/* 
   SISTEMA DE DISEÑO - CENTRO DE GESTIÓN 
   Tokens, Variables y Estilos Globales
*/

:root {
    /* Paleta Principal */
    --color-primary: #1e1b4b; /* Indigo profundo */
    --color-primary-light: #4338ca;
    --color-accent: #2563eb; /* Azul brillante */
    --color-accent-hover: #1d4ed8;
    
    /* Neutros (Modo Claro) */
    --bg-base: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --border-color: #e2e8f0;
    --border-color-focus: #93c5fd;

    /* Semánticos (Estados) */
    --status-verified-bg: #dcfce7;
    --status-verified-text: #166534;
    --status-review-bg: #fef9c3;
    --status-review-text: #854d0e;
    --status-error-bg: #fee2e2;
    --status-error-text: #991b1b;
    --status-changed-bg: #dbeafe;
    --status-changed-text: #1e40af;

    /* Colores por Organismo/Categoría */
    --cat-extranjeria: #0ea5e9; /* Light blue */
    --cat-policia: #1d4ed8;    /* Dark blue */
    --cat-hacienda: #16a34a;   /* Green */
    --cat-dgt: #ea580c;        /* Orange */
    --cat-segsocial: #0284c7;  /* Ocean */
    --cat-sepe: #eab308;       /* Yellow */
    --cat-justicia: #7c3aed;   /* Purple */
    --cat-default: #64748b;    /* Slate */

    /* Tipografía */
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
    --text-xs: 0.75rem;   /* 12px */
    --text-sm: 0.875rem;  /* 14px */
    --text-base: 1rem;    /* 16px */
    --text-lg: 1.125rem;  /* 18px */
    --text-xl: 1.25rem;   /* 20px */
    --text-2xl: 1.5rem;   /* 24px */
    --text-3xl: 1.875rem; /* 30px */
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    --line-height-body: 1.6;
    --line-height-heading: 1.2;

    /* Espaciado (Base 4/8px) */
    --space-1: 0.25rem; /* 4px */
    --space-2: 0.5rem;  /* 8px */
    --space-3: 0.75rem; /* 12px */
    --space-4: 1rem;    /* 16px */
    --space-6: 1.5rem;  /* 24px */
    --space-8: 2rem;    /* 32px */
    --space-12: 3rem;   /* 48px */

    /* Layout */
    --max-width-container: 1280px;
    --sidebar-width: 280px;

    /* Radios y Sombras */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-hover: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    /* Transiciones */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modo Oscuro - Se activa si el sistema lo pide, o por clase .dark */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-base: #0f172a;
        --bg-surface: #1e293b;
        --bg-surface-hover: #334155;
        --text-primary: #f8fafc;
        --text-secondary: #cbd5e1;
        --text-tertiary: #94a3b8;
        --border-color: #334155;
        --border-color-focus: #3b82f6;

        --status-verified-bg: #064e3b;
        --status-verified-text: #6ee7b7;
        --status-review-bg: #713f12;
        --status-review-text: #fde047;
        --status-error-bg: #7f1d1d;
        --status-error-text: #fca5a5;
        --status-changed-bg: #1e3a8a;
        --status-changed-text: #93c5fd;
    }
}

/* Resets globales */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-base);
    color: var(--text-primary);
    line-height: var(--line-height-body);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    line-height: var(--line-height-heading);
    color: var(--text-primary);
    margin: 0;
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-accent-hover);
}


/* MICROINTERACCIONES Y SKELETONS - Paso 5 */
@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

.skeleton {
    animation: shimmer 2s infinite linear;
    background: linear-gradient(to right, var(--bg-surface-hover) 4%, var(--border-color) 25%, var(--bg-surface-hover) 36%);
    background-size: 1000px 100%;
    border-radius: var(--radius-sm);
}

/* Efecto de presión en botones táctiles (Microinteracción activa) */
.btn-primary:active, .nav-btn:active, .btn-icon:active, .mobile-btn:active {
    transform: scale(0.95);
}

/* Animación de entrada de tarjetas (Staggering en CSS) */
@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.bento-card, .doc-card {
    content-visibility: auto;
    contain-intrinsic-size: 200px; /* Placeholder para evitar CLS cuando content-visibility salta */
    animation: slideUpFade 0.4s ease-out forwards;
    opacity: 0;
}

/* Pequeño retardo en cada tarjeta para efecto cascada */
.bento-card:nth-child(1) { animation-delay: 0.05s; }
.bento-card:nth-child(2) { animation-delay: 0.10s; }
.bento-card:nth-child(3) { animation-delay: 0.15s; }
.bento-card:nth-child(4) { animation-delay: 0.20s; }
.bento-card:nth-child(5) { animation-delay: 0.25s; }
.bento-card:nth-child(6) { animation-delay: 0.30s; }

.doc-card:nth-child(1) { animation-delay: 0.10s; }
.doc-card:nth-child(2) { animation-delay: 0.15s; }
.doc-card:nth-child(3) { animation-delay: 0.20s; }
.doc-card:nth-child(4) { animation-delay: 0.25s; }
.doc-card:nth-child(5) { animation-delay: 0.30s; }
.doc-card:nth-child(6) { animation-delay: 0.35s; }

/* Hover mejorado para enlaces dentro del Bento */
.bento-card a {
    position: relative;
    overflow: hidden;
}
.bento-card a:hover {
    background: var(--bg-surface-hover) !important;
    transform: translateX(4px);
    transition: all var(--transition-fast);
}


/* KPI Cards Restored */
.kpi-cards {
    display: flex;
    justify-content: center;
    gap: var(--space-4);
    margin-top: var(--space-6);
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
}
.kpi-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-6);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    cursor: pointer;
    transition: var(--transition-fast);
    min-width: 200px;
    text-align: left;
}
.kpi-card:hover {
    transform: translateY(-2px);
    border-color: var(--color-accent);
    box-shadow: var(--shadow-md);
}
.kpi-card i {
    font-size: 24px;
    color: var(--color-primary-light);
    background: var(--bg-base);
    padding: 12px;
    border-radius: 50%;
}
.kpi-card > div {
    display: flex;
    flex-direction: column;
}
.kpi-value {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
}
.kpi-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}
