*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: #0f172a;
  color: #f8fafc;
  overflow: hidden;
}

.app-layout {
  display: flex;
  width: 100vw;
  height: 100vh;
}

/* PANELS LATERALES */
.sidebar-left {
  width: 280px;
  min-width: 280px;
  background-color: #1e293b;
  border-right: 1px solid #334155;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-right {
  width: 320px;
  min-width: 320px;
  background-color: #1e293b;
  border-left: 1px solid #334155;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 16px;
  background-color: #0f172a;
  border-bottom: 1px solid #334155;
}

.sidebar-header h2 {
  font-size: 13px;
  letter-spacing: 1px;
  color: #94a3b8;
}

.panel-section {
  padding: 16px;
  border-bottom: 1px solid #334155;
}

.panel-section h3 {
  font-size: 11px;
  letter-spacing: 0.5px;
  color: #94a3b8;
  margin-bottom: 12px;
  text-transform: uppercase;
}

/* BOTONES DE ELEMENTOS */
.btn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-grid button, .btn-full {
  background-color: #334155;
  color: #ffffff;
  border: 1px solid #475569;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
}

.btn-grid button:hover, .btn-full:hover {
  background-color: #475569;
}

.btn-full {
  grid-column: span 2;
}

/* LIENZO */
.canvas-container {
  flex: 1;
  background-color: #26334d;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  overflow-y: auto;
}

.viewport-toolbar {
  background-color: #0f172a;
  padding: 6px;
  border-radius: 20px;
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
}

.btn-view {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 6px 14px;
  font-size: 11px;
  border-radius: 14px;
  cursor: pointer;
}

.btn-view.active {
  background-color: #0284c7;
  color: #ffffff;
  font-weight: bold;
}

.canvas-board {
  background-color: #ffffff;
  min-height: 600px;
  color: #000000;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  transition: width 0.2s ease;
}

/* NODOS DENTRO DEL CANVAS */
.node-wrapper {
  position: relative;
  border: 1px dashed transparent;
  cursor: pointer;
}

.node-wrapper:hover {
  border-color: #38bdf8;
}

.node-wrapper.selected {
  border: 2px solid #0284c7;
}

.node-actions {
  position: absolute;
  top: -12px;
  right: 4px;
  display: none;
  gap: 4px;
  z-index: 100;
}

.node-wrapper:hover .node-actions,
.node-wrapper.selected .node-actions {
  display: flex;
}

.btn-act {
  background: #ef4444;
  color: #ffffff;
  border: none;
  font-size: 10px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 2px;
  cursor: pointer;
}

.btn-act-dup {
  background: #0284c7;
}

/* CONTROLES DE PROPIEDADES */
.prop-group {
  margin-bottom: 16px;
}

.prop-group-title {
  font-size: 11px;
  font-weight: bold;
  color: #38bdf8;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.control {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.control label {
  font-size: 11px;
  color: #94a3b8;
}

.control input, .control select {
  background-color: #0f172a;
  border: 1px solid #334155;
  color: #ffffff;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.control-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.color-wrapper {
  display: flex;
  gap: 8px;
}

.color-wrapper input[type="color"] {
  width: 40px;
  height: 30px;
  padding: 0;
  cursor: pointer;
}

.btn-clear {
  background-color: #334155;
  border: 1px solid #475569;
  color: #ffffff;
  font-size: 11px;
  padding: 0 8px;
  border-radius: 4px;
  cursor: pointer;
}

.trbl-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.trbl-box {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.trbl-box label {
  font-size: 9px;
}

.trbl-box input {
  width: 100%;
  text-align: center;
}

.btn-parent {
  width: 100%;
  background-color: #0284c7;
  color: white;
  border: none;
  padding: 8px;
  font-size: 11px;
  font-weight: bold;
  border-radius: 4px;
  cursor: pointer;
  margin-bottom: 14px;
}

.empty-msg {
  font-size: 12px;
  color: #64748b;
  font-style: italic;
}

/* PANEL CÓDIGO DERECHO */
.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background-color: #0f172a;
  border-bottom: 1px solid #334155;
}

.code-header span {
  font-size: 12px;
  font-weight: bold;
  color: #94a3b8;
}

.btn-copy {
  background-color: #22c55e;
  color: #ffffff;
  border: none;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: bold;
  border-radius: 4px;
  cursor: pointer;
}

#code-output {
  width: 100%;
  height: 100%;
  flex: 1;
  background-color: #090d16;
  color: #38bdf8;
  border: none;
  padding: 16px;
  font-family: monospace;
  font-size: 12px;
  line-height: 1.5;
  resize: none;
  outline: none;
}