/* ============================================
   RESPONSIVE DESIGN
   Mobile-First Approach
   ============================================ */

/* ============================================
   TABLET (768px and below)
   ============================================ */
@media (max-width: 768px) {
    :root {
        --container-padding: 1.5rem;
        --spacing-xl: 2rem;
        --spacing-2xl: 3rem;
    }

    /* Typography */
    h1 {
        font-size: 2.5rem;
    }

    h2 {
        font-size: 2rem;
    }

    h3 {
        font-size: 1.5rem;
    }

    /* Header & Navigation */
    .nav {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        background: rgba(10, 10, 10, 0.98);
        backdrop-filter: blur(20px);
        flex-direction: column;
        padding: var(--spacing-lg);
        gap: var(--spacing-md);
        transform: translateX(-100%);
        transition: transform var(--transition-base);
        border-bottom: 1px solid var(--glass-border);
        max-height: calc(100vh - 70px);
        overflow-y: auto;
        z-index: 2000;
    }

    .nav.active {
        transform: translateX(0) !important;
        visibility: visible !important;
        opacity: 1 !important;
        display: flex !important;
    }

    .menu-toggle {
        display: block;
        font-size: 1.8rem;
        cursor: pointer;
        background: none;
        border: none;
        color: var(--text-main);
        z-index: 2100;
        /* Higher than nav */
        padding: 0.5rem;
        position: relative;
        /* Ensure z-index works */
        margin-left: auto;
        /* Force right align if needed */
    }

    .nav-link {
        width: 100%;
        padding: var(--spacing-sm) 0;
        font-size: 1.125rem;
        color: #ffffff !important;
        /* Force white text on dark background */
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .nav-link:hover {
        color: var(--primary-purple) !important;
        padding-left: 10px;
        /* Slight movement on hover */
        background: rgba(255, 255, 255, 0.05);
    }

    .nav-icons {
        width: 100%;
        justify-content: center;
        padding-top: var(--spacing-md);
        border-top: 1px solid var(--glass-border);
    }

    /* Grid Layouts */
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    /* Footer */
    .footer-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }

    /* Buttons */
    .btn {
        width: 100%;
        justify-content: center;
    }

    /* Product Grid - 2 columns on tablet */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-md);
    }

    /* Cart Table */
    .cart-table {
        display: block;
        overflow-x: auto;
    }

    /* Checkout Form */
    .checkout-grid {
        grid-template-columns: 1fr;
    }

    /* Category Toggle - mobile */
    .category-toggle {
        display: flex;
    }

    .categories {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        max-height: 0;
        overflow: hidden;
        margin-bottom: 0;
        transition: max-height 0.3s ease, margin-bottom 0.3s ease;
    }

    .categories.open {
        max-height: 800px;
        margin-bottom: 2rem;
    }

    .category-btn {
        width: 100%;
        text-align: center;
    }

    .category-btn:first-child {
        grid-column: 1 / -1;
    }
}

/* ============================================
   MOBILE (480px and below)
   ============================================ */
@media (max-width: 480px) {
    :root {
        --container-padding: 1rem;
        --spacing-lg: 1.5rem;
        --spacing-xl: 2rem;
        --spacing-2xl: 2.5rem;
    }

    /* Typography */
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    /* Header */
    .logo {
        font-size: 1.5rem;
    }

    .header-content {
        padding: var(--spacing-sm);
    }

    /* Product Grid - 2 columns on mobile */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-sm);
    }

    /* Product Card */
    .product-info {
        padding: var(--spacing-sm);
    }

    .product-title {
        font-size: 1.125rem;
    }

    .price-current {
        font-size: 1.25rem;
    }

    /* Buttons */
    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }

    /* Forms */
    .form-input,
    .form-select,
    .form-textarea {
        padding: 0.75rem;
        font-size: 0.95rem;
    }

    /* Cards */
    .card {
        padding: var(--spacing-md);
    }

    /* Section Spacing */
    .section {
        padding: var(--spacing-xl) 0;
    }
}

/* ============================================
   LARGE DESKTOP (1400px and above)
   ============================================ */
@media (min-width: 1400px) {
    .grid-4 {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {

    .header,
    .footer,
    .btn,
    .nav {
        display: none;
    }

    body {
        background: white;
        color: black;
    }

    .card {
        border: 1px solid #ccc;
        box-shadow: none;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   DARK MODE (Already default, but prepared for light mode toggle)
   ============================================ */
@media (prefers-color-scheme: light) {
    /* If you want to add light mode support in the future */
}

/* ============================================
   LANDSCAPE ORIENTATION
   ============================================ */
@media (max-width: 768px) and (orientation: landscape) {
    .nav {
        max-height: calc(100vh - 60px);
    }

    .section {
        padding: var(--spacing-lg) 0;
    }
}

/* ============================================
   HOVER SUPPORT
   ============================================ */
@media (hover: hover) and (pointer: fine) {

    /* Enhanced hover effects for devices that support hover */
    .product-card:hover {
        transform: translateY(-10px) scale(1.02);
    }

    .btn:hover {
        transform: translateY(-3px) scale(1.05);
    }
}

/* ============================================
   TOUCH DEVICES
   ============================================ */
@media (hover: none) and (pointer: coarse) {

    /* Optimized for touch devices */
    .btn {
        min-height: 44px;
        /* Minimum touch target size */
    }

    .icon-btn {
        min-width: 44px;
        min-height: 44px;
    }

    .nav-link {
        padding: var(--spacing-sm);
    }
}