/* ===== BASE.CSS - SISTEMA GLOBAL PÚBLICO ===== */
/* Tokens, reset, tipografía, layout, botones, utilidades, accesibilidad */


/* ===== TOKENS ===== */
:root {
    /* Colores principales */
    --primary: #e7a641;
    --primary-hover: #d48f2a;
    --primary-dark: #c47a2e;
    --primary-light: #f1ab43;

    --secondary: #2ecc71;
    --secondary-dark: #27ae60;

    --accent: #f59e0b;
    --accent-dark: #d97706;

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #dc3545;
    --error: #ef4444;
    --info: #3b82f6;

    /* Escala de grises */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Texto */
    --dark-text: #2c3e50;
    --medium-text: #495057;
    --light-text: #6c757d;

    /* Fondos */
    --background-light: #f8fafc;
    --background-accent: #f0f7ff;
    --white: #ffffff;
    --gray-light: #e2e8f0;

    /* Tipografía */
    --font-primary: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-heading: 'Montserrat', 'Inter', system-ui, sans-serif;
    --font-mono: 'Fira Code', 'Roboto Mono', monospace;

    /* Tamaños */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;
    --text-5xl: 3rem;

    /* Espaciado */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    --space-24: 6rem;

    /* Bordes */
    --radius-sm: 0.125rem;
    --radius: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 0.75rem;
    --radius-2xl: 1rem;
    --radius-full: 9999px;

    /* Sombras */
    --shadow-soft: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-medium: 0 10px 20px rgba(0, 0, 0, 0.1);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 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);

    /* Transiciones */
    --transition-fast: all 0.2s ease;
    --transition-medium: all 0.3s ease;
    --transition-slow: all 0.5s ease;

    /* Breakpoints */
    --screen-sm: 640px;
    --screen-md: 768px;
    --screen-lg: 1024px;
    --screen-xl: 1280px;
    --screen-2xl: 1536px;
}


/* ===== RESET ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--font-primary);
    line-height: 1.6;
    color: var(--medium-text);
    background-color: var(--background-light);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

main {
    flex: 1;
}

img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
    height: auto;
}

button,
input,
textarea,
select {
    font: inherit;
}

ul,
ol {
    list-style: none;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition-medium);
}

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

.whatsapp-float:hover,
.whatsapp-float:hover i {
    color: #fff;
}


/* ===== TIPOGRAFÍA ===== */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.25;
    color: var(--dark-text);
    margin-bottom: var(--space-4);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
    margin-bottom: var(--space-4);
    color: var(--medium-text);
}

strong {
    color: var(--dark-text);
}


/* ===== LAYOUT GLOBAL ===== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding-inline: var(--space-6);
}

.main-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-8) var(--space-6);
}


/* ===== SECCIONES GENÉRICAS ===== */
.section-header {
    text-align: center;
    margin-bottom: var(--space-16);
    padding-inline: var(--space-4);
}

.section-header h2 {
    font-size: clamp(2rem, 4vw, 2.5rem);
    margin-bottom: var(--space-4);
    font-weight: 800;
}

.section-header p {
    color: var(--light-text);
    font-size: var(--text-lg);
    max-width: 600px;
    margin: 0 auto;
}

.titulo-nivel-principal {
    color: var(--primary-dark);
    font-size: var(--text-4xl);
    margin-top: var(--space-16);
    margin-bottom: var(--space-12);
    font-weight: 800;
    text-align: center;
}


/* ===== BOTONES ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-8);
    border: 2px solid transparent;
    border-radius: var(--radius-full);
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    font-size: var(--text-base);
    font-weight: 600;
    transition: var(--transition-medium);
}

.btn-primary {
    background-color: var(--primary);
    color: var(--white);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background-color: var(--secondary);
    color: var(--white);
    box-shadow: var(--shadow-md);
}

.btn-secondary:hover {
    background-color: var(--secondary-dark);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: var(--white);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.btn-ghost {
    background: transparent;
    color: var(--medium-text);
    border: none;
}

.btn-ghost:hover {
    background: var(--gray-100);
    color: var(--dark-text);
}

.btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
}

.btn-lg {
    padding: var(--space-4) var(--space-10);
    font-size: var(--text-lg);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-loading {
    position: relative;
    color: transparent;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}


/* ===== CARDS GENÉRICAS ===== */
.card {
    margin: var(--space-6) 0;
    padding: var(--space-8);
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-medium);
    transition: var(--transition-medium);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}


/* ===== GRID Y FLEX UTILITIES ===== */
.grid {
    display: grid;
    gap: var(--space-6);
}

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.grid-auto-fit {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }

.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }

.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }


/* ===== UTILIDADES ===== */
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mt-10 { margin-top: var(--space-10); }
.mt-12 { margin-top: var(--space-12); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.mb-10 { margin-bottom: var(--space-10); }
.mb-12 { margin-bottom: var(--space-12); }

.p-1 { padding: var(--space-1); }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }

.text-primary { color: var(--primary); }
.text-secondary { color: var(--secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--light-text); }

.rounded { border-radius: var(--radius); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow { box-shadow: var(--shadow); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }


/* ===== MODAL GLOBAL ===== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.modal-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: none;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    animation: fadeIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-6);
    color: var(--white);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}

.modal-title {
    margin: 0;
    font-size: var(--text-xl);
    font-weight: 600;
}

.modal-close {
    padding: 0 var(--space-2);
    border: none;
    background: none;
    color: var(--white);
    font-size: var(--text-2xl);
    line-height: 1;
    cursor: pointer;
    opacity: 0.8;
    transition: var(--transition-fast);
}

.modal-close:hover {
    opacity: 1;
    transform: scale(1.1);
}

.modal-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: var(--space-8);
    background-color: var(--background-light);
}

.modal-footer {
    display: flex;
    justify-content: center;
    padding: var(--space-6);
    background-color: var(--background-light);
}


/* ===== ESTADOS ===== */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.skeleton {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}


/* ===== ACCESIBILIDAD ===== */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}


/* ===== ANIMACIONES ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

.slide-in {
    animation: slideIn 0.4s ease-out;
}


/* ===== WHATSAPP GLOBAL ===== */
.whatsapp-float {
    position: fixed;
    right: 18px;
    bottom: 20px;
    width: 58px;
    height: 58px;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, #25D366, #128C7E);
    border-radius: 50%;
    text-decoration: none;
    font-size: 30px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
    transition: transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
    animation: whatsappPulse 2.2s ease-in-out infinite;
}

.whatsapp-float::before {
    content: "";
    position: absolute;
    inset: -6px;
    border: 2px solid rgba(37, 211, 102, 0.45);
    border-radius: 50%;
    opacity: 0;
    animation: whatsappRing 2.2s ease-out infinite;
}

.whatsapp-float:hover {
    transform: translateY(-3px) scale(1.08);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
    filter: brightness(1.04);
}

.whatsapp-float:active {
    transform: scale(0.96);
}

.whatsapp-float i {
    pointer-events: none;
    font-size: 30px;
    animation: whatsappIconBounce 2.2s ease-in-out infinite;
}

@keyframes whatsappPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
    }
    15% {
        transform: scale(1.04);
        box-shadow: 0 10px 24px rgba(37, 211, 102, 0.28);
    }
    30% {
        transform: scale(1);
        box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
    }
}

@keyframes whatsappRing {
    0% {
        transform: scale(0.92);
        opacity: 0;
    }
    20% {
        opacity: 0.55;
    }
    70% {
        transform: scale(1.22);
        opacity: 0;
    }
    100% {
        transform: scale(1.22);
        opacity: 0;
    }
}

@keyframes whatsappIconBounce {
    0%, 100% { transform: scale(1); }
    15% { transform: scale(1.12); }
    30% { transform: scale(1); }
}


/* ===== RESPONSIVE GLOBAL ===== */
@media (max-width: 900px) {
    .whatsapp-float {
        width: 54px;
        height: 54px;
        right: 16px;
        bottom: 18px;
        font-size: 28px;
    }

    .whatsapp-float i {
        font-size: 28px;
    }
}

@media (max-width: 768px) {
    .main-container {
        padding: var(--space-6) var(--space-4);
    }

    .btn {
        padding: var(--space-2) var(--space-6);
        font-size: var(--text-sm);
    }

    .section-header h2 {
        font-size: var(--text-2xl);
    }

    .card {
        padding: var(--space-6);
    }

}

@media (max-width: 640px) {
    .btn {
        width: 100%;
    }

    .whatsapp-float {
        width: 52px;
        height: 52px;
        right: 14px;
        bottom: 14px;
    }

    .whatsapp-float i {
        font-size: 26px;
    }
}


/* ===== REDUCIR MOVIMIENTO ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .whatsapp-float,
    .whatsapp-float::before,
    .whatsapp-float i {
        animation: none;
        transition: none;
    }
}

