/* ==========================================================================
   SISTEMA DE DISEÑO EVAD-EVIN V2 (Mobile First)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200');

:root {
    /* Paleta Institucional (DMQ / COE) */
    --color-primary: #0F355C;       /* Azul Institucional Fuerte */
    --color-primary-light: #2A5A8E; /* Azul Activo */
    --color-secondary: #00A650;     /* Verde Aprobación/Seguridad */
    --color-accent: #E63946;        /* Rojo Emergencia */
    --color-warning: #FFB703;       /* Naranja Alerta */

    /* Grises y Fondos */
    --color-bg-body: #F4F7F6;
    --color-bg-card: #FFFFFF;
    --color-text-main: #1D2D35;
    --color-text-muted: #6B7280;
    --color-border: #E5E7EB;

    /* Sombras y Radios */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;

    /* Espaciado Modular */
    --sp-1: 0.25rem;
    --sp-2: 0.5rem;
    --sp-3: 0.75rem;
    --sp-4: 1rem;
    --sp-6: 1.5rem;
    --sp-8: 2rem;
}

/* ==========================================================================
   RESET & TIPOGRAFÍA
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--color-bg-body);
    color: var(--color-text-main);
    line-height: 1.5;
    font-size: 16px;
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
ul { list-style: none; }

/* ==========================================================================
   SPA LAYOUT (HEADER, SIDEBAR, MAIN)
   ========================================================================== */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh; /* Soporte móvil iOS/Android */
}

/* HEADER */
.app-header {
    background-color: var(--color-primary);
    color: white;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--sp-4);
    z-index: 100;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.header-left { display: flex; align-items: center; gap: var(--sp-3); }
.header-brand { font-weight: 700; font-size: 1.125rem; letter-spacing: 0.5px; }

/* Buscador Universal */
.header-search {
    display: none; /* Oculto en móvil por defecto, visible en desktop */
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: var(--sp-1) var(--sp-3);
    align-items: center;
    gap: var(--sp-2);
}
.header-search input {
    background: transparent;
    border: none;
    color: white;
    outline: none;
}
.header-search input::placeholder { color: rgba(255,255,255,0.6); }

.header-right { display: flex; align-items: center; gap: var(--sp-3); }
.header-action { color: white; display: flex; position: relative; }

/* MAIN CONTENT WRAPPER */
.app-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* SIDEBAR (Drawer en Móvil, Fijo en Desktop) */
.app-sidebar {
    background-color: var(--color-bg-card);
    width: 260px;
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 0; left: -260px;
    height: 100%;
    z-index: 90;
    transition: left 0.3s ease;
    box-shadow: var(--shadow-lg);
}
.app-sidebar.active { left: 0; }

.sidebar-menu { padding: var(--sp-4) 0; flex: 1; overflow-y: auto; }
.menu-item {
    display: flex; align-items: center; gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    color: var(--color-text-main);
    font-weight: 500;
    transition: background 0.2s;
}
.menu-item:hover, .menu-item.active {
    background-color: rgba(15, 53, 92, 0.05);
    color: var(--color-primary);
    border-right: 4px solid var(--color-primary);
}
.menu-item .material-symbols-outlined { color: var(--color-text-muted); }
.menu-item.active .material-symbols-outlined { color: var(--color-primary); }

/* AREA DE CONTENIDO (Vistas) */
.app-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--sp-4);
    background-color: var(--color-bg-body);
}

.view-section { display: none; animation: fadeIn 0.3s ease; }
.view-section.active { display: block; }

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

/* ==========================================================================
   COMPONENTES UI (Cards, Badges, Buttons, Timeline)
   ========================================================================== */

/* Tarjetas */
.card {
    background: var(--color-bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    margin-bottom: var(--sp-4);
    overflow: hidden;
}
.card-header {
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--color-border);
    font-weight: 600;
    display: flex; justify-content: space-between; align-items: center;
}
.card-body { padding: var(--sp-4); }

/* Event Hub Card (Especial para la vista de Evento) */
.event-hub-header {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: white; padding: var(--sp-6) var(--sp-4);
    border-radius: var(--radius-lg); margin-bottom: var(--sp-4);
}
.event-hub-title { font-size: 1.5rem; font-weight: 700; margin-bottom: var(--sp-1); }
.event-hub-meta { font-size: 0.875rem; opacity: 0.8; display: flex; gap: var(--sp-4); }

/* Badges */
.badge {
    padding: 0.25em 0.6em;
    border-radius: var(--radius-full);
    font-size: 0.75rem; font-weight: 600;
    display: inline-flex; align-items: center; gap: 4px;
}
.badge-red { background: #FEE2E2; color: #991B1B; }
.badge-green { background: #D1FAE5; color: #065F46; }
.badge-yellow { background: #FEF3C7; color: #92400E; }
.badge-blue { background: #DBEAFE; color: #1E40AF; }

/* Botones */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600; font-size: 1rem;
    transition: all 0.2s;
    /* Touch Target de 48px min */
    min-height: 48px; 
}
.btn-primary { background: var(--color-primary); color: white; }
.btn-primary:active { background: var(--color-primary-light); }
.btn-danger { background: var(--color-accent); color: white; }
.btn-outline { border: 2px solid var(--color-primary); color: var(--color-primary); background: transparent; }

/* Línea de Tiempo (Bitácora) */
.timeline {
    position: relative;
    padding-left: 2rem;
}
.timeline::before {
    content: ''; position: absolute; left: 0.5rem; top: 0; bottom: 0;
    width: 2px; background: var(--color-border);
}
.timeline-item { position: relative; margin-bottom: var(--sp-6); }
.timeline-dot {
    position: absolute; left: -2rem; top: 0;
    width: 1rem; height: 1rem; border-radius: 50%;
    background: var(--color-primary); border: 3px solid white;
}
.timeline-time { font-size: 0.75rem; color: var(--color-text-muted); margin-bottom: 0.25rem; }
.timeline-content { background: var(--color-bg-body); padding: var(--sp-3); border-radius: var(--radius-md); font-size: 0.875rem; }

/* Panel Diagnóstico Grid */
.diagnostic-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3);
}
.diag-card {
    background: var(--color-bg-body); padding: var(--sp-3); border-radius: var(--radius-md);
    text-align: center;
}
.diag-value { font-size: 1.5rem; font-weight: 700; color: var(--color-primary); }
.diag-label { font-size: 0.75rem; color: var(--color-text-muted); text-transform: uppercase; }

/* Modales (Bottom Sheet en Móvil) */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 1000;
    display: flex; align-items: flex-end; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-content {
    background: white; width: 100%; max-height: 90vh; overflow-y: auto;
    border-radius: 20px 20px 0 0; padding: var(--sp-6);
    transform: translateY(100%); transition: transform 0.3s ease;
}
.modal-overlay.active .modal-content { transform: translateY(0); }

/* ==========================================================================
   MEDIA QUERIES (Tablet & Desktop)
   ========================================================================== */
@media (min-width: 768px) {
    .app-sidebar { position: static; left: 0; }
    .header-left .menu-toggle { display: none; }
    .header-search { display: flex; width: 300px; }
    .modal-overlay { align-items: center; }
    .modal-content { width: 500px; border-radius: var(--radius-lg); transform: scale(0.9); }
    .modal-overlay.active .modal-content { transform: scale(1); }
}

/* ==========================================================================
   PINTEREST STYLE LOGIN
   ========================================================================== */
.view-login-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex !important;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #0F355C 0%, #1a202c 100%);
}

.view-section.view-login-fullscreen:not(.active) {
    display: none !important;
}

.login-modal {
    background: #ffffff;
    width: 100%;
    max-width: 480px;
    border-radius: 32px;
    padding: 40px 32px;
    box-shadow: 0 24px 48px rgba(0,0,0,0.3);
    text-align: center;
    box-sizing: border-box;
    margin: 20px;
    max-height: 90vh;
    overflow-y: auto;
}

.login-logo {
    width: 64px;
    height: 64px;
    background: #ffe6e9;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 16px auto;
}

.login-title {
    font-size: 28px;
    font-weight: 700;
    color: #111;
    margin-bottom: 24px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.login-form .form-group {
    text-align: left;
    margin-bottom: 16px;
}

.login-form label {
    display: block;
    font-size: 14px;
    color: #111;
    margin-bottom: 8px;
    margin-left: 8px;
    font-weight: 600;
}

.login-form input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #cdcdcd;
    border-radius: 16px;
    font-size: 16px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.login-form input:focus {
    border-color: #E60023;
    outline: none;
}

.login-forgot {
    text-align: left;
    margin-bottom: 24px;
    margin-left: 8px;
}

.login-forgot a {
    font-weight: 600;
    color: #111;
    font-size: 14px;
    text-decoration: none;
}

.login-forgot a:hover {
    text-decoration: underline;
}

.btn-login-submit {
    width: 100%;
    background: #E60023;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    padding: 14px;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-login-submit:hover {
    background: #ad081b;
}

.login-divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    color: #767676;
    font-weight: 700;
    font-size: 14px;
}

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

.login-divider span {
    padding: 0 10px;
}

.btn-social {
    width: 100%;
    padding: 14px;
    border-radius: 24px;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin-bottom: 12px;
    border: none;
    transition: background 0.2s;
}

.btn-sigma {
    background: #1877F2;
    color: white;
}

.btn-sigma:hover { background: #166fe5; }

.btn-gob {
    background: #ffffff;
    color: #111;
    border: 2px solid #cdcdcd;
}

.btn-gob:hover { background: #f0f0f0; }

.login-terms {
    font-size: 11px;
    color: #767676;
    margin-top: 24px;
    line-height: 1.5;
}

.login-terms a {
    color: #111;
    font-weight: 600;
    text-decoration: none;
}
