/* ===============================
   MOBILE CRITICAL CSS
   =============================== */
   
/* CSS Variables Mobile Optimized */
:root {
    /* Colors - Mobile Optimized */
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-200: #c7d2fe;
    --primary-300: #a5b4fc;
    --primary-400: #818cf8;
    --primary-500: #6366f1;
    --primary-600: #4f46e5;
    --primary-700: #4338ca;
    --primary-800: #3730a3;
    --primary-900: #312e81;
    
    /* Mobile-first color scheme */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-glass: rgba(15, 23, 42, 0.85);
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-accent: #6366f1;
    
    /* Mobile spacing */
    --space-xs: 0.25rem;   /* 4px */
    --space-sm: 0.5rem;    /* 8px */
    --space-md: 1rem;      /* 16px */
    --space-lg: 1.5rem;    /* 24px */
    --space-xl: 2rem;      /* 32px */
    --space-2xl: 3rem;     /* 48px */
    --space-3xl: 4rem;     /* 64px */
    
    /* Mobile font sizes */
    --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 */
    --text-4xl: 2.25rem;   /* 36px */
    
    /* Mobile shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.3);
    
    /* Mobile gradients */
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    --gradient-hero: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-card: linear-gradient(145deg, rgba(30, 41, 59, 0.9) 0%, rgba(51, 65, 85, 0.8) 100%);
    
    /* Mobile transitions */
    --transition-fast: 0.15s ease-out;
    --transition-normal: 0.3s ease-out;
    --transition-slow: 0.5s ease-out;
    
    /* Mobile borders */
    --border-radius-sm: 0.5rem;
    --border-radius-md: 0.75rem;
    --border-radius-lg: 1rem;
    --border-radius-xl: 1.5rem;
    
    /* Mobile header height */
    --header-height: 4rem;
    --bottom-nav-height: 4.5rem;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: var(--text-base);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    padding-top: var(--header-height);
    padding-bottom: var(--bottom-nav-height);
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity var(--transition-slow), visibility var(--transition-slow);
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-spinner {
    text-align: center;
}

.spinner {
    width: 3rem;
    height: 3rem;
    border: 3px solid rgba(99, 102, 241, 0.2);
    border-top: 3px solid var(--primary-500);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--space-md);
}

.loading-spinner p {
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile Header */
.mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(203, 213, 225, 0.1);
    z-index: 100;
    transition: transform var(--transition-fast);
}

.mobile-header.scrolled {
    background: rgba(15, 23, 42, 0.98);
    box-shadow: var(--shadow-lg);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 var(--space-md);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-sm);
    border-radius: var(--border-radius-md);
    transition: all var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.logo-container:hover {
    background: rgba(99, 102, 241, 0.1);
    transform: scale(1.02);
}

.logo-container:active {
    transform: scale(0.98);
    background: rgba(99, 102, 241, 0.2);
}

.logo {
    width: 2.5rem;
    height: 2.5rem;
    object-fit: contain;
    background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
    border-radius: 50%;
    padding: 0.3rem;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.15),
        0 2px 6px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(99, 102, 241, 0.2);
    transition: all var(--transition-fast);
}

.logo-container:hover .logo {
    box-shadow: 
        0 6px 20px rgba(99, 102, 241, 0.3),
        0 4px 12px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border-color: rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

.logo-container.active {
    background: rgba(99, 102, 241, 0.2);
}

.logo-container.active .logo {
    box-shadow: 
        0 8px 25px rgba(99, 102, 241, 0.4),
        0 4px 12px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    border-color: rgba(99, 102, 241, 0.6);
    transform: scale(1.05);
}

.logo-container.active .logo-text {
    text-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

.menu-indicator {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-left: var(--space-xs);
    padding: var(--space-xs);
}

.menu-indicator span {
    width: 12px;
    height: 1.5px;
    background: rgba(248, 250, 252, 0.6);
    border-radius: 1px;
    transition: all var(--transition-fast);
}

.logo-container:hover .menu-indicator span {
    background: rgba(99, 102, 241, 0.8);
}

.logo-container.active .menu-indicator span:nth-child(1) {
    transform: rotate(45deg) translate(3px, 3px);
    background: rgba(99, 102, 241, 1);
}

.logo-container.active .menu-indicator span:nth-child(2) {
    opacity: 0;
}

.logo-container.active .menu-indicator span:nth-child(3) {
    transform: rotate(-45deg) translate(3px, -3px);
    background: rgba(99, 102, 241, 1);
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.025em;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Mobile Navigation */
.mobile-nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
    z-index: 99;
}

.mobile-nav.active {
    transform: translateX(0);
}

.nav-content {
    padding: var(--space-xl) var(--space-md);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.nav-link {
    display: block;
    padding: var(--space-md) 0;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--text-lg);
    font-weight: 500;
    transition: color var(--transition-fast);
    border-bottom: 1px solid rgba(203, 213, 225, 0.1);
}

.nav-link.active,
.nav-link:hover {
    color: var(--primary-400);
}

.nav-cta {
    margin-top: var(--space-xl);
}

/* Main Content */
.main-content {
    min-height: 100vh;
}

/* Section Container */
.section-container {
    width: 100%;
    max-width: 100%;
    padding: 0 var(--space-md);
    margin: 0 auto;
}

.section-header {
    text-align: center;
    margin-bottom: var(--space-2xl);
}

.section-title {
    font-size: var(--text-3xl);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: var(--space-md);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-subtitle {
    font-size: var(--text-lg);
    color: var(--text-secondary);
    line-height: 1.5;
    max-width: 600px;
    margin: 0 auto;
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    background: var(--gradient-primary);
    color: white;
    text-decoration: none;
    border-radius: var(--border-radius-lg);
    font-weight: 600;
    font-size: var(--text-base);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-md);
    border: none;
    cursor: pointer;
    min-height: 3rem;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-hero {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-lg) var(--space-2xl);
    background: var(--gradient-primary);
    color: white;
    text-decoration: none;
    border-radius: var(--border-radius-xl);
    font-weight: 700;
    font-size: var(--text-lg);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-xl);
    border: none;
    cursor: pointer;
    min-height: 3.5rem;
    position: relative;
    overflow: hidden;
}

.btn-hero:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-lg) var(--space-xl);
    background: rgba(203, 213, 225, 0.1);
    color: var(--text-primary);
    text-decoration: none;
    border-radius: var(--border-radius-lg);
    font-weight: 600;
    font-size: var(--text-base);
    transition: all var(--transition-fast);
    border: 1px solid rgba(203, 213, 225, 0.2);
    min-height: 3rem;
}

.btn-secondary:hover {
    background: rgba(203, 213, 225, 0.2);
    transform: translateY(-2px);
}

.btn-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left var(--transition-slow);
}

.btn-primary:hover .btn-shine,
.btn-hero:hover .btn-shine {
    left: 100%;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(203, 213, 225, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 100;
    padding: var(--space-xs) 0;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    text-decoration: none;
    color: var(--text-muted);
    font-size: var(--text-xs);
    font-weight: 500;
    transition: all var(--transition-fast);
    padding: var(--space-xs);
    border-radius: var(--border-radius-sm);
    min-width: 3rem;
}

.nav-item.active,
.nav-item:hover {
    color: var(--primary-400);
    transform: translateY(-2px);
}

.nav-item.cta {
    background: var(--gradient-primary);
    color: white;
    transform: scale(1.1);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-glow);
}

.nav-item.cta:hover {
    transform: scale(1.15) translateY(-2px);
}

.nav-icon {
    font-size: var(--text-lg);
    line-height: 1;
}

/* WhatsApp Float */
.whatsapp-float {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + var(--space-md));
    right: var(--space-md);
    width: 3.5rem;
    height: 3.5rem;
    background: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
    z-index: 90;
    transition: all var(--transition-fast);
    animation: pulse 2s infinite;
}

.whatsapp-float:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 30px rgba(37, 211, 102, 0.6);
}

.whatsapp-icon {
    width: 1.5rem;
    height: 1.5rem;
    color: white;
}

.whatsapp-text {
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--border-radius-md);
    font-size: var(--text-sm);
    white-space: nowrap;
    margin-right: var(--space-sm);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
}

.whatsapp-float:hover .whatsapp-text {
    opacity: 1;
    visibility: visible;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Install PWA Button */
.install-pwa {
    position: fixed;
    top: calc(var(--header-height) + var(--space-md));
    right: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--border-radius-lg);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    z-index: 80;
    transition: all var(--transition-fast);
}

.install-pwa.hidden {
    display: none;
}

.install-pwa:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Safe area adjustments for devices with notches */
@supports (padding: max(0px)) {
    body {
        padding-top: max(var(--header-height), env(safe-area-inset-top));
        padding-bottom: max(var(--bottom-nav-height), env(safe-area-inset-bottom));
    }
    
    .mobile-header {
        padding-top: env(safe-area-inset-top);
        height: calc(var(--header-height) + env(safe-area-inset-top));
    }
    
    .bottom-nav {
        padding-bottom: env(safe-area-inset-bottom);
        height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
    }
}

/* Dark mode support */
@media (prefers-color-scheme: light) {
    :root {
        --bg-primary: #ffffff;
        --bg-secondary: #f8fafc;
        --bg-tertiary: #f1f5f9;
        --bg-glass: rgba(255, 255, 255, 0.85);
        
        --text-primary: #0f172a;
        --text-secondary: #475569;
        --text-muted: #64748b;
    }
    
    .mobile-header {
        background: rgba(255, 255, 255, 0.95);
        border-bottom: 1px solid rgba(15, 23, 42, 0.1);
    }
    
    .mobile-nav {
        background: rgba(255, 255, 255, 0.98);
    }
    
    .bottom-nav {
        background: rgba(255, 255, 255, 0.95);
        border-top: 1px solid rgba(15, 23, 42, 0.1);
    }
}

/* Desktop adaptations */
@media (min-width: 768px) {
    body {
        padding-top: 0;
        padding-bottom: 0;
    }
    
    .mobile-header {
        position: relative;
        background: transparent;
        border: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        box-shadow: none;
        padding: var(--space-lg) 0;
    }
    
    .header-content {
        max-width: 1200px;
        margin: 0 auto;
        padding: 0 var(--space-xl);
    }
    
    .logo-container {
        transform: scale(1.2);
    }
    
    .bottom-nav {
        display: none;
    }
    
    .whatsapp-float {
        bottom: var(--space-xl);
        right: var(--space-xl);
        width: 4rem;
        height: 4rem;
    }
    
    .whatsapp-icon {
        width: 2rem;
        height: 2rem;
    }
}

@media (min-width: 1024px) {
    .mobile-header {
        padding: var(--space-xl) 0;
    }
    
    .header-content {
        padding: 0 var(--space-2xl);
    }
    
    .logo-container {
        transform: scale(1.3);
    }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .whatsapp-float {
        animation: none;
    }
}

/* ===============================
   RELIABILITY IMPROVEMENTS
   =============================== */

/* Ensure critical content is always visible */
.section-container,
.products-grid,
.services-grid,
.benefits-content,
.faq-container,
.contact-content {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Backup visibility for service items */
.service-item {
    opacity: 1;
    visibility: visible;
    display: block;
}

/* Backup visibility for product cards */
.product-card {
    opacity: 1;
    visibility: visible;
    display: block;
}

/* Backup visibility for benefit items */
.benefit-item,
.stat-item {
    opacity: 1;
    visibility: visible;
    display: flex;
}

/* Backup visibility for FAQ */
.faq-item {
    opacity: 1;
    visibility: visible;
    display: block;
}

/* ===============================
   SUBTLE DARK THEME SUPPORT
   =============================== */

/* Solo mejorar la apariencia en dark mode sin cambiar el diseño actual */
@media (prefers-color-scheme: dark) {
    /* Meta theme color para la barra de estado */
    body {
        color-scheme: dark;
    }
    
    /* Ajustar solo elementos con poco contraste en dark mode */
    
    /* Mejorar legibilidad de textos violetas en dark mode */
    .section-title,
    .hero-title .hero-accent,
    .logo-text {
        filter: brightness(1.3) saturate(0.8);
    }
    
    /* Ajustar primary-400 violeta para mejor contraste */
    .nav-link.active,
    .nav-link:hover,
    .desktop-nav a:hover {
        color: #a5b4fc !important; /* Un violeta más claro y legible */
    }
    
    /* Mejorar contraste de elementos con gradiente violeta */
    .btn-primary,
    .btn-hero {
        filter: brightness(1.1);
    }
    
    /* Ajustar textos secundarios para mejor legibilidad */
    .section-subtitle,
    .hero-subtitle {
        filter: brightness(1.2);
    }
    
    /* Mejorar visibilidad de bordes y elementos sutiles */
    .mobile-header,
    .bottom-nav {
        border-color: rgba(156, 163, 175, 0.2);
    }
    
    /* Ajustar cards para mejor contraste */
    .product-card,
    .service-item,
    .testimonial-card {
        filter: brightness(1.05);
    }
}

/* Light mode por defecto - mantener todo como está */
@media (prefers-color-scheme: light) {
    body {
        color-scheme: light;
    }
}
