/**
 * FILE: frontend/css/theme.css
 * PURPOSE: Global Design System Variables.
 * Contains color palettes for Light/Dark modes across multiple themes.
 * Strict SoC: Shared by landing, PWA, admin, and login to maintain visual consistency.
 */

/* ==========================================================================
   1. THEME VARIABLES (Ecosystem Global)
   ========================================================================== */

/* THEME 1: OFICIAL (Navy & Sage) */
:root[data-theme="oficial"] {
    --color-primary: #1e3a8a;
    --color-primary-light: #3b82f6;
    --color-secondary: #8ba888;
    --color-accent: #f59e0b;
    --color-danger: #ef4444;
    
    --color-surface: #ffffff;
    --color-surface-muted: #f8fafc;
    --color-text-base: #0f172a;
    --color-text-muted: #475569;
    --color-border: #e2e8f0;
    --bg-body: #ffffff;
    --bg-muted: #f1f5f9;
}

:root[data-theme="oficial"].dark,
html.dark[data-theme="oficial"] {
    --color-primary: #3b82f6;
    --color-primary-light: #60a5fa;
    --color-secondary: #a7f3d0;
    --color-surface: #1e293b;
    --color-surface-muted: #0f172a;
    --color-text-base: #f8fafc;
    --color-text-muted: #cbd5e1;
    --color-border: #334155;
    --bg-body: #020617;
    --bg-muted: #0f172a;
}

/* THEME 2: VITAL (Teal & Mint) */
:root[data-theme="vital"] {
    --color-primary: #0f766e;
    --color-primary-light: #14b8a6;
    --color-secondary: #0ea5e9;
    --color-accent: #f43f5e;
    
    --color-surface: #ffffff;
    --color-surface-muted: #f0fdfa;
    --color-text-base: #111827;
    --color-text-muted: #6b7280;
    --color-border: #e5e7eb;
    --bg-body: #ffffff;
    --bg-muted: #f3f4f6;
}

:root[data-theme="vital"].dark,
html.dark[data-theme="vital"] {
    --color-primary: #2dd4bf;
    --color-primary-light: #5eead4;
    --color-secondary: #38bdf8;
    
    --color-surface: #1f2937;
    --color-surface-muted: #111827;
    --color-text-base: #f9fafb;
    --color-text-muted: #9ca3af;
    --color-border: #374151;
    --bg-body: #030712;
    --bg-muted: #111827;
}

/* THEME 3: PREMIUM (Purple & Emerald) */
:root[data-theme="premium"] {
    --color-primary: #4c1d95;
    --color-primary-light: #7c3aed;
    --color-secondary: #10b981;
    --color-accent: #fbbf24;
    
    --color-surface: #ffffff;
    --color-surface-muted: #f5f3ff;
    --color-text-base: #171717;
    --color-text-muted: #525252;
    --color-border: #d4d4d4;
    --bg-body: #ffffff;
    --bg-muted: #e5e5e5;
}

:root[data-theme="premium"].dark,
html.dark[data-theme="premium"] {
    --color-primary: #a78bfa;
    --color-primary-light: #c4b5fd;
    --color-secondary: #34d399;
    
    --color-surface: #262626;
    --color-surface-muted: #171717;
    --color-text-base: #fafafa;
    --color-text-muted: #a3a3a3;
    --color-border: #404040;
    --bg-body: #0a0a0a;
    --bg-muted: #171717;
}
/* ==========================================================================
   MODAL & LEGAL FOOTER (Isomorphic Pattern)
   ========================================================================== */
.site-footer {
    background-color: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: 2rem 0;
    margin-top: auto;
}
.footer-container {
    display: flex; flex-direction: column; align-items: center; gap: 1.5rem; text-align: center;
}
.footer-links {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem 1.5rem;
}
.legal-link {
    color: var(--color-text-muted); text-decoration: none; font-size: 0.875rem; transition: color 0.2s ease;
}
.legal-link:hover {
    color: var(--color-primary); text-decoration: underline;
}

/* Overlay Oscuro */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
    opacity: 1; transition: opacity 0.3s ease;
}
.modal-overlay.hidden {
    opacity: 0; pointer-events: none;
}

/* Contenedor Modal: 100% de la pantalla siempre */
.modal-content.full-screen {
    background-color: var(--bg-muted); /* Gris claro para diferenciar del documento blanco */
    width: 100%; height: 100%; max-width: 100%; border-radius: 0;
    display: flex; flex-direction: column;
    transform: translateY(0); transition: transform 0.3s ease;
}
.modal-overlay.hidden .modal-content {
    transform: translateY(30px);
}

/* Cabecera del modal */
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
    background-color: var(--color-surface);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    z-index: 10;
}
.modal-title { margin: 0; font-size: 1.25rem; font-weight: 600; color: var(--color-text-base); }

.close-btn {
    background: transparent; border: none; font-size: 1.5rem;
    color: var(--color-text-muted); cursor: pointer; transition: color 0.2s;
    display: flex; align-items: center; justify-content: center;
}
.close-btn:hover { color: var(--color-danger); }

/* Cuerpo general: Centra horizontalmente el scroll-wrapper */
.modal-body {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    overflow: hidden; /* Corta el scroll general de la ventana */
}

/* FIX DEL BUG: !important asegura que el loader desaparezca y no empuje el contenido */
.modal-loader {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    width: 100%; color: var(--color-text-muted); gap: 1rem;
}
.modal-loader.hidden {
    display: none !important;
}

/* Contenedor de la barra de desplazamiento (Ancho exacto: 600px) */
.modal-scroll-wrapper {
    width: 100%; max-width: 600px;
    height: 100%;
    overflow-y: auto; /* Barra de desplazamiento restringida aquí */
    display: flex; flex-direction: column;
}

/* El área visual del texto (Hoja en blanco) */
#modal-content-area {
    width: 100%;
    background-color: var(--color-surface);
    padding: 3rem 2rem;
    margin-top: auto; margin-bottom: auto; /* Centrado vertical automático si es texto corto */
    box-shadow: 0 0 20px rgba(0,0,0,0.05);
}

/* Oculta la "hoja blanca" mientras el loader está dando vueltas */
#modal-content-area:empty {
    display: none !important;
}

/* Estilos de tipografía legales inyectados por PHP */
#modal-content-area h3 { margin-top: 0; margin-bottom: 1rem; color: var(--color-primary); }
#modal-content-area h3:not(:first-child) { margin-top: 2.5rem; }
#modal-content-area p { margin-bottom: 1rem; color: var(--color-text-muted); line-height: 1.7; }
#modal-content-area ul { margin-bottom: 1rem; padding-left: 1.5rem; color: var(--color-text-muted); line-height: 1.7; }