/**
 * ============================================================================
 * ARCHIVO: style.css
 * PROYECTO: KORI SPA OS | Interfaz Pública
 * ARQUITECTURA: Sinapse OS Enterprise Blueprint (Vanilla JS)
 * ============================================================================
 * Capa estética unificada. Prohibido el uso de !important salvo extrema 
 * necesidad. Todo se controla mediante Variables CSS para permitir la 
 * inyección asíncrona de colores desde el Panel de Administrador (Supabase).
 * ============================================================================
 */

/* ==========================================
   1. BLOQUE MAESTRO DE VARIABLES Y CMS
   ========================================== */
   :root {
    /* Paleta Base KORI SPA (Pueden ser sobreescritas por main.js) */
    --kori-primary: #FF007F; /* Rosa Fucsia / Magenta Vibrante */
    --kori-secondary: #00FFCC; /* Verde Menta / Aqua */
    --kori-accent: #D4AF37; /* Oro / Bronce */
    --kori-dark: #333333; /* Gris Oscuro para máxima legibilidad */
    --kori-light: #FFFFFF;
    --kori-bg-soft: #F9F9F9;
    
    /* Tipografía (Efecto Lujo Tecnológico) */
    --font-heading: 'Montserrat', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Tipografía Fluida (Responsive sin Media Queries complejas) */
    --text-h1: clamp(2.5rem, 5vw, 4rem);
    --text-h2: clamp(2rem, 4vw, 3rem);
    --text-h3: clamp(1.5rem, 3vw, 2rem);
    --text-body: clamp(1rem, 1.5vw, 1.125rem);
    --text-small: clamp(0.875rem, 1vw, 1rem);

    /* Espaciado y UI */
    --border-radius: 12px;
    --border-radius-pill: 50px;
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 8px 30px rgba(255, 0, 127, 0.15);
    --transition-bezier: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    
    /* Altura del Header para cálculos de scroll */
    --header-height: 80px;
}

/* ==========================================
   2. RESET DE INGENIERÍA
   ========================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-body);
    color: var(--kori-dark);
    background-color: var(--kori-light);
    line-height: 1.6;
    overflow-x: hidden;
    padding-top: var(--header-height); /* Evita que el header tape el contenido */
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--kori-dark);
}

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

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ==========================================
   3. ARQUITECTURA SPA (SECTION PANES)
   ========================================== */
.section-pane {
    display: none; /* Oculto por defecto, main.js gestiona la visibilidad */
    min-height: calc(100vh - var(--header-height));
    padding: 4rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
    animation-duration: 0.6s;
}

.section-pane.active {
    display: block;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-header h2 {
    font-size: var(--text-h2);
    color: var(--kori-primary);
}

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

/* ==========================================
   4. NAVEGACIÓN SUPERIOR (DESKTOP)
   ========================================== */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    z-index: 1000;
    box-shadow: var(--shadow-soft);
}

.logo-container .brand-logo {
    height: 50px;
    object-fit: contain;
}

.desktop-menu {
    display: flex;
    gap: 1.5rem;
}

.desktop-menu .nav-btn {
    background: none;
    border: none;
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 1rem;
    color: var(--kori-dark);
    cursor: pointer;
    transition: var(--transition-bezier);
    position: relative;
    padding: 0.5rem 0;
}

.desktop-menu .nav-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--kori-primary);
    transition: var(--transition-bezier);
}

.desktop-menu .nav-btn:hover::after,
.desktop-menu .nav-btn.active::after {
    width: 100%;
}

.desktop-menu .nav-btn.active {
    color: var(--kori-primary);
}

.desktop-menu .highlight-btn {
    background: var(--kori-primary);
    color: var(--kori-light);
    padding: 0.5rem 1.5rem;
    border-radius: var(--border-radius-pill);
}

.desktop-menu .highlight-btn::after {
    display: none;
}

.desktop-menu .highlight-btn:hover {
    background: var(--kori-dark);
    color: var(--kori-light);
}

.auth-container .login-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--kori-primary);
}

/* ==========================================
   5. NAVEGACIÓN INFERIOR (MOBILE APP FIRST)
   ========================================== */
.bottom-nav-mobile {
    display: none; /* Oculto en desktop */
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--kori-light);
    box-shadow: 0 -2px 15px rgba(0,0,0,0.05);
    z-index: 1000;
    justify-content: space-around;
    padding: 0.8rem 0;
    padding-bottom: env(safe-area-inset-bottom, 0.8rem); /* Para iPhone Notch */
}

.bottom-nav-mobile .nav-btn {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    color: #888;
    cursor: pointer;
    font-size: 0.75rem;
    transition: var(--transition-bezier);
}

.bottom-nav-mobile .nav-btn i {
    font-size: 1.2rem;
}

.bottom-nav-mobile .nav-btn.active {
    color: var(--kori-primary);
    transform: translateY(-2px);
}

/* ==========================================
   6. UI COMPONENTS: BOTONES Y HERO
   ========================================== */
.cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2rem;
    border-radius: var(--border-radius-pill);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition-bezier);
    border: 2px solid transparent;
}

.primary-btn {
    background: var(--kori-primary);
    color: var(--kori-light);
    box-shadow: var(--shadow-soft);
}

.primary-btn:hover {
    background: #d6006a; /* Tono más oscuro de Fucsia */
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

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

.outline-btn:hover {
    background: var(--kori-primary);
    color: var(--kori-light);
}

.btn-text-only {
    background: none;
    border: none;
    color: #666;
    text-decoration: underline;
    cursor: pointer;
    font-size: var(--text-small);
}

/* HERO SECTION */
.hero-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 70vh;
    text-align: center;
    background: radial-gradient(circle at center, rgba(0, 255, 204, 0.05) 0%, rgba(255, 0, 127, 0.02) 100%);
    border-radius: var(--border-radius);
    padding: 2rem;
}

.hero-content h1 {
    font-size: var(--text-h1);
    color: var(--kori-primary);
}

.hero-content p {
    font-size: var(--text-body);
    margin-bottom: 2rem;
}

/* BANNER PROMOCIONAL ESTRATÉGICO */
.promo-banner {
    background: linear-gradient(135deg, var(--kori-primary), #ff4da6);
    color: var(--kori-light);
    padding: 2rem;
    border-radius: var(--border-radius);
    margin: 2rem auto;
    max-width: 600px;
    position: relative;
    box-shadow: var(--shadow-hover);
    transform: scale(1);
    animation: pulseSoft 3s infinite;
}

.promo-badge {
    position: absolute;
    top: -15px;
    right: -15px;
    background: var(--kori-accent);
    color: var(--kori-light);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-pill);
    font-weight: 800;
    font-size: 0.9rem;
    transform: rotate(5deg);
    box-shadow: var(--shadow-soft);
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ==========================================
   7. BLOQUE MAESTRO DE RESPONSIVIDAD (GRID)
   ========================================== */
.grid-container {
    display: grid;
    /* Grid fluido y automático, no requiere media queries complejas */
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    width: 100%;
}

/* SKELETON LOADERS (UX FAIL-SAFE) */
.skeleton-card {
    background: var(--kori-light);
    border-radius: var(--border-radius);
    padding: 1rem;
    box-shadow: var(--shadow-soft);
}

.skeleton-img, .skeleton-text {
    background: #e0e0e0;
    border-radius: 8px;
    animation: shimmer 1.5s infinite linear;
    background: linear-gradient(to right, #eeeeee 8%, #dddddd 18%, #eeeeee 33%);
    background-size: 800px 100%;
}

.skeleton-img {
    height: 200px;
    margin-bottom: 1rem;
}

.skeleton-text {
    height: 20px;
    margin-bottom: 0.5rem;
}

.skeleton-text.small {
    width: 60%;
}

/* ==========================================
   8. FORMULARIOS INTELIGENTES (CRM LEADS)
   ========================================== */
.form-wrapper {
    background: var(--kori-light);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-soft);
    padding: 3rem;
    max-width: 800px;
    margin: 0 auto;
}

.smart-form .form-group {
    margin-bottom: 1.5rem;
}

.smart-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--kori-dark);
}

.smart-form input[type="text"],
.smart-form input[type="tel"],
.smart-form select {
    width: 100%;
    padding: 1rem;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 1rem;
    transition: var(--transition-bezier);
    background: var(--kori-bg-soft);
}

.smart-form input:focus,
.smart-form select:focus {
    outline: none;
    border-color: var(--kori-secondary);
    box-shadow: 0 0 0 3px rgba(0, 255, 204, 0.2);
    background: var(--kori-light);
}

/* FIRMA DIGITAL CANVAS */
.signature-wrapper {
    border: 2px dashed #ccc;
    border-radius: 8px;
    background: #fff;
    touch-action: none; /* Previene scroll en móviles al firmar */
    position: relative;
    overflow: hidden;
}

.signature-pad {
    width: 100%;
    height: 200px;
    display: block;
}

.error-pulse {
    border-color: red !important;
    animation: pulseError 0.5s ease-in-out;
}

/* PROGRESS BAR */
.form-progress-bar {
    width: 100%;
    height: 6px;
    background: #eee;
    border-radius: 3px;
    margin-bottom: 2rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--kori-secondary);
    width: 33%; /* Ajustado dinámicamente vía JS */
    transition: width 0.3s ease;
}

/* ==========================================
   9. SECCIÓN EDUCATIVA (BLOG PODOLOGÍA)
   ========================================== */
.educational-block {
    background: var(--kori-bg-soft);
    border-left: 5px solid var(--kori-secondary);
    padding: 2rem;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    margin-bottom: 3rem;
}

.edu-content h3 {
    color: var(--kori-secondary);
}

.edu-list {
    list-style: none;
    margin-top: 1rem;
}

.edu-list li {
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
}

.edu-list i {
    color: var(--kori-secondary);
    margin-top: 5px;
}

/* ==========================================
   10. SISTEMA DE TOASTS & UTILS
   ========================================== */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--kori-dark);
    color: var(--kori-light);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.toast-success i { color: var(--kori-secondary); }
.toast-error i { color: #ff3333; }
.toast-info i { color: #33ccff; }

.hidden { display: none !important; }

/* ANIMACIONES KEYFRAMES */
@keyframes shimmer {
    0% { background-position: -468px 0; }
    100% { background-position: 468px 0; }
}

@keyframes pulseSoft {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

@keyframes pulseError {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}

/* ==========================================
   11. MEDIA QUERIES ESTRATÉGICAS
   ========================================== */
@media (max-width: 768px) {
    /* Ocultar menú desktop, mostrar Bottom Nav */
    .desktop-menu, .auth-container {
        display: none;
    }
    
    .bottom-nav-mobile {
        display: flex;
    }

    /* Ajustar layout para móviles */
    .section-pane {
        padding: 2rem 1rem;
        padding-bottom: 6rem; /* Espacio para el bottom nav */
    }

    .hero-wrapper {
        min-height: 50vh;
        padding: 1rem;
    }

    .form-wrapper {
        padding: 1.5rem;
    }

    .hero-actions {
        flex-direction: column;
        width: 100%;
    }

    .cta-btn {
        width: 100%;
    }
}