/* ==========================================================================
   ESP32 Lab - Diseño Moderno y Confortable (Modo Oscuro)
   ========================================================================== */

:root {
  color-scheme: dark;

  /* Paleta moderna basada en el diseño de referencia */
  --bg-app: #080c16;
  --bg-surface: #0f1422;
  --bg-surface-elevated: #161c2d;
  --bg-surface-hover: #1e263d;
  --bg-canvas: #0b0f19;

  /* Bordes limpios */
  --border-color: #1c2438;
  --border-subtle: #161c2b;
  --border-focus: #7c3aed;

  /* Tipografía */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Acentos Púrpura Vibrante */
  --accent-purple: #7c3aed;
  --accent-purple-light: #9333ea;
  --accent-purple-glow: rgba(124, 58, 237, 0.45);
  --accent-purple-bg: rgba(124, 58, 237, 0.16);

  /* Estado */
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --cyan: #06b6d4;

  --sidebar-width: 240px;
  --editor-width: 460px;
  --code-editor-height: 58%;

  scrollbar-color: #242e47 transparent;
  scrollbar-width: thin;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg-app: #f4f6fa;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --bg-surface-hover: #e2e8f0;
  --bg-canvas: #f8fafc;
  --border-color: #cbd5e1;
  --border-subtle: #e2e8f0;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent-purple: #7c3aed;
  --accent-purple-light: #9333ea;
  --accent-purple-bg: rgba(124, 58, 237, 0.12);
  scrollbar-color: #cbd5e1 transparent;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* --------------------------------------------------------------------------
   1. BARRA SUPERIOR (HEADER)
   -------------------------------------------------------------------------- */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.navbar {
  height: 56px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1.25rem;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-chip-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: -0.2px;
}

.brand-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.brand-quick-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: 0.75rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--border-color);
}

.nav-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-icon-btn:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--accent-purple);
}

/* Botones Centrales de Control */
.navbar-center-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.btn-play-run {
  background: var(--accent-purple);
  color: #ffffff;
  border: none;
  border-radius: 9999px;
  padding: 0.45rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  box-shadow: 0 0 16px var(--accent-purple-glow);
  transition: all 0.18s ease;
}

.btn-play-run:hover:not(:disabled) {
  background: #6d28d9;
  box-shadow: 0 0 22px rgba(124, 58, 237, 0.7);
  transform: translateY(-1px);
}

.btn-play-run:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-control-pill {
  background: #181f33;
  color: #cbd5e1;
  border: 1px solid #232d47;
  border-radius: 9999px;
  padding: 0.45rem 1.05rem;
  font-size: 0.83rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-control-pill:hover:not(:disabled) {
  background: #202a45;
  color: #ffffff;
  border-color: #3b82f6;
}

.btn-control-pill:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Acciones Derechas */
.navbar-right-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.board-selector-pill {
  background: #181f33;
  color: #cbd5e1;
  border: 1px solid #232d47;
  border-radius: 9999px;
  padding: 0.45rem 1rem;
  font-size: 0.8rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.board-selector-pill .chevron {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.user-avatar-pill {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-purple);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.4);
}

/* --------------------------------------------------------------------------
   2. WORKSPACE LAYOUT (3 COLUMNAS FLEXIBLES Y REDIMENSIONABLES)
   -------------------------------------------------------------------------- */
.workspace-layout {
  display: flex;
  flex-direction: row;
  flex: 1;
  height: calc(100vh - 64px - 38px);
  overflow: hidden;
  position: relative;
  width: 100%;
}

/* --------------------------------------------------------------------------
   COLUMNA IZQUIERDA: MENÚ DE COMPONENTES
   -------------------------------------------------------------------------- */
.sidebar-components {
  width: var(--sidebar-width, 240px);
  min-width: 0;
  max-width: 550px;
  flex-shrink: 0;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0.6rem 0.5rem;
  gap: 0.5rem;
  transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease, padding 0.22s ease;
  position: relative;
  z-index: 10;
}

.sidebar-components.collapsed {
  width: 0 !important;
  min-width: 0 !important;
  padding: 0 !important;
  border-right-width: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.search-box {
  background-color: #141a29;
  border: 1px solid #1f293d;
  border-radius: 10px;
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  gap: 0.5rem;
}

.search-icon {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.82rem;
  width: 100%;
}

.search-box input::placeholder {
  color: #64748b;
}

.category-menu {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow-y: auto;
}

.cat-item {
  display: flex;
  align-items: center;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
  text-align: left;
}

.cat-item:hover {
  background-color: var(--bg-surface-elevated);
  color: #ffffff;
}

.cat-item.active {
  background-color: #1a2236;
  color: #ffffff;
}

.cat-icon {
  margin-right: 0.65rem;
  font-size: 0.95rem;
}

.cat-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cat-count-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background-color: #181f33;
  color: #94a3b8;
  border: 1px solid #232d47;
  margin-right: 0.5rem;
}

.cat-arrow {
  font-size: 0.95rem;
  color: #64748b;
}

.component-items-drawer {
  position: absolute;
  top: 56px;
  left: var(--sidebar-width, 240px);
  width: 250px;
  height: calc(100vh - 56px - 38px);
  background-color: #0f1422;
  border-right: 1px solid var(--border-color);
  box-shadow: 6px 0 24px rgba(0, 0, 0, 0.6);
  z-index: 100;
  padding: 0.75rem;
  overflow-y: auto;
  display: none;
  flex-direction: column;
  gap: 0.4rem;
  transition: left 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.component-items-drawer.open {
  display: flex;
}

.btn-delete-node {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #1e263d;
  border: 1px solid #334155;
  color: #94a3b8;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease;
  z-index: 30;
  padding: 0;
}

.canvas-item:hover .btn-delete-node {
  opacity: 1;
}

.btn-delete-node:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
}

.canvas-resistor-item {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.canvas-resistor-item wokwi-resistor {
  display: block;
}

.canvas-resistor-item .component-pads-row {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  margin: 0;
  padding: 0;
  pointer-events: none;
}

.canvas-resistor-item .component-pads-row .pin-pad {
  pointer-events: auto;
}

.canvas-resistor-item .component-pads-row .pin-pad span,
.canvas-led-item .component-pads-row .pin-pad span,
.canvas-btn-item .component-pads-row .pin-pad span {
  display: none;
}

.canvas-led-item {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.canvas-led-item .component-pads-row {
  margin-top: -12px;
  gap: 14px;
}

.canvas-btn-item {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.canvas-btn-item .component-pads-row {
  margin-top: -8px;
  gap: 22px;
}

.spawn-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.spawn-chip:hover {
  border-color: var(--accent-purple);
  background-color: var(--bg-surface-elevated);
  transform: translateX(2px);
}

.spawn-chip-number {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent-purple-light);
  background: var(--accent-purple-bg);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

/* --------------------------------------------------------------------------
   COLUMNA CENTRAL: LIENZO LIBRE DE HARDWARE
   -------------------------------------------------------------------------- */
.canvas-workspace {
  flex: 1;
  min-width: 0;
  position: relative;
  background-color: var(--bg-canvas);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Barras de herramientas flotantes */
.canvas-floating-toolbar {
  position: absolute;
  top: 14px;
  z-index: 50;
  background-color: #111625;
  border: 1px solid #1c2438;
  border-radius: 12px;
  padding: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.toolbar-top-left { left: 16px; }
.toolbar-top-right { right: 16px; }

.c-tool-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 0.95rem;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.c-tool-btn:hover {
  background-color: #1a2236;
  color: #ffffff;
}

.c-tool-btn.active {
  background-color: var(--accent-purple);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.4);
}

/* Escenario / Lienzo */
.canvas-stage {
  flex: 1;
  position: relative;
  overflow: hidden;
  user-select: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1.2px, transparent 1.2px);
  background-size: 22px 22px;
  cursor: grab;
  width: 100%;
  height: 100%;
}

.canvas-world {
  position: absolute;
  top: 0;
  left: 0;
  width: 6000px;
  height: 5000px;
  transform-origin: 0 0;
  pointer-events: auto;
}

.canvas-stage.is-panning {
  cursor: grabbing !important;
}

.canvas-bounds-spacer {
  position: absolute;
  top: 0;
  left: 0;
  width: 5000px;
  height: 4000px;
  pointer-events: none;
  z-index: 1;
}

/* Capa SVG para Cables */
.wires-svg-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 5000px;
  height: 4000px;
  pointer-events: none;
  z-index: 10;
}

.circuit-wire {
  fill: none;
  stroke-width: 3.8px;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: stroke;
  cursor: pointer;
  transition: stroke-width 0.15s ease, filter 0.15s ease;
}

.circuit-wire:hover {
  stroke-width: 5.5px;
  filter: drop-shadow(0 0 8px rgba(124, 58, 237, 0.7));
}

.circuit-wire.selected {
  stroke-width: 4.5px;
  filter: drop-shadow(0 0 10px rgba(124, 58, 237, 0.9));
}

.wire-handle {
  fill: #7c3aed;
  stroke: #ffffff;
  stroke-width: 2px;
  cursor: move;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.8));
  pointer-events: all;
  transition: transform 0.1s ease;
}

.wire-handle:hover {
  transform: scale(1.3);
}

.wire-handle.is-dragging {
  fill: #f59e0b;
  transform: scale(1.5);
}

.temp-wire-live {
  fill: none;
  stroke-width: 3.5px;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   COMPONENTES DIRECTOS EN EL LIENZO
   -------------------------------------------------------------------------- */
.canvas-item {
  position: absolute;
  z-index: 20;
  cursor: grab;
  user-select: none;
}

.canvas-item.is-dragging {
  z-index: 40;
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.7));
}

/* Etiquetas flotantes en componentes (#1 Botón Pulsador, #47 LED Azul) */
.c-badge-tag {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #111625;
  border: 1px solid #1e263d;
  border-radius: 9999px;
  padding: 2px 8px 2px 3px;
  font-size: 11px;
  font-weight: 500;
  color: #f1f5f9;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.c-badge-num {
  background: var(--accent-purple);
  color: #ffffff;
  font-weight: 700;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 9999px;
}

.resistor-val-label {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 600;
  color: #f8fafc;
  pointer-events: none;
  white-space: nowrap;
  z-index: 10;
}

/* --------------------------------------------------------------------------
   CHASIS Y REGLAS DE PINES ESP32
   -------------------------------------------------------------------------- */
.esp32-board-carrier {
  display: flex;
  align-items: center;
  background: #0a0d17;
  border: 1.5px solid #1a2238;
  border-radius: 14px;
  padding: 6px 8px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.85);
  cursor: grab;
  z-index: 30;
}

.esp32-board-carrier.is-dragging {
  cursor: grabbing;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.95), 0 0 0 2px var(--accent-purple);
}

.esp-pcb-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.6));
  pointer-events: none;
}

.esp-header-rail {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  min-height: 380px;
  padding: 4px 2px;
  box-sizing: border-box;
}

.rail-left { margin-right: 6px; }
.rail-right { margin-left: 6px; }

.pin-pad {
  display: flex;
  align-items: center;
  height: 24px;
  padding: 0 3px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.12s ease;
  position: relative;
}

.rail-left .pin-pad {
  justify-content: flex-end;
  gap: 7px;
}

.rail-right .pin-pad {
  justify-content: flex-start;
  gap: 7px;
}

.pin-pad .pin-name {
  font-family: 'Fira Code', Consolas, monospace;
  font-size: 0.68rem;
  font-weight: 600;
  color: #94a3b8;
  width: 28px;
  pointer-events: none;
}

.rail-left .pin-pad .pin-name { text-align: right; }
.rail-right .pin-pad .pin-name { text-align: left; }

.pad-ring {
  width: 13px;
  height: 13px;
  min-width: 13px;
  min-height: 13px;
  border-radius: 50%;
  background: #f97316;
  border: 2px solid #c2410c;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease;
}

.pad-ring::after {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #030712;
}

/* Colores de Pines */
.pad-ring.io-gpio { background: #f97316; border-color: #ea580c; }
.pad-ring.io-adc { background: #06b6d4; border-color: #0891b2; }
.pad-ring.io-touch { background: #a855f7; border-color: #9333ea; }
.pad-ring.io-power, .pad-ring.vcc { background: #ef4444; border-color: #dc2626; }
.pad-ring.gnd { background: #475569; border-color: #334155; }

.pin-pad:hover {
  background-color: #1e293b;
}

.pin-pad:hover .pin-name {
  color: #ffffff;
}

.pin-pad:hover .pad-ring {
  border-color: #38bdf8 !important;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.4), 0 0 10px #38bdf8 !important;
}

.pin-pad.wire-active {
  background-color: rgba(124, 58, 237, 0.3) !important;
}

.pin-pad.wire-active .pad-ring {
  background: var(--accent-purple) !important;
  border-color: #ffffff !important;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.5), 0 0 14px var(--accent-purple) !important;
}

.component-pads-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 4px;
  padding: 4px 6px;
}

.component-pads-row .pin-pad {
  height: 22px;
  gap: 4px;
}

.component-pads-row .pin-pad span {
  font-family: monospace;
  font-size: 0.68rem;
  color: #94a3b8;
}

/* --------------------------------------------------------------------------
   COLUMNA DERECHA: CÓDIGO + MONITOR SERIAL
   -------------------------------------------------------------------------- */
.sidebar-code {
  width: var(--editor-width, 460px);
  min-width: 0;
  max-width: 850px;
  flex-shrink: 0;
  background-color: #090d16;
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 10px;
  gap: 8px;
  overflow: hidden;
  transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease, padding 0.22s ease;
  position: relative;
  z-index: 10;
}

.sidebar-code.collapsed {
  width: 0 !important;
  min-width: 0 !important;
  padding: 0 !important;
  border-left-width: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.code-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: var(--code-editor-height, 58%);
  min-height: 120px;
  max-height: calc(100% - 130px);
  flex-shrink: 0;
}

.code-card-header {
  height: 44px;
  padding: 0 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  background-color: #121828;
}

.code-view-pill {
  background-color: var(--accent-purple);
  color: #ffffff;
  padding: 0.35rem 0.95rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.35);
}

.code-preset-select {
  background-color: #161c2d;
  color: #cbd5e1;
  border: 1px solid #1e263d;
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  font-size: 0.76rem;
  outline: none;
}

.project-files-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #0e1322;
  border-bottom: 1px solid var(--border-color);
  padding: 0.25rem 0.75rem;
}

.project-tabs-list {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.project-file-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  font-family: 'Fira Code', monospace;
  font-size: 0.76rem;
  color: #94a3b8;
  border-radius: 6px;
  cursor: pointer;
}

.project-file-tab.active {
  background-color: #1a2236;
  color: #ffffff;
  font-weight: 600;
}

.tab-dot-status {
  color: #38bdf8;
  margin-left: 2px;
}

.btn-new-file {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 2px 4px;
}

.code-view-container {
  flex: 1;
  display: flex;
  background-color: #0a0e1a;
  overflow: hidden;
}

.line-numbers {
  width: 36px;
  padding: 0.75rem 0.5rem;
  text-align: right;
  font-family: 'Fira Code', monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  color: #475569;
  user-select: none;
  border-right: 1px solid #161c2d;
  background-color: #080b14;
}

#codeEditor {
  flex: 1;
  height: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: #f8fafc;
  font-family: 'Fira Code', Consolas, monospace;
  font-size: 0.84rem;
  line-height: 1.5;
  padding: 0.75rem 0.85rem;
  resize: none;
  tab-size: 2;
  white-space: pre;
}

/* Monitor Serial */
.terminal-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.terminal-card-header {
  height: 40px;
  padding: 0 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  background-color: #121828;
}

.terminal-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: #f8fafc;
}

.terminal-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.baud-select {
  background-color: #161c2d;
  color: #cbd5e1;
  border: 1px solid #1e263d;
  border-radius: 6px;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  outline: none;
}

.btn-icon-subtle {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}

.btn-icon-subtle:hover {
  color: #ffffff;
}

.terminal-body {
  flex: 1;
  background-color: #080c16;
  padding: 0.65rem 0.85rem;
  overflow-y: auto;
  font-family: 'Fira Code', monospace;
  font-size: 0.78rem;
  line-height: 1.55;
  color: #cbd5e1;
}

.log-entry.log-sys { color: #cbd5e1; }
.log-entry.log-boot { color: #a855f7; }
.log-entry.log-err { color: #f87171; font-weight: 600; }

.terminal-send-row {
  height: 42px;
  background-color: #121828;
  border-top: 1px solid var(--border-color);
  display: flex;
  padding: 0.35rem 0.65rem;
  gap: 0.5rem;
  align-items: center;
}

#terminalInput {
  flex: 1;
  background-color: #161c2d;
  border: 1px solid #1e263d;
  border-radius: 8px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  color: #ffffff;
  outline: none;
}

#terminalInput:focus {
  border-color: var(--accent-purple);
}

.btn-send-purple {
  background-color: var(--accent-purple);
  color: white;
  border: none;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s ease;
}

.btn-send-purple:hover {
  background-color: #6d28d9;
}

/* --------------------------------------------------------------------------
   3. BARRA INFERIOR DE ESTADO
   -------------------------------------------------------------------------- */
.bottom-bar {
  height: 38px;
  background-color: #080c16;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1.25rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  z-index: 60;
}

.status-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.live-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #64748b;
  transition: all 0.3s ease;
}

.live-status-dot.active {
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.9); }
}

.status-center,
.status-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.status-stat-pill {
  background: #121828;
  border: 1px solid #1e263d;
  border-radius: 9999px;
  padding: 0.2rem 0.75rem;
  font-size: 0.72rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.status-stat-pill .pill-ico {
  font-size: 0.8rem;
}

/* Popover rápido de cables */
.wire-quick-popover {
  position: absolute;
  background: #111625;
  border: 1px solid #1e263d;
  border-radius: 9999px;
  padding: 0.35rem 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  z-index: 999;
}

.popover-label {
  font-size: 0.72rem;
  color: #94a3b8;
  font-weight: 500;
}

.popover-colors {
  display: flex;
  gap: 0.35rem;
}

.wire-pop-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease;
}

.wire-pop-dot:hover {
  transform: scale(1.3);
  border-color: #ffffff;
}

.btn-pop-delete {
  background: transparent;
  border: none;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0 0.2rem;
  color: #94a3b8;
}

.btn-pop-delete:hover {
  color: #ef4444;
}

/* Modal de Configuración */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 16, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.config-modal-card {
  width: 90%;
  max-width: 480px;
  background: #111827;
  border: 1px solid #374151;
  border-radius: 14px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.config-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: #162032;
  border-bottom: 1px solid #1f293d;
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.modal-icon {
  font-size: 1.5rem;
}

.modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: #f1f5f9;
}

.modal-subtitle {
  font-size: 0.75rem;
  color: #94a3b8;
  font-family: monospace;
}

.btn-modal-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.1rem;
  cursor: pointer;
}

.config-modal-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 65vh;
  overflow-y: auto;
}

.config-modal-footer {
  padding: 0.85rem 1.25rem;
  background: #162032;
  border-top: 1px solid #1f293d;
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
}

.btn {
  padding: 0.45rem 1rem;
  border-radius: 8px;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
}

.btn-secondary { background: #1e293b; color: #cbd5e1; }
.btn-primary { background: var(--accent-purple); color: #fff; }

/* ==========================================================================
   CATÁLOGO COMPLETO DE 100 COMPONENTES - TARJETAS Y MÓDULOS DE HARDWARE
   ========================================================================== */
.hw-module-card {
  background: linear-gradient(145deg, #0d1322, #070a12);
  border: 1.5px solid #1e293b;
  border-radius: 10px;
  padding: 8px 10px;
  min-width: 150px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  user-select: none;
  cursor: grab;
  transition: transform 0.1s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-sizing: border-box;
}

.hw-module-card:hover {
  border-color: #38bdf8;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.85), 0 0 14px rgba(56, 189, 248, 0.25);
}

.hw-module-card.is-dragging {
  cursor: grabbing;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.95), 0 0 0 2px var(--accent-purple);
}

.hw-module-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  border-bottom: 1px solid #1e293b;
  padding-bottom: 4px;
}

.hw-module-title-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
}

.hw-module-icon {
  font-size: 0.95rem;
}

.hw-module-num {
  font-size: 0.62rem;
  font-weight: 700;
  color: #a855f7;
  background: rgba(168, 85, 247, 0.15);
  padding: 1px 4px;
  border-radius: 4px;
  font-family: monospace;
}

.hw-module-name {
  font-size: 0.72rem;
  font-weight: 700;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.hw-module-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-code-node {
  background: rgba(14, 165, 233, 0.15);
  border: 1px solid rgba(14, 165, 233, 0.35);
  color: #38bdf8;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-code-node:hover {
  background: #0284c7;
  color: #ffffff;
}

.hw-module-badges {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.6rem;
  font-family: 'Fira Code', monospace;
  margin-top: 1px;
}

.badge-volt {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 700;
}

.badge-proto {
  background: rgba(14, 165, 233, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.3);
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 700;
}

.hw-module-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 2px;
  gap: 4px;
  min-height: 40px;
}

.hw-module-chip {
  background: #030712;
  border: 1px solid #334155;
  border-radius: 4px;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  color: #94a3b8;
  font-family: monospace;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.8);
  width: 100%;
  box-sizing: border-box;
}

.hw-module-chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
  flex-shrink: 0;
}

.hw-module-screen {
  background: #020617;
  border: 1px solid #1e293b;
  border-radius: 4px;
  padding: 6px;
  font-family: monospace;
  font-size: 0.68rem;
  color: #38bdf8;
  text-align: center;
  min-width: 110px;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.9);
  width: 100%;
  box-sizing: border-box;
}

/* ==========================================================================
   PANTALLAS Y DISPLAYS ELECTRÓNICOS REALISTAS (11-21)
   ========================================================================== */
.hw-screen-frame {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.screen-subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-size: 0.62rem;
  font-family: 'Fira Code', monospace;
  padding: 2px 4px;
  box-sizing: border-box;
}

.screen-chip-tag {
  color: #38bdf8;
  font-weight: 700;
}

.screen-res-tag {
  color: #94a3b8;
}

/* Wokwi Element Display Styles */
wokwi-lcd1602, wokwi-lcd2004 {
  display: block;
  max-width: 100%;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.7));
}

wokwi-ssd1306 {
  display: block;
  max-width: 100%;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.7));
}

wokwi-ili9341 {
  display: block;
  max-width: 100%;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.7));
}

wokwi-7segment {
  display: block;
  max-width: 100%;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.7));
}

/* OLED SSD1306 (13) & SH1106 (14) */
.oled-frame {
  min-width: 175px;
}

.oled-bezel {
  background: #020617;
  border: 2px solid #0f172a;
  border-radius: 6px;
  padding: 6px;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.95), 0 2px 6px rgba(0, 0, 0, 0.6);
  width: 100%;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
}

.oled-glass {
  background: #000000;
  border: 1px solid #1e293b;
  border-radius: 3px;
  overflow: hidden;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.9);
}

.oled-canvas {
  display: block;
  width: 160px;
  height: 80px;
  background: #000000;
  image-rendering: pixelated;
}

/* LCD 1602 (15) & LCD 2004 (16) */
.lcd-frame {
  min-width: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lcd-bezel {
  background: #0b1329;
  border: 3px solid #1e293b;
  border-radius: 8px;
  padding: 8px;
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.9), 0 4px 10px rgba(0, 0, 0, 0.5);
  width: 100%;
  box-sizing: border-box;
}

.lcd-screen-inner {
  border-radius: 4px;
  padding: 6px 8px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.74rem;
  letter-spacing: 1.2px;
  line-height: 1.45;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.85);
  user-select: none;
}

.lcd-blue {
  background: #002e8a;
  color: #e0f2fe;
  text-shadow: 0 0 6px rgba(56, 189, 248, 0.85), 0 0 2px #ffffff;
}

.lcd-line {
  white-space: pre;
  font-weight: 700;
  overflow: hidden;
}

/* TFT ILI9341 (11) & ST7789 (12) */
.tft-frame {
  min-width: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tft-bezel {
  background: #881337;
  border: 2px solid #9f1239;
  border-radius: 8px;
  padding: 8px 8px 6px 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7);
  box-sizing: border-box;
  display: flex;
  justify-content: center;
}

.tft-canvas {
  background: #000000;
  border: 1.5px solid #000000;
  border-radius: 4px;
  display: block;
  width: 200px;
  height: 150px;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.9);
}

.st7789-frame {
  min-width: 190px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.st7789-bezel {
  background: #0f172a;
  border: 2.5px solid #334155;
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.8), inset 0 0 10px rgba(0, 0, 0, 0.95);
  box-sizing: border-box;
  display: flex;
  justify-content: center;
}

.st7789-canvas {
  background: #000000;
  border-radius: 6px;
  display: block;
  width: 170px;
  height: 170px;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.9);
}

/* Display 7 Segmentos (17) & TM1637 (18) */
.sevenseg-frame, .tm1637-frame {
  min-width: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sevenseg-bezel, .tm1637-bezel {
  background: #050811;
  border: 2px solid #1e293b;
  border-radius: 6px;
  padding: 8px;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.95);
  display: flex;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
}

.sevenseg-digits-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.seg-digit-svg {
  width: 30px;
  height: 50px;
}

.seg-colon-svg {
  width: 10px;
  height: 50px;
}

/* MAX7219 Matriz LED 8x8 (19) */
.matrix-frame {
  min-width: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.matrix-bezel {
  background: #090d16;
  border: 2.5px solid #1e293b;
  border-radius: 8px;
  padding: 8px;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.95), 0 4px 12px rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
}

.matrix-grid-8x8 {
  display: grid;
  grid-template-columns: repeat(8, 14px);
  grid-template-rows: repeat(8, 14px);
  gap: 4px;
}

.matrix-led-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #18181b;
  border: 1px solid #27272a;
  transition: all 0.1s ease;
  cursor: pointer;
}

.matrix-led-dot.active {
  background: #ef4444;
  border-color: #f87171;
  box-shadow: 0 0 10px #ef4444, inset 0 0 4px #ffffff;
}

/* E-Ink / E-Paper (20) */
.eink-frame {
  min-width: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.eink-bezel {
  background: #cbd5e1;
  border: 2px solid #94a3b8;
  border-radius: 6px;
  padding: 6px;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.2), 0 3px 8px rgba(0, 0, 0, 0.5);
  box-sizing: border-box;
}

.eink-paper {
  background: #f8fafc;
  color: #0f172a;
  width: 190px;
  min-height: 90px;
  padding: 8px;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  border: 1px solid #94a3b8;
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.08);
}

.eink-title {
  font-size: 0.7rem;
  font-weight: 700;
  border-bottom: 1px solid #334155;
  padding-bottom: 2px;
}

.eink-temp {
  font-size: 1.25rem;
  font-weight: 900;
  text-align: center;
  margin: 4px 0;
}

.eink-details, .eink-battery {
  font-size: 0.62rem;
  color: #334155;
}

/* TFT Touch XPT2046 (21) */
.xpt-frame {
  min-width: 210px;
}

.xpt-bezel {
  position: relative;
  background: #1e1b4b;
  border: 2px solid #4338ca;
  border-radius: 8px;
  padding: 6px;
  display: flex;
  justify-content: center;
  cursor: crosshair;
}

.xpt-canvas {
  background: #000000;
  border-radius: 4px;
  display: block;
  width: 180px;
  height: 135px;
}

.xpt-touch-cursor {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid #22c55e;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 8px #22c55e;
}

.hw-module-slider-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hw-module-slider-lbl {
  font-size: 0.65rem;
  color: #94a3b8;
  display: flex;
  justify-content: space-between;
}

.hw-module-slider {
  width: 100%;
  accent-color: #38bdf8;
  cursor: pointer;
}

.hw-module-trigger-btn {
  width: 100%;
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.hw-module-trigger-btn:hover {
  background: var(--accent-purple);
  color: #ffffff;
  border-color: var(--accent-purple-light);
}

.modal-code-preview-wrap {
  margin-top: 12px;
  background: #090d16;
  border: 1px solid #1e293b;
  border-radius: 8px;
  overflow: hidden;
}

.modal-code-preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
  font-size: 0.72rem;
  color: #94a3b8;
}

.modal-code-pre {
  margin: 0;
  padding: 10px;
  font-family: 'Fira Code', monospace;
  font-size: 0.75rem;
  color: #e2e8f0;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre;
  line-height: 1.4;
  background: #070a12;
}

.btn-code-insert {
  background: #059669;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-code-insert:hover {
  background: #10b981;
}

.btn-code-copy {
  background: #334155;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 0.7rem;
  cursor: pointer;
}

.btn-code-copy:hover {
  background: #475569;
}

/* ==========================================================================
   SIMULACIÓN ELÉCTRICA: COMPONENTES QUEMADOS, HUMO Y CHISPAS
   ========================================================================== */

/* Estado de componente quemado / dañado */
.canvas-item.is-burned, .hw-module-card.is-burned {
  z-index: 50 !important;
  background: radial-gradient(circle at center, #261212 0%, #110505 100%) !important;
  border-color: #ef4444 !important;
  box-shadow: 0 0 18px 2px rgba(239, 68, 68, 0.75), inset 0 0 15px rgba(0, 0, 0, 0.9) !important;
  animation: burnShake 0.45s ease-in-out;
}

.canvas-item.is-burned wokwi-led,
.canvas-item.is-burned wokwi-rgb-led,
.canvas-item.is-burned .hw-module-title-wrap {
  filter: grayscale(0.8) brightness(0.55) sepia(0.4) contrast(1.2);
}

@keyframes burnShake {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  20% { transform: translate(-3px, 2px) rotate(-1deg); }
  40% { transform: translate(3px, -2px) rotate(1deg); }
  60% { transform: translate(-2px, -1px) rotate(-0.5deg); }
  80% { transform: translate(2px, 1px) rotate(0.5deg); }
}

/* Badge superior indicador de componente quemado */
.burned-badge {
  position: absolute;
  top: -12px;
  right: 6px;
  background: linear-gradient(135deg, #ef4444, #991b1b);
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 12px;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.95);
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 100;
  cursor: pointer;
  animation: pulseBurned 1.4s infinite;
  user-select: none;
}

@keyframes pulseBurned {
  0%, 100% { transform: scale(1); box-shadow: 0 0 8px rgba(239, 68, 68, 0.8); }
  50% { transform: scale(1.06); box-shadow: 0 0 18px rgba(239, 68, 68, 1); }
}

/* Botón interactivo para reemplazar / reparar el componente dañado */
.btn-repair-component {
  position: absolute;
  bottom: -13px;
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  border: 1.5px solid #38bdf8;
  color: #38bdf8;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.85);
  cursor: pointer;
  z-index: 101;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-repair-component:hover {
  background: #38bdf8;
  color: #020617;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.8);
}

/* Contenedor flotante de animación de humo y chispas */
.smoke-puff-container {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  width: 70px;
  height: 70px;
  pointer-events: none;
  z-index: 200;
}

.smoke-puff {
  position: absolute;
  width: 26px;
  height: 26px;
  background: radial-gradient(circle, rgba(180, 180, 180, 0.85) 0%, rgba(90, 90, 90, 0.5) 60%, rgba(30, 30, 30, 0) 100%);
  border-radius: 50%;
  animation: smokeRise 2.4s cubic-bezier(0.2, 0.8, 0.4, 1) forwards;
}

.smoke-puff:nth-child(1) { left: 18px; animation-delay: 0s; }
.smoke-puff:nth-child(2) { left: 30px; animation-delay: 0.18s; width: 34px; height: 34px; }
.smoke-puff:nth-child(3) { left: 10px; animation-delay: 0.35s; width: 30px; height: 30px; }

@keyframes smokeRise {
  0% {
    transform: translateY(18px) scale(0.3);
    opacity: 0.95;
  }
  50% {
    transform: translateY(-28px) scale(1.4);
    opacity: 0.7;
  }
  100% {
    transform: translateY(-75px) scale(2.4);
    opacity: 0;
  }
}

.spark-particle {
  position: absolute;
  width: 5px;
  height: 5px;
  background: #fbbf24;
  border-radius: 50%;
  box-shadow: 0 0 8px #f59e0b, 0 0 12px #ef4444;
  animation: sparkShoot 0.75s ease-out forwards;
}

@keyframes sparkShoot {
  0% { transform: translate(0, 0) scale(1.2); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; }
}

/* ==========================================================================
   Nuevas Características: WebSerial, Gestor de Librerías, ESP32-CAM y RC
   ========================================================================== */

/* Botones nuevos: Gestor de Librerías y USB Real */
.btn-lib-pill {
  background: #181f33;
  color: #cbd5e1;
  border: 1px solid #283556;
  border-radius: 9999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-lib-pill:hover {
  background: #242f4c;
  color: #ffffff;
  border-color: var(--accent-purple);
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.4);
}

.btn-usb-pill {
  background: #0e2038;
  color: #38bdf8;
  border: 1px solid #1e3a5f;
  border-radius: 9999px;
  padding: 0.3rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-usb-pill:hover {
  background: #143258;
  color: #7dd3fc;
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

.btn-audio-pill {
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.btn-audio-pill:hover {
  border-color: #38bdf8;
  background: #1e263d;
}

.btn-audio-pill.muted {
  color: #94a3b8;
  opacity: 0.75;
}

/* Modal del Gestor de Librerías */
.lib-manager-card {
  width: 760px;
  max-width: 95vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.lib-search-bar-wrap {
  display: flex;
  align-items: center;
  background: #141a29;
  border: 1px solid #1f293d;
  border-radius: 10px;
  padding: 0.55rem 0.85rem;
  margin: 0.75rem 1rem 0.5rem 1rem;
  gap: 0.5rem;
}

.lib-search-bar-wrap input {
  background: transparent;
  border: none;
  outline: none;
  color: #f8fafc;
  font-size: 0.88rem;
  width: 100%;
}

.lib-category-chips {
  display: flex;
  gap: 0.4rem;
  padding: 0 1rem 0.5rem 1rem;
  overflow-x: auto;
}

.lib-filter-chip {
  background: #161c2d;
  border: 1px solid #232d47;
  color: #94a3b8;
  padding: 0.3rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.lib-filter-chip:hover {
  color: #f8fafc;
  border-color: #3b82f6;
}

.lib-filter-chip.active {
  background: var(--accent-purple);
  color: #ffffff;
  border-color: var(--accent-purple-light);
}

.lib-list-container {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 420px;
}

.lib-item-card {
  background: #111625;
  border: 1px solid #1e263d;
  border-radius: 12px;
  padding: 0.8rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  transition: all 0.15s ease;
}

.lib-item-card:hover {
  border-color: #3b82f6;
  background: #151c30;
}

.lib-info {
  flex: 1;
}

.lib-header-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.lib-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f8fafc;
}

.lib-version {
  font-size: 0.72rem;
  font-weight: 600;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.lib-author {
  font-size: 0.75rem;
  color: #64748b;
}

.lib-desc {
  font-size: 0.8rem;
  color: #94a3b8;
  line-height: 1.35;
  margin-bottom: 0.4rem;
}

.lib-tags {
  display: flex;
  gap: 0.35rem;
}

.lib-tag {
  font-size: 0.68rem;
  color: #a855f7;
  background: rgba(168, 85, 247, 0.12);
  padding: 0.08rem 0.4rem;
  border-radius: 4px;
}

.lib-actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 130px;
}

.btn-lib-install {
  background: #10b981;
  color: #ffffff;
  border: none;
  padding: 0.45rem 0.8rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-lib-install:hover {
  background: #059669;
}

.btn-lib-install.installed {
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid #334155;
  cursor: default;
}

.btn-lib-example {
  background: transparent;
  color: #38bdf8;
  border: 1px solid #0284c7;
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-lib-example:hover {
  background: rgba(56, 189, 248, 0.15);
  color: #7dd3fc;
}

.lib-installed-count {
  font-size: 0.82rem;
  color: #94a3b8;
}

/* Modal Serial USB Físico */
.serial-modal-card {
  width: 680px;
  max-width: 95vw;
}

.serial-conn-banner {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: #111827;
  border: 1px solid #1f293d;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.85rem;
}

.conn-status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
  flex-shrink: 0;
}

.conn-status-dot.connected {
  background: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.8);
}

.conn-status-info {
  flex: 1;
}

.conn-status-info b {
  display: block;
  font-size: 0.9rem;
  color: #f8fafc;
  margin-bottom: 0.15rem;
}

.conn-status-info span {
  font-size: 0.78rem;
  color: #94a3b8;
  line-height: 1.3;
}

.btn-connect-usb {
  background: var(--accent-purple);
  color: #ffffff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-connect-usb:hover {
  background: var(--accent-purple-light);
  box-shadow: 0 0 12px rgba(124, 58, 237, 0.5);
}

.btn-connect-usb.connected {
  background: #dc2626;
}

.serial-config-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  gap: 1rem;
}

.serial-label {
  font-size: 0.82rem;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.real-baud-select {
  background: #141a29;
  border: 1px solid #1f293d;
  color: #f8fafc;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  font-size: 0.8rem;
}

.serial-quick-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-subtle-serial {
  background: #1e263d;
  border: 1px solid #334155;
  color: #cbd5e1;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-subtle-serial:hover {
  background: #2a3554;
  color: #ffffff;
  border-color: #3b82f6;
}

.serial-flash-section {
  background: #0f1422;
  border: 1px dashed #24304c;
  border-radius: 10px;
  padding: 0.8rem;
  margin-bottom: 0.85rem;
}

.flash-actions-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.btn-flash-file {
  background: #1e293b;
  border: 1px solid #334155;
  color: #cbd5e1;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
}

.selected-fw-name {
  font-size: 0.78rem;
  color: #94a3b8;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-flash-run {
  background: #0284c7;
  color: #ffffff;
  border: none;
  padding: 0.45rem 1rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-flash-run:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.flash-progress-bar {
  margin-top: 0.6rem;
  height: 18px;
  background: #141a29;
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  transition: width 0.2s ease;
}

.progress-text {
  position: relative;
  z-index: 2;
  font-size: 0.7rem;
  font-weight: 700;
  color: #ffffff;
}

.serial-terminal-live {
  background: #090c15;
  border: 1px solid #1c2438;
  border-radius: 8px;
  overflow: hidden;
}

.terminal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.65rem;
  background: #111625;
  font-size: 0.75rem;
  color: #94a3b8;
  border-bottom: 1px solid #1c2438;
}

.btn-clear-real-term {
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 0.72rem;
  cursor: pointer;
}

.real-term-log {
  max-height: 140px;
  overflow-y: auto;
  padding: 0.5rem;
  font-family: monospace;
  font-size: 0.78rem;
  color: #e2e8f0;
}

/* Estado Deep Sleep Visual en el ESP32 */
.esp32-board-carrier.is-deepsleep {
  filter: brightness(0.45) saturate(0.6);
  border-color: #3b82f6;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.45);
  transition: all 0.5s ease;
}

.deepsleep-badge {
  position: absolute;
  top: -14px;
  right: 12px;
  background: #1e3a8a;
  border: 1px solid #3b82f6;
  color: #93c5fd;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.6);
  animation: sleepPulse 2.5s infinite ease-in-out;
  pointer-events: none;
  z-index: 40;
}

@keyframes sleepPulse {
  0%, 100% { opacity: 0.8; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

/* Componente ESP32-CAM */
.canvas-esp32cam-item {
  width: 170px;
  background: #0d121f;
  border: 1.5px solid #232d47;
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cam-bezel {
  width: 140px;
  height: 105px;
  background: #000000;
  border: 2px solid #1e293b;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 6px 0;
}

.cam-video-view {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cam-flash-led {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 10px;
  height: 10px;
  background: #e2e8f0;
  border: 1px solid #94a3b8;
  border-radius: 2px;
  transition: all 0.1s ease;
}

.cam-flash-led.active {
  background: #ffffff;
  box-shadow: 0 0 20px 8px rgba(255, 255, 255, 0.95);
}

.cam-btn-toggle {
  background: #1e293b;
  border: 1px solid #334155;
  color: #cbd5e1;
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 4px;
}

.cam-btn-toggle:hover {
  background: #334155;
  color: #ffffff;
}

/* Componente Condensador con Barra de Carga */
.canvas-capacitor-item {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cap-charge-wrap {
  width: 48px;
  height: 6px;
  background: #141a29;
  border: 1px solid #232d47;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 3px;
  position: relative;
}

.cap-charge-bar {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  width: 0%;
  transition: width 0.1s ease;
}

.cap-val-label {
  font-size: 10px;
  font-weight: 700;
  color: #38bdf8;
  text-align: center;
  margin-top: 2px;
}

/* =============================================================================
   Pestañas de Navegación del Gestor de Librerías e Internet
   ============================================================================= */
.lib-main-nav-tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 1rem 0 1rem;
  border-bottom: 1px solid #1e263d;
  background: #0b0f19;
}

.lib-main-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: #94a3b8;
  padding: 0.6rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  border-radius: 4px 4px 0 0;
}

.lib-main-tab:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.03);
}

.lib-main-tab.active {
  color: #c084fc;
  border-bottom-color: #a855f7;
  background: rgba(168, 85, 247, 0.08);
}

.lib-download-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: #1e1b4b;
  border: 1px solid #6366f1;
  color: #e0e7ff;
  padding: 0.6rem 1rem;
  margin: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  animation: pulseSlow 1.5s infinite;
}

.lib-download-spinner {
  display: inline-block;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes pulseSlow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

/* Resaltado de Errores Exactos en Editor de Código */
.line-num-error {
  color: #ffffff !important;
  font-weight: 800 !important;
  background: #ef4444 !important;
  padding: 1px 4px;
  border-radius: 4px;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.8);
  display: inline-block;
  animation: pulseError 1s infinite alternate;
}

@keyframes pulseError {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

/* Mensajes de Diagnóstico del Compilador en la Terminal */
.log-compiler-err {
  color: #fca5a5 !important;
  background: rgba(239, 68, 68, 0.12) !important;
  border-left: 3px solid #ef4444 !important;
  padding: 0.6rem 0.8rem !important;
  margin: 0.35rem 0 !important;
  border-radius: 4px;
  font-family: 'Fira Code', 'Cascadia Code', monospace !important;
  font-size: 0.85rem !important;
  white-space: pre !important;
  overflow-x: auto;
}

.log-runtime-err {
  color: #fdba74 !important;
  background: rgba(249, 115, 22, 0.12) !important;
  border-left: 3px solid #f97316 !important;
  padding: 0.6rem 0.8rem !important;
  margin: 0.35rem 0 !important;
  border-radius: 4px;
  font-family: 'Fira Code', 'Cascadia Code', monospace !important;
  font-size: 0.85rem !important;
  white-space: pre !important;
  overflow-x: auto;
}

/* ==========================================================================
   PANEL RESIZERS, HIDE/SHOW TOGGLES & ZEN MODE
   ========================================================================== */

/* 1. Divisores Redimensionables (Left / Right) */
.panel-resizer {
  width: 12px;
  margin: 0 -6px;
  z-index: 40;
  position: relative;
  cursor: col-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  user-select: none;
  touch-action: none;
}

.panel-resizer::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 5px;
  width: 2px;
  background-color: var(--border-color);
  transition: background-color 0.15s ease, width 0.15s ease, box-shadow 0.15s ease;
}

.panel-resizer:hover::before,
.panel-resizer.is-dragging::before {
  background-color: var(--accent-purple);
  width: 3px;
  box-shadow: 0 0 10px var(--accent-purple-glow);
}

.resizer-handle-pill {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 45;
}

.resizer-toggle-btn {
  width: 20px;
  height: 42px;
  border-radius: 6px;
  background-color: #1a2236;
  border: 1px solid #2e3a59;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 11px;
  transition: all 0.15s ease;
  padding: 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

.resizer-toggle-btn:hover {
  background-color: var(--accent-purple);
  color: #ffffff;
  border-color: #a855f7;
  box-shadow: 0 0 14px var(--accent-purple-glow);
  transform: scale(1.12);
}

/* 2. Divisor Vertical entre Editor y Terminal */
.panel-resizer-vertical {
  height: 10px;
  margin: -5px 0;
  cursor: row-resize;
  position: relative;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  touch-action: none;
  flex-shrink: 0;
}

.panel-resizer-vertical::before {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  top: 4px;
  height: 2px;
  background-color: var(--border-color);
  transition: all 0.15s ease;
}

.panel-resizer-vertical:hover::before,
.panel-resizer-vertical.is-dragging::before {
  background-color: var(--accent-purple);
  height: 3px;
  box-shadow: 0 0 10px var(--accent-purple-glow);
}

.resizer-v-pill {
  width: 38px;
  height: 4px;
  border-radius: 9999px;
  background-color: #2b354f;
  z-index: 26;
  transition: all 0.15s ease;
}

.panel-resizer-vertical:hover .resizer-v-pill,
.panel-resizer-vertical.is-dragging .resizer-v-pill {
  background-color: var(--accent-purple);
  transform: scaleX(1.2);
  box-shadow: 0 0 8px var(--accent-purple-glow);
}

/* 3. Botones en Barra Superior (Navbar Layout Toggles) */
.navbar-layout-toggles {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background-color: #121828;
  padding: 3px;
  border-radius: 9999px;
  border: 1px solid #1f2a42;
}

.nav-toggle-pill {
  background: transparent;
  color: #94a3b8;
  border: none;
  border-radius: 9999px;
  padding: 0.32rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.nav-toggle-pill:hover {
  background-color: #1a233a;
  color: #f1f5f9;
}

.nav-toggle-pill.active {
  background-color: #1e293b;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.nav-toggle-pill .pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #64748b;
  transition: all 0.2s ease;
}

.nav-toggle-pill.active .pill-dot {
  background-color: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.7);
}

.nav-toggle-pill.btn-zen-pill {
  border-left: 1px solid #23314d;
  border-radius: 0 9999px 9999px 0;
  padding-left: 0.65rem;
}

.nav-toggle-pill.btn-zen-pill.zen-active {
  background: var(--accent-purple);
  color: #ffffff;
  box-shadow: 0 0 14px var(--accent-purple-glow);
}

/* 4. Pastillas Flotantes para Restaurar Paneles Ocultos */
.floating-restore-pill {
  position: absolute;
  top: 14px;
  z-index: 35;
  background: rgba(18, 24, 38, 0.94);
  backdrop-filter: blur(10px);
  border: 1px solid #334155;
  color: #e2e8f0;
  border-radius: 9999px;
  padding: 0.45rem 0.95rem;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.55);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.floating-restore-pill.restore-left {
  left: 14px;
}

.floating-restore-pill.restore-right {
  right: 14px;
}

.floating-restore-pill:hover {
  background: var(--accent-purple);
  border-color: #c084fc;
  box-shadow: 0 0 18px var(--accent-purple-glow);
  transform: translateY(-1px);
  color: #ffffff;
}

/* 5. Estado Global al Arrastrar y Redimensionar */
body.is-resizing,
body.is-resizing * {
  user-select: none !important;
  -webkit-user-select: none !important;
}

body.is-resizing-col {
  cursor: col-resize !important;
}

body.is-resizing-row {
  cursor: row-resize !important;
}

body.is-resizing .sidebar-components,
body.is-resizing .sidebar-code,
body.is-resizing .code-card,
body.is-resizing .terminal-card {
  transition: none !important;
}

/* ==========================================================================
   FIREBASE AUTHENTICATION (INICIO DE SESIÓN)
   ========================================================================== */
.user-auth-container {
  position: relative;
  display: flex;
  align-items: center;
}

.btn-auth-signin {
  background: linear-gradient(135deg, #7c3aed, #9333ea);
  color: #ffffff;
  border: 1px solid #a855f7;
  border-radius: 9999px;
  padding: 0.38rem 0.95rem;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(124, 58, 237, 0.4);
  transition: all 0.2s ease;
}

.btn-auth-signin:hover {
  background: linear-gradient(135deg, #6d28d9, #7c3aed);
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.65);
  transform: translateY(-1px);
}

.user-profile-pill {
  background: #181f33;
  color: #e2e8f0;
  border: 1px solid #232d47;
  border-radius: 9999px;
  padding: 0.25rem 0.65rem 0.25rem 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.user-profile-pill:hover {
  background: #202a45;
  border-color: #7c3aed;
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.3);
}

.user-avatar-img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid #a855f7;
}

.user-avatar-initial {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #7c3aed;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
}

.user-display-name {
  max-width: 110px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Menú Desplegable */
.user-profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  background-color: #121828;
  border: 1px solid #25334d;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  z-index: 200;
  padding: 0.5rem 0;
  animation: dropdownFadeIn 0.18s ease;
}

@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.dropdown-header {
  padding: 0.6rem 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.dropdown-header .user-info-text {
  overflow: hidden;
}

.dropdown-header .user-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-header .user-email {
  font-size: 0.72rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.provider-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  background-color: #1e293b;
  color: #38bdf8;
  border: 1px solid #0284c7;
}

.dropdown-divider {
  height: 1px;
  background-color: #1e293b;
  margin: 0.35rem 0;
}

.dropdown-item {
  width: 100%;
  background: transparent;
  border: none;
  color: #cbd5e1;
  padding: 0.5rem 0.85rem;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.dropdown-item:hover {
  background-color: #1a233a;
  color: #ffffff;
}

.dropdown-item-danger {
  color: #fca5a5;
}

.dropdown-item-danger:hover {
  background-color: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* Modal de Autenticación */
.auth-modal-card {
  max-width: 440px;
  width: 92%;
}

.auth-modal-body {
  padding: 1.25rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.btn-google-auth {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  background-color: #ffffff;
  color: #1f2937;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.btn-google-auth:hover {
  background-color: #f8fafc;
  border-color: #9ca3af;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transform: translateY(-1px);
}

.google-icon {
  flex-shrink: 0;
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: #64748b;
  font-size: 0.74rem;
  margin: 0.2rem 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #1e293b;
}

.auth-divider span {
  padding: 0 0.65rem;
}

.auth-tab-switch {
  display: flex;
  background-color: #101626;
  border-radius: 8px;
  padding: 3px;
  border: 1px solid #1e293b;
  gap: 3px;
}

.auth-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 0.45rem 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.15s ease;
}

.auth-tab-btn:hover {
  color: #f1f5f9;
}

.auth-tab-btn.active {
  background-color: #1e293b;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.auth-field-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.auth-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: #cbd5e1;
}

.auth-input {
  background-color: #0f1422;
  border: 1px solid #1f2a40;
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  color: #f8fafc;
  font-size: 0.84rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-input:focus {
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.25);
}

.btn-auth-submit {
  background: var(--accent-purple);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1rem;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  margin-top: 0.25rem;
  box-shadow: 0 0 12px var(--accent-purple-glow);
}

.btn-auth-submit:hover:not(:disabled) {
  background: #6d28d9;
  box-shadow: 0 0 18px rgba(124, 58, 237, 0.7);
  transform: translateY(-1px);
}

.btn-auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-guest-section {
  text-align: center;
  margin-top: 0.2rem;
}

.btn-auth-guest {
  background: transparent;
  border: 1px dashed #334155;
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  color: #94a3b8;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
}

.btn-auth-guest:hover {
  background: #141b2d;
  color: #cbd5e1;
  border-color: #64748b;
}

.auth-alert {
  padding: 0.55rem 0.8rem;
  border-radius: 8px;
  font-size: 0.78rem;
  line-height: 1.4;
}

.auth-alert.error {
  background-color: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.auth-alert.success {
  background-color: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
}

.auth-footer-note {
  font-size: 0.72rem;
  color: #64748b;
}

/* ==========================================================================
   PANEL DE INICIO (HOME VIEW) & PROYECTOS EN LA NUBE (CLOUD HUB)
   ========================================================================== */

/* 1. Navegación Principal en Header */
.navbar-nav-links {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: 1rem;
}

.nav-tab-link {
  background: transparent;
  border: 1px solid transparent;
  color: #94a3b8;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.38rem 0.85rem;
  border-radius: 9999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.18s ease;
  user-select: none;
  text-decoration: none;
}

.nav-tab-link:hover {
  background-color: rgba(124, 58, 237, 0.15);
  color: #f1f5f9;
  border-color: rgba(168, 85, 247, 0.3);
}

.nav-tab-link.active {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.32), rgba(147, 51, 234, 0.22));
  color: #ffffff;
  border-color: #a855f7;
  box-shadow: 0 0 14px rgba(124, 58, 237, 0.4);
}

.cloud-count-badge {
  background-color: #7c3aed;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  min-width: 18px;
  text-align: center;
}

/* 2. Vistas Principales (Page Views) */
.page-view {
  width: 100%;
}

.simulator-view {
  height: calc(100vh - 56px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 3. Panel de Inicio (Home View Morado estilo Velxio) */
.home-view {
  min-height: calc(100vh - 56px);
  flex: 1;
  overflow-y: auto;
  background-color: #080415;
  background-image: 
    radial-gradient(ellipse 65% 55% at 5% 90%, rgba(139, 92, 246, 0.38) 0%, rgba(91, 33, 182, 0.14) 45%, transparent 75%),
    radial-gradient(circle 520px at 78% 36%, rgba(147, 51, 234, 0.28) 0%, rgba(124, 58, 237, 0.08) 50%, transparent 75%),
    radial-gradient(ellipse 50% 30% at 50% 0%, rgba(124, 58, 237, 0.15) 0%, transparent 60%);
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #f1f5f9;
  padding-bottom: 5rem;
}

.home-hero-section {
  position: relative;
  width: 100%;
  max-width: 1200px;
  padding: 3.5rem 2rem 2.5rem 2rem;
  display: flex;
  justify-content: center;
}

.hero-glow-blob {
  position: absolute;
  top: 30%;
  right: 15%;
  width: 650px;
  height: 450px;
  background: radial-gradient(circle, rgba(147, 51, 234, 0.25) 0%, rgba(124, 58, 237, 0.08) 50%, transparent 75%);
  filter: blur(65px);
  pointer-events: none;
  z-index: 1;
}

.hero-container-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 3.5rem;
  align-items: center;
  width: 100%;
}

.hero-left-column {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.hero-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(30, 18, 56, 0.85);
  border: 1px solid rgba(168, 85, 247, 0.4);
  padding: 0.35rem 1rem;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #e9d5ff;
  box-shadow: 0 0 18px rgba(124, 58, 237, 0.3);
  margin-bottom: 1.5rem;
}

.hero-title {
  font-size: 3.4rem;
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: #ffffff;
  margin-bottom: 1.35rem;
}

.hero-gradient-text {
  background: linear-gradient(135deg, #c084fc 15%, #a855f7 45%, #60a5fa 90%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.05rem;
  line-height: 1.65;
  color: #94a3b8;
  max-width: 580px;
  margin-bottom: 2rem;
}

.hero-cta-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: nowrap;
  margin-bottom: 2.2rem;
}

.btn-hero-primary {
  background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%);
  color: #ffffff;
  border: 1px solid #c084fc;
  padding: 0.65rem 1.35rem;
  border-radius: 9999px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 0 28px rgba(168, 85, 247, 0.5), 0 4px 14px rgba(0, 0, 0, 0.4);
  transition: all 0.22s ease;
  white-space: nowrap;
}

.btn-hero-primary:hover {
  background: linear-gradient(135deg, #7c3aed 0%, #9333ea 100%);
  transform: translateY(-2px);
  box-shadow: 0 0 38px rgba(168, 85, 247, 0.7), 0 6px 20px rgba(0, 0, 0, 0.5);
}

.btn-hero-secondary {
  background: rgba(22, 14, 42, 0.8);
  border: 1px solid rgba(168, 85, 247, 0.35);
  color: #e2e8f0;
  padding: 0.65rem 1.2rem;
  border-radius: 9999px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-hero-secondary:hover {
  background: rgba(124, 58, 237, 0.25);
  border-color: #c084fc;
  color: #ffffff;
  transform: translateY(-2px);
}

.btn-hero-ghost {
  background: rgba(18, 12, 34, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #cbd5e1;
  padding: 0.65rem 1.2rem;
  border-radius: 9999px;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-hero-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: #a855f7;
  color: #ffffff;
  transform: translateY(-2px);
}

.hero-features-strip {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  flex-wrap: wrap;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(168, 85, 247, 0.18);
  width: 100%;
}

.hero-feature-pill {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.feat-pill-ico {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(124, 58, 237, 0.2);
  border: 1px solid rgba(168, 85, 247, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: #c084fc;
  flex-shrink: 0;
}

.feat-pill-text {
  display: flex;
  flex-direction: column;
}

.feat-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: #f1f5f9;
}

.feat-detail {
  font-size: 0.74rem;
  color: #94a3b8;
}

/* Columna Derecha: Render 3D del ESP32 */
.hero-right-column {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.hero-esp32-showcase-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.esp32-aura-glow {
  position: absolute;
  width: 90%;
  height: 90%;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.45) 0%, rgba(124, 58, 237, 0.15) 50%, transparent 75%);
  filter: blur(45px);
  pointer-events: none;
  z-index: 1;
}

.hero-esp32-img {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 420px;
  height: auto;
  border-radius: 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 45px rgba(168, 85, 247, 0.3);
  border: 1px solid rgba(168, 85, 247, 0.25);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  object-fit: cover;
}

.hero-esp32-img:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.65), 0 0 55px rgba(168, 85, 247, 0.55);
}

/* Sección de 3 Pilares */
.home-pillars-section {
  width: 100%;
  max-width: 1200px;
  padding: 1rem 2rem 3rem 2rem;
}

.pillars-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  width: 100%;
}

.pillar-card {
  background: rgba(18, 10, 36, 0.7);
  border: 1px solid rgba(168, 85, 247, 0.22);
  border-radius: 18px;
  padding: 1.75rem 1.6rem;
  transition: all 0.3s ease;
  backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.pillar-card:hover {
  background: rgba(28, 16, 54, 0.85);
  border-color: rgba(168, 85, 247, 0.5);
  transform: translateY(-4px);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.35), 0 0 28px rgba(124, 58, 237, 0.25);
}

.pillar-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(124, 58, 237, 0.25);
  border: 1px solid rgba(168, 85, 247, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.35rem;
}

.pillar-title {
  font-size: 1.18rem;
  font-weight: 700;
  color: #f8fafc;
}

.pillar-desc {
  font-size: 0.9rem;
  line-height: 1.55;
  color: #94a3b8;
}

@media (max-width: 900px) {
  .hero-container-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
  .hero-left-column {
    align-items: center;
    text-align: center;
  }
  .hero-subtitle {
    max-width: 100%;
  }
  .hero-cta-row {
    justify-content: center;
  }
  .hero-features-strip {
    justify-content: center;
  }
  .pillars-grid {
    grid-template-columns: 1fr;
  }
}

.stat-ico {
  font-size: 1.4rem;
}

.stat-val {
  font-size: 0.92rem;
  font-weight: 700;
  color: #ffffff;
}

.stat-lbl {
  font-size: 0.72rem;
  color: #94a3b8;
}

/* 4. Sección de Plantillas de Inicio Rápido */
.home-templates-section {
  width: 100%;
  max-width: 1180px;
  padding: 3rem 1.5rem;
}

.section-header-center {
  text-align: center;
  margin-bottom: 2.25rem;
}

.section-tag {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #a855f7;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

.section-title {
  font-size: 1.85rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 0.5rem;
}

.section-desc {
  font-size: 0.92rem;
  color: #94a3b8;
}

.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.template-card {
  background: #110c22;
  border: 1px solid #2a1b4d;
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: all 0.22s ease;
  cursor: pointer;
}

.template-card:hover {
  background: #171030;
  border-color: #a855f7;
  box-shadow: 0 8px 26px rgba(124, 58, 237, 0.28);
  transform: translateY(-3px);
}

.card-chip-badge {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid #3b82f6;
  color: #93c5fd;
}

.card-chip-badge.badge-purple {
  background: rgba(168, 85, 247, 0.15);
  border-color: #a855f7;
  color: #d8b4fe;
}

.card-chip-badge.badge-cyan {
  background: rgba(6, 182, 212, 0.15);
  border-color: #06b6d4;
  color: #67e8f9;
}

.card-chip-badge.badge-amber {
  background: rgba(245, 158, 11, 0.15);
  border-color: #f59e0b;
  color: #fcd34d;
}

.card-chip-badge.badge-emerald {
  background: rgba(16, 185, 129, 0.15);
  border-color: #10b981;
  color: #6ee7b7;
}

.template-icon {
  font-size: 2rem;
  margin-bottom: 0.85rem;
}

.template-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.45rem;
}

.template-desc {
  font-size: 0.84rem;
  line-height: 1.5;
  color: #94a3b8;
  margin-bottom: 1.25rem;
  flex: 1;
}

.btn-template-run {
  background: rgba(124, 58, 237, 0.18);
  border: 1px solid rgba(168, 85, 247, 0.4);
  color: #e9d5ff;
  border-radius: 8px;
  padding: 0.55rem 1rem;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
}

.template-card:hover .btn-template-run {
  background: #7c3aed;
  border-color: #a855f7;
  color: #ffffff;
  box-shadow: 0 0 14px var(--accent-purple-glow);
}

/* 5. Sección de Características */
.home-features-section {
  width: 100%;
  max-width: 1180px;
  padding: 2.5rem 1.5rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.feature-item-card {
  background: #0f0a1e;
  border: 1px solid #231640;
  border-radius: 14px;
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.feat-ico {
  font-size: 1.7rem;
  margin-bottom: 0.3rem;
}

.feat-title {
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
}

.feat-desc {
  font-size: 0.82rem;
  line-height: 1.5;
  color: #94a3b8;
}

/* ==========================================================================
   6. APARTADO DE PROYECTOS EN LA NUBE (CLOUD HUB) - ESTILO PLASMA
   ========================================================================== */
.cloud-view {
  min-height: calc(100vh - 56px);
  flex: 1;
  overflow-y: auto;
  background-color: #080414;
  position: relative;
  display: flex;
  flex-direction: column;
  color: #f1f5f9;
  padding: 2.2rem 3rem 4rem 3rem;
}

.cloud-hub-container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

/* Encabezado Hero en la Nube */
.cloud-hero-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2.5rem;
  margin-bottom: 2rem;
}

.cloud-hero-left {
  flex: 1;
  max-width: 680px;
}

.cloud-badges-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.cloud-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(28, 16, 52, 0.75);
  border: 1px solid rgba(168, 85, 247, 0.35);
  border-radius: 9999px;
  padding: 0.32rem 0.95rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #e9d5ff;
}

.cloud-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 9999px;
  padding: 0.32rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #6ee7b7;
}

.status-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

.cloud-hero-title {
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: #ffffff;
  margin-bottom: 0.85rem;
}

.plasma-gradient-text {
  background: linear-gradient(135deg, #c084fc 20%, #a855f7 60%, #e879f9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.cloud-hero-subtitle {
  font-size: 0.98rem;
  line-height: 1.55;
  color: #94a3b8;
  max-width: 560px;
}

/* Nube 3D en Podio */
.cloud-hero-right {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cloud-hero-3d-podium {
  position: relative;
  width: 250px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cloud-hero-3d-podium::before {
  content: '';
  position: absolute;
  width: 190px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.4) 0%, rgba(124, 58, 237, 0.1) 60%, transparent 80%);
  filter: blur(28px);
  z-index: 1;
}

.cloud-hero-3d-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 14px 30px rgba(168, 85, 247, 0.4));
  animation: floatCloud 5s ease-in-out infinite;
}

@keyframes floatCloud {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* Barra de Acciones y Búsqueda */
.cloud-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.cloud-search-wrap {
  flex: 1;
  min-width: 280px;
  position: relative;
  background: rgba(18, 12, 36, 0.75);
  border: 1px solid rgba(168, 85, 247, 0.22);
  border-radius: 12px;
  display: flex;
  align-items: center;
  padding: 0.65rem 1rem;
  gap: 0.75rem;
  transition: all 0.2s ease;
}

.cloud-search-wrap:focus-within {
  border-color: #a855f7;
  background: rgba(22, 14, 46, 0.9);
  box-shadow: 0 0 16px rgba(168, 85, 247, 0.25);
}

.search-ico-svg {
  color: #94a3b8;
  flex-shrink: 0;
}

.cloud-search-wrap input {
  background: transparent;
  border: none;
  outline: none;
  color: #ffffff;
  font-size: 0.88rem;
  width: 100%;
}

.cloud-search-wrap input::placeholder {
  color: #64748b;
}

.cloud-bar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-cloud-new-project {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 1.4rem;
  border-radius: 12px;
  background: rgba(20, 13, 40, 0.85);
  border: 1px solid rgba(168, 85, 247, 0.45);
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.btn-cloud-new-project:hover {
  background: rgba(35, 20, 68, 0.95);
  border-color: #c084fc;
  box-shadow: 0 0 18px rgba(168, 85, 247, 0.4);
  transform: translateY(-1px);
}

/* Cuadrícula de Proyectos en la Nube */
.cloud-projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

@media (max-width: 1100px) {
  .cloud-projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 720px) {
  .cloud-projects-grid {
    grid-template-columns: 1fr;
  }
}

/* Tarjeta de Proyecto en la Nube */
.cloud-project-card {
  background: rgba(17, 11, 35, 0.85);
  border: 1px solid rgba(168, 85, 247, 0.2);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
}

.cloud-project-card:hover {
  background: rgba(22, 14, 46, 0.95);
  border-color: rgba(168, 85, 247, 0.55);
  box-shadow: 0 14px 32px rgba(124, 58, 237, 0.22), 0 0 20px rgba(168, 85, 247, 0.15);
  transform: translateY(-3px);
}

/* Fotografía Real del Hardware en la Tarjeta */
.card-image-wrap {
  position: relative;
  width: 100%;
  height: 175px;
  background: #0d0822;
  overflow: hidden;
  border-bottom: 1px solid rgba(168, 85, 247, 0.15);
}

.card-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.35s ease;
}

.cloud-project-card:hover .card-preview-img {
  transform: scale(1.03);
}

.card-image-overlay {
  position: absolute;
  top: 10px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  pointer-events: none;
}

.lab-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(15, 10, 30, 0.8);
  border: 1px solid rgba(168, 85, 247, 0.4);
  border-radius: 8px;
  padding: 0.22rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #e9d5ff;
  backdrop-filter: blur(8px);
  pointer-events: auto;
}

.card-menu-dropdown-wrap {
  position: relative;
  pointer-events: auto;
}

.btn-card-more-menu {
  background: rgba(15, 10, 30, 0.8);
  border: 1px solid rgba(168, 85, 247, 0.4);
  color: #cbd5e1;
  border-radius: 8px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  letter-spacing: 1px;
  transition: all 0.18s ease;
  backdrop-filter: blur(8px);
}

.btn-card-more-menu:hover {
  background: rgba(35, 20, 68, 0.95);
  color: #ffffff;
  border-color: #c084fc;
}

.card-context-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: #140d2b;
  border: 1px solid rgba(168, 85, 247, 0.35);
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.55), 0 0 15px rgba(124, 58, 237, 0.2);
  min-width: 145px;
  padding: 0.35rem 0;
  z-index: 50;
  display: none;
}

.card-context-menu.show {
  display: block;
}

.context-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 0.5rem 0.85rem;
  color: #cbd5e1;
  font-size: 0.78rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background 0.15s ease;
}

.context-item:hover {
  background: rgba(168, 85, 247, 0.15);
  color: #ffffff;
}

.context-item.action-delete:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

/* Cuerpo de la Tarjeta */
.cloud-project-card .card-body {
  padding: 1.25rem 1.35rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.cloud-project-card .card-title {
  font-size: 1.12rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.4rem;
  line-height: 1.3;
}

.cloud-project-card .card-desc {
  font-size: 0.82rem;
  color: #94a3b8;
  line-height: 1.48;
  margin-bottom: 1.1rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.cloud-project-card .card-meta-chips {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}

.cloud-project-card .meta-chip {
  background: rgba(20, 13, 40, 0.6);
  border: 1px solid rgba(168, 85, 247, 0.18);
  border-radius: 9999px;
  padding: 0.22rem 0.6rem;
  font-size: 0.72rem;
  color: #cbd5e1;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.cloud-project-card .btn-card-open-sim {
  background: linear-gradient(135deg, #7c3aed 0%, #9333ea 100%);
  border: 1px solid rgba(192, 132, 252, 0.4);
  color: #ffffff;
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
  text-decoration: none;
}

.cloud-project-card .btn-card-open-sim:hover {
  background: linear-gradient(135deg, #6d28d9 0%, #7c3aed 100%);
  border-color: #c084fc;
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.6);
  transform: translateY(-1px);
}

/* Estado Vacío de la Nube */
.cloud-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 1.5rem;
  background: rgba(17, 11, 35, 0.65);
  border: 2px dashed rgba(168, 85, 247, 0.3);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.empty-cloud-ico {
  font-size: 3.5rem;
  margin-bottom: 1rem;
}

.empty-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.5rem;
}

.empty-desc {
  font-size: 0.88rem;
  color: #94a3b8;
  max-width: 480px;
  margin-bottom: 1.5rem;
}

/* 7. Modal Guardar con Nombre */
.save-cloud-card {
  max-width: 460px;
  width: 92%;
}

.save-cloud-form {
  padding: 1.25rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.cloud-save-preview-stats {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.2rem;
  flex-wrap: wrap;
}

.preview-stat-pill {
  background: #140d28;
  border: 1px solid #2e1a59;
  border-radius: 9999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.76rem;
  color: #cbd5e1;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.save-cloud-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 0.5rem;
}

/* 8. Toast de Notificaciones Flotante */
.app-toast-notification {
  position: fixed;
  bottom: 2.8rem;
  right: 2rem;
  background: #140d28;
  border: 1px solid #a855f7;
  box-shadow: 0 10px 32px rgba(124, 58, 237, 0.45);
  color: #f8fafc;
  padding: 0.85rem 1.25rem;
  border-radius: 12px;
  font-size: 0.86rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  z-index: 10000;
  animation: toastSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

@keyframes toastSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =============================================================================
   ESTILO PLASMA CÓSMICO MODERNO (ESP REICON LANDING 2026)
   ============================================================================= */
.plasma-page-body {
  background-color: #080415 !important;
  color: #f8fafc;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
}

.landing-app-container {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Efectos de Iluminación y Ondas de Plasma */
.plasma-bg-effects {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.plasma-wave-bottom-left {
  position: absolute;
  bottom: -220px;
  left: -180px;
  width: 850px;
  height: 520px;
  background: radial-gradient(ellipse at 40% 60%, rgba(168, 85, 247, 0.42) 0%, rgba(124, 58, 237, 0.22) 35%, rgba(76, 29, 149, 0.08) 65%, transparent 80%);
  filter: blur(65px);
  transform: rotate(-12deg);
}

.plasma-ambient-blur-right {
  position: absolute;
  top: 40px;
  right: -50px;
  width: 720px;
  height: 650px;
  background: radial-gradient(circle at 60% 40%, rgba(147, 51, 234, 0.32) 0%, rgba(124, 58, 237, 0.12) 45%, transparent 70%);
  filter: blur(75px);
}

.plasma-wave-bottom-right {
  position: absolute;
  bottom: -160px;
  right: -120px;
  width: 650px;
  height: 420px;
  background: radial-gradient(ellipse at 60% 70%, rgba(124, 58, 237, 0.28) 0%, rgba(76, 29, 149, 0.10) 45%, transparent 75%);
  filter: blur(65px);
  transform: rotate(18deg);
}

.plasma-arc-line {
  position: absolute;
  bottom: 40px;
  left: -60px;
  width: 580px;
  height: 280px;
  border-radius: 50%;
  border-top: 2px solid rgba(192, 132, 252, 0.5);
  box-shadow: 0 -8px 32px rgba(168, 85, 247, 0.55);
  transform: rotate(-16deg);
  filter: blur(1.5px);
  opacity: 0.75;
}

/* Transición Suave de Página */
body.plasma-body {
  animation: pageFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pageFadeIn {
  from {
    opacity: 0;
    transform: translateY(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header Plasma */
.plasma-navbar {
  position: relative;
  z-index: 50;
  height: 64px;
  padding: 0 clamp(1.25rem, 3.5vw, 3rem) !important;
  background: rgba(8, 4, 21, 0.5) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border-bottom: 1px solid rgba(168, 85, 247, 0.08) !important;
  box-shadow: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}

.plasma-nav-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-tab-pill {
  text-decoration: none;
  background: rgba(124, 58, 237, 0.38);
  border: 1px solid rgba(168, 85, 247, 0.45);
  color: #ffffff !important;
  border-radius: 9999px;
  padding: 0.42rem 1.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.28);
  transition: all 0.2s ease;
}

.nav-tab-pill:hover {
  background: rgba(124, 58, 237, 0.55);
  border-color: #c084fc;
}

.plasma-navbar .nav-tab-link {
  color: #cbd5e1 !important;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.42rem 0.95rem;
  border: 1px solid transparent;
  border-radius: 9999px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.2s ease;
}

.plasma-navbar .nav-tab-link:hover {
  color: #ffffff !important;
  background: rgba(168, 85, 247, 0.12);
}

.navbar-right-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 175px;
  flex-shrink: 0;
}

.user-auth-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 175px;
  flex-shrink: 0;
}

.plasma-navbar .user-profile-pill {
  background: rgba(28, 16, 52, 0.75) !important;
  border: 1px solid rgba(168, 85, 247, 0.35) !important;
  color: #f8fafc !important;
  backdrop-filter: blur(14px);
  height: 38px !important;
  width: 165px !important;
  box-sizing: border-box !important;
  padding: 0.25rem 0.65rem 0.25rem 0.4rem !important;
  border-radius: 9999px !important;
  box-shadow: 0 0 16px rgba(124, 58, 237, 0.2) !important;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  transition: all 0.2s ease;
  user-select: none;
}

.plasma-navbar .user-profile-pill[style*="display: none"] {
  display: none !important;
}

.plasma-navbar .btn-auth-signin[style*="display: none"] {
  display: none !important;
}

.plasma-navbar .user-profile-pill:hover {
  background: rgba(45, 24, 82, 0.9) !important;
  border-color: #c084fc !important;
  box-shadow: 0 0 24px rgba(168, 85, 247, 0.4) !important;
}

.plasma-navbar .user-avatar-img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid #a855f7;
  flex-shrink: 0;
}

.plasma-navbar .user-avatar-initial {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #7c3aed;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.78rem;
  flex-shrink: 0;
}

.plasma-navbar .user-display-name {
  max-width: 88px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.82rem;
  font-weight: 600;
  color: #f8fafc;
}

.plasma-navbar .chevron {
  font-size: 0.72rem;
  color: #c084fc;
  flex-shrink: 0;
}

.plasma-navbar .btn-auth-signin {
  background: linear-gradient(135deg, #7c3aed 0%, #9333ea 100%);
  color: #ffffff;
  border: 1px solid #c084fc;
  border-radius: 9999px;
  height: 38px !important;
  width: 165px !important;
  box-sizing: border-box !important;
  padding: 0 0.85rem !important;
  font-size: 0.84rem;
  font-weight: 600;
  box-shadow: 0 0 16px rgba(124, 58, 237, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.plasma-navbar .btn-auth-signin:hover {
  background: linear-gradient(135deg, #6d28d9 0%, #7e22ce 100%);
  transform: translateY(-1px);
  box-shadow: 0 0 22px rgba(168, 85, 247, 0.5);
}

/* =============================================================================
   HERO Y WORKBENCH DE HARDWARE (ESP REICON WORKBENCH 2026)
   ============================================================================= */
.plasma-hero-section {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1260px;
  padding: 1.8rem 2rem 1.2rem 2rem;
  margin: 0 auto;
}

.plasma-hero-grid {
  display: grid;
  grid-template-columns: 1.12fr 0.88fr;
  gap: 2.5rem;
  align-items: center;
  width: 100%;
  margin-bottom: 1.8rem;
}

.plasma-hero-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.plasma-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(28, 14, 58, 0.75);
  border: 1px solid rgba(168, 85, 247, 0.4);
  padding: 0.35rem 1rem;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #f1f5f9;
  box-shadow: 0 0 18px rgba(124, 58, 237, 0.25);
  margin-bottom: 1.1rem;
  letter-spacing: 0.01em;
}

.plasma-hero-title {
  font-size: clamp(2.2rem, 3.4vw, 3.2rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.035em;
  color: #ffffff;
  margin-bottom: 1rem;
}

.plasma-gradient-text {
  color: #a855f7;
  background: linear-gradient(135deg, #c084fc 20%, #a855f7 60%, #9333ea 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.plasma-hero-desc {
  font-size: 0.98rem;
  line-height: 1.55;
  color: #94a3b8;
  max-width: 480px;
  margin-bottom: 1.4rem;
}

/* Botones de Acción */
.plasma-cta-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.4rem;
}

.plasma-btn-primary {
  background: linear-gradient(135deg, #7c3aed 0%, #9333ea 100%);
  color: #ffffff;
  border: 1px solid #c084fc;
  padding: 0.72rem 1.45rem;
  border-radius: 9999px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 0 26px rgba(147, 51, 234, 0.45);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.plasma-btn-primary:hover {
  background: linear-gradient(135deg, #6d28d9 0%, #7e22ce 100%);
  transform: translateY(-2px);
  box-shadow: 0 0 35px rgba(168, 85, 247, 0.65);
}

.plasma-btn-capsule {
  background: rgba(22, 13, 46, 0.7);
  border: 1px solid rgba(168, 85, 247, 0.3);
  color: #e2e8f0;
  padding: 0.72rem 1.25rem;
  border-radius: 9999px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  backdrop-filter: blur(14px);
  transition: all 0.22s ease;
  white-space: nowrap;
}

.plasma-btn-capsule:hover {
  background: rgba(124, 58, 237, 0.25);
  border-color: #c084fc;
  color: #ffffff;
  transform: translateY(-2px);
}

/* Fila de Especificaciones Clave */
.plasma-specs-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.plasma-spec-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(168, 85, 247, 0.2);
  padding: 0.28rem 0.8rem;
  border-radius: 9999px;
}

.spec-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.spec-dot.green { background-color: #10b981; box-shadow: 0 0 8px #10b981; }
.spec-dot.purple { background-color: #c084fc; box-shadow: 0 0 8px #c084fc; }
.spec-dot.blue { background-color: #38bdf8; box-shadow: 0 0 8px #38bdf8; }

/* =============================================================================
   CARACTERÍSTICAS RÁPIDAS EN HERO (PROGRAMA, SIMULA, GUARDA)
   ============================================================================= */
.plasma-features-strip {
  display: flex;
  align-items: center;
  gap: 1.8rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(168, 85, 247, 0.15);
  width: 100%;
}

.plasma-feat-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.plasma-feat-icon-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(124, 58, 237, 0.18);
  border: 1px solid rgba(168, 85, 247, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(124, 58, 237, 0.2);
}

.plasma-feat-content {
  display: flex;
  flex-direction: column;
}

.plasma-feat-heading {
  font-size: 0.84rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
}

.plasma-feat-sub {
  font-size: 0.72rem;
  color: #94a3b8;
  line-height: 1.2;
}

/* =============================================================================
   RENDER 3D ESP32 FLOTANTE LIMPIO (COLUMNA DERECHA HERO)
   ============================================================================= */
.plasma-hero-right {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  width: 100%;
}

.plasma-esp32-frame {
  position: relative;
  width: 100%;
  max-width: 410px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.plasma-esp32-glow-backdrop {
  position: absolute;
  width: 330px;
  height: 330px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.38) 0%, rgba(124, 58, 237, 0.12) 50%, transparent 72%);
  filter: blur(40px);
  pointer-events: none;
}

.plasma-esp32-image {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 380px;
  height: auto;
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.85));
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  animation: floatEsp32 6s ease-in-out infinite alternate;
}

@keyframes floatEsp32 {
  0% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-7px) rotate(-0.5deg); }
  100% { transform: translateY(0px) rotate(0deg); }
}

.plasma-esp32-image:hover {
  transform: translateY(-8px) scale(1.03);
}

/* =============================================================================
   LAS 3 TARJETAS PRINCIPALES DEL MOCKUP ORIGINAL
   ============================================================================= */
.plasma-mockup-cards-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.35rem;
  width: 100%;
  margin-top: 1rem;
}

.mockup-feature-card {
  background: rgba(18, 10, 38, 0.65);
  border: 1px solid rgba(139, 92, 246, 0.22);
  border-radius: 18px;
  padding: 1.4rem 1.35rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 10px 25px -10px rgba(0, 0, 0, 0.5);
  transition: all 0.28s ease;
}

.mockup-feature-card:hover {
  transform: translateY(-4px);
  border-color: rgba(168, 85, 247, 0.45);
  box-shadow: 0 16px 35px -10px rgba(124, 58, 237, 0.22);
  background: rgba(26, 14, 54, 0.8);
}

.mfc-icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(124, 58, 237, 0.25);
  border: 1px solid rgba(168, 85, 247, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.95rem;
}

.mfc-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.4rem;
  letter-spacing: -0.01em;
}

.mfc-desc {
  font-size: 0.85rem;
  line-height: 1.5;
  color: #94a3b8;
}
  letter-spacing: -0.01em;
}

.mfc-desc {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #94a3b8;
}

/* =============================================================================
   SECCIÓN: PLACAS ESP32 SOPORTADAS (SHOWCASE COHESIVO)
   ============================================================================= */
.plasma-boards-section {
  width: 100%;
  max-width: 1240px;
  margin: 5rem auto 3.5rem auto;
  padding: 0 2rem;
  position: relative;
  z-index: 2;
}

.plasma-boards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  width: 100%;
}

.plasma-board-card {
  background: rgba(16, 10, 36, 0.8);
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: 22px;
  padding: 1.6rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 20px 50px -15px rgba(0, 0, 0, 0.75), 0 0 35px rgba(124, 58, 237, 0.12);
  position: relative;
  overflow: hidden;
}

.plasma-board-card:hover {
  transform: translateY(-6px);
}

/* Variante Clásica (Violeta) */
.plasma-board-card.classic:hover {
  border-color: rgba(168, 85, 247, 0.65);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.85), 0 0 45px rgba(168, 85, 247, 0.35);
}

/* Variante S3 (Cian / Esmeralda) */
.plasma-board-card.s3 {
  border-color: rgba(6, 182, 212, 0.32);
  box-shadow: 0 20px 50px -15px rgba(0, 0, 0, 0.75), 0 0 35px rgba(6, 182, 212, 0.12);
}
.plasma-board-card.s3:hover {
  border-color: rgba(6, 182, 212, 0.65);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.85), 0 0 45px rgba(6, 182, 212, 0.35);
}

/* Variante C3 (Ámbar / Dorado) */
.plasma-board-card.c3 {
  border-color: rgba(245, 158, 11, 0.32);
  box-shadow: 0 20px 50px -15px rgba(0, 0, 0, 0.75), 0 0 35px rgba(245, 158, 11, 0.12);
}
.plasma-board-card.c3:hover {
  border-color: rgba(245, 158, 11, 0.65);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.85), 0 0 45px rgba(245, 158, 11, 0.35);
}

.board-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.board-chip-badge {
  font-size: 0.76rem;
  font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, monospace;
  padding: 0.28rem 0.68rem;
  border-radius: 6px;
}

.board-chip-badge.classic {
  background: rgba(124, 58, 237, 0.2);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.35);
}

.board-chip-badge.s3 {
  background: rgba(6, 182, 212, 0.18);
  color: #67e8f9;
  border: 1px solid rgba(6, 182, 212, 0.4);
}

.board-chip-badge.c3 {
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.board-badge-pill-sub {
  font-size: 0.72rem;
  font-weight: 600;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
}

.board-card-preview {
  width: 100%;
  height: 220px;
  border-radius: 16px;
  background: #090518;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  margin-bottom: 1.35rem;
}

.board-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  border-radius: 14px;
  transition: transform 0.4s ease;
}

.plasma-board-card:hover .board-thumb-img {
  transform: scale(1.05);
}

.board-card-body {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.board-card-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 0.65rem;
  letter-spacing: -0.015em;
}

.board-card-desc {
  font-size: 0.88rem;
  line-height: 1.55;
  color: #94a3b8;
  margin-bottom: 1.2rem;
  min-height: 4em;
}

.board-card-specs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.bspec {
  font-size: 0.74rem;
  font-weight: 600;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.22rem 0.6rem;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, monospace;
}

.board-card-footer {
  margin-top: auto;
}

.board-btn-launch {
  display: block;
  width: 100%;
  text-align: center;
  padding: 0.78rem 1rem;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.22s ease;
}

.board-btn-launch.classic-btn {
  background: rgba(124, 58, 237, 0.25);
  border: 1px solid rgba(168, 85, 247, 0.4);
  color: #f1f5f9;
}
.board-btn-launch.classic-btn:hover {
  background: #8b5cf6;
  border-color: #c084fc;
  color: #ffffff;
  box-shadow: 0 0 24px rgba(168, 85, 247, 0.55);
}

.board-btn-launch.s3-btn {
  background: rgba(6, 182, 212, 0.2);
  border: 1px solid rgba(6, 182, 212, 0.45);
  color: #f1f5f9;
}
.board-btn-launch.s3-btn:hover {
  background: #06b6d4;
  border-color: #67e8f9;
  color: #020617;
  box-shadow: 0 0 24px rgba(6, 182, 212, 0.55);
}

.board-btn-launch.c3-btn {
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #f1f5f9;
}
.board-btn-launch.c3-btn:hover {
  background: #f59e0b;
  border-color: #fcd34d;
  color: #020617;
  box-shadow: 0 0 24px rgba(245, 158, 11, 0.55);
}

/* =============================================================================
   SECCIÓN: CONSOLA DE ESTUDIO (ESP REICON STUDIO WORKSTATION)
   ============================================================================= */
.plasma-studio-section {
  width: 100%;
  max-width: 1240px;
  margin: 5rem auto 4rem auto;
  padding: 0 2rem;
  position: relative;
  z-index: 2;
}

/* =============================================================================
   VENTANA ESTUDIO INTERACTIVO (ESP REICON STUDIO WORKSTATION)
   ============================================================================= */
.plasma-studio-window {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  background: rgba(13, 8, 28, 0.85);
  border: 1px solid rgba(168, 85, 247, 0.32);
  border-radius: 20px;
  box-shadow: 0 25px 70px -15px rgba(0, 0, 0, 0.85), 0 0 50px rgba(124, 58, 237, 0.22);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  overflow: hidden;
  position: relative;
}

.studio-window-header {
  height: 46px;
  background: rgba(22, 13, 46, 0.95);
  border-bottom: 1px solid rgba(168, 85, 247, 0.18);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
}

.studio-window-controls {
  display: flex;
  align-items: center;
  gap: 7px;
}

.window-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
}

.window-dot.red { background-color: #ef4444; }
.window-dot.yellow { background-color: #f59e0b; }
.window-dot.green { background-color: #10b981; }

.studio-window-title {
  display: flex;
  align-items: center;
}

.studio-tab.active {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(124, 58, 237, 0.25);
  border: 1px solid rgba(168, 85, 247, 0.3);
  padding: 0.25rem 0.85rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.studio-window-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: #a7f3d0;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
}

.status-live-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulseLive 2s infinite ease-in-out;
}

@keyframes pulseLive {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.studio-window-body {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  min-height: 360px;
  background: #090514;
}

/* Panel Izquierdo: Código */
.studio-code-pane {
  display: flex;
  padding: 1.35rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.88rem;
  line-height: 1.7;
  overflow-x: auto;
  border-right: 1px solid rgba(168, 85, 247, 0.16);
  background: rgba(10, 6, 22, 0.85);
}

.code-line-numbers {
  display: flex;
  flex-direction: column;
  padding-right: 1.15rem;
  user-select: none;
  color: #475569;
  text-align: right;
  border-right: 1px solid rgba(168, 85, 247, 0.1);
  margin-right: 1.15rem;
}

.code-content {
  margin: 0;
  color: #f1f5f9;
}

.tok-kw { color: #f43f5e; font-weight: 600; }
.tok-str { color: #34d399; }
.tok-fn { color: #60a5fa; font-weight: 600; }
.tok-type { color: #c084fc; font-weight: 600; }
.tok-num { color: #fbbf24; }
.tok-obj { color: #e879f9; }
.tok-const { color: #38bdf8; font-weight: 600; }

/* Panel Derecho: Hardware ESP32 en Vivo (Limpio, Sin Letras) */
.studio-hardware-pane {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: #110f1d;
  position: relative;
  overflow: hidden;
}

.studio-hardware-glow {
  position: absolute;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.22) 0%, rgba(16, 185, 129, 0.1) 45%, transparent 70%);
  filter: blur(40px);
  pointer-events: none;
}

.studio-esp32-img {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 380px;
  height: auto;
  border-radius: 18px;
  filter: drop-shadow(0 15px 35px rgba(0, 0, 0, 0.75));
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  animation: floatEsp32Studio 5s ease-in-out infinite alternate;
}

@keyframes floatEsp32Studio {
  0% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-6px) rotate(-0.5deg); }
  100% { transform: translateY(0px) rotate(0deg); }
}

.studio-esp32-img:hover {
  transform: translateY(-8px) scale(1.03);
}

.studio-window-footer {
  height: 42px;
  background: rgba(14, 8, 30, 0.95);
  border-top: 1px solid rgba(168, 85, 247, 0.16);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  gap: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.8rem;
}

.footer-prompt {
  color: #a855f7;
  font-weight: 700;
}

.footer-log {
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.studio-btn-inspect {
  color: #c084fc;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.82rem;
  white-space: nowrap;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  background: rgba(124, 58, 237, 0.15);
  border: 1px solid rgba(168, 85, 247, 0.3);
  transition: all 0.2s ease;
}

.studio-btn-inspect:hover {
  background: rgba(124, 58, 237, 0.35);
  color: #ffffff;
}

.studio-window-footer {
  height: 42px;
  background: rgba(14, 8, 30, 0.95);
  border-top: 1px solid rgba(168, 85, 247, 0.16);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  gap: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.8rem;
}

.footer-prompt {
  color: #a855f7;
  font-weight: 700;
}

.footer-log {
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.studio-btn-inspect {
  color: #c084fc;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.82rem;
  white-space: nowrap;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  background: rgba(124, 58, 237, 0.15);
  border: 1px solid rgba(168, 85, 247, 0.3);
  transition: all 0.2s ease;
}

.studio-btn-inspect:hover {
  background: rgba(124, 58, 237, 0.35);
  color: #ffffff;
}

/* =============================================================================
   SECCIÓN DE CIRCUITOS LISTOS (PRESETS INTERACTIVOS)
   ============================================================================= */
.plasma-presets-section {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1240px;
  padding: 5rem 2rem 3rem 2rem;
  margin: 0 auto;
}

.section-header-wrap {
  text-align: center;
  max-width: 760px;
  margin: 0 auto 3rem auto;
}

.section-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #c084fc;
  margin-bottom: 0.75rem;
}

.section-title {
  font-size: clamp(2rem, 3.2vw, 2.75rem);
  font-weight: 800;
  color: #ffffff;
  line-height: 1.15;
  margin-bottom: 1rem;
}

.section-subtitle {
  font-size: 1.05rem;
  line-height: 1.6;
  color: #94a3b8;
}

.plasma-presets-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.35rem;
  width: 100%;
}

.preset-card-interactive {
  background: rgba(18, 11, 38, 0.65);
  border: 1px solid rgba(168, 85, 247, 0.22);
  border-radius: 20px;
  padding: 1.6rem 1.4rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.25rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.preset-card-interactive:hover {
  background: rgba(28, 16, 56, 0.85);
  border-color: rgba(168, 85, 247, 0.55);
  transform: translateY(-5px);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6), 0 0 35px rgba(124, 58, 237, 0.35);
}

.preset-card-icon {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preset-card-icon.oled { background: rgba(56, 189, 248, 0.15); border: 1px solid rgba(56, 189, 248, 0.35); color: #38bdf8; }
.preset-card-icon.cam { background: rgba(244, 63, 94, 0.15); border: 1px solid rgba(244, 63, 94, 0.35); color: #f43f5e; }
.preset-card-icon.tft { background: rgba(168, 85, 247, 0.15); border: 1px solid rgba(168, 85, 247, 0.35); color: #c084fc; }
.preset-card-icon.sleep { background: rgba(16, 185, 129, 0.15); border: 1px solid rgba(16, 185, 129, 0.35); color: #10b981; }

.preset-card-tags {
  display: flex;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.ptag {
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
}

.preset-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.45rem;
}

.preset-card-desc {
  font-size: 0.86rem;
  line-height: 1.55;
  color: #94a3b8;
}

.preset-card-footer {
  padding-top: 0.85rem;
  border-top: 1px solid rgba(168, 85, 247, 0.15);
}

.preset-launch-btn {
  font-size: 0.84rem;
  font-weight: 700;
  color: #c084fc;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: gap 0.2s ease;
}

.preset-card-interactive:hover .preset-launch-btn {
  color: #ffffff;
  gap: 0.6rem;
}

/* =============================================================================
   TRES PILARES TECNOLÓGICOS
   ============================================================================= */
.plasma-pillars-section {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1240px;
  padding: 3rem 2rem 5rem 2rem;
  margin: 0 auto;
}

.plasma-pillars-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.75rem;
  width: 100%;
}

.plasma-pillar-card {
  background: rgba(18, 11, 38, 0.6);
  border: 1px solid rgba(168, 85, 247, 0.22);
  border-radius: 22px;
  padding: 2.2rem 1.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
  transition: all 0.28s ease;
}

.plasma-pillar-card:hover {
  background: rgba(28, 16, 56, 0.8);
  border-color: rgba(168, 85, 247, 0.5);
  transform: translateY(-4px);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.5), 0 0 35px rgba(124, 58, 237, 0.28);
}

.plasma-pillar-icon-box {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(124, 58, 237, 0.25);
  border: 1px solid rgba(168, 85, 247, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.4rem;
}

.plasma-pillar-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #ffffff;
}

.plasma-pillar-desc {
  font-size: 0.94rem;
  line-height: 1.65;
  color: #94a3b8;
}

/* =============================================================================
   BANNER FINAL CALL TO ACTION
   ============================================================================= */
.plasma-bottom-cta {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1240px;
  padding: 0 2rem 6rem 2rem;
  margin: 0 auto;
}

.bottom-cta-card {
  position: relative;
  background: linear-gradient(135deg, rgba(30, 16, 62, 0.9) 0%, rgba(16, 9, 36, 0.95) 100%);
  border: 1px solid rgba(168, 85, 247, 0.4);
  border-radius: 28px;
  padding: 4rem 2rem;
  text-align: center;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), 0 0 50px rgba(124, 58, 237, 0.25);
}

.bottom-cta-glow {
  position: absolute;
  top: -150px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 300px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.35) 0%, transparent 70%);
  filter: blur(60px);
  pointer-events: none;
}

.bottom-cta-title {
  font-size: clamp(2rem, 3.5vw, 2.85rem);
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 1rem;
  position: relative;
}

.bottom-cta-desc {
  font-size: 1.1rem;
  color: #94a3b8;
  max-width: 620px;
  margin: 0 auto 2.5rem auto;
  line-height: 1.65;
  position: relative;
}

.bottom-cta-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  position: relative;
}

/* =============================================================================
   ADAPTABILIDAD RESPONSIVA PARA TODAS LAS PANTALLAS
   ============================================================================= */
@media (max-width: 1080px) {
  .plasma-hero-grid {
    gap: 2.5rem;
  }
  .plasma-boards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .plasma-presets-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 960px) {
  .plasma-hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 2.5rem;
  }
  .plasma-hero-left {
    align-items: center;
    text-align: center;
  }
  .plasma-hero-desc {
    margin-left: auto;
    margin-right: auto;
  }
  .plasma-cta-group {
    justify-content: center;
  }
  .plasma-features-strip {
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
  }
  .plasma-mockup-cards-row {
    grid-template-columns: 1fr;
  }
  .plasma-boards-grid {
    grid-template-columns: 1fr;
  }
  .studio-window-body {
    grid-template-columns: 1fr;
  }
  .studio-code-pane {
    border-right: none;
    border-bottom: 1px solid rgba(168, 85, 247, 0.16);
  }
  .plasma-pillars-grid {
    grid-template-columns: 1fr;
  }
  .plasma-hero-section {
    padding: 2.5rem 1.5rem 2rem 1.5rem;
  }
}

@media (max-width: 640px) {
  .plasma-hero-title {
    font-size: 2.2rem;
  }
  .plasma-features-strip {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  .plasma-presets-grid {
    grid-template-columns: 1fr;
  }
  .plasma-cta-group {
    flex-direction: column;
    width: 100%;
  }
  .plasma-btn-primary, .plasma-btn-capsule {
    width: 100%;
    justify-content: center;
  }
  .bottom-cta-card {
    padding: 3rem 1.25rem;
  }
  .bottom-cta-buttons {
    flex-direction: column;
    width: 100%;
  }
}



/* =============================================================================
   LABORATORIO ESP REICON - IDENTIDAD VISUAL PLASMA Y OPTIMIZACIÓN DE ESPACIO
   ============================================================================= */
.lab-page-body {
  background-color: #080415 !important;
  color: #f8fafc;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow: hidden;
  position: relative;
  height: 100vh;
}

.lab-app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

.lab-navbar {
  height: 64px !important;
  min-height: 64px;
  max-height: 64px;
  background: rgba(8, 4, 21, 0.65) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border-bottom: 1px solid rgba(168, 85, 247, 0.16) !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(0.75rem, 2vw, 1.75rem) !important;
  gap: 0.75rem;
  z-index: 100;
}

.project-actions-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.plasma-btn-header {
  background: rgba(28, 16, 52, 0.75);
  border: 1px solid rgba(168, 85, 247, 0.35);
  color: #cbd5e1;
  border-radius: 9999px;
  padding: 0.42rem 0.95rem;
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 14px rgba(124, 58, 237, 0.18);
  white-space: nowrap;
  text-decoration: none;
}

.plasma-btn-header:hover {
  background: rgba(45, 24, 82, 0.9);
  border-color: #c084fc;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.4);
}

.plasma-btn-header-primary {
  background: linear-gradient(135deg, #7c3aed 0%, #9333ea 100%);
  border-color: #c084fc;
  color: #ffffff;
  box-shadow: 0 0 18px rgba(124, 58, 237, 0.4);
}

.plasma-btn-header-primary:hover {
  background: linear-gradient(135deg, #6d28d9 0%, #7e22ce 100%);
  border-color: #e9d5ff;
  box-shadow: 0 0 26px rgba(168, 85, 247, 0.6);
}

.navbar-sim-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-plasma-run {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: 1px solid #34d399;
  border-radius: 9999px;
  padding: 0.42rem 1.15rem;
  font-size: 0.84rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.35);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-plasma-run:hover:not(:disabled) {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-1px);
  box-shadow: 0 0 24px rgba(16, 185, 129, 0.55);
}

.btn-plasma-control {
  background: rgba(28, 16, 52, 0.65);
  border: 1px solid rgba(168, 85, 247, 0.3);
  color: #e2e8f0;
  border-radius: 9999px;
  padding: 0.42rem 0.95rem;
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-plasma-control:hover:not(:disabled) {
  background: rgba(45, 24, 82, 0.85);
  border-color: #c084fc;
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-plasma-control:disabled, .btn-plasma-run:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.board-selector-pill .mcu-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  display: inline-block;
  margin-right: 4px;
}

/* Modal de Carga de Proyectos en la Nube */
.cloud-load-modal-card {
  width: 92%;
  max-width: 640px;
  background: rgba(14, 9, 28, 0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(168, 85, 247, 0.35);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85), 0 0 40px rgba(124, 58, 237, 0.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 85vh;
}

.cloud-load-modal-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  flex: 1;
}

.cloud-load-search-bar {
  background: rgba(20, 11, 40, 0.7);
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: 12px;
  display: flex;
  align-items: center;
  padding: 0.6rem 0.85rem;
  gap: 0.6rem;
}

.cloud-load-search-bar input {
  background: transparent;
  border: none;
  outline: none;
  color: #f8fafc;
  font-size: 0.88rem;
  width: 100%;
}

.cloud-load-search-bar input::placeholder {
  color: #94a3b8;
}

.cloud-load-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
  max-height: 440px;
  padding-right: 4px;
}

.cloud-load-item {
  background: rgba(28, 16, 52, 0.6);
  border: 1px solid rgba(168, 85, 247, 0.2);
  border-radius: 14px;
  padding: 0.95rem 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  transition: all 0.2s ease;
}

.cloud-load-item:hover {
  background: rgba(45, 24, 82, 0.8);
  border-color: rgba(192, 132, 252, 0.45);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.25);
}

.cloud-load-info {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.cloud-load-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cloud-load-meta {
  font-size: 0.76rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.cloud-load-stat-chip {
  background: rgba(124, 58, 237, 0.22);
  border: 1px solid rgba(168, 85, 247, 0.35);
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  color: #e9d5ff;
  font-size: 0.72rem;
  font-weight: 600;
}

.btn-cloud-load-action {
  background: linear-gradient(135deg, #7c3aed 0%, #9333ea 100%);
  color: #ffffff;
  border: 1px solid #c084fc;
  border-radius: 9999px;
  padding: 0.45rem 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  box-shadow: 0 0 14px rgba(124, 58, 237, 0.3);
}

.btn-cloud-load-action:hover {
  background: linear-gradient(135deg, #6d28d9 0%, #7e22ce 100%);
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.5);
  transform: translateY(-1px);
}

.cloud-load-empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: #94a3b8;
}

.cloud-load-empty-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  display: block;
}

/* Resaltado de pines activos en la placa ESP32 */
.pin-pad.pin-pad-active-high .pad-ring {
  box-shadow: 0 0 10px #38bdf8, 0 0 18px rgba(56, 189, 248, 0.65) !important;
  border-color: #38bdf8 !important;
  background-color: #0284c7 !important;
}

/* Toast de Notificación Global */
.app-toast-notification {
  position: fixed;
  bottom: 48px;
  right: 24px;
  background: rgba(18, 10, 36, 0.95);
  border: 1px solid rgba(168, 85, 247, 0.45);
  border-radius: 12px;
  padding: 0.75rem 1.25rem;
  color: #f8fafc;
  font-size: 0.86rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  z-index: 99999;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7), 0 0 24px rgba(124, 58, 237, 0.35);
  backdrop-filter: blur(16px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.app-toast-notification.toast-warning {
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7), 0 0 24px rgba(245, 158, 11, 0.25);
}

@media (max-width: 1180px) {
  .lab-navbar {
    padding: 0 0.75rem !important;
    gap: 0.4rem;
  }
  .plasma-btn-header span, .btn-plasma-control span:not(.btn-icon), .btn-plasma-run span:not(.btn-icon) {
    display: inline;
  }
}

@media (max-width: 900px) {
  .project-actions-group .plasma-btn-header span {
    display: none;
  }
  .navbar-sim-controls .btn-plasma-control span:not(.btn-icon) {
    display: none;
  }
}
