/* ===========================================
   RESPONSIVE DESIGN - MOBILE OPTIMIZATIONS
   Glow Séoul - Korean Skincare
   =========================================== */

/* Tablet landscape and below (1024px) */
@media (max-width: 1024px) {
    .container {
        max-width: 95%;
        padding: 0 20px;
    }
    
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
    
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .categories-nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 10px;
    }
    
    .categories-nav::-webkit-scrollbar {
        height: 4px;
    }
}

/* Tablet portrait (768px) */
@media (max-width: 768px) {
    /* Navigation principale mobile */
    .nav-container {
        gap: 20px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start;
    }
    
    .nav-link {
        white-space: nowrap;
        font-size: 0.9rem;
        padding: 15px 0;
    }
    
    /* Header responsive */
    .header-container {
        gap: 8px;
        padding: 0 10px;
    }
    
    .logo a {
        font-size: 1.1rem;
        white-space: nowrap;
    }
    
    .search-bar {
        max-width: 180px;
        min-width: 120px;
        flex-shrink: 1;
    }
    
    .search-bar input {
        padding: 8px 10px 8px 32px;
        font-size: 0.8rem;
    }
    
    .search-bar i {
        left: 10px;
        font-size: 0.85rem;
    }
    
    .icon-btn,
    .whatsapp-btn-header {
        width: 38px;
        height: 38px;
        flex-shrink: 0;
    }
    
    .icon-btn i,
    .whatsapp-btn-header i {
        font-size: 1.1rem;
    }
    
    .cart-count {
        font-size: 0.65rem;
        min-width: 16px;
        height: 16px;
        top: -4px;
        right: -4px;
    }
    
    /* Navigation mobile */
    nav .container {
        flex-wrap: wrap;
    }
    
    nav ul {
        flex-direction: column;
        width: 100%;
        background: rgba(255, 255, 255, 0.98);
        position: absolute;
        top: 100%;
        left: 0;
        display: none;
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    }
    
    nav ul.active {
        display: flex;
    }
    
    nav ul li {
        width: 100%;
        text-align: center;
        padding: 15px 0;
        border-bottom: 1px solid #f0f0f0;
    }
    
    /* Mobile menu button */
    .mobile-menu-toggle {
        display: block;
        font-size: 1.5rem;
        background: none;
        border: none;
        cursor: pointer;
        color: #333;
        padding: 10px;
    }
    
    /* Products grid - 2 columns */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    /* Hero section */
    .hero {
        padding: 60px 0 40px;
    }
    
    .hero h1 {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    .hero .subtitle {
        font-size: 1rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: 15px;
        width: 100%;
    }
    
    .hero-buttons .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Search bar */
    .search-container {
        width: 100%;
        margin: 20px 0;
    }
    
    .search-bar {
        max-width: 100%;
    }
    
    .search-bar input {
        font-size: 14px;
        padding: 12px 50px 12px 45px;
    }
    
    /* Logo responsive */
    .logo img {
        height: 35px;
    }
    
    .header-container {
        gap: 15px;
    }
    
    /* Product card */
    .product-card {
        padding: 12px;
    }
    
    .product-card .product-image {
        height: 180px;
    }
    
    .product-card h3 {
        font-size: 0.9rem;
        min-height: 36px;
    }
    
    .product-card .brand {
        font-size: 0.7rem;
    }
    
    .product-card .description {
        font-size: 0.75rem;
        max-height: 2.4em;
    }
    
    .product-card .price {
        font-size: 1.1rem;
    }
    
    .product-card .btn {
        padding: 10px 15px;
        font-size: 0.85rem;
    }
    
    /* Promo banner */
    .promo-banner {
        font-size: 0.85rem;
        padding: 12px 10px;
    }
    
    .promo-banner .timer {
        font-size: 0.9rem;
    }
    
    /* Categories */
    .category-nav {
        padding: 10px 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .category-nav::-webkit-scrollbar {
        display: none;
    }
    
    .category-container {
        gap: 8px;
        padding: 0;
        display: flex;
        flex-wrap: nowrap;
    }
    
    .category-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
        white-space: nowrap;
        flex-shrink: 0;
        min-width: fit-content;
    }
    
    /* About section */
    .about-section {
        padding: 40px 0;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    /* Stats */
    .stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    /* Footer */
    footer .container {
        grid-template-columns: 1fr;
        gap: 30px;
        text-align: center;
    }
    
    footer .footer-col {
        align-items: center;
    }
    
    /* WhatsApp floating button */
    .whatsapp-float {
        bottom: 80px;
        right: 15px;
        width: 55px;
        height: 55px;
    }
    
    /* Modal */
    .modal-content {
        width: 95%;
        max-width: 500px;
        padding: 20px;
    }
    
    .product-modal-content {
        flex-direction: column;
    }
    
    .product-modal-image {
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }
    
    .product-modal-details {
        width: 100%;
        padding: 20px 0 0 0;
    }
}

/* Mobile phones (480px) */
@media (max-width: 480px) {
    /* Single column for products */
    .products-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 0 10px;
    }
    
    /* Larger product cards on mobile */
    .product-card .product-image {
        height: 250px;
    }
    
    .product-card h3 {
        font-size: 1rem;
    }
    
    .product-card .description {
        font-size: 0.85rem;
        max-height: 3.6em;
    }
    
    /* Hero */
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .hero .subtitle {
        font-size: 0.9rem;
    }
    
    /* Promo banner */
    .promo-banner {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .promo-banner .timer {
        width: 100%;
    }
    
    /* Stats - single column */
    .stats {
        grid-template-columns: 1fr;
    }
    
    /* Search results */
    .search-results {
        max-height: 60vh;
    }
    
    /* Cart items on mobile */
    .cart-item {
        flex-direction: column;
        gap: 15px;
    }
    
    .cart-item-image {
        width: 100%;
        height: 200px;
    }
    
    .cart-item-details {
        width: 100%;
    }
    
    /* Quantity controls */
    .quantity-controls {
        justify-content: center;
    }
    
    /* Contact form */
    .contact-form input,
    .contact-form textarea,
    .contact-form button {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Extra small devices (360px) */
@media (max-width: 360px) {
    .hero h1 {
        font-size: 1.5rem;
    }
    
    .product-card .product-image {
        height: 220px;
    }
    
    .category-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
}

/* Landscape orientation fixes */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        padding: 30px 0 20px;
    }
    
    .hero h1 {
        font-size: 1.5rem;
    }
    
    nav {
        padding: 8px 0;
    }
    
    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Larger tap targets */
    .btn,
    button,
    a {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Remove hover effects on touch devices */
    .product-card:hover {
        transform: none;
    }
    
    .btn:hover {
        transform: none;
    }
    
    /* Improve scrolling */
    .categories-nav,
    .search-results {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
}

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

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a1a1a;
        --text-color: #e0e0e0;
        --card-bg: #2a2a2a;
    }
    
    body {
        background-color: var(--bg-color);
        color: var(--text-color);
    }
    
    .product-card {
        background: var(--card-bg);
        border-color: #3a3a3a;
    }
    
    nav {
        background: rgba(26, 26, 26, 0.98);
        border-bottom-color: #3a3a3a;
    }
}

/* Print styles */
@media print {
    nav,
    .promo-banner,
    .whatsapp-float,
    .categories-nav,
    footer,
    .btn {
        display: none !important;
    }
    
    .product-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    body {
        background: white;
        color: black;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Performance optimizations */
.product-card,
.modal,
.search-results {
    will-change: auto;
}

.product-card:hover {
    will-change: transform;
}

/* Smooth scrolling for all */
html {
    scroll-behavior: smooth;
}

/* Better text rendering on mobile */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}
