/* ==========================================================================
   NexoMart - Responsive Styles
   Mobile-first responsive design
   ========================================================================== */

/* ==========================================================================
   1. EXTRA SMALL DEVICES (Phone, 320px and up)
   ========================================================================== */
@media (max-width: 380px) {
    .container {
        padding: 0 12px;
    }
    
    .logo {
        font-size: 1.2rem;
    }
    
    .logo i {
        padding: 6px 8px;
        font-size: 0.8rem;
    }
    
    .nav-btn {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
    
    .nav-btn span {
        display: none;
    }
    
    .search-bar input {
        font-size: 0.8rem;
    }
    
    .search-btn {
        padding: 6px 12px;
        font-size: 0.75rem;
    }
    
    .search-btn span {
        display: none;
    }
    
    .product-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .product-image-wrap {
        height: 120px;
    }
    
    .product-details {
        padding: 8px 10px 10px;
    }
    
    .product-name {
        font-size: 0.75rem;
        min-height: 28px;
    }
    
    .product-price .current {
        font-size: 0.8rem;
    }
    
    .product-price .old {
        font-size: 0.7rem;
    }
    
    .btn-add-cart {
        padding: 6px;
        font-size: 0.7rem;
    }
    
    .category-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 4px;
    }
    
    .category-card {
        padding: 6px 4px;
    }
    
    .category-icon {
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
    }
    
    .category-name {
        font-size: 0.55rem;
    }
    
    .hero-title {
        font-size: 1.2rem;
    }
    
    .hero-desc {
        font-size: 0.85rem;
    }
    
    .hero-tag {
        padding: 10px 16px;
    }
    
    .hero-tag h3 {
        font-size: 1.6rem;
    }
    
    .section-title {
        font-size: 1rem;
    }
}

/* ==========================================================================
   2. SMALL DEVICES (Tablets, 576px and up)
   ========================================================================== */
@media (min-width: 576px) and (max-width: 767px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }
    
    .product-image-wrap {
        height: 180px;
    }
    
    .category-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }
}

/* ==========================================================================
   3. MEDIUM DEVICES (Tablets/Laptops, 768px and up)
   ========================================================================== */
@media (min-width: 768px) and (max-width: 991px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
    
    .category-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
    }
    
    .hero-title {
        font-size: 2rem;
    }
}

/* ==========================================================================
   4. LARGE DEVICES (Desktops, 992px and up)
   ========================================================================== */
@media (min-width: 992px) and (max-width: 1199px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .category-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* ==========================================================================
   5. EXTRA LARGE DEVICES (Large Desktops, 1200px and up)
   ========================================================================== */
@media (min-width: 1200px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .category-grid {
        grid-template-columns: repeat(8, 1fr);
    }
}

/* ==========================================================================
   6. LANDSCAPE MODE
   ========================================================================== */
@media (orientation: landscape) and (max-height: 500px) {
    .hero-section {
        padding: 12px 0;
    }
    
    .hero-banner {
        padding: 20px 24px;
        min-height: auto;
    }
    
    .hero-title {
        font-size: 1.4rem;
    }
    
    .hero-desc {
        font-size: 0.85rem;
        margin-bottom: 12px;
    }
    
    .hero-tag {
        padding: 10px 16px;
    }
    
    .hero-tag h3 {
        font-size: 1.4rem;
    }
    
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }
    
    .product-image-wrap {
        height: 120px;
    }
    
    .category-grid {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .section {
        padding: 16px 0;
    }
}

/* ==========================================================================
   7. TOUCH DEVICE OPTIMIZATIONS
   ========================================================================== */
@media (hover: none) {
    .product-card:hover {
        transform: none;
    }
    
    .product-card:hover .product-image-wrap img {
        transform: none;
    }
    
    .product-overlay {
        opacity: 1;
        background: transparent;
    }
    
    .product-overlay .btn {
        display: none;
    }
    
    .btn:hover {
        transform: none;
    }
    
    .category-card:hover {
        transform: none;
    }
    
    .nav-btn:hover {
        transform: none;
    }
}

/* ==========================================================================
   8. DARK MODE ADAPTATIONS
   ========================================================================== */
[data-theme="dark"] .top-bar {
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .hero-banner {
    background: linear-gradient(135deg, #0a1a2e 0%, #162a45 100%);
}

[data-theme="dark"] .hero-tag {
    background: var(--bg-white);
}

[data-theme="dark"] .footer {
    border-top-color: var(--primary-dark);
}

/* ==========================================================================
   9. PRINT STYLES
   ========================================================================== */
@media print {
    .top-bar,
    .header,
    .hero-section,
    .categories-section,
    .footer,
    .cart-drawer,
    .modal-overlay,
    .toast,
    .nav-actions {
        display: none !important;
    }
    
    body {
        background: #fff;
        color: #000;
    }
    
    .product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .product-card {
        break-inside: avoid;
        border: 1px solid #ddd;
    }
}

/* ==========================================================================
   10. ACCESSIBILITY
   ========================================================================== */
@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;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --primary: #d45a0a;
        --primary-dark: #b84d08;
        --text-primary: #000000;
        --text-secondary: #1a1a1a;
        --border-color: #333333;
    }
    
    .card,
    .product-card {
        border-width: 2px;
    }
    
    .btn-primary {
        outline: 2px solid #000;
    }
}