/* ==========================================================================
   ESTILOS COMPLEMENTARIOS BOOTSTRAP 5.3 - Control de Aula (ESP32)
   Integra los componentes y clases de estado de panel.js con Bootstrap 5
   ========================================================================== */

:root,
html[data-theme="claro"] {
    color-scheme: light;

    --ui-scale: 1;
    --card-padding: 20px;
    --grid-gap: 16px;

    /* Superficies - Bootstrap 5 Light (por defecto) */
    --bg-base: #f8f9fa;
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f8f9fa;
    --bg-input: #ffffff;
    --bg-subtle: #f1f3f5;
    --bg-subtle-hover: #e9ecef;
    --border-subtle: #dee2e6;

    --select-bg: #ffffff;
    --select-color: #212529;
    --select-border: #dee2e6;

    /* Textos - Bootstrap 5 Light */
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #6c757d;
    --text-on-primary: #ffffff;

    /* Acento por defecto: Bootstrap Primary Blue */
    --color-primary: #0d6efd;
    --color-primary-hover: #0b5ed7;
    --color-primary-glow: rgba(13, 110, 253, 0.25);
    --color-primary-bg: rgba(13, 110, 253, 0.1);
    --border-highlight: rgba(13, 110, 253, 0.45);
    --text-gold: #0d6efd;

    /* Estados Bootstrap 5 */
    --color-success: #198754;
    --color-success-bg: #d1e7dd;
    --color-success-glow: rgba(25, 135, 84, 0.2);
    --text-success-alert: #0f5132;

    --color-danger: #dc3545;
    --color-danger-bg: #f8d7da;
    --color-danger-glow: rgba(220, 53, 69, 0.2);
    --text-danger-alert: #842029;

    --color-warning: #ffc107;
    --color-warning-bg: #fff3cd;

    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.5rem;
    --radius-full: 50rem;

    --shadow-card: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-glow: none;

    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif;
    --font-mono: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* --------------------------------------------------------------------------
   TEMA DE FONDO: MODO OSCURO (BOOTSTRAP 5 DARK)
   -------------------------------------------------------------------------- */
html[data-theme="oscuro"] {
    color-scheme: dark;

    --bg-base: #181b1f;
    --bg-surface: #212529;
    --bg-card: #212529;
    --bg-card-hover: #2b3035;
    --bg-input: #2b3035;
    --bg-subtle: #2b3035;
    --bg-subtle-hover: #343a40;
    --border-subtle: #373b3e;

    --select-bg: #2b3035;
    --select-color: #dee2e6;
    --select-border: #495057;

    --text-primary: #dee2e6;
    --text-secondary: #adb5bd;
    --text-muted: #868e96;
    --text-on-primary: #ffffff;

    --color-primary: #0d6efd;
    --color-primary-hover: #0b5ed7;
    --color-primary-glow: rgba(13, 110, 253, 0.25);
    --color-primary-bg: rgba(13, 110, 253, 0.15);
    --border-highlight: rgba(13, 110, 253, 0.5);
    --text-gold: #6ea8fe;

    --color-success: #198754;
    --color-success-bg: rgba(25, 135, 84, 0.2);
    --text-success-alert: #75b798;

    --color-danger: #dc3545;
    --color-danger-bg: rgba(220, 53, 69, 0.2);
    --text-danger-alert: #ea868f;

    --color-warning-bg: rgba(255, 193, 7, 0.2);

    --shadow-card: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.25);
}

/* --------------------------------------------------------------------------
   PALETAS DE COLOR PRIMARIO (ESTILO BOOTSTRAP 5)
   -------------------------------------------------------------------------- */
html[data-accent="azul"] {
    --color-primary: #0d6efd;
    --color-primary-hover: #0b5ed7;
    --color-primary-glow: rgba(13, 110, 253, 0.25);
    --color-primary-bg: rgba(13, 110, 253, 0.1);
    --border-highlight: rgba(13, 110, 253, 0.45);
    --text-gold: #0d6efd;
}
html[data-theme="oscuro"][data-accent="azul"] { --text-gold: #6ea8fe; }

html[data-accent="esmeralda"] {
    --color-primary: #198754;
    --color-primary-hover: #157347;
    --color-primary-glow: rgba(25, 135, 84, 0.25);
    --color-primary-bg: rgba(25, 135, 84, 0.1);
    --border-highlight: rgba(25, 135, 84, 0.45);
    --text-gold: #198754;
}
html[data-theme="oscuro"][data-accent="esmeralda"] { --text-gold: #75b798; }

html[data-accent="violeta"] {
    --color-primary: #6610f2;
    --color-primary-hover: #520dc2;
    --color-primary-glow: rgba(102, 16, 242, 0.25);
    --color-primary-bg: rgba(102, 16, 242, 0.1);
    --border-highlight: rgba(102, 16, 242, 0.45);
    --text-gold: #6610f2;
}
html[data-theme="oscuro"][data-accent="violeta"] { --text-gold: #a370f7; }

html[data-accent="coral"] {
    --color-primary: #dc3545;
    --color-primary-hover: #bb2d3b;
    --color-primary-glow: rgba(220, 53, 69, 0.25);
    --color-primary-bg: rgba(220, 53, 69, 0.1);
    --border-highlight: rgba(220, 53, 69, 0.45);
    --text-gold: #dc3545;
}
html[data-theme="oscuro"][data-accent="coral"] { --text-gold: #ea868f; }

html[data-accent="cian"] {
    --color-primary: #0dcaf0;
    --color-primary-hover: #0aa2c0;
    --color-primary-glow: rgba(13, 202, 240, 0.25);
    --color-primary-bg: rgba(13, 202, 240, 0.12);
    --border-highlight: rgba(13, 202, 240, 0.45);
    --text-gold: #0aa2c0;
}
html[data-theme="oscuro"][data-accent="cian"] { --text-gold: #6edff6; }

html[data-accent="dorado"] {
    --color-primary: #6c757d;
    --color-primary-hover: #5c636a;
    --color-primary-glow: rgba(108, 117, 125, 0.25);
    --color-primary-bg: rgba(108, 117, 125, 0.12);
    --border-highlight: rgba(108, 117, 125, 0.45);
    --text-gold: #495057;
}
html[data-theme="oscuro"][data-accent="dorado"] { --text-gold: #adb5bd; }

/* --------------------------------------------------------------------------
   TIPOGRAFÍAS, DENSIDAD Y ACCESIBILIDAD
   -------------------------------------------------------------------------- */
html[data-font="sans"]  { --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
html[data-font="serif"] { --font-sans: Georgia, Cambria, "Times New Roman", Times, serif; }
html[data-font="mono"]  { --font-sans: SFMono-Regular, Menlo, Monaco, Consolas, monospace; }

html[data-density="comoda"] {
    --card-padding: 20px;
    --grid-gap: 16px;
}
html[data-density="compacta"] {
    --card-padding: 14px;
    --grid-gap: 12px;
}

html[data-contrast="alto"] {
    --border-subtle: #495057;
}
html[data-theme="oscuro"][data-contrast="alto"] {
    --border-subtle: #adb5bd;
}

html[data-motion="reducido"] *,
html[data-motion="reducido"] *::before,
html[data-motion="reducido"] *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: calc(15px * var(--ui-scale));
    min-height: 100vh;
    line-height: 1.5;
}

/* --------------------------------------------------------------------------
   LAYOUT PRINCIPAL DEL PANEL Y CABECERA NAVBAR
   -------------------------------------------------------------------------- */
.panel-contenedor {
    max-width: 1180px;
    margin: 0 auto;
    padding: 16px 14px 48px;
}

.cabecera-principal {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-card);
}

.marca-titulo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.marca-icono {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.marca-info h1 {
    font-size: calc(18px * var(--ui-scale));
    font-weight: 700;
    line-height: 1.2;
    margin: 0;
}

.marca-info span {
    font-size: calc(12px * var(--ui-scale));
    color: var(--text-secondary);
}

.cabecera-acciones {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

/* Indicador ESP32 Online / Offline (Bootstrap Badge Style) */
.badge-conexion {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: calc(11.5px * var(--ui-scale));
    font-weight: 700;
    text-transform: uppercase;
    border: 1px solid var(--border-subtle);
}

.badge-conexion.online {
    background-color: var(--color-success-bg);
    border-color: var(--color-success);
    color: var(--text-success-alert);
}

.badge-conexion.offline {
    background-color: var(--color-danger-bg);
    border-color: var(--color-danger);
    color: var(--text-danger-alert);
}

.pulso-punto {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: currentColor;
}

/* --------------------------------------------------------------------------
   BARRA DE ESCENAS RÁPIDAS DEL AULA (1 CLIC)
   -------------------------------------------------------------------------- */
.escenas-seccion {
    margin-bottom: var(--grid-gap);
}

.escenas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.barra-escenas {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

@media (min-width: 680px) {
    .barra-escenas {
        grid-template-columns: repeat(3, 1fr);
    }
}

.btn-escena {
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    text-align: left;
    color: var(--text-primary);
    box-shadow: var(--shadow-card);
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-escena:hover {
    border-color: var(--color-primary);
    background-color: var(--bg-card-hover);
}

.btn-escena-peligro:hover {
    border-color: var(--color-danger);
}

.escena-icono {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.escena-info strong {
    display: block;
    font-size: calc(13.5px * var(--ui-scale));
    font-weight: 600;
    color: var(--text-primary);
}

.escena-info span {
    display: block;
    font-size: calc(11.5px * var(--ui-scale));
    color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   GRILLA DE CONTROLES DEL AULA (BOOTSTRAP CARDS)
   -------------------------------------------------------------------------- */
.grilla-controles {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--grid-gap);
    margin-bottom: 24px;
    align-items: stretch;
}

@media (min-width: 920px) {
    .grilla-controles {
        grid-template-columns: 1fr 1.25fr;
        align-items: start;
    }
    .tarjeta-proyector-destacada {
        grid-column: 2;
        grid-row: 1 / span 2;
    }
}

.tarjeta-control {
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: calc(var(--card-padding) * var(--ui-scale));
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 14px;
}

.control-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.control-icono-titulo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icono-dispositivo {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    flex-shrink: 0;
}

.icono-dispositivo.luces-on {
    background-color: var(--color-warning-bg);
    color: #b45309;
    border-color: #ffc107;
}
html[data-theme="oscuro"] .icono-dispositivo.luces-on {
    color: #ffc107;
}

.icono-dispositivo.aire-on,
.icono-dispositivo.proyector-on {
    background-color: var(--color-primary-bg);
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.estado-pastilla {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: calc(11px * var(--ui-scale));
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
}

.estado-pastilla.on {
    background-color: var(--color-success);
    color: #ffffff;
}

.estado-pastilla.off {
    background-color: var(--bg-subtle);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

.control-botones {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* --------------------------------------------------------------------------
   SUBBLOQUES Y OPCIONES DE CONTROL (PROYECTOR / FUENTES / VOLUMEN)
   -------------------------------------------------------------------------- */
.subbloque-control {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.subbloque-label {
    font-size: calc(11.5px * var(--ui-scale));
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.grilla-botones-opciones {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.btn-opcion-control {
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    color: var(--text-primary);
    font-size: calc(13px * var(--ui-scale));
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s ease;
}

.btn-opcion-control:hover {
    background-color: var(--bg-subtle);
    border-color: var(--color-primary);
}

.btn-opcion-control.activo {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: #ffffff;
}

/* Control de Volumen del Proyector */
.proyector-volumen-fila {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
}

.btn-vol-mute,
.btn-vol-step {
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
}

.btn-vol-mute:hover,
.btn-vol-step:hover {
    background-color: var(--bg-subtle-hover);
    border-color: var(--color-primary);
}

.btn-vol-mute.activo {
    background-color: var(--color-danger);
    color: #ffffff;
    border-color: var(--color-danger);
}

.btn-vol-mute.activo .icono-parlante {
    display: none;
}

.btn-vol-mute.activo .icono-parlante-mute {
    display: inline-block !important;
}

.slider-volumen-contenedor {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 0 4px;
}

.proyector-volumen-pills {
    display: flex;
    gap: 8px;
    margin-top: 2px;
}

.btn-vol-pill {
    flex: 1;
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-size: calc(12px * var(--ui-scale));
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
}

.btn-vol-pill:hover {
    background-color: var(--bg-subtle);
    color: var(--text-primary);
}

.btn-vol-pill.activo {
    background-color: var(--color-primary);
    color: #ffffff;
    border-color: var(--color-primary);
}

/* Chips informativos de Hardware */
.hw-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-size: calc(11px * var(--ui-scale));
    font-weight: 600;
}

.hw-chip-star {
    background-color: rgba(13, 202, 240, 0.15);
    color: #055160;
    border: 1px solid rgba(13, 202, 240, 0.4);
}
html[data-theme="oscuro"] .hw-chip-star {
    color: #6edff6;
}

.hw-chip-epson {
    background-color: rgba(13, 110, 253, 0.12);
    color: #084298;
    border: 1px solid rgba(13, 110, 253, 0.35);
}
html[data-theme="oscuro"] .hw-chip-epson {
    color: #6ea8fe;
}

/* --------------------------------------------------------------------------
   PANEL DE ADMINISTRACIÓN, TELEMETRÍA Y TABLAS BOOTSTRAP
   -------------------------------------------------------------------------- */
.admin-panel-wrapper {
    margin-top: 24px;
    border-top: 1px solid var(--border-subtle);
    padding-top: 18px;
}

.admin-toggle-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    cursor: pointer;
    margin-bottom: 14px;
}

.admin-toggle-titulo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: calc(15px * var(--ui-scale));
    font-weight: 600;
}

.barra-telemetria {
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}

@media (min-width: 768px) {
    .barra-telemetria {
        grid-template-columns: repeat(5, 1fr);
    }
}

.telemetria-item {
    display: flex;
    flex-direction: column;
}

.telemetria-item .etiqueta {
    font-size: calc(11px * var(--ui-scale));
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.telemetria-item .valor {
    font-size: calc(13.5px * var(--ui-scale));
    font-weight: 600;
    font-family: var(--font-mono);
}

.seccion-tabs.colapsado {
    display: none;
}

.tabs-navegacion {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 16px;
    overflow-x: auto;
}

.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: calc(13.5px * var(--ui-scale));
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    cursor: pointer;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--color-primary);
    background-color: var(--bg-subtle);
}

.tab-btn.activo {
    color: var(--color-primary);
    background-color: var(--bg-card);
    border-color: var(--border-subtle);
    font-weight: 600;
}

.tab-contenido {
    display: none;
}

.tab-contenido.activo {
    display: block;
}

.tarjeta-seccion {
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 18px;
}

.seccion-encabezado {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.codigo-tag {
    font-family: var(--font-mono);
    background-color: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: calc(12px * var(--ui-scale));
    color: var(--text-primary);
}

.formulario-grilla {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 12px;
}

@media (min-width: 640px) {
    .formulario-grilla {
        grid-template-columns: repeat(4, 1fr);
    }
    .col-span-2 { grid-column: span 2; }
    .col-span-4 { grid-column: span 4; }
}

.campo-grupo {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.campo-grupo label {
    font-size: calc(12.5px * var(--ui-scale));
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0;
}

/* Compatibilidad con clases de botones y alertas de panel.js */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-grande {
    padding: 10px 16px;
    font-weight: 600;
}

.btn-bloque {
    width: 100%;
}

.btn-primario {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: #ffffff;
}
.btn-primario:hover {
    background-color: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    color: #ffffff;
}

.btn-exito {
    background-color: var(--color-success);
    border-color: var(--color-success);
    color: #ffffff;
}

.btn-peligro {
    background-color: var(--color-danger);
    border-color: var(--color-danger);
    color: #ffffff;
}

.alerta {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: calc(13px * var(--ui-scale));
    margin-bottom: 12px;
}

.alerta-error {
    background-color: var(--color-danger-bg);
    border: 1px solid var(--color-danger);
    color: var(--text-danger-alert);
}

.alerta-exito {
    background-color: var(--color-success-bg);
    border: 1px solid var(--color-success);
    color: var(--text-success-alert);
}

/* --------------------------------------------------------------------------
   MODAL DE CENTRO DE CONFIGURACIÓN (BOOTSTRAP MODAL STYLE)
   -------------------------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1055;
    padding: 16px;
}

.modal-overlay.activo {
    display: flex;
}

.modal-panel {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-tabs-nav {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    background-color: var(--bg-subtle);
    border-bottom: 1px solid var(--border-subtle);
    padding: 6px 10px 0;
    gap: 4px;
}

.modal-tab-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 8px 6px;
    font-size: calc(12.5px * var(--ui-scale));
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
}

.modal-tab-btn.activo {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    font-weight: 600;
}

.modal-body-scroll {
    padding: 18px;
    overflow-y: auto;
    flex: 1;
}

.cfg-tab-pane {
    display: none;
}

.cfg-tab-pane.activo {
    display: block;
}

.pref-grupo {
    margin-bottom: 16px;
}

.pref-grupo-titulo {
    font-size: calc(11.5px * var(--ui-scale));
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pref-opciones-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.pref-opciones-grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.pref-btn {
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-size: calc(12.5px * var(--ui-scale));
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.pref-btn:hover {
    background-color: var(--bg-subtle);
}

.pref-btn.activo {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: #ffffff;
}

.color-circulo {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.color-custom-fila,
.switch-fila {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background-color: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    margin-top: 8px;
    font-size: calc(13px * var(--ui-scale));
}

.switch-fila small {
    display: block;
    font-size: calc(11.5px * var(--ui-scale));
    color: var(--text-secondary);
}

.termostato-slider-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: calc(12px * var(--ui-scale));
    color: var(--text-secondary);
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 18px;
    border-top: 1px solid var(--border-subtle);
    background-color: var(--bg-subtle);
}

/* --------------------------------------------------------------------------
   SIMULADOR ESP32
   -------------------------------------------------------------------------- */
.simulador-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 768px) {
    .simulador-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.consola-log,
.simulador-consola {
    background-color: #212529;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-family: var(--font-mono);
    font-size: calc(12px * var(--ui-scale));
    color: #f8f9fa;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* --------------------------------------------------------------------------
   RESPONSIVE MÓVILES Y TABLETS
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .cabecera-principal {
        flex-direction: column;
        align-items: stretch;
    }
    .cabecera-acciones {
        width: 100%;
        justify-content: flex-start;
        padding-top: 8px;
        border-top: 1px solid var(--border-subtle);
    }
    .grilla-controles {
        grid-template-columns: 1fr;
    }
    .pref-opciones-grid.cols-3 {
        grid-template-columns: 1fr;
    }
}
