/**
 * =============================================================================
 * BANCHY BLOODBANK - DESIGN SYSTEM
 * =============================================================================
 * Sistema de diseño unificado para toda la aplicación
 * Versión: 1.0.0
 * Autor: Banchy Team
 * =============================================================================
 */

/* =============================================================================
   1. CSS VARIABLES & DESIGN TOKENS
   ============================================================================= */

:root {
    /* ===== COLORES PRIMARIOS ===== */
    --primary: #457B9D;
    --primary-dark: #1D3557;
    --primary-light: #6B9BC2;
    --primary-lighter: #A8D5E2;
    --primary-hover: #3A6A85;
    
    /* ===== COLORES DE ACENTO ===== */
    --accent: #A8DADC;
    --accent-light: #E0F4F5;
    --accent-dark: #89C5C8;
    
    /* ===== COLORES SECUNDARIOS ===== */
    --secondary: #264653;
    --secondary-light: #2A5A6B;
    --secondary-dark: #1A3340;
    
    /* ===== COLORES DE ESTADO ===== */
    --success: #10B981;
    --success-light: #D1FAE5;
    --success-dark: #059669;
    
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --warning-dark: #D97706;
    
    --error: #EF4444;
    --error-light: #FEE2E2;
    --error-dark: #DC2626;
    
    --info: #3B82F6;
    --info-light: #DBEAFE;
    --info-dark: #2563EB;
    
    /* ===== COLORES DE SUPERFICIE ===== */
    --surface: #FFFFFF;
    --surface-50: #F9FAFB;
    --surface-100: #F3F4F6;
    --surface-200: #E5E7EB;
    --surface-300: #D1D5DB;
    --surface-glass: rgba(255, 255, 255, 0.85);
    --surface-glass-dark: rgba(255, 255, 255, 0.95);
    
    /* ===== FONDOS ===== */
    --bg-primary: linear-gradient(135deg, #F5F7FA 0%, #E8EDF2 100%);
    --bg-secondary: linear-gradient(135deg, #FFFFFF 0%, #F8FAFC 100%);
    --bg-page: #F5F7FA;
    
    /* ===== GRADIENTES ===== */
    --gradient-primary: linear-gradient(135deg, #457B9D 0%, #1D3557 100%);
    --gradient-accent: linear-gradient(135deg, #A8DADC 0%, #6B9BC2 100%);
    --gradient-success: linear-gradient(135deg, #10B981 0%, #059669 100%);
    --gradient-overlay: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.1) 100%);
    
    /* ===== COLORES DE TEXTO ===== */
    --text-primary: #1D3557;
    --text-secondary: #64748B;
    --text-tertiary: #94A3B8;
    --text-muted: #CBD5E1;
    --text-white: #FFFFFF;
    --text-inverse: #FFFFFF;
    
    /* ===== BORDES ===== */
    --border-color: #E2E8F0;
    --border-light: rgba(226, 232, 240, 0.3);
    --border-dark: #CBD5E1;
    --border-radius-sm: 6px;
    --border-radius-md: 8px;
    --border-radius-lg: 12px;
    --border-radius-xl: 16px;
    --border-radius-2xl: 24px;
    --border-radius-full: 9999px;
    
    /* ===== SOMBRAS ===== */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --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), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
    
    /* ===== TIPOGRAFÍA ===== */
    --font-family-base: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-family-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', monospace;
    
    /* Tamaños de fuente */
    --font-size-xs: 0.75rem;      /* 12px */
    --font-size-sm: 0.875rem;     /* 14px */
    --font-size-base: 1rem;       /* 16px */
    --font-size-lg: 1.125rem;     /* 18px */
    --font-size-xl: 1.25rem;      /* 20px */
    --font-size-2xl: 1.5rem;      /* 24px */
    --font-size-3xl: 1.875rem;    /* 30px */
    --font-size-4xl: 2.25rem;     /* 36px */
    
    /* Pesos de fuente */
    --font-weight-light: 300;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --font-weight-extrabold: 800;
    
    /* Altura de línea */
    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;
    
    /* ===== ESPACIADO ===== */
    --spacing-xs: 0.25rem;    /* 4px */
    --spacing-sm: 0.5rem;     /* 8px */
    --spacing-md: 1rem;       /* 16px */
    --spacing-lg: 1.5rem;     /* 24px */
    --spacing-xl: 2rem;       /* 32px */
    --spacing-2xl: 2.5rem;    /* 40px */
    --spacing-3xl: 3rem;      /* 48px */
    --spacing-4xl: 4rem;      /* 64px */
    
    /* ===== DIMENSIONES ===== */
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --header-height: 64px;
    --container-sm: 640px;
    --container-md: 768px;
    --container-lg: 1024px;
    --container-xl: 1280px;
    --container-2xl: 1536px;
    
    /* ===== TRANSICIONES ===== */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 500ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
    
    /* ===== Z-INDEX ===== */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
}

/* =============================================================================
   2. RESET & BASE STYLES
   ============================================================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

*,
*::before,
*::after {
    box-sizing: inherit;
}

html {
    box-sizing: border-box;
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    color: var(--text-primary);
    background: var(--bg-page);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* =============================================================================
   3. TIPOGRAFÍA
   ============================================================================= */

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
    color: var(--text-primary);
}

h1 { font-size: var(--font-size-4xl); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }
h5 { font-size: var(--font-size-lg); }
h6 { font-size: var(--font-size-base); }

p {
    margin: 0 0 var(--spacing-md) 0;
    color: var(--text-secondary);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-hover);
}

strong, b {
    font-weight: var(--font-weight-semibold);
}

small {
    font-size: var(--font-size-sm);
}

code {
    font-family: var(--font-family-mono);
    font-size: 0.875em;
    background: var(--surface-100);
    padding: 0.125rem 0.25rem;
    border-radius: var(--border-radius-sm);
}

/* =============================================================================
   4. LAYOUT UTILITIES
   ============================================================================= */

.container {
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.container-sm { max-width: var(--container-sm); }
.container-md { max-width: var(--container-md); }
.container-lg { max-width: var(--container-lg); }
.container-xl { max-width: var(--container-xl); }
.container-2xl { max-width: var(--container-2xl); }

/* =============================================================================
   5. SCROLLBAR PERSONALIZADO
   ============================================================================= */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--surface-100);
}

::-webkit-scrollbar-thumb {
    background: var(--surface-300);
    border-radius: var(--border-radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* =============================================================================
   6. ANIMACIONES GLOBALES
   ============================================================================= */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(-25%);
        animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
    }
    50% {
        transform: translateY(0);
        animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
    }
}

/* =============================================================================
   7. CLASES DE ANIMACIÓN
   ============================================================================= */

.animate-fade-in {
    animation: fadeIn var(--transition-base);
}

.animate-fade-in-up {
    animation: fadeInUp var(--transition-base);
}

.animate-fade-in-down {
    animation: fadeInDown var(--transition-base);
}

.animate-slide-in-right {
    animation: slideInRight var(--transition-base);
}

.animate-slide-in-left {
    animation: slideInLeft var(--transition-base);
}

.animate-spin {
    animation: spin 1s linear infinite;
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-bounce {
    animation: bounce 1s infinite;
}

/* =============================================================================
   8. RESPONSIVE DESIGN
   ============================================================================= */

/* Mobile first approach */
@media (max-width: 640px) {
    :root {
        --sidebar-width: 100%;
    }
}

@media (min-width: 768px) {
    .container {
        padding: 0 var(--spacing-lg);
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 0 var(--spacing-xl);
    }
}

/* =============================================================================
   9. PRINT STYLES
   ============================================================================= */

@media print {
    * {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    a,
    a:visited {
        text-decoration: underline;
    }
    
    pre,
    blockquote {
        border: 1px solid #999;
        page-break-inside: avoid;
    }
    
    thead {
        display: table-header-group;
    }
    
    tr,
    img {
        page-break-inside: avoid;
    }
    
    img {
        max-width: 100% !important;
    }
    
    p,
    h2,
    h3 {
        orphans: 3;
        widows: 3;
    }
    
    h2,
    h3 {
        page-break-after: avoid;
    }
}

/* =============================================================================
   10. ACCESIBILIDAD
   ============================================================================= */

/* Respetar preferencias de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible para teclado */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Ocultar visualmente pero mantener para lectores de pantalla */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
