/* ================================================================
   METRIKTEK CONTROL INDUSTRIAL — DARK THEME DESIGN SYSTEM V1
   Identidad visual oscura para https://app.metriktek.com
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Space+Grotesk:wght@400;500;600;700&family=SF+Mono:wght@400;600&display=swap');

:root {
    /* Paleta Principal — METRIK Brand Blue */
    --primary:       #0284c7;
    --primary-hover: #0369a1;
    --primary-light: rgba(2, 132, 199, 0.18);
    --primary-glow:  #38bdf8;
    --primary-dark:  #075985;

    /* Superficies Dark Mode */
    --bg:            #090d16;
    --surface:       #0f172a;
    --surface-light: #1e293b;
    --card:          #131d31;
    --card-hover:    #182642;
    --modal-bg:      #0f172a;

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

    /* Estados Industriales */
    --success:       #10b981;
    --success-bg:    rgba(16, 185, 129, 0.15);
    --warning:       #f59e0b;
    --warning-bg:    rgba(245, 158, 11, 0.15);
    --danger:        #ef4444;
    --danger-bg:     rgba(239, 68, 68, 0.15);
    --error:         #ef4444;
    --info:          #38bdf8;
    --info-bg:       rgba(56, 189, 248, 0.15);

    /* Bordes y Divisiones */
    --border:        rgba(255, 255, 255, 0.08);
    --border-light:  rgba(255, 255, 255, 0.04);
    --border-focus:  #38bdf8;

    /* Sombras Dark */
    --shadow-sm:     0 1px 2px rgba(0,0,0,0.4);
    --shadow:        0 4px 12px rgba(0,0,0,0.5);
    --shadow-md:     0 8px 24px rgba(0,0,0,0.6);
    --shadow-lg:     0 12px 36px rgba(0,0,0,0.7);
    --shadow-xl:     0 20px 48px rgba(0,0,0,0.8);

    /* Radios */
    --radius-sm:     8px;
    --radius:        12px;
    --radius-lg:     16px;
    --radius-xl:     20px;
    --radius-full:   9999px;

    /* Transiciones */
    --transition:    200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms ease;

    /* Tipografía */
    --font-heading:  'Space Grotesk', 'Inter', system-ui, sans-serif;
    --font-body:     'Inter', system-ui, sans-serif;
    --font-mono:     'SF Mono', 'Fira Code', 'Consolas', monospace;
}

/* ---- Reset y Base ---- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.material-symbols-outlined {
    font-family: 'Material Symbols Outlined' !important;
    font-weight: normal;
    font-style: normal;
    font-size: 20px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
}
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- Header METRIKTEK ---- */
.nor-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    background: rgba(15, 23, 42, 0.95);
}
.nor-header-logo {
    height: 36px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
}
.nor-header-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--primary-glow);
    letter-spacing: -0.3px;
}
.nor-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ---- Footer METRIKTEK ---- */
.nor-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    text-align: center;
    padding: 20px 24px;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    margin-top: auto;
}
.nor-footer strong { color: var(--text); font-weight: 700; }

/* ---- Contenedor Principal ---- */
.nor-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    flex: 1;
}

/* ---- Tarjetas (Cards) Dark ---- */
.wcard, .card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition);
}
.wcard:hover { 
    box-shadow: var(--shadow); 
    border-color: rgba(56, 189, 248, 0.25); 
}
.wcard-head {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}
.wcard-head .material-symbols-outlined {
    font-size: 18px;
    color: var(--primary-glow);
}
.wcard-body { flex: 1; }
.wcard-grow { display: flex; flex-direction: column; }

/* ---- Grids ---- */
.tech-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* ---- Tablas RAW Dark ---- */
.raw-table { width: 100%; font-size: 11.5px; border-collapse: collapse; }
.raw-table td {
    padding: 7px 10px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
}
.raw-table td:last-child {
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 11px;
    text-align: right;
}
.raw-table tr:last-child td { border-bottom: none; }
.raw-table .mono { font-family: var(--font-mono); }
.raw-table .editable-cell {
    cursor: pointer;
    transition: background var(--transition);
    border-radius: 4px;
    color: var(--primary-glow) !important;
}
.raw-table .editable-cell:hover { 
    background: var(--primary-light); 
    color: #fff !important;
}

/* ---- Botones Dark Theme ---- */
.btn-primary {
    background: var(--primary);
    color: var(--on-primary);
    border: none;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-body);
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
}
.btn-primary:hover { 
    background: var(--primary-hover); 
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.6); 
    transform: translateY(-1px); 
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-c {
    background: var(--surface-light);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
}
.btn-c:hover { background: #334155; border-color: var(--primary); }

.btn-maint-toggle {
    background: var(--surface-light);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    justify-content: center;
}
.btn-maint-toggle:hover { 
    background: var(--primary-light); 
    border-color: var(--primary); 
    color: var(--primary-glow); 
}
.btn-maint-toggle.active {
    background: var(--warning-bg);
    border-color: var(--warning);
    color: var(--warning);
}

/* ---- Badges ---- */
.badge-operador {
    background: rgba(2, 132, 199, 0.15) !important;
    color: #38bdf8 !important;
    border: 1px solid rgba(56, 189, 248, 0.35) !important;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-ingeniero {
    background: rgba(245, 158, 11, 0.15) !important;
    color: #fbbf24 !important;
    border: 1px solid rgba(251, 191, 36, 0.35) !important;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-supervisor {
    background: rgba(168, 85, 247, 0.15) !important;
    color: #c084fc !important;
    border: 1px solid rgba(192, 132, 252, 0.35) !important;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-admin {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #f87171 !important;
    border: 1px solid rgba(248, 113, 113, 0.35) !important;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge {
    background: var(--primary-light);
    color: var(--primary-glow);
    border: 1px solid rgba(56, 189, 248, 0.3);
    font-size: 0.68rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ================================================================
   DISEÑO RESPONSIVO INDUSTRIAL MULTICANAL (1 a 4 ZONAS)
   ================================================================ */

.temp-channels-grid {
    display: grid;
    gap: 16px;
    margin-bottom: 16px;
    width: 100%;
}

/* Alineación simétrica a 100% del contenedor con los demás elementos */
.temp-channels-grid.zones-1 {
    grid-template-columns: 1fr;
}

.temp-channels-grid.zones-2 {
    grid-template-columns: repeat(2, 1fr);
}

.temp-channels-grid.zones-3 {
    grid-template-columns: repeat(3, 1fr);
}

.temp-channels-grid.zones-4 {
    grid-template-columns: repeat(4, 1fr);
}

.temp-channel-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: clamp(14px, 1.6vw, 18px);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.temp-channel-card:hover {
    border-color: rgba(56, 189, 248, 0.3);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.temp-pv-val {
    font-size: clamp(2.4rem, 4vw, 3.2rem);
    font-weight: 800;
    font-family: var(--font-mono);
    color: #f97316;
    letter-spacing: 0.5px;
    line-height: 1.1;
}

.temp-summary-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    background: #090d16;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    text-align: center;
}

.temp-summary-val {
    font-size: clamp(1.05rem, 1.5vw, 1.25rem);
    font-weight: 700;
    font-family: var(--font-mono);
}

/* Media Queries para Portátiles, Tablets y Pantallas Pequeñas */
@media (max-width: 1200px) {
    .temp-channels-grid.zones-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {
    .nor-container {
        padding: 16px;
    }
    .panel-bar {
        flex-wrap: wrap;
        gap: 10px;
    }
    .temp-channels-grid.zones-3 {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    }
}

@media (max-width: 768px) {
    .temp-channels-grid.zones-2,
    .temp-channels-grid.zones-3,
    .temp-channels-grid.zones-4 {
        grid-template-columns: 1fr !important;
    }
    .nor-header {
        padding: 10px 16px;
        flex-wrap: wrap;
    }
    .nor-header-right {
        width: 100%;
        justify-content: space-between;
        margin-top: 6px;
    }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.spin {
    display: inline-block;
    animation: spin 1s linear infinite;
}


