/* ====================================================================
   CAMPUS VIRTUAL MÜRÖNTÖ - MPPD / UMBV
   SISTEMA DE DISEÑO DUAL: MODO TÁCTICO OSCURO + MODO DIURNO OPERACIONAL
   ==================================================================== */

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

:root {
    /* ====================================================================
       SISTEMA DE DISEÑO MÜRÖNTÖ — GOOGLE ANTIGRAVITY LIGHT MODE (PREDETERMINADO)
       Paleta Oficial extraída del Isotipo de Hexágonos Tecnológicos
       ==================================================================== */
    --bg-base: #f8fafc;            /* Antigravity Canvas Blanco-Gris */
    --bg-surface: #ffffff;         /* Superficie de tarjetas blanco puro */
    --bg-card: #ffffff;            /* Fondo de tarjetas */
    --bg-card-hover: #f0f7ff;      /* Sutil iluminación azul cielo en hover */
    --bg-sidebar: #ffffff;         /* Barra lateral limpia */
    --bg-input: #ffffff;

    --text-primary: #0a0f1d;       /* Negro carbón de la tipografía Müröntö */
    --text-secondary: #334155;     /* Gris oscuro de alta legibilidad */
    --text-muted: #7d99aa;         /* Gris pizarra metálico de los hexágonos */
    --text-inverse: #ffffff;

    /* Identidad cromática Müröntö */
    --muronto-blue-royal: #0052b6; /* Azul Real del hexágono primario */
    --muronto-blue-sky: #009cde;   /* Azul Cielo del hexágono intermedio */
    --muronto-cyan-light: #00ffff; /* Cian brillante del hexágono superior */
    --muronto-slate: #7d99aa;      /* Pizarra metálico neutro */

    --cyber-cyan: #0052b6;         /* Primario interactivo */
    --color-primary: #0052b6;
    --muronto-cyan: #009cde;
    --cyber-cyan-glow: rgba(0, 156, 222, 0.2);
    --gold-patria: #009cde;        /* Acento secundario (sustituye dorado por azul cielo Müröntö) */
    --gold-glow: rgba(0, 82, 182, 0.18);
    --accent-blue: #0052b6;
    --accent-sky: #009cde;
    --accent-cyan: #00d9f5;
    --accent-green: #059669;
    --accent-red: #dc2626;
    --accent-orange: #d97706;

    --border-color: #e2e8f0;
    --border-card: #e2e8f0;
    --border-focus: #0052b6;
    --shadow-soft: 0 4px 20px rgba(0, 82, 182, 0.06);
    --shadow-glow: 0 0 16px rgba(0, 156, 222, 0.18);

    --btn-primary-bg: linear-gradient(135deg, #0052b6 0%, #009cde 100%);
    --btn-primary-hover: linear-gradient(135deg, #00459e 0%, #0088c4 100%);

    --font-heading: 'Rajdhani', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* MODO OSCURO TÁCTICO MÜRÖNTÖ (CONSERVA LA PALETA DEL LOGO) */
[data-theme="dark"] {
    --bg-base: #060d19;            /* Azul noche profundo */
    --bg-surface: #0c182d;         /* Azul marino corporativo */
    --bg-card: #10203b;            /* Tarjetas con profundidad */
    --bg-card-hover: #162b4e;      /* Hover resaltado */
    --bg-sidebar: #081224;
    --bg-input: #0a1426;

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #7d99aa;         /* Pizarra del logo */
    --text-inverse: #0a0f1d;

    --cyber-cyan: #00d9f5;         /* Cian luminoso de alto contraste */
    --color-primary: #009cde;
    --muronto-cyan: #00d9f5;
    --cyber-cyan-glow: rgba(0, 217, 245, 0.3);
    --gold-patria: #009cde;        /* Azul cielo del logo */
    --gold-glow: rgba(0, 156, 222, 0.35);
    --accent-blue: #0052b6;
    --accent-sky: #009cde;
    --accent-cyan: #00ffff;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-orange: #f59e0b;

    --border-color: rgba(0, 156, 222, 0.22);
    --border-card: rgba(255, 255, 255, 0.08);
    --border-focus: #00d9f5;
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 25px rgba(0, 156, 222, 0.25);

    --btn-primary-bg: linear-gradient(135deg, #0052b6 0%, #009cde 100%);
    --btn-primary-hover: linear-gradient(135deg, #00459e 0%, #0088c4 100%);
}

/* RESET GENERAL */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    letter-spacing: 0.5px;
    font-weight: 700;
    color: var(--text-primary);
}

a {
    color: var(--cyber-cyan);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--text-primary);
}

/* LAYOUT GENERAL */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    position: relative;
    box-sizing: border-box;
}

/* SIDEBAR LATERAL TÁCTICA */
.app-sidebar {
    width: 270px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-header {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--gold-patria);
    box-shadow: 0 0 12px var(--gold-glow);
}

.sidebar-title h2 {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
}

.sidebar-title span {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--gold-patria);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-menu {
    flex: 1;
    padding: 20px 12px;
    overflow-y: auto;
    list-style: none;
}

.menu-category {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #64748b;
    padding: 12px 14px 6px;
    margin-top: 8px;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 11px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.92rem;
    transition: var(--transition);
    margin-bottom: 4px;
}

.sidebar-menu li a:hover,
.sidebar-menu li.active a {
    background: rgba(0, 82, 182, 0.09);
    color: var(--cyber-cyan);
    border-left: 3px solid var(--cyber-cyan);
    font-weight: 700;
}

.sidebar-menu li a i {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
}

/* CONTENIDO PRINCIPAL */
.app-main {
    flex: 1 1 0%;
    min-width: 0;
    max-width: calc(100vw - 270px);
    width: calc(100vw - 270px);
    margin-left: 270px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* TOPBAR */
.app-topbar {
    height: 72px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 90;
    transition: var(--transition);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 18px;
}

.topbar-badge-role {
    font-family: var(--font-heading);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
}

.badge-alumno {
    background: rgba(0, 210, 255, 0.15);
    color: var(--cyber-cyan);
    border: 1px solid var(--cyber-cyan);
}

.badge-docente {
    background: rgba(212, 175, 55, 0.15);
    color: var(--gold-patria);
    border: 1px solid var(--gold-patria);
}

.badge-admin {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid #ef4444;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* BOTÓN SWITCH CLARO/OSCURO */
.theme-switch-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
}

.theme-switch-btn:hover {
    border-color: var(--cyber-cyan);
    color: var(--cyber-cyan);
    transform: rotate(20deg);
}

/* PERFIL EN TOPBAR */
.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-full);
    cursor: pointer;
}

.topbar-user img {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--gold-patria);
}

.topbar-user-info strong {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.2;
}

.topbar-user-info span {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ZONA DE CONTENIDO INTERNO */
.content-body {
    padding: 30px;
    flex: 1 1 0%;
    min-width: 0;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* TARJETAS KPI Y GAMIFICACIÓN */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: var(--shadow-soft);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.kpi-card:hover {
    transform: translateY(-3px);
    border-color: var(--cyber-cyan);
    box-shadow: var(--shadow-glow);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--cyber-cyan);
}

.kpi-card.kpi-gold::before { background: var(--gold-patria); }
.kpi-card.kpi-green::before { background: var(--accent-green); }
.kpi-card.kpi-orange::before { background: var(--accent-orange); }

.kpi-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    background: rgba(0, 210, 255, 0.1);
    color: var(--cyber-cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.kpi-gold .kpi-icon { background: rgba(212, 175, 55, 0.1); color: var(--gold-patria); }
.kpi-green .kpi-icon { background: rgba(16, 185, 129, 0.1); color: var(--accent-green); }
.kpi-orange .kpi-icon { background: rgba(245, 158, 11, 0.1); color: var(--accent-orange); }

.kpi-details h3 {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.1;
}

.kpi-details p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
}

/* REPRODUCTOR ESTILO TUTOR LMS (CINEMA PLAYER) */
.cinema-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
}

.player-main-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    background: #000000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.video-container iframe,
.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* INDICE DE LECCIONES LATERAL (SYLLABUS) */
.syllabus-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    height: fit-content;
    max-height: calc(100vh - 120px);
    overflow: hidden;
}

.syllabus-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-surface);
}

.syllabus-header h3 {
    font-size: 1.1rem;
}

.syllabus-list {
    overflow-y: auto;
    padding: 10px 0;
    list-style: none;
}

.syllabus-module-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--gold-patria);
    padding: 10px 20px 6px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.syllabus-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.syllabus-item:hover {
    background: rgba(0, 210, 255, 0.05);
}

.syllabus-item.active {
    background: rgba(0, 210, 255, 0.12);
    border-left-color: var(--cyber-cyan);
}

.syllabus-item.active strong {
    color: var(--cyber-cyan);
}

.syllabus-check {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1.5px solid var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: transparent;
}

.syllabus-item.completed .syllabus-check {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: #ffffff;
}

/* VITRINA DE GAFETES Y GAMIFICACIÓN */
.badges-showcase {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 18px;
}

.badge-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    padding: 18px 14px;
    text-align: center;
    transition: var(--transition);
    position: relative;
}

.badge-card.unlocked {
    border-color: var(--gold-patria);
    box-shadow: 0 0 15px var(--gold-glow);
}

.badge-card.locked {
    opacity: 0.45;
    filter: grayscale(1);
}

.badge-ribbon {
    width: 60px;
    height: 60px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.2) 0%, rgba(0,0,0,0) 70%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: var(--gold-patria);
}

.badge-card h4 {
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.badge-card p {
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

/* BOTÓN DE MENÚ LATERAL MÓVIL */
.mobile-menu-btn {
    display: none;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--cyber-cyan);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition);
    flex-shrink: 0;
}
.mobile-menu-btn:hover {
    border-color: var(--cyber-cyan);
    color: #ffffff;
    box-shadow: 0 0 12px var(--cyber-cyan-glow);
}

/* OVERLAY TELÓN DE FONDO PARA SIDEBAR MÓVIL */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(4, 8, 16, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.sidebar-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* CONTENEDOR DE TABLAS RESPONSIVAS */
.table-responsive,
div[style*="overflow-x: auto"] {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    display: block !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box !important;
}

.table-responsive table,
div[style*="overflow-x: auto"] table,
.data-table {
    min-width: 720px;
}

/* =====================================================================
   RESPONSIVE DESIGN (CAMPUS VIRTUAL)
   ===================================================================== */
html, body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

@media (max-width: 992px) {
    .mobile-menu-btn {
        display: flex;
    }
    .app-sidebar {
        transform: translateX(-100%);
        z-index: 1050;
        box-shadow: 0 0 45px rgba(0, 0, 0, 0.9);
    }
    .app-sidebar.show-mobile {
        transform: translateX(0);
    }
    .app-main {
        margin-left: 0;
        width: 100% !important;
        max-width: 100vw !important;
        min-width: 0 !important;
    }
    .cinema-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .syllabus-card {
        max-height: 480px;
    }
}

@media (max-width: 768px) {
    .app-topbar {
        padding: 0 16px;
        height: 64px;
    }
    .topbar-badge-role {
        display: none;
    }
    .content-body {
        padding: 16px;
    }
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .kpi-card {
        padding: 16px;
        gap: 12px;
    }
    .kpi-icon {
        width: 44px;
        height: 44px;
        font-size: 1.25rem;
    }
    .kpi-details h3 {
        font-size: 1.45rem;
    }
    .badges-showcase {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
    .modal-content, .modal-card {
        width: 95vw;
        max-width: 95vw;
        padding: 18px 14px;
        margin: 10px;
    }
}

@media (max-width: 480px) {
    .app-topbar {
        padding: 0 12px;
    }
    .topbar-left {
        gap: 10px;
    }
    .topbar-right {
        gap: 8px;
    }
    .topbar-user-info span {
        display: none;
    }
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    .content-body {
        padding: 12px;
    }
    .syllabus-header {
        padding: 14px 16px;
    }
    .syllabus-item {
        padding: 10px 14px;
    }
}
