/* ============================================================
   CIF · Design system de la plataforma camutest.com
   ------------------------------------------------------------
   Hoja única de tokens y componentes. Las páginas migradas la
   cargan vía includes/header.php y NO deben declarar paletas ni
   componentes propios: si falta algo, se añade aquí.
   ============================================================ */

/* ---- 1. Tokens ---- */
:root {
    /* Paleta */
    --primary-dark: #0a1628;
    --primary-blue: #1e3a8a;
    --accent-blue: #3b82f6;
    --accent-blue-light: #60a5fa;
    --accent-cyan: #06b6d4;
    --secondary-green: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;

    /* Superficies */
    --bg-dark: #0c1222;
    --bg-gradient: linear-gradient(135deg, #0c1222 0%, #1e293b 50%, #0f172a 100%);
    --surface-glass: rgba(30, 58, 138, 0.12);
    --surface-elevated: rgba(255, 255, 255, 0.05);
    --surface-border: rgba(59, 130, 246, 0.25);
    --surface-border-strong: rgba(59, 130, 246, 0.5);

    /* Texto */
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    /* Tipografía */
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Rajdhani', sans-serif;

    /* Geometría */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Sombras */
    --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.25);
    --shadow-glow-blue: 0 10px 30px rgba(59, 130, 246, 0.18);
    --shadow-glow-cyan: 0 10px 30px rgba(6, 182, 212, 0.15);

    /* Movimiento */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

body.cif-theme-light {
    /* Paleta clara neutral, similar a la interfaz de trabajo */
    --primary-dark: #111827;
    --primary-blue: #2f5f9f;
    --accent-blue: #2563eb;
    --accent-blue-light: #3b82f6;
    --accent-cyan: #0f766e;
    --secondary-green: #15803d;
    --warning: #b45309;
    --error: #b42318;

    /* Superficies */
    --bg-dark: #f5f5f3;
    --bg-gradient: linear-gradient(135deg, #fafafa 0%, #f5f5f3 48%, #ececea 100%);
    --surface-glass: rgba(255, 255, 255, 0.92);
    --surface-elevated: #ffffff;
    --surface-border: rgba(17, 24, 39, 0.14);
    --surface-border-strong: rgba(17, 24, 39, 0.28);

    /* Texto */
    --text-primary: #111111;
    --text-secondary: #27272a;
    --text-muted: #5f6368;

    /* Sombras */
    --shadow-card: 0 10px 24px rgba(17, 24, 39, 0.08);
    --shadow-glow-blue: 0 10px 24px rgba(17, 24, 39, 0.10);
    --shadow-glow-cyan: 0 10px 24px rgba(17, 24, 39, 0.08);
}

body.cif-theme-dark {
    --primary-dark: #f8fafc;
    --primary-blue: #60a5fa;
    --accent-blue: #3b82f6;
    --accent-blue-light: #93c5fd;
    --accent-cyan: #22d3ee;
    --secondary-green: #34d399;
    --warning: #fbbf24;
    --error: #f87171;

    --bg-dark: #0f1117;
    --bg-gradient: linear-gradient(135deg, #0f1117 0%, #151923 50%, #0b0f16 100%);
    --surface-glass: rgba(24, 28, 37, 0.94);
    --surface-elevated: #171b24;
    --surface-border: rgba(148, 163, 184, 0.20);
    --surface-border-strong: rgba(148, 163, 184, 0.36);

    --text-primary: #f8fafc;
    --text-secondary: #d4d4d8;
    --text-muted: #a1a1aa;

    --shadow-card: 0 12px 30px rgba(0, 0, 0, 0.28);
    --shadow-glow-blue: 0 12px 30px rgba(59, 130, 246, 0.14);
    --shadow-glow-cyan: 0 12px 30px rgba(34, 211, 238, 0.10);
}

/* ---- 2. Base ---- */
.cif-page,
body.cif-body {
    font-family: var(--font-body);
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Fondo con halos sutiles, como el login y el panel */
body.cif-body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(59, 130, 246, 0.12) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(16, 185, 129, 0.10) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(6, 182, 212, 0.08) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

body.cif-theme-light::before {
    background-image:
        linear-gradient(180deg, rgba(255, 255, 255, 0.66), rgba(255, 255, 255, 0)),
        radial-gradient(circle at 12% 16%, rgba(17, 24, 39, 0.045) 0%, transparent 34%),
        radial-gradient(circle at 88% 10%, rgba(37, 99, 235, 0.055) 0%, transparent 30%);
}

/* ---- 3. Cabeceras de sección ---- */
.cif-section-header { text-align: center; margin: 32px 0 36px; }
.cif-section-title {
    font-family: var(--font-display);
    font-size: clamp(26px, 4vw, 38px);
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-cyan));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}
.cif-section-subtitle { color: var(--text-muted); font-size: 15px; }

/* ---- 4. Tarjetas ---- */
.cif-card {
    background: var(--surface-glass);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: var(--transition-spring);
    box-shadow: var(--shadow-card);
}
.cif-card:hover {
    border-color: var(--surface-border-strong);
    box-shadow: var(--shadow-glow-blue);
    transform: translateY(-3px);
}
.cif-card-static:hover { transform: none; box-shadow: none; border-color: var(--surface-border); }

/* Tarjeta-enlace de módulo (como las del panel) */
a.cif-card { display: block; text-decoration: none; color: inherit; }

.cif-card-title {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.cif-card-text { color: var(--text-muted); font-size: 13.5px; line-height: 1.5; margin: 0; }

.cif-icon-box {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--surface-border);
    color: var(--accent-blue-light);
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}
.cif-card:hover .cif-icon-box {
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
}

/* ---- 5. Botones ---- */
.cif-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.5px;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}
.cif-btn-primary {
    background: linear-gradient(135deg, var(--primary-dark), #4a3828);
    color: #fff;
}
.cif-btn-primary:hover {
    color: #fff;
    box-shadow: 0 8px 20px rgba(6, 182, 212, 0.3);
    transform: translateY(-2px);
}
.cif-btn-success {
    background: linear-gradient(135deg, var(--secondary-green), #34d399);
    color: #fff;
}
.cif-btn-success:hover { color: #fff; box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3); transform: translateY(-2px); }
.cif-btn-danger {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}
.cif-btn-danger:hover { background: rgba(239, 68, 68, 0.22); color: #fecaca; }
.cif-btn-ghost {
    background: var(--surface-elevated);
    border: 1px solid var(--surface-border);
    color: var(--text-secondary);
}
.cif-btn-ghost:hover { color: var(--text-primary); border-color: var(--surface-border-strong); background: var(--surface-glass); }

/* ---- 6. Badges ---- */
.cif-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 999px;
}
.cif-badge-blue { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue-light); border: 1px solid var(--surface-border); }
.cif-badge-green { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.cif-badge-amber { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.cif-badge-red { background: rgba(239, 68, 68, 0.15); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.3); }

/* ---- 7. Progreso ---- */
.cif-progress {
    height: 6px;
    background: rgba(17, 17, 17, 0.08);
    border-radius: 3px;
    overflow: hidden;
}
.cif-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan));
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.cif-progress-bar.is-success { background: linear-gradient(90deg, var(--secondary-green), #34d399); }
.cif-progress-bar.is-warning { background: linear-gradient(90deg, var(--warning), #fbbf24); }

/* ---- 8. Formularios ---- */
.cif-input,
.cif-select,
.cif-textarea {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    font-family: var(--font-body);
    background: var(--surface-elevated);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: var(--transition);
}
.cif-input::placeholder, .cif-textarea::placeholder { color: var(--text-muted); }
.cif-input:focus, .cif-select:focus, .cif-textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}
.cif-select option { background: var(--bg-dark); color: var(--text-primary); }
.cif-label {
    display: block;
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.4px;
    margin-bottom: 6px;
}

/* ---- 9. Tablas ---- */
.cif-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface-glass);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 14px;
}
.cif-table thead th {
    background: rgba(123, 88, 52, 0.08);
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 14px 16px;
    border-bottom: 1px solid var(--surface-border);
}
.cif-table tbody td { padding: 12px 16px; border-bottom: 1px solid rgba(59, 130, 246, 0.1); }
.cif-table tbody tr:last-child td { border-bottom: none; }
.cif-table tbody tr { transition: var(--transition); }
.cif-table tbody tr:hover { background: rgba(59, 130, 246, 0.07); }

/* ---- 10. Alertas ---- */
.cif-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
}
.cif-alert-success { background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.4); color: #34d399; }
.cif-alert-error { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.4); color: #fca5a5; }
.cif-alert-warning { background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.4); color: #fbbf24; }
.cif-alert-info { background: rgba(59, 130, 246, 0.1); border: 1px solid var(--surface-border); color: var(--accent-blue-light); }

/* ---- 11. Overrides de Bootstrap en oscuro ---- */
.cif-page .modal-content,
body.cif-body .modal-content {
    background: #101a30;
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
}
body.cif-body .modal-header, body.cif-body .modal-footer { border-color: var(--surface-border); }
body.cif-body .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }
body.cif-body .accordion-item {
    background: var(--surface-glass);
    border: 1px solid var(--surface-border);
    color: var(--text-secondary);
}
body.cif-body .accordion-button {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    box-shadow: none;
}
body.cif-body .accordion-button:not(.collapsed) { background: var(--surface-glass); color: var(--accent-blue-light); }
body.cif-body .accordion-button::after { filter: invert(1); }
body.cif-body .form-control, body.cif-body .form-select {
    background: var(--surface-elevated);
    border: 1px solid var(--surface-border);
    color: var(--text-primary);
}
body.cif-body .form-control:focus, body.cif-body .form-select:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
    color: var(--text-primary);
}
body.cif-body .form-control::placeholder { color: var(--text-muted); }

body.cif-theme-light .modal-content {
    background: #fffaf3;
    border-color: var(--surface-border);
    color: var(--text-primary);
}
body.cif-theme-light .btn-close { filter: none; }
body.cif-theme-light .accordion-button::after { filter: none; }
body.cif-theme-light .form-control:focus,
body.cif-theme-light .form-select:focus {
    background: #fffaf3;
}

/* ---- 12. Utilidades ---- */
.cif-text-muted { color: var(--text-muted) !important; }
.cif-text-secondary { color: var(--text-secondary) !important; }
.cif-text-accent { color: var(--accent-blue-light) !important; }
.cif-text-display { font-family: var(--font-display); letter-spacing: 1px; }
.cif-divider { border: none; border-top: 1px solid var(--surface-border); margin: 24px 0; }

/* Grid de tarjetas de módulos */
.cif-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

/* ---- 13. Animación de entrada ---- */
@keyframes cifFadeUp {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}
.cif-fade-up { animation: cifFadeUp 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) both; }

/* ---- 14. Accesibilidad ---- */
@media (prefers-reduced-motion: reduce) {
    .cif-page *, body.cif-body * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
