/* ==========================================================================
   WEB TOTAL MÉXICO - STYLE.CSS (CORE ENGINE)
   Arquitectura Sinapse OS | Diseño Premium Oscuro
   ========================================================================== */

/* ---------------------------------------------------
   1. VARIABLES GLOBALES (PALETA OFICIAL WTM)
   --------------------------------------------------- */
:root {
    /* Colores Corporativos Oficiales */
    --wtm-primario: #722F37;      /* Vino - Botones principales, acentos de acción */
    --wtm-secundario: #026E9F;    /* Azul Océano - Enlaces, íconos de progreso */
    --wtm-base: #17252A;          /* Teal Oscuro - Fondos de tarjetas, sidebar, modales */
    
    /* Fondos y Textos */
    --wtm-bg-dark: #0b1214;       /* Fondo global ultra oscuro (contraste con base) */
    --text-main: #f8fafc;         /* Blanco humo para lectura clara */
    --text-muted: #94a3b8;        /* Gris azulado para textos secundarios */
    
    /* UI Elements */
    --border-light: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(2, 110, 159, 0.5); /* Focus con Azul Océano */
    --shadow-hub: 0 15px 35px rgba(0, 0, 0, 0.6);
    --shadow-soft: 0 5px 15px rgba(0, 0, 0, 0.3);
    
    /* Semántica de Estados */
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    
    /* Tipografía Premium */
    --font-title: 'Cinzel', serif;
    --font-body: 'Outfit', sans-serif;
}

/* ---------------------------------------------------
   2. RESET Y ESTILOS BASE
   --------------------------------------------------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--wtm-bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: var(--wtm-secundario);
    transition: 0.3s ease;
}

a:hover {
    color: #0388c5;
}

ul {
    list-style: none;
}

/* Scrollbar Personalizado */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--wtm-bg-dark); }
::-webkit-scrollbar-thumb { background: var(--wtm-base); border-radius: 10px; border: 1px solid var(--border-light); }
::-webkit-scrollbar-thumb:hover { background: var(--wtm-secundario); }

/* ---------------------------------------------------
   3. PORTAL DE ACCESO (LOGIN - INDEX.HTML)
   --------------------------------------------------- */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: radial-gradient(circle at center, var(--wtm-base) 0%, var(--wtm-bg-dark) 100%);
}

.login-wrapper {
    width: 100%;
    padding: 20px;
    display: flex;
    justify-content: center;
}

.login-card-premium {
    background: var(--wtm-base);
    width: 100%;
    max-width: 420px;
    padding: 50px 40px;
    border-radius: 16px;
    box-shadow: var(--shadow-hub);
    border: 1px solid var(--border-light);
    text-align: center;
    animation: slideUp 0.6s ease forwards;
}

.login-header {
    margin-bottom: 35px;
}

.brand-title {
    font-family: var(--font-title);
    font-size: 2rem;
    color: var(--text-main);
    line-height: 1.2;
    margin-bottom: 5px;
}

.brand-subtitle {
    font-size: 0.9rem;
    color: var(--wtm-secundario);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.login-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

.login-footer p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ---------------------------------------------------
   4. FORMULARIOS Y BOTONES (UI KITS)
   --------------------------------------------------- */
.input-group {
    position: relative;
    margin-bottom: 20px;
    text-align: left;
}

.input-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
    pointer-events: none;
    transition: 0.3s;
}

.input-group input, 
.input-group select, 
.input-group textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 1rem;
    outline: none;
    transition: 0.3s ease;
}

.input-group input { padding: 15px 15px 15px 45px; }
.input-group select { padding: 15px; appearance: none; }
.input-group textarea { padding: 15px; resize: vertical; min-height: 100px; }

.input-group input:focus, 
.input-group select:focus, 
.input-group textarea:focus {
    border-color: var(--wtm-secundario);
    background: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 0 3px var(--border-focus);
}

.input-group input:focus + i { color: var(--wtm-secundario); }

/* Alertas */
.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
}

/* Botones */
.btn-primary-wtm {
    background: var(--wtm-primario);
    color: #ffffff;
    border: none;
    padding: 15px 25px;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary-wtm:hover:not(:disabled) {
    background: #8b3a44; /* Vino más claro */
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(114, 47, 55, 0.4);
}

.btn-primary-wtm:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-secondary-wtm {
    background: var(--wtm-secundario);
    color: #ffffff;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
}

.btn-secondary-wtm:hover { background: #0388c5; transform: translateY(-2px); }

.btn-outline-wtm {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-light);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.3s;
}

.btn-outline-wtm:hover { background: rgba(255,255,255,0.05); border-color: var(--wtm-secundario); }

.action-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    width: 35px; height: 35px;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s;
    display: inline-flex; align-items: center; justify-content: center;
}
.action-btn.edit:hover { color: var(--wtm-secundario); border-color: var(--wtm-secundario); }
.action-btn.delete:hover { color: var(--danger); border-color: var(--danger); }

.full-width { width: 100%; }

/* ---------------------------------------------------
   5. LAYOUT DEL HUB (HUB.HTML)
   --------------------------------------------------- */
.hub-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--wtm-base);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    padding: 30px 20px;
    z-index: 100;
}

.sidebar-brand {
    text-align: center;
    margin-bottom: 40px;
}

.sidebar-brand h2 {
    font-family: var(--font-title);
    font-size: 1.5rem;
    color: var(--text-main);
    line-height: 1.1;
}

.sidebar-brand span {
    font-size: 0.75rem;
    color: var(--wtm-secundario);
    letter-spacing: 2px;
}

.nav-menu {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 14px 18px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 400;
    cursor: pointer;
    text-align: left;
    transition: all 0.3s ease;
}

.nav-btn i { font-size: 1.1rem; width: 20px; text-align: center; }

.nav-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.03);
}

.nav-btn.active {
    background: var(--wtm-primario);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(114, 47, 55, 0.3);
}

.user-profile-widget {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.user-profile-widget p { font-size: 0.95rem; font-weight: 600; color: var(--text-main); line-height: 1.2; }
.user-profile-widget span { font-size: 0.8rem; color: var(--wtm-secundario); font-weight: 600; }

/* Contenido Principal */
.main-content {
    flex-grow: 1;
    background: var(--wtm-bg-dark);
    padding: 40px 50px;
    overflow-y: auto;
    position: relative;
}

.view-section {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.view-section.active {
    display: block;
}

.section-header {
    margin-bottom: 40px;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 20px;
    display: flex; justify-content: space-between; align-items: flex-end;
}

.section-header h2 {
    font-family: var(--font-title);
    font-size: 2.2rem;
    color: var(--text-main);
}

.section-header p {
    color: var(--text-muted);
    font-size: 1rem;
    margin-top: 5px;
}

/* ---------------------------------------------------
   6. COMPONENTES VISUALES (DASHBOARD, KANBAN, ACADEMY)
   --------------------------------------------------- */

/* Grid de KPIs */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.kpi-card {
    background: var(--wtm-base);
    border: 1px solid var(--border-light);
    padding: 30px 25px;
    border-radius: 12px;
    border-left: 4px solid var(--wtm-secundario);
    box-shadow: var(--shadow-soft);
    transition: 0.3s;
}

.kpi-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-hub); }
.kpi-card.destacado { border-left-color: var(--wtm-primario); }

.kpi-card h4 { color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase; margin-bottom: 10px; letter-spacing: 1px; }
.kpi-card .valor { font-family: var(--font-title); font-size: 2.8rem; color: var(--text-main); line-height: 1; }

/* Tablero Kanban (Business) */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    align-items: start;
}

.kanban-col {
    background: rgba(23, 37, 42, 0.4);
    border-radius: 12px;
    padding: 20px;
    border: 1px dashed var(--border-light);
    min-height: 500px;
}

.kanban-header {
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 15px;
    font-size: 1.1rem;
}

.badge-count {
    background: var(--wtm-base); border: 1px solid var(--border-light);
    padding: 2px 10px; border-radius: 20px; font-size: 0.85rem; color: var(--text-muted);
}

.task-card {
    background: var(--wtm-base);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid var(--border-light);
    margin-bottom: 15px;
    transition: 0.2s;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
}

.task-card:hover { border-color: var(--wtm-secundario); transform: translateY(-3px); }
.task-card h5 { color: var(--text-main); font-size: 1.1rem; margin-bottom: 8px; font-family: var(--font-title); }
.task-card p { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 15px; line-height: 1.4; }
.task-card .precio { color: var(--success); font-weight: 600; font-size: 1rem; }

/* Tarjetas Academy */
.academy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}

.module-card {
    background: var(--wtm-base);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-soft);
    display: flex; flex-direction: column;
}

.module-img {
    height: 160px;
    background: linear-gradient(135deg, var(--wtm-base) 0%, var(--wtm-secundario) 100%);
    display: flex; align-items: center; justify-content: center;
    font-size: 3.5rem; color: rgba(255,255,255,0.3);
}

.module-info { padding: 25px; display: flex; flex-direction: column; flex-grow: 1; }
.module-info h3 { font-size: 1.2rem; margin-bottom: 10px; color: var(--text-main); }
.module-info p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 20px; line-height: 1.5; flex-grow: 1; }

/* ---------------------------------------------------
   7. MODALES GLOBALES (RG Architecture)
   --------------------------------------------------- */
.modal-wrapper {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(11, 18, 20, 0.9);
    backdrop-filter: blur(5px);
    display: flex; justify-content: center; align-items: center;
    z-index: 9999;
    opacity: 0; visibility: hidden; transition: 0.3s ease;
}

.modal-wrapper.active { opacity: 1; visibility: visible; }

.modal-card-premium {
    background: var(--wtm-base);
    width: 90%; max-width: 600px;
    border-radius: 16px;
    padding: 40px;
    position: relative;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-hub);
    transform: translateY(20px); transition: 0.3s ease;
    max-height: 90vh; overflow-y: auto;
}

.modal-wrapper.active .modal-card-premium { transform: translateY(0); }

.btn-close-modal {
    position: absolute; top: 20px; right: 20px;
    background: rgba(255,255,255,0.05); border: 1px solid var(--border-light);
    color: var(--text-muted); width: 35px; height: 35px; border-radius: 50%;
    font-size: 1.2rem; cursor: pointer; transition: 0.2s;
    display: grid; place-items: center;
}
.btn-close-modal:hover { background: var(--danger); color: white; border-color: var(--danger); }

/* ---------------------------------------------------
   8. ANIMACIONES Y RESPONSIVE
   --------------------------------------------------- */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (max-width: 1024px) {
    .kanban-board { grid-template-columns: 1fr; }
    .kanban-col { min-height: auto; }
}

@media (max-width: 768px) {
    .hub-layout { flex-direction: column; }
    
    .sidebar {
        width: 100%; border-right: none; border-bottom: 1px solid var(--border-light);
        padding: 20px; flex-direction: row; align-items: center; justify-content: space-between;
    }
    
    .sidebar-brand { margin-bottom: 0; text-align: left; }
    .sidebar-brand h2 { font-size: 1.2rem; }
    
    .nav-menu { display: none; /* En móvil se controlaría con un menú hamburguesa vía JS */ }
    .user-profile-widget { display: none; }
    
    .main-content { padding: 20px; }
    .section-header h2 { font-size: 1.8rem; }
}

/* ==========================================================================
   WTM ACADEMY - EXTENSION (REPRODUCTOR Y CONTENIDO TÉCNICO)
   ========================================================================== */

/* Contenedor del Player de Pantalla Completa */
#academy-player {
    display: none; /* Se activa vía JS */
    z-index: 10000;
}

#academy-player.active {
    display: flex;
    animation: fadeIn 0.3s ease forwards;
}

/* Tipografía y Contenido Técnico */
.technical-content {
    color: var(--text-main);
    font-family: var(--font-body);
}

.technical-content h1, .technical-content h2 {
    font-family: var(--font-title);
    margin-bottom: 20px;
    color: var(--wtm-secundario);
}

.technical-content p {
    margin-bottom: 15px;
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1.8;
}

/* Bloques de Código (Estilo Sinapse OS) */
.technical-content pre {
    background: #000;
    border: 1px solid var(--border-light);
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 25px 0;
    position: relative;
}

.technical-content code {
    font-family: 'Courier New', Courier, monospace;
    color: #a5d6ff; /* Azul código */
    font-size: 0.9rem;
}

/* Notas y Callouts */
.wtm-note {
    background: rgba(114, 47, 55, 0.1);
    border-left: 4px solid var(--wtm-primario);
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 4px;
}

.wtm-note strong {
    color: var(--wtm-primario);
    display: block;
    margin-bottom: 5px;
    text-transform: uppercase;
    font-size: 0.8rem;
}

/* Responsive Video Wrapper */
#video-placeholder iframe {
    width: 100%;
    height: 100%;
    border: none;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    border-radius: 4px;
}

/* Academy Grid - Mejoras de Tarjetas */
.module-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-bottom: 3px solid transparent;
}

.module-card:hover {
    transform: translateY(-10px);
    border-bottom: 3px solid var(--wtm-secundario);
    box-shadow: var(--shadow-hub);
}

.module-card.completed {
    border-bottom: 3px solid var(--success);
}

.module-card.completed .module-img {
    background: linear-gradient(135deg, var(--wtm-base) 0%, var(--success) 100%);
}

/* Animación de Entrada para el Contenido */
.technical-content > * {
    animation: slideUp 0.5s ease forwards;
    opacity: 0;
}

.technical-content > *:nth-child(1) { animation-delay: 0.1s; }
.technical-content > *:nth-child(2) { animation-delay: 0.2s; }
.technical-content > *:nth-child(3) { animation-delay: 0.3s; }

/* ---------------------------------------------------
   RESPONSIVE ACADEMY
   --------------------------------------------------- */
@media (max-width: 1100px) {
    #academy-player .player-container div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        overflow-y: auto;
    }
    
    #video-placeholder {
        max-width: 100% !important;
        padding: 20px;
    }

    #academy-player header {
        padding: 15px 20px;
    }
}