/* ============================================
   MAIN.CSS - Sistema de Diseño Base
   Abeme Modjobuy - Envíos Ghana ↔ Guinea Ecuatorial
   ============================================ */

/* ============================================
   1. VARIABLES CSS GLOBALES
   ============================================ */
:root {
    /* Colores Primarios - Verde Corporativo */
    --color-primary: #1a4d2e;
    --color-primary-light: #2d6b3f;
    --color-primary-dark: #0f3a1f;
    --color-primary-rgb: 26, 77, 46;
    
    /* Colores Secundarios */
    --color-secondary: #f59e0b;
    --color-secondary-light: #fbbf24;
    --color-secondary-dark: #d97706;
    
    /* Colores de Acento */
    --color-accent: #10b981;
    --color-accent-light: #34d399;
    --color-accent-dark: #059669;
    
    /* Neutrales */
    --color-white: #ffffff;
    --color-black: #000000;
    --color-gray-50: #f9fafb;
    --color-gray-100: #f3f4f6;
    --color-gray-200: #e5e7eb;
    --color-gray-300: #d1d5db;
    --color-gray-400: #9ca3af;
    --color-gray-500: #6b7280;
    --color-gray-600: #4b5563;
    --color-gray-700: #374151;
    --color-gray-800: #1f2937;
    --color-gray-900: #111827;
    
    /* Colores Semánticos */
    --color-success: #10b981;
    --color-success-light: #d1fae5;
    --color-success-dark: #065f46;
    --color-warning: #f59e0b;
    --color-warning-light: #fef3c7;
    --color-warning-dark: #92400e;
    --color-error: #ef4444;
    --color-error-light: #fee2e2;
    --color-error-dark: #991b1b;
    --color-info: #3b82f6;
    --color-info-light: #dbeafe;
    --color-info-dark: #1e40af;
    
    /* Backgrounds */
    --bg-body: #f5f7fa;
    --bg-surface: #ffffff;
    --bg-overlay: rgba(0, 0, 0, 0.5);
    
    /* Borders */
    --border-color: #e5e7eb;
    --border-color-dark: #d1d5db;
    
    /* Espaciado (Sistema 4px) */
    --space-0: 0;
    --space-1: 0.25rem;   /* 4px */
    --space-2: 0.5rem;    /* 8px */
    --space-3: 0.75rem;   /* 12px */
    --space-4: 1rem;      /* 16px */
    --space-5: 1.25rem;   /* 20px */
    --space-6: 1.5rem;    /* 24px */
    --space-8: 2rem;      /* 32px */
    --space-10: 2.5rem;   /* 40px */
    --space-12: 3rem;     /* 48px */
    --space-16: 4rem;     /* 64px */
    --space-20: 5rem;     /* 80px */
    
    /* Tipografía */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-family-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    
    --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 */
    --font-size-5xl: 3rem;        /* 48px */
    
    --font-weight-light: 300;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --font-weight-extrabold: 800;
    
    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;
    
    /* Border Radius */
    --radius-none: 0;
    --radius-sm: 0.375rem;    /* 6px */
    --radius-md: 0.5rem;      /* 8px */
    --radius-lg: 0.75rem;     /* 12px */
    --radius-xl: 1rem;        /* 16px */
    --radius-2xl: 1.5rem;     /* 24px */
    --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 -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    
    /* Transiciones */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slower: 500ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Z-Index Scale */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
    
    /* Layout */
    --header-height: 60px;
    --footer-height: auto;
    --container-max-width: 1400px;
    --container-padding: var(--space-4);
    
    /* Breakpoints (para referencia en JS) */
    --breakpoint-sm: 640px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 1024px;
    --breakpoint-xl: 1440px;
}

/* ============================================
   2. RESET Y NORMALIZACIÓN
   ============================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    color: var(--color-gray-900);
    background-color: var(--bg-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================
   3. TIPOGRAFÍA BASE
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
    color: var(--color-gray-900);
}

/* Dentro de secciones con color de texto explícito (hero, banners de color)
   los headings heredan el color del contenedor padre */
.hero-premium h1,
.hero-premium h2,
.hero-premium h3,
.hero-premium p,
[class*="hero"] h1,
[class*="hero"] h2,
[class*="hero"] p {
    color: inherit;
}

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(--space-4) 0;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-primary-dark);
}

a:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

strong, b {
    font-weight: var(--font-weight-bold);
}

em, i {
    font-style: italic;
}

small {
    font-size: var(--font-size-sm);
}

code {
    font-family: var(--font-family-mono);
    font-size: 0.875em;
    padding: 0.125rem 0.25rem;
    background-color: var(--color-gray-100);
    border-radius: var(--radius-sm);
}

/* ============================================
   4. LISTAS
   ============================================ */
ul, ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

/* ============================================
   5. IMÁGENES Y MEDIA
   ============================================ */
img, svg, video, canvas, audio, iframe, embed, object {
    display: block;
    max-width: 100%;
    height: auto;
}

img {
    border-style: none;
}

/* ============================================
   6. FORMULARIOS BASE
   ============================================ */
button, input, optgroup, select, textarea {
    font-family: inherit;
    font-size: 100%;
    line-height: inherit;
    margin: 0;
}

button, select {
    text-transform: none;
}

button, [type='button'], [type='reset'], [type='submit'] {
    -webkit-appearance: button;
    cursor: pointer;
}

button:disabled, [disabled] {
    cursor: not-allowed;
    opacity: 0.6;
}

input, textarea, select {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
}

textarea {
    resize: vertical;
}

::placeholder {
    color: var(--color-gray-400);
    opacity: 1;
}

/* ============================================
   7. TABLAS BASE
   ============================================ */
table {
    border-collapse: collapse;
    border-spacing: 0;
    width: 100%;
}

/* ============================================
   8. LAYOUT PRINCIPAL
   ============================================ */
.main-content {
    flex: 1;
    width: 100%;
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: var(--space-6) var(--container-padding);
}

/* Páginas que gestionan su propio layout (blog, landing, etc.)
   El wrapper no añade padding ni max-width — la página toma el control */
.main-content--blog,
.main-content--full {
    padding: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
}

.container {
    width: 100%;
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

.section {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
    box-shadow: var(--shadow-sm);
}

/* En móvil el container tiene padding lateral mínimo de app nativa */
@media (max-width: 768px) {
    .container {
        padding: 0 0.75rem;
    }
}

/* ============================================
   9. UTILIDADES DE ACCESIBILIDAD
   ============================================ */
.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;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--color-primary);
    color: var(--color-white);
    padding: var(--space-2) var(--space-4);
    text-decoration: none;
    z-index: var(--z-tooltip);
}

.skip-link:focus {
    top: 0;
}

/* ============================================
   10. FOCUS VISIBLE (Accesibilidad)
   ============================================ */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* ============================================
   11. SCROLLBAR PERSONALIZADO
   ============================================ */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--color-gray-100);
    border-radius: var(--radius-md);
}

::-webkit-scrollbar-thumb {
    background: var(--color-gray-400);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-gray-500);
}

/* ============================================
   12. SELECCIÓN DE TEXTO
   ============================================ */
::selection {
    background-color: rgba(var(--color-primary-rgb), 0.2);
    color: var(--color-gray-900);
}

/* ============================================
   13. RESPONSIVE - MOBILE FIRST
   ============================================ */

/* Móvil (< 640px) — base por defecto, sin media query */
/* .main-content hereda padding: var(--space-6) var(--container-padding)
   pero override-modern.css lo resetea a 0 en ≤768px con !important */

/* Tablet pequeño (640px+) */
@media (min-width: 640px) {
    :root {
        --header-height: 60px;
        --container-padding: var(--space-6);
    }

    h1 { font-size: var(--font-size-5xl); }
    h2 { font-size: var(--font-size-4xl); }
    h3 { font-size: var(--font-size-3xl); }
}

/* Tablet (768px+) */
@media (min-width: 769px) {
    .main-content {
        padding: var(--space-8) var(--container-padding);
    }

    .section {
        padding: var(--space-8);
    }
}

/* Móvil (≤768px) — wrapper sin padding, secciones compactas */
@media (max-width: 768px) {
    .main-content {
        padding: 0;
        max-width: 100%;
        width: 100%;
    }

    .section {
        padding: 1rem 0.75rem;
        border-radius: var(--radius-lg);
        margin-bottom: 0.75rem;
    }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    :root {
        --container-padding: var(--space-8);
    }
}

/* Desktop XL (1440px+) */
@media (min-width: 1440px) {
    :root {
        --container-padding: var(--space-12);
    }
}

/* ============================================
   14. PRINT STYLES
   ============================================ */
@media print {
    *,
    *::before,
    *::after {
        background: transparent !important;
        color: #000 !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    a,
    a:visited {
        text-decoration: underline;
    }
    
    a[href]::after {
        content: " (" attr(href) ")";
    }
    
    img {
        page-break-inside: avoid;
    }
    
    h2, h3 {
        page-break-after: avoid;
    }
}

/* ============================================
   15. REDUCED MOTION (Accesibilidad)
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================
   16. HIGH CONTRAST MODE (Accesibilidad)
   ============================================ */
@media (prefers-contrast: high) {
    :root {
        --border-color: var(--color-gray-900);
    }
    
    button,
    a,
    input,
    select,
    textarea {
        border: 2px solid currentColor;
    }
}
