/* ===================================
   MOBILE-FIRST OPTIMIZATIONS
   =================================== */

/* Touch-friendly tap targets */
* {
    -webkit-tap-highlight-color: rgba(110, 31, 42, 0.2);
    -webkit-touch-callout: none;
}

a, button, input, select, textarea {
    min-height: 44px;
    min-width: 44px;
}

/* Smooth scrolling for mobile */
html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Mobile-optimized typography */
@media (max-width: 768px) {
    body {
        font-size: 16px; /* Prevent zoom on input focus */
        line-height: 1.6;
    }
    
    h1 {
        font-size: clamp(2rem, 8vw, 3.5rem);
        line-height: 1.2;
    }
    
    h2 {
        font-size: clamp(1.75rem, 6vw, 2.5rem);
        line-height: 1.3;
    }
    
    h3 {
        font-size: clamp(1.25rem, 4vw, 1.75rem);
    }
    
    p {
        font-size: clamp(0.9375rem, 3vw, 1rem);
    }
}

/* Mobile Header Optimization */
@media (max-width: 768px) {
    .header {
        padding: 15px 0;
        position: sticky;
        top: 0;
        z-index: 1000;
        backdrop-filter: blur(10px);
    }
    
    .logo {
        font-size: 1.5rem;
    }
    
    .nav-link {
        padding: 15px 0;
        font-size: 1.125rem;
        display: block;
    }
}

/* Mobile Hero Section (fix selectors + reverse order) */
@media (max-width: 768px) {
    .hero {
        min-height: 80vh;
        padding: 52px 12px 32px;
        overflow: hidden;
    }

    /* Reduce heavy effects on mobile */
    .hero-bg-layers,
    .hero-ambient-glow,
    .hero-particles,
    .gallery-glow,
    .scroll-indicator {
        display: none !important;
    }
    
    /* Hide badge and stats on mobile */
    .hero-badge,
    .floating-stats {
        display: none !important;
    }

    /* Stack hero sections and reverse: visuals first, then content */
    .hero-container {
        display: flex;
        flex-direction: column-reverse;
        gap: 24px;
        align-items: center;
        max-width: 100%;
        padding: 0;
    }

    .hero-main-content {
        text-align: center;
        margin: 0 auto;
        max-width: 100%;
        padding: 0 12px;
    }

    .hero-title-breathtaking {
        display: inline-flex;
        flex-wrap: wrap;
        gap: 6px 10px;
        justify-content: center;
    }

    .hero-subtitle-breathtaking {
        margin-top: 10px;
        opacity: 0.9;
    }

    .hero-cta-group {
        display: flex;
        flex-wrap: wrap;
        gap: 12px;
        justify-content: center;
    }

    /* Show only ONE image on mobile - hide secondary and accent */
    .hero-visual-gallery {
        position: relative;
        width: 100%;
        max-width: 600px;
        height: auto;
        margin: 0;
        padding: 0 12px;
    }

    .gallery-item {
        position: relative !important;
        height: auto !important;
        width: 100% !important;
        border-radius: 20px;
        overflow: hidden;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        animation: none !important;
    }

    /* Show only the main gallery item */
    .gallery-main {
        display: block;
    }

    .gallery-secondary,
    .gallery-accent {
        display: none !important;
    }

    .gallery-item img {
        object-fit: cover;
        height: auto;
        width: 100%;
        display: block;
        aspect-ratio: 1 / 1;
    }
    
    /* Show mobile-specific image on mobile */
    .hero-img-desktop {
        display: none !important;
    }
    
    .hero-img-mobile {
        display: block !important;
    }
}

/* Tablet devices (iPad, etc) */
@media (min-width: 769px) and (max-width: 1024px) {
    .hero {
        min-height: 70vh;
        padding: 60px 32px 40px;
    }
    
    /* Hide badge and stats on tablet */
    .hero-badge,
    .floating-stats {
        display: none !important;
    }

    .hero-container {
        display: flex;
        flex-direction: column-reverse;
        gap: 32px;
        align-items: center;
    }

    .hero-main-content {
        text-align: center;
        max-width: 720px;
        margin: 0 auto;
    }

    /* Show only ONE image on tablet too */
    .hero-visual-gallery {
        position: relative;
        width: 100%;
        max-width: 600px;
        height: auto;
        margin: 0 auto;
    }

    .gallery-item {
        position: relative !important;
        height: auto !important;
        width: 100% !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        animation: none !important;
    }

    .gallery-main {
        display: block;
    }

    .gallery-secondary,
    .gallery-accent {
        display: none !important;
    }

    .gallery-item img {
        aspect-ratio: 1 / 1;
        width: 100%;
        height: auto;
    }
}

/* Mobile Product Cards */
@media (max-width: 768px) {
    .featured-grid, 
    .shop-products {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .product-card {
        border-radius: 12px;
    }
    
    .product-card-image {
        height: 180px;
    }
    
    .product-card-content {
        padding: 12px;
    }
    
    .product-card-name {
        font-size: 1rem;
        margin-bottom: 8px;
    }
    
    .product-card-price {
        font-size: 1.125rem;
    }
}

/* Mobile Product Detail Page */
@media (max-width: 768px) {
    .product-layout {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .product-gallery {
        order: -1;
    }
    
    .product-image-main {
        height: 350px;
        max-height: 50vh;
    }
    
    .product-name {
        font-size: 1.75rem;
    }
    
    .product-price-display {
        padding: 20px;
        margin: 20px 0;
    }
    
    .price-value {
        font-size: 2rem;
    }
    
    .product-options {
        gap: 15px;
    }
    
    .fragrance-selector {
        padding: 14px;
        font-size: 1rem;
    }
    
    .buy-button {
        padding: 16px 32px;
        font-size: 1rem;
        width: 100%;
    }
}

/* Mobile Filters */
@media (max-width: 768px) {
    .shop-filters {
        position: fixed;
        left: -100%;
        top: 0;
        height: 100vh;
        width: 85%;
        max-width: 320px;
        background: var(--color-bg);
        z-index: 9999;
        transition: left 0.3s ease;
        overflow-y: auto;
        padding: 20px;
        box-shadow: 2px 0 20px rgba(0,0,0,0.5);
    }
    
    .shop-filters.active {
        left: 0;
    }
    
    .filter-toggle {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 12px 20px;
        background: var(--color-primary);
        color: white;
        border: none;
        border-radius: 8px;
        font-weight: 600;
        cursor: pointer;
        margin-bottom: 20px;
    }
    
    .filter-close {
        display: block;
        position: absolute;
        top: 20px;
        right: 20px;
        background: none;
        border: none;
        font-size: 1.5rem;
        color: var(--color-text);
        cursor: pointer;
        padding: 5px;
    }
}

/* Mobile Shop Search */
@media (max-width: 768px) {
    .shop-search {
        margin-bottom: 20px;
    }
    
    .search-input {
        padding: 12px 40px 12px 16px;
        font-size: 16px; /* Prevent zoom on iOS */
        border-radius: 12px;
    }
}

/* Mobile Footer */
@media (max-width: 768px) {
    .footer-content {
        text-align: center;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 30px;
        text-align: center;
    }
    
    .footer-column {
        width: 100%;
    }
    
    .footer-newsletter {
        max-width: 100%;
    }
    
    .newsletter-input {
        font-size: 16px; /* Prevent zoom */
    }
}

/* Mobile Performance Optimizations */
@media (max-width: 768px) {
    /* Reduce animations for better performance */
    * {
        animation-duration: 0.3s !important;
        transition-duration: 0.2s !important;
    }
    
    /* Optimize images */
    img {
        content-visibility: auto;
    }
    
    /* Reduce blur effects */
    .product-glow,
    .gallery-glow {
        display: none;
    }
}

/* Landscape Mode Optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        min-height: 100vh;
        padding: 36px 16px;
    }

    .hero-container {
        flex-direction: row;
        gap: 20px;
        align-items: center;
    }

    .hero-main-content {
        flex: 1;
    }

    .hero-visual-gallery {
        flex: 1;
        max-width: 400px;
    }

    .gallery-item img {
        aspect-ratio: 3 / 4;
    }
}

/* Small Mobile Devices (<400px) */
@media (max-width: 400px) {
    .container {
        padding: 0 15px;
    }
    
    .hero {
        padding: 40px 15px;
    }
    
    .featured-grid,
    .shop-products {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .product-card-image {
        height: 220px;
    }
}

/* iOS Specific Fixes */
@supports (-webkit-touch-callout: none) {
    /* iOS Safari fixes */
    input,
    textarea,
    select {
        font-size: 16px !important; /* Prevent zoom on focus */
    }
    
    .hero {
        min-height: -webkit-fill-available;
    }
}

/* PWA Optimizations */
@media (display-mode: standalone) {
    .header {
        padding-top: max(15px, env(safe-area-inset-top));
    }
    
    body {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* High DPI Screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}
