/**
 * RWD/rev9 Responsive Styles
 * Mobile-First Responsive Design
 * Breakpoints: Mobile (< 768px), Tablet (768px - 1024px), Desktop (> 1024px)
 */

/* ========================================
   Tablet Styles (768px - 1024px)
======================================== */
@media screen and (max-width: 1024px) {
    .container {
        padding: 0 16px;
    }
    
    /* Header adjustments */
    .header-content {
        gap: 24px;
    }
    
    .header-search {
        max-width: 400px;
    }
    
    .header-actions {
        gap: 16px;
    }
    
    .action-text {
        display: none;
    }
    
    /* Navigation adjustments */
    .nav-wrapper > ul > li > a {
        padding: 14px 16px;
        font-size: 14px;
    }
    
    /* Reduce dropdown width */
    .nav-wrapper > ul > li > ul {
        min-width: 200px;
    }
}

/* ========================================
   Mobile Styles (< 768px)
======================================== */
@media screen and (max-width: 767px) {
    /* Container */
    .container {
        padding: 0 12px;
    }
    
    /* Top Bar */
    .rev9-topbar {
        display: none; /* Hide on mobile for cleaner look */
    }
    
    /* Main Header */
    .rev9-main-header {
        padding: 12px 0;
        position: sticky;
        top: 0;
        z-index: 1000;
        background: var(--white);
        box-shadow: var(--shadow-md);
    }
    
    .header-content {
        display: grid;
        grid-template-columns: auto 1fr auto;
        gap: 12px;
        align-items: center;
    }
    
    /* Mobile Menu Toggle */
    .mobile-menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        grid-column: 1;
    }
    
    /* Logo */
    .logo-wrapper {
        grid-column: 2;
        text-align: center;
    }
    
    .logo-text {
        font-size: 22px;
    }
    
    .logo img {
        height: 32px;
    }
    
    /* Header Actions - Only show cart on mobile */
    .header-actions {
        grid-column: 3;
        gap: 8px;
    }
    
    .account-link,
    .wishlist-link {
        display: none;
    }
    
    /* Search Bar - Full width below header on mobile */
    .header-search {
        grid-column: 1 / -1;
        max-width: 100%;
        margin-top: 12px;
    }
    
    .search-wrapper {
        background: var(--white);
        border: 1px solid var(--light-gray);
    }
    
    .search-input {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    /* Hide desktop navigation */
    .rev9-navigation {
        display: none;
    }
    
    /* Mobile Navigation Active State */
    .mobile-nav-overlay {
        display: block;
    }
    
    /* Cart modifications for mobile */
    .cart-count {
        min-width: 18px;
        height: 18px;
        font-size: 10px;
        padding: 0 5px;
        top: -6px;
        right: -6px;
    }
    
    .action-link svg {
        width: 22px;
        height: 22px;
    }
}

/* ========================================
   Small Mobile Styles (< 480px)
======================================== */
@media screen and (max-width: 480px) {
    /* Even more compact header */
    .rev9-main-header {
        padding: 10px 0;
    }
    
    .header-content {
        gap: 8px;
    }
    
    .logo-text {
        font-size: 20px;
    }
    
    .logo img {
        height: 28px;
    }
    
    /* Compact search */
    .search-wrapper {
        border-radius: 6px;
    }
    
    .search-input {
        padding: 8px 10px;
        font-size: 13px;
    }
    
    .search-button {
        padding: 8px 12px;
    }
    
    .search-button svg {
        width: 18px;
        height: 18px;
    }
    
    /* Mobile menu adjustments */
    .mobile-nav-content {
        width: 280px;
        padding: 20px;
    }
    
    .mobile-menu a {
        font-size: 15px;
        padding: 14px 0;
    }
    
    .mobile-search-input {
        padding: 10px 12px;
        font-size: 14px;
    }
}

/* ========================================
   Landscape Mobile (< 768px landscape)
======================================== */
@media screen and (max-width: 767px) and (orientation: landscape) {
    .rev9-main-header {
        padding: 8px 0;
    }
    
    .header-search {
        margin-top: 8px;
    }
    
    .search-input {
        padding: 8px 10px;
    }
}

/* ========================================
   Large Desktop (> 1440px)
======================================== */
@media screen and (min-width: 1441px) {
    .container {
        padding: 0 32px;
    }
    
    /* Larger spacing for big screens */
    .header-content {
        gap: 48px;
    }
    
    .header-actions {
        gap: 32px;
    }
    
    .nav-wrapper > ul {
        gap: 16px;
    }
    
    .nav-wrapper > ul > li > a {
        padding: 18px 24px;
        font-size: 16px;
    }
}

/* ========================================
   Touch Device Optimizations
======================================== */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .action-link {
        padding: 8px;
        min-width: 44px;
        min-height: 44px;
    }
    
    .search-button {
        min-width: 44px;
    }
    
    .mobile-menu-toggle {
        width: 44px;
        height: 44px;
    }
    
    /* Remove hover effects on touch devices */
    .nav-wrapper > ul > li > a:hover::after {
        width: 0;
    }
    
    .nav-wrapper > ul > li.active > a::after {
        width: calc(100% - 40px);
    }
    
    /* Simplify dropdown interaction */
    .nav-wrapper > ul > li > ul {
        display: none;
    }
    
    .nav-wrapper > ul > li:active > ul,
    .nav-wrapper > ul > li:focus-within > ul {
        display: block;
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
}

/* ========================================
   Print Styles
======================================== */
@media print {
    .rev9-topbar,
    .mobile-menu-toggle,
    .header-search,
    .header-actions,
    .rev9-navigation,
    .mobile-nav-overlay {
        display: none !important;
    }
    
    .rev9-header {
        box-shadow: none;
        border-bottom: 1px solid #000;
    }
    
    .logo-text {
        color: #000;
    }
}

/* ========================================
   High Contrast Mode Support
======================================== */
@media (prefers-contrast: high) {
    .rev9-header {
        border: 2px solid currentColor;
    }
    
    .search-wrapper {
        border: 2px solid currentColor;
    }
    
    .action-link:focus,
    .search-button:focus,
    .mobile-menu-toggle:focus {
        outline: 3px solid currentColor;
        outline-offset: 2px;
    }
}

/* ========================================
   Reduced Motion Support
======================================== */
@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;
    }
    
    .mobile-nav-content {
        transition: none;
    }
}

/* ========================================
   Dark Mode Support (Optional)
======================================== */
@media (prefers-color-scheme: dark) {
    /* You can add dark mode styles here if needed */
    /* Currently keeping light theme as per requirement */
}
