@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;600;700;800&display=swap');

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: #030712;
    color: #f3f4f6;
    overflow-x: hidden;
}

/* PWA Standalone Mode: Hide landing page sections, show only catalog */
@media all and (display-mode: standalone) {
    .pwa-hide { display: none !important; }
    #catalogo { padding-top: 1.5rem; }
    nav a[href="#inicio"],
    nav a[href="#migoremix"],
    nav a[href="#precios"] { display: none; }
}
body.is-pwa .pwa-hide { display: none !important; }
body.is-pwa #catalogo { padding-top: 1.5rem; }

/* ============================================
   PERFORMANCE-OPTIMIZED GLASS EFFECTS
   ============================================ */
.glass {
    background: rgba(17, 24, 39, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.05);
}
/* Only apply blur on desktop (expensive on mobile GPU) */
@media (min-width: 768px) {
    .glass {
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
    }
}

.glass-card {
    background: rgba(17, 24, 39, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.03);
    transition: border-color 0.2s ease;
}

/* ============================================
   SKELETON / PLACEHOLDER LOADING
   ============================================ */
.skeleton-loader {
    background: linear-gradient(90deg, #111827 25%, #1f2937 50%, #111827 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 0.75rem;
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Image fade-in when loaded */
.catalog-card img {
    opacity: 0;
    transition: opacity 0.3s ease;
}
.catalog-card img.loaded {
    opacity: 1;
}

.animate-in {
    animation: fadeIn 0.3s ease-out;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.text-gradient {
    background: linear-gradient(135deg, #a5b4fc 0%, #6366f1 50%, #4f46e5 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.text-gradient-cyan {
    background: linear-gradient(135deg, #67e8f9 0%, #06b6d4 50%, #0891b2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ============================================
   SCROLLBAR (lightweight)
   ============================================ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: #030712; }
::-webkit-scrollbar-thumb { background: #1f2937; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #374151; }

/* ============================================
   BUTTONS
   ============================================ */
.btn-glow {
    position: relative;
    transition: all 0.2s ease;
}
.btn-glow:hover {
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
    transform: translateY(-1px);
}

/* ============================================
   CATALOG GRID - Performance optimized
   ============================================ */
.catalog-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: 1fr;
}

/* CSS Containment for each card - massive perf improvement */
.catalog-card {
    contain: layout style paint;
    will-change: auto;
    content-visibility: auto;
    contain-intrinsic-size: 0 350px;
}

/* ---- Responsive breakpoints ---- */
@media (min-width: 360px) {
    .catalog-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.625rem;
    }
    .catalog-card {
        contain-intrinsic-size: 0 280px;
    }
}
@media (min-width: 640px) {
    .catalog-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}
@media (min-width: 768px) {
    .catalog-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.25rem;
    }
    /* Re-enable glass hover only on desktop */
    .glass-card:hover {
        transform: translateY(-3px);
        border-color: rgba(99, 102, 241, 0.15);
        box-shadow: 0 12px 30px -10px rgba(99, 102, 241, 0.1);
    }
}
@media (min-width: 1024px) {
    .catalog-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.25rem;
    }
}

/* ============================================
   MOBILE NAVIGATION
   ============================================ */
.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 7, 18, 0.97);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.mobile-menu-overlay.active {
    opacity: 1;
    pointer-events: all;
}
.mobile-menu-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 1.5rem;
}
.mobile-menu-content a,
.mobile-menu-content button {
    font-size: 1.25rem;
    font-weight: 700;
    color: #d1d5db;
    text-decoration: none;
    padding: 0.75rem 2rem;
    border-radius: 1rem;
    transition: color 0.15s;
    background: none;
    border: none;
    cursor: pointer;
}
.mobile-menu-content a:hover,
.mobile-menu-content button:hover {
    color: #fff;
}

.hamburger-btn {
    display: none;
    background: none;
    border: none;
    color: #d1d5db;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
}

/* ============================================
   MOBILE-SPECIFIC (max-width: 767px)
   ============================================ */
@media (max-width: 767px) {
    .hamburger-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Bigger touch targets for buy buttons */
    .catalog-card .card-buy-btn {
        padding: 0.875rem;
        font-size: 0.8125rem;
        min-height: 44px;
    }
    
    /* Card image area */
    .catalog-card .card-image-container {
        aspect-ratio: 1 / 1;
        padding: 0.375rem;
    }
    
    /* Card info padding */
    .catalog-card .card-info {
        padding: 0.75rem;
        gap: 0.5rem;
    }

    /* Pack name badge - smaller on mobile */
    .catalog-card .card-info span:first-child {
        font-size: 8px;
        padding: 2px 6px;
    }
    
    /* Design title - ensure readable on mobile */
    .catalog-card .card-info h4 {
        font-size: 0.6875rem;
        line-height: 1.3;
    }
    
    /* Stats cards */
    .stats-grid { gap: 0.5rem; }
    
    /* Horizontal scroll filters */
    .pack-filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 0.5rem;
        gap: 0.375rem;
    }
    .pack-filters::-webkit-scrollbar { display: none; }
    .pack-filters button {
        white-space: nowrap;
        flex-shrink: 0;
        padding: 0.5rem 0.75rem;
        font-size: 0.6875rem;
    }
    
    /* Modal sizing */
    #modal > div {
        max-height: 95vh;
        overflow-y: auto;
        margin: 0.5rem;
    }
    
    /* Header compact */
    header { top: 0 !important; padding: 0 0.5rem; }
    header > div {
        padding: 0.625rem 0.75rem;
        border-radius: 0.75rem;
    }
    
    /* CTA button compact */
    .header-cta {
        padding: 0.5rem 0.625rem;
        font-size: 0.625rem;
    }
    
    /* Hero mobile */
    .hero-section { padding-top: 3.5rem; padding-bottom: 1.5rem; }
    .hero-section h1 { font-size: 1.75rem; line-height: 1.2; }
    .hero-section p { font-size: 0.8125rem; }
    
    /* Pricing cards */
    .pricing-grid { gap: 0.75rem; }
    
    /* Cart panel full width */
    .cart-panel { width: 100% !important; }
    
    /* Footer vertical */
    .footer-links { flex-direction: column; gap: 0.75rem; }

    /* Catalog section tight padding */
    .catalog-section { padding: 0.375rem; }
    .catalog-section > div {
        padding: 0.75rem;
        border-radius: 1.25rem;
    }
    
    /* Search input sized properly */
    .catalog-search-input {
        font-size: 1rem;
        padding: 0.75rem 0.75rem 0.75rem 2.5rem;
    }

    /* Pagination buttons bigger on mobile */
    [data-action="page-prev"],
    [data-action="page-next"] {
        min-width: 44px;
        min-height: 44px;
    }
    [data-action="page-goto"] {
        min-width: 40px;
        min-height: 40px;
    }
}

/* Extra small devices (below 360px) */
@media (max-width: 359px) {
    .catalog-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    .catalog-card .card-image-container {
        aspect-ratio: 1 / 1;
        padding: 0.5rem;
    }
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */
@media (hover: none) {
    /* Disable expensive hover transforms on touch */
    .glass-card:hover {
        transform: none;
        border-color: rgba(255, 255, 255, 0.03);
        box-shadow: none;
    }
    /* Quick tap feedback instead */
    .catalog-card:active {
        transform: scale(0.97);
        transition: transform 0.1s ease;
    }
    /* Disable hover overlay on catalog images for touch */
    .catalog-card .card-image-container > div:last-child {
        display: none;
    }
}

/* ============================================
   GLOBAL PERFORMANCE
   ============================================ */
html {
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
}

/* Prevent zoom on input focus (iOS) */
input, select, textarea { font-size: 16px !important; }
@media (min-width: 768px) {
    input, select, textarea { font-size: inherit !important; }
}

/* Reduce motion for users who prefer it */
@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;
    }
    .skeleton-loader { animation: none; }
}
