/* ===========================
   CARD OASIS MOBILE OVERHAUL
   Modern Mobile-First Design
   =========================== */

/* CSS Variables for consistent theming - Responsive units for better zoom handling */
:root {
    --mobile-primary: #00B5AD;
    --mobile-primary-dark: #009A92;
    --mobile-primary-light: #e6f7f6;
    --mobile-secondary: #f8f9fa;
    --mobile-secondary-dark: #e9ecef;
    --mobile-text: #2c3e50;
    --mobile-text-light: #6c757d;
    --mobile-text-inverse: #ffffff;
    --mobile-border: #e9ecef;
    --mobile-border-focus: #00B5AD;
    --mobile-shadow: 0 0.125rem 0.625rem rgba(0, 0, 0, 0.1);
    --mobile-shadow-heavy: 0 0.25rem 1.25rem rgba(0, 0, 0, 0.15);
    --mobile-shadow-soft: 0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05);
    --mobile-radius: 0.75rem;
    --mobile-radius-small: 0.5rem;
    --mobile-radius-large: 1rem;
    --mobile-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --mobile-transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --mobile-transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    --mobile-header-height: 5rem;
    --mobile-menu-width: 20rem;
    --mobile-z-overlay: 1000;
    --mobile-z-menu: 1001;
    --mobile-z-toggle: 1002;
    --mobile-gradient: linear-gradient(135deg, #00B5AD 0%, #009A92 100%);
    --mobile-gradient-soft: linear-gradient(135deg, rgba(0, 181, 173, 0.1) 0%, rgba(0, 154, 146, 0.05) 100%);
}

/* ===========================
   RESET & BASE MOBILE STYLES
   =========================== */

/* Responsive base font size for better zoom handling */
html {
    font-size: 16px; /* Base font size */
    -webkit-text-size-adjust: 100%; /* Prevent iOS zoom on orientation change */
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Responsive font scaling for different screen sizes */
@media (max-width: 480px) {
    html {
        font-size: 14px; /* Smaller base on very small screens */
    }
}

@media (max-width: 320px) {
    html {
        font-size: 13px; /* Even smaller for tiny screens */
    }
}

/* Zoom-friendly body styles */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: hidden; /* Prevent horizontal scroll on zoom */
}

/* Enhanced zoom handling for mobile devices */
@media (max-width: 768px) {
    /* Ensure content scales properly with zoom */
    * {
        box-sizing: border-box;
    }

    /* Prevent layout breaking on zoom */
    .main-nav,
    .mobile-menu,
    .mobile-filters-container,
    .product-card,
    .container {
        min-width: 0; /* Allow shrinking */
        max-width: 100%; /* Prevent overflow */
    }

    /* Flexible grid that adapts to zoom */
    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)) !important;
        gap: clamp(0.5rem, 2vw, 1rem);
    }

    /* Responsive text that scales with zoom */
    .hero-content h1 {
        font-size: clamp(1.5rem, 5vw, 2.25rem);
    }

    .hero-content p {
        font-size: clamp(1rem, 3vw, 1.25rem);
    }

    /* Ensure touch targets remain accessible when zoomed */
    .mobile-menu-toggle,
    .mobile-cart-icon,
    .btn,
    .mobile-filter-toggle {
        min-height: 2.75rem;
        min-width: 2.75rem;
    }
}

/* High zoom level adjustments */
@media (max-width: 768px) and (max-resolution: 1dppx) {
    /* When zoomed in significantly, simplify layout */
    .products-grid {
        grid-template-columns: 1fr !important; /* Single column at high zoom */
    }

    .mobile-menu {
        width: 100vw !important; /* Full width menu at high zoom */
        max-width: none !important;
    }

    /* Larger touch targets for high zoom */
    .mobile-menu-toggle,
    .mobile-cart-icon {
        width: 4rem;
        height: 4rem;
        padding: 1.25rem;
    }
}

/* Hide mobile elements on desktop */
.mobile-menu-toggle,
.mobile-menu-overlay,
.mobile-menu,
.mobile-header-actions,
.mobile-cart-icon,
.mobile-filter-toggle,
.mobile-search-bar {
    display: none !important;
}

/* Desktop preservation - Hide all mobile elements */
@media (min-width: 769px) {
    .mobile-menu-toggle,
    .mobile-menu-overlay,
    .mobile-menu,
    .mobile-header-actions,
    .mobile-cart-icon,
    .mobile-filter-toggle,
    .mobile-filters-container,
    .mobile-filters-dropdown,
    .mobile-filters-content,
    .mobile-filter-section,
    .mobile-filter-option,
    .mobile-clear-filters,
    .filters-overlay,
    .close-filters-mobile,
    .mobile-search-bar {
        display: none !important;
        visibility: hidden !important;
    }

    .nav-content {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .desktop-nav {
        display: flex !important;
        align-items: center;
        gap: 30px;
    }

    .header-top {
        display: block !important;
    }

    .user-nav-bar {
        display: flex !important;
    }

    .header-actions .header-link {
        display: inline-flex !important;
    }

    .top-header .cart-link {
        display: inline-flex !important;
    }
}

/* ===========================
   MODERN HAMBURGER MENU
   =========================== */

.mobile-menu-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 1rem;
    position: relative;
    width: 3.5rem;
    height: 3.5rem;
    z-index: var(--mobile-z-toggle);
    border-radius: var(--mobile-radius-small);
    transition: var(--mobile-transition);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.3125rem;
}

.mobile-menu-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

.hamburger-line {
    background: #333333 !important; /* Always dark for visibility */
    display: block;
    height: 0.25rem;
    width: 1.75rem;
    border-radius: 0.125rem;
    transition: var(--mobile-transition);
    transform-origin: center;
}

/* Animated hamburger to X transformation */
.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
    background: white;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: scale(0);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
    background: white;
}

/* ===========================
   MOBILE MENU OVERLAY & PANEL
   =========================== */

.mobile-menu-overlay {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--mobile-z-overlay);
    opacity: 0;
    visibility: hidden;
    transition: var(--mobile-transition);
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Enhanced modern slide-in menu panel */
.mobile-menu {
    background: var(--mobile-text-inverse);
    position: fixed;
    top: 0;
    left: -100%;
    width: var(--mobile-menu-width);
    max-width: 90vw;
    height: 100vh;
    z-index: var(--mobile-z-menu);
    overflow-y: auto;
    overflow-x: hidden;
    transition: var(--mobile-transition);
    box-shadow: var(--mobile-shadow-heavy);
    display: flex;
    flex-direction: column;
    text-align: left !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--mobile-border);
}

.mobile-menu.active {
    left: 0;
}

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

/* ===========================
   MOBILE MENU HEADER
   =========================== */

.mobile-menu-header {
    background: linear-gradient(135deg, var(--mobile-primary) 0%, var(--mobile-primary-dark) 100%);
    color: white;
    padding: 24px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    flex-shrink: 0;
}

.mobile-menu-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
}

.mobile-menu-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.mobile-menu-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 12px;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--mobile-transition);
}

.mobile-menu-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.mobile-menu-close:active {
    transform: scale(0.95);
}

/* ===========================
   MOBILE USER SECTION
   =========================== */

.mobile-user-section {
    padding: 24px 20px;
    background: var(--mobile-secondary);
    border-bottom: 1px solid var(--mobile-border);
    flex-shrink: 0;
}

.mobile-user-info {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
    margin-bottom: 20px;
    font-weight: 600;
    color: var(--mobile-text);
    font-size: 16px;
    text-align: left;
}

.mobile-user-info i {
    font-size: 32px;
    color: var(--mobile-primary);
    background: white;
    padding: 8px;
    border-radius: 50%;
    box-shadow: var(--mobile-shadow);
}

.mobile-user-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ===========================
   MOBILE AUTH BUTTONS
   =========================== */

.mobile-auth-buttons {
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex-shrink: 0;
}

.btn-outline-mobile,
.btn-primary-mobile {
    padding: 16px 24px;
    text-align: center;
    border-radius: var(--mobile-radius);
    text-decoration: none;
    font-weight: 700;
    font-size: 16px;
    transition: var(--mobile-transition);
    border: 2px solid var(--mobile-primary);
    position: relative;
    overflow: hidden;
}

.btn-outline-mobile {
    color: var(--mobile-primary);
    background: white;
}

.btn-outline-mobile:hover {
    background: var(--mobile-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--mobile-shadow);
}

.btn-primary-mobile {
    background: var(--mobile-primary);
    color: white;
}

.btn-primary-mobile:hover {
    background: var(--mobile-primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--mobile-shadow);
}

/* ===========================
   MOBILE MENU NAVIGATION
   =========================== */

.mobile-menu-nav {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
    text-align: left !important;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

/* Force left alignment for all menu content */
.mobile-menu * {
    text-align: left !important;
}

.mobile-menu-nav * {
    text-align: left !important;
}

/* Specific overrides for menu items */
.mobile-menu .mobile-menu-link,
.mobile-menu .mobile-submenu-link,
.mobile-menu .mobile-user-info {
    text-align: left !important;
    justify-content: flex-start !important;
    align-items: center !important;
}

.mobile-menu-link {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 16px;
    padding: 20px 24px;
    color: var(--mobile-text);
    text-decoration: none;
    border-radius: var(--mobile-radius);
    transition: var(--mobile-transition);
    font-weight: 500;
    font-size: 16px;
    margin-bottom: 2px;
    position: relative;
    overflow: hidden;
    text-align: left !important;
    width: 100%;
    box-sizing: border-box;
}

.mobile-menu-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--mobile-primary);
    transform: scaleY(0);
    transition: var(--mobile-transition);
}

.mobile-menu-link:hover,
.mobile-menu-link:active {
    background: rgba(0, 181, 173, 0.08);
    color: var(--mobile-primary);
    transform: translateX(4px);
    padding-left: 28px;
}

.mobile-menu-link:hover::before {
    transform: scaleY(1);
}

.mobile-menu-link i {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--mobile-primary);
    font-size: 16px;
    background: rgba(0, 181, 173, 0.1);
    border-radius: var(--mobile-radius-small);
    transition: var(--mobile-transition);
    flex-shrink: 0;
}

.mobile-menu-link:hover i {
    background: var(--mobile-primary);
    color: white;
    transform: scale(1.1);
}

/* ===========================
   MOBILE DROPDOWN MENUS
   =========================== */

.mobile-menu-dropdown {
    margin: 4px 0;
}

.mobile-menu-dropdown .dropdown-toggle {
    width: 100%;
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    position: relative;
    padding: 0;
}

.mobile-menu-dropdown .dropdown-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    transition: var(--mobile-transition);
    color: var(--mobile-text-light);
    font-size: 14px;
}

.mobile-menu-dropdown.active .dropdown-icon {
    transform: translateY(-50%) rotate(180deg);
    color: var(--mobile-primary);
}

.mobile-dropdown-content {
    display: none;
    padding-left: 48px;
    padding-top: 8px;
    padding-bottom: 8px;
    max-height: 0;
    overflow: hidden;
    transition: var(--mobile-transition);
}

.mobile-menu-dropdown.active .mobile-dropdown-content {
    display: block;
    max-height: 300px;
}

.mobile-submenu-link {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 14px 20px;
    color: var(--mobile-text-light);
    text-decoration: none;
    transition: var(--mobile-transition);
    border-radius: var(--mobile-radius-small);
    font-size: 15px;
    margin-bottom: 2px;
    position: relative;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
}

.mobile-submenu-link:hover {
    color: var(--mobile-primary);
    background: rgba(0, 181, 173, 0.05);
    transform: translateX(4px);
    padding-left: 24px;
}

.mobile-submenu-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: var(--mobile-border);
    border-radius: 50%;
    transition: var(--mobile-transition);
}

.mobile-submenu-link:hover::before {
    background: var(--mobile-primary);
}

/* ===========================
   MOBILE SEARCH SECTION
   =========================== */

.mobile-search-section {
    padding: 20px;
    border-top: 1px solid var(--mobile-border);
    background: white;
    flex-shrink: 0;
}

.mobile-search-form {
    display: flex;
    gap: 12px;
    align-items: center;
}

.mobile-search-input {
    flex: 1;
    padding: 16px 20px;
    border: 2px solid var(--mobile-border);
    border-radius: var(--mobile-radius);
    font-size: 16px;
    background: var(--mobile-secondary);
    transition: var(--mobile-transition);
    color: var(--mobile-text);
}

.mobile-search-input:focus {
    outline: none;
    border-color: var(--mobile-primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 181, 173, 0.1);
}

.mobile-search-btn {
    padding: 16px 20px;
    background: var(--mobile-primary);
    color: white;
    border: none;
    border-radius: var(--mobile-radius);
    cursor: pointer;
    font-weight: 600;
    transition: var(--mobile-transition);
    min-width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-search-btn:hover {
    background: var(--mobile-primary-dark);
    transform: scale(1.05);
}

/* ===========================
   MOBILE HEADER ACTIONS
   =========================== */

.mobile-header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mobile-cart-icon {
    position: relative;
    color: #333333 !important; /* Always dark for visibility */
    text-decoration: none;
    font-size: 1.5rem;
    padding: 1rem;
    border-radius: var(--mobile-radius-small);
    transition: var(--mobile-transition);
    background: transparent;
    width: 3.5rem;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-cart-icon:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--mobile-primary);
    transform: scale(1.05);
}

.cart-count-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--mobile-primary);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 6px;
    border-radius: 10px;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 2px solid white;
    line-height: 1;
}

.mobile-menu-divider {
    height: 1px;
    background: var(--mobile-border);
    margin: 16px 0;
}

/* ===========================
   MAIN MOBILE RESPONSIVE STYLES
   Modern Mobile-First Design
   =========================== */

/* Hide formats section, title, category cards, and carousel/banner on mobile */
@media (max-width: 768px) {
    .formats-section,
    .category-card[href*="/format/"],
    .section-title,
    h2.section-title,
    .banner-carousel,
    .carousel-container,
    .hero-carousel,
    .carousel {
        display: none !important;
    }

    /* ===========================
       MOBILE HEADER LAYOUT
       =========================== */

    /* Show mobile elements */
    .mobile-menu-toggle,
    .mobile-header-actions,
    .mobile-cart-icon {
        display: flex !important;
    }

    /* Show mobile menu and overlay (but keep them hidden until activated) */
    .mobile-menu,
    .mobile-menu-overlay {
        display: block !important;
    }

    /* Hide desktop elements */
    .desktop-nav,
    .header-top,
    .user-nav-bar,
    .header-actions .header-link {
        display: none !important;
    }

    /* Modern mobile header */
    .main-nav {
        padding: 0;
        position: sticky;
        top: 0;
        z-index: 997;
        background: white;
        box-shadow: var(--mobile-shadow);
        border-bottom: 1px solid var(--mobile-border);
        width: 100%;
    }

    .main-nav .nav-content {
        height: var(--mobile-header-height) !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        position: relative;
        padding: 0 1.25rem !important;
        width: 100%;
        max-width: 100%;
        gap: 0 !important;
    }

    /* Hamburger menu - LEFT SIDE (reorder from position 2 to 1) */
    .mobile-menu-toggle {
        order: 1 !important;
        flex-shrink: 0;
        z-index: var(--mobile-z-toggle);
    }

    /* Logo - CENTER (reorder from position 1 to 2) */
    .main-nav .logo {
        order: 2 !important;
        flex: 1 !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        z-index: 1;
        margin: 0 1.25rem !important;
        margin-bottom: 0 !important;
    }

    .main-nav .logo img {
        width: 10rem !important;
        height: auto !important;
        max-height: 2.8125rem !important;
        object-fit: contain;
    }

    /* Cart icon - RIGHT SIDE (stays in position 3) */
    .mobile-header-actions {
        order: 3 !important;
        flex-shrink: 0;
        z-index: var(--mobile-z-toggle);
        display: flex;
        align-items: center;
    }

    /* ===========================
       MOBILE CONTAINER & SPACING
       =========================== */

    .container {
        padding: 0 1rem;
        max-width: 100%;
    }

    /* Enhanced mobile body styling */
    body.is-mobile {
        font-size: 1rem;
        line-height: 1.6;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
        background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
        min-height: 100vh;
        color: var(--mobile-text);
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    /* Enhanced container styling */
    .container {
        padding: 0 1rem;
        max-width: 100%;
        margin: 0 auto;
    }

    /* ===========================
       MOBILE BANNER TEXT FIXES
       =========================== */

    /* Ensure all mobile banners have white text for better contrast */
    .singles-page-hero,
    .backorder-page-hero,
    .collection-page-hero,
    .format-page-hero,
    .page-hero,
    .hero-section {
        color: #ffffff !important;
    }

    .singles-page-hero h1,
    .singles-page-hero p,
    .singles-page-hero .hero-badge,
    .singles-page-hero .hero-notice,
    .singles-page-hero .hero-notice span,
    .singles-page-hero .hero-notice i,
    .backorder-page-hero h1,
    .backorder-page-hero p,
    .backorder-page-hero .hero-badge,
    .collection-page-hero h1,
    .collection-page-hero p,
    .collection-page-hero .hero-badge,
    .format-page-hero h1,
    .format-page-hero p,
    .format-page-hero .hero-badge,
    .page-hero h1,
    .page-hero p,
    .page-hero .hero-badge,
    .hero-section h1,
    .hero-section p,
    .hero-section .hero-badge,
    .sealed-page-hero h1,
    .sealed-page-hero p,
    .sealed-page-hero .hero-badge,
    .sealed-page-hero .hero-notice,
    .sealed-page-hero .hero-notice span,
    .sealed-page-hero .hero-notice i,
    .releases-page-hero h1,
    .releases-page-hero p,
    .releases-page-hero .hero-badge,
    .releases-page-hero .hero-stats,
    .releases-page-hero .hero-stats span,
    .releases-page-hero .hero-stats i,
    .deckbuilder-header h1,
    .deckbuilder-header p {
        color: #ffffff !important;
    }

    .hero-badge,
    .mobile-hero-badge,
    .backorder-badge {
        color: #ffffff !important;
        background: rgba(255, 255, 255, 0.2) !important;
    }

    .hero-notice,
    .hero-notice span,
    .hero-notice i {
        color: #ffffff !important;
    }

    /* Force white text on any banner with blue gradient background */
    [style*="linear-gradient"][style*="primary-dark"],
    [style*="linear-gradient"][style*="primary-light"],
    [style*="linear-gradient"][style*="#004F8B"],
    [style*="linear-gradient"][style*="#76B6D7"] {
        color: #ffffff !important;
    }

    [style*="linear-gradient"][style*="primary-dark"] h1,
    [style*="linear-gradient"][style*="primary-dark"] p,
    [style*="linear-gradient"][style*="primary-light"] h1,
    [style*="linear-gradient"][style*="primary-light"] p {
        color: #ffffff !important;
    }
    
    /* ===========================
       ENHANCED MOBILE HERO SECTION
       =========================== */

    /* AGGRESSIVE MOBILE BANNER TEXT FIXES - FORCE WHITE TEXT ON ALL HERO SECTIONS */
    .singles-page-hero,
    .backorder-page-hero,
    .collection-page-hero,
    .format-page-hero,
    .page-hero,
    .hero-section,
    .sealed-page-hero,
    .releases-page-hero,
    .deckbuilder-header,
    [class*="hero"],
    [class*="banner"] {
        color: #ffffff !important;
    }

    /* FORCE WHITE TEXT ON ALL MOBILE HERO ELEMENTS */
    .singles-page-hero *,
    .backorder-page-hero *,
    .collection-page-hero *,
    .format-page-hero *,
    .page-hero *,
    .hero-section *,
    .sealed-page-hero *,
    .releases-page-hero *,
    .deckbuilder-header *,
    [class*="hero"] *,
    [class*="banner"] * {
        color: #ffffff !important;
    }

    .singles-page-hero h1,
    .singles-page-hero p,
    .singles-page-hero .hero-badge,
    .singles-page-hero .hero-notice,
    .singles-page-hero .hero-notice span,
    .backorder-page-hero h1,
    .backorder-page-hero p,
    .collection-page-hero h1,
    .collection-page-hero p,
    .format-page-hero h1,
    .format-page-hero p,
    .page-hero h1,
    .page-hero p,
    .hero-section h1,
    .hero-section p {
        color: #ffffff !important;
    }

    .hero-badge,
    .mobile-hero-badge {
        color: #ffffff !important;
    }

    .hero-notice,
    .hero-notice span,
    .hero-notice i {
        color: #ffffff !important;
    }

    .hero-section {
        padding: 20px 0 20px;
        background: var(--mobile-gradient-soft);
        position: relative;
        overflow: hidden;
        margin-top: 0;
    }

    .hero-section::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="%23e9ecef" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
        opacity: 0.3;
        pointer-events: none;
    }

    .hero-content {
        position: relative;
        z-index: 1;
        text-align: center;
    }

    .hero-content h1 {
        font-size: 36px;
        line-height: 1.1;
        font-weight: 900;
        color: #ffffff !important; /* Force white text for better contrast */
        margin-bottom: 20px;
        text-align: center;
        animation: fadeInUp 0.8s ease-out;
    }

    .hero-content p {
        font-size: 20px;
        color: #ffffff !important; /* Force white text for better contrast */
        text-align: center;
        margin-bottom: 40px;
        font-weight: 500;
        animation: fadeInUp 0.8s ease-out 0.2s both;
    }

    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translateY(30px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .hero-search {
        flex-direction: column;
        gap: 20px;
        max-width: 450px;
        margin: 0 auto;
        animation: fadeInUp 0.8s ease-out 0.4s both;
    }

    .search-input {
        width: 100%;
        padding: 20px 24px;
        border: 2px solid var(--mobile-border);
        border-radius: var(--mobile-radius-large);
        font-size: 16px;
        background: var(--mobile-text-inverse);
        box-shadow: var(--mobile-shadow);
        transition: var(--mobile-transition);
        font-weight: 500;
        color: var(--mobile-text);
    }

    .search-input::placeholder {
        color: var(--mobile-text-light);
        font-weight: 400;
    }

    .search-input:focus {
        outline: none;
        border-color: var(--mobile-primary);
        box-shadow: 0 0 0 4px rgba(0, 181, 173, 0.15);
        transform: translateY(-1px);
        background: var(--mobile-text-inverse);
    }

    .btn-search {
        width: 100%;
        padding: 20px 24px;
        background: var(--mobile-gradient);
        color: white;
        border: none;
        border-radius: var(--mobile-radius-large);
        font-size: 18px;
        font-weight: 700;
        transition: var(--mobile-transition);
        position: relative;
        overflow: hidden;
        box-shadow: var(--mobile-shadow);
    }

    .btn-search::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
        transition: left 0.5s;
    }

    .btn-search:hover {
        background: var(--mobile-primary-dark);
        transform: translateY(-3px);
        box-shadow: var(--mobile-shadow-heavy);
    }

    .btn-search:hover::before {
        left: 100%;
    }

    .btn-search:active {
        transform: translateY(-1px);
    }

    /* ===========================
       MOBILE PRODUCT GRID (FORCED GRID VIEW)
       =========================== */

    /* Responsive grid view for all product displays on mobile */
    .products-grid,
    .products-table,
    .collection-products,
    .search-results .products-container {
        display: grid !important;
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)) !important;
        gap: 16px;
        padding: 20px 0;
    }

    /* Hide table view elements on mobile */
    .table-view-toggle,
    .products-table-wrapper,
    .collection-table {
        display: none !important;
    }

    /* Hide entire view toggle on mobile */
    .view-toggle {
        display: none !important;
    }

    .product-card {
        padding: 20px;
        border-radius: var(--mobile-radius-large);
        box-shadow: var(--mobile-shadow-soft);
        background: var(--mobile-text-inverse);
        transition: none; /* Disable transitions on mobile */
        border: 1px solid var(--mobile-border);
        display: flex;
        flex-direction: column;
        height: 100%;
        position: relative;
        overflow: hidden;
        backdrop-filter: blur(10px);
    }

    .product-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 4px;
        background: var(--mobile-gradient);
        opacity: 0;
        transition: var(--mobile-transition);
    }

    /* Disable hover animations on mobile for better touch experience */
    .product-card:hover {
        transform: none !important;
        box-shadow: var(--mobile-shadow) !important;
        border-color: var(--mobile-border) !important;
    }

    .product-card:hover::before {
        opacity: 0 !important;
    }

    /* Hide product overlay and quick view on mobile */
    .product-overlay,
    .btn-quick-view {
        display: none !important;
    }

    /* Hide product image wrapper overlay */
    .product-image-wrapper .product-overlay {
        display: none !important;
    }

    .product-image {
        margin-bottom: 16px;
        border-radius: var(--mobile-radius);
        background-color: transparent !important; /* Transparent background */
        position: relative;
        padding-top: 140%; /* Maintain aspect ratio */
        overflow: hidden;
    }

    .product-image img {
        border-radius: var(--mobile-radius);
        transition: none !important; /* Disable transitions on mobile */
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }

    .product-card:hover .product-image img {
        transform: none !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }

    /* Disable all product hover effects on mobile */
    .product-card:hover .product-title,
    .product-card:hover .product-price,
    .product-card:hover .product-meta {
        transform: none !important;
        color: inherit !important;
    }

    /* Product image loading placeholder */
    .product-image::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 40px;
        height: 40px;
        margin: -20px 0 0 -20px;
        border: 3px solid var(--mobile-border);
        border-top: 3px solid var(--mobile-primary);
        border-radius: 50%;
        animation: spin 1s linear infinite;
        opacity: 0;
        transition: opacity var(--mobile-transition);
    }

    .product-image img[loading="lazy"] + ::before {
        opacity: 1;
    }

    .product-image img:loaded + ::before {
        opacity: 0;
    }

    .product-info {
        flex: 1;
        display: flex;
        flex-direction: column;
    }

    .product-title {
        font-size: 15px;
        font-weight: 700;
        height: auto;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        color: var(--mobile-text);
        margin: 0 0 12px 0;
        overflow: hidden;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        line-height: 1.4;
        transition: none; /* Disable transitions on mobile */
    }

    .product-card:hover .product-title {
        color: var(--mobile-text);
    }

    .product-price {
        font-size: 20px;
        font-weight: 800;
        color: var(--mobile-primary);
        margin-bottom: 16px;
        position: relative;
    }

    .product-price::after {
        content: '';
        position: absolute;
        bottom: -2px;
        left: 0;
        width: 30px;
        height: 3px;
        background: var(--mobile-gradient);
        border-radius: 2px;
        opacity: 0;
        transition: none; /* Disable transitions on mobile */
    }

    .product-card:hover .product-price::after {
        opacity: 0;
    }

    .variant-selector {
        flex-direction: column;
        gap: 8px;
        margin-top: auto;
    }

    .variant-badge {
        font-size: 12px;
        padding: 8px 12px;
        width: 100%;
        text-align: center;
        border-radius: var(--mobile-radius-small);
        border: 1px solid var(--mobile-border);
        background: white;
        transition: var(--mobile-transition);
    }

    .variant-badge.selected,
    .variant-badge:hover {
        background: var(--mobile-primary);
        color: white;
        border-color: var(--mobile-primary);
    }

    /* Product actions */
    .product-actions {
        margin-top: 12px;
        display: flex;
        gap: 8px;
    }

    .btn-add-cart {
        flex: 1;
        padding: 10px 12px;
        font-size: 13px;
        border-radius: var(--mobile-radius-small);
        width: 100%;
    }

    /* Hide quick view button on mobile */
    .btn-quick-view {
        display: none !important;
    }
    
    /* ===========================
       MOBILE FILTERS DROPDOWN
       =========================== */

    .collection-content {
        flex-direction: column;
        gap: 0;
    }

    /* Hide desktop filters sidebar on mobile */
    .filters-sidebar {
        display: none !important;
    }

    .products-section {
        width: 100%;
        padding-top: 0;
    }

    /* Hide category highlights section completely on mobile since cards are hidden */
    .category-highlights {
        display: none !important;
    }

    /* Reduce excessive padding on featured products section */
    .featured-products {
        padding: 20px 0 !important; /* Much less than desktop 80px */
    }

    /* Also reduce padding on other sections that might have excessive spacing */
    .featured-collections {
        padding: 20px 0 !important;
    }

    /* Mobile filter dropdown container */
    .mobile-filters-container {
        position: relative;
        margin-bottom: 20px;
        z-index: 100; /* Much lower than mobile menu (1000-1002) */
        display: block !important; /* Show on mobile */
        pointer-events: auto !important;
    }

    /* Hamburger-style filter toggle button */
    .mobile-filter-toggle {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 16px 20px;
        background: white;
        border: 2px solid var(--mobile-border);
        color: var(--mobile-text);
        border-radius: var(--mobile-radius);
        width: 100%;
        cursor: pointer !important;
        font-weight: 600;
        font-size: 16px;
        transition: var(--mobile-transition);
        box-shadow: var(--mobile-shadow);
        position: relative;
        z-index: 101; /* Lower than mobile menu */
        min-height: 56px; /* Ensure good touch target */
        pointer-events: auto !important; /* Ensure clickable */
        touch-action: manipulation; /* Better touch handling */
        -webkit-tap-highlight-color: rgba(0, 181, 173, 0.1);
    }

    .mobile-filter-toggle:hover,
    .mobile-filter-toggle.active {
        background: var(--mobile-secondary);
        border-color: var(--mobile-primary);
        color: var(--mobile-primary);
    }

    .mobile-filter-toggle:focus {
        outline: none;
        border-color: var(--mobile-primary);
        box-shadow: 0 0 0 3px rgba(0, 181, 173, 0.15);
    }

    /* Hamburger icon for filters */
    .mobile-filter-toggle .filter-hamburger {
        display: flex;
        flex-direction: column;
        gap: 3px;
        width: 20px;
        height: 16px;
    }

    .mobile-filter-toggle .filter-hamburger span {
        display: block;
        height: 2px;
        width: 100%;
        background: #333333 !important; /* Always dark for visibility */
        border-radius: 1px;
        transition: var(--mobile-transition);
    }

    .mobile-filter-toggle.active .filter-hamburger span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .mobile-filter-toggle.active .filter-hamburger span:nth-child(2) {
        opacity: 0;
    }

    .mobile-filter-toggle.active .filter-hamburger span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }

    /* Mobile filters dropdown content - HIDDEN BY DEFAULT */
    .mobile-filters-dropdown {
        position: absolute;
        top: 0; /* Start from top to cover the button */
        left: 0;
        right: 0;
        background: white;
        border: 2px solid var(--mobile-border);
        border-radius: var(--mobile-radius);
        box-shadow: var(--mobile-shadow-heavy);
        max-height: 0 !important;
        overflow: hidden !important;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        z-index: 102; /* Lower than mobile menu */
        padding-top: 60px; /* Space for the hidden button */
    }

    /* Only show when active class is added */
    .mobile-filters-dropdown.active {
        max-height: 70vh !important;
        overflow-y: auto !important;
        opacity: 1;
        visibility: visible;
    }

    .mobile-filters-content {
        padding: 20px;
    }

    /* Filter sections in dropdown */
    .mobile-filter-section {
        margin-bottom: 24px;
        border-bottom: 1px solid var(--mobile-border);
        padding-bottom: 20px;
    }

    .mobile-filter-section:last-child {
        border-bottom: none;
        margin-bottom: 0;
        padding-bottom: 0;
    }

    .mobile-filter-section h4 {
        font-size: 16px;
        font-weight: 700;
        color: var(--mobile-text);
        margin-bottom: 12px;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    /* Clear filters button in dropdown */
    .mobile-clear-filters {
        width: 100%;
        padding: 12px 16px;
        background: var(--mobile-primary);
        color: white;
        border: none;
        border-radius: var(--mobile-radius);
        font-weight: 600;
        font-size: 14px;
        cursor: pointer;
        transition: var(--mobile-transition);
        margin-top: 16px;
    }

    .mobile-clear-filters:hover {
        background: var(--mobile-primary-dark);
    }

    /* Filter options styling */
    .mobile-filter-option {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 10px 0;
        cursor: pointer;
        transition: var(--mobile-transition);
    }

    .mobile-filter-option:hover {
        color: var(--mobile-primary);
    }

    .mobile-filter-option input[type="checkbox"],
    .mobile-filter-option input[type="radio"] {
        width: 18px;
        height: 18px;
        accent-color: var(--mobile-primary);
        cursor: pointer;
    }

    /* Enhanced checkbox styling for better visibility */
    .mobile-filter-option input[type="checkbox"]:checked + label {
        color: var(--mobile-primary);
        font-weight: 600;
    }

    .mobile-filter-option input[type="checkbox"]:checked + label .rarity-indicator {
        color: var(--mobile-primary);
        font-weight: 600;
    }

    /* Highlight the entire option when checked */
    .mobile-filter-option:has(input[type="checkbox"]:checked) {
        background-color: rgba(0, 181, 173, 0.1);
        border-radius: 8px;
        padding: 12px 8px;
        margin: 2px 0;
    }

    .mobile-filter-option label {
        flex: 1;
        font-size: 14px;
        color: var(--mobile-text);
        cursor: pointer;
        display: flex;
        justify-content: space-between;
        transition: var(--mobile-transition);
    }

    .mobile-filter-option .filter-count {
        font-size: 12px;
        color: var(--mobile-text-light);
        background: var(--mobile-secondary);
        padding: 2px 8px;
        border-radius: 10px;
    }

    /* Price range slider in mobile */
    .mobile-price-range {
        margin: 16px 0;
    }

    .mobile-price-inputs {
        display: flex;
        gap: 12px;
        margin-top: 12px;
    }

    .mobile-price-inputs input {
        flex: 1;
        padding: 10px 12px;
        border: 1px solid var(--mobile-border);
        border-radius: var(--mobile-radius-small);
        font-size: 14px;
    }

    /* Sort dropdown in mobile */
    .mobile-sort-section {
        margin-bottom: 20px;
    }

    .mobile-sort-select {
        width: 100%;
        padding: 12px 16px;
        border: 1px solid var(--mobile-border);
        border-radius: var(--mobile-radius);
        font-size: 14px;
        background: white;
        color: var(--mobile-text);
    }
    
    /* ===========================
       MOBILE SECTIONS & COMPONENTS
       =========================== */

    /* Enhanced Section Headers */
    .section-header {
        text-align: center;
        padding: 50px 0 40px 0;
        position: relative;
    }

    .section-header::before {
        content: '';
        position: absolute;
        top: 20px;
        left: 50%;
        width: 60px;
        height: 4px;
        background: var(--mobile-gradient);
        border-radius: 2px;
        transform: translateX(-50%);
    }

    .section-header h2 {
        font-size: 32px;
        font-weight: 900;
        color: var(--mobile-text);
        margin-bottom: 16px;
        position: relative;
        background: linear-gradient(135deg, var(--mobile-text) 0%, var(--mobile-primary) 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        text-shadow: none;
    }

    .section-header p {
        font-size: 18px;
        color: var(--mobile-text-light);
        max-width: 600px;
        margin: 0 auto;
        font-weight: 500;
        line-height: 1.6;
    }

    /* Enhanced Modern Mobile Buttons */
    .btn,
    .btn-primary,
    .btn-outline {
        padding: 18px 28px;
        font-size: 17px;
        font-weight: 700;
        border-radius: var(--mobile-radius-large);
        transition: var(--mobile-transition);
        border: 2px solid transparent;
        min-height: 52px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        position: relative;
        overflow: hidden;
        cursor: pointer;
        text-decoration: none;
        letter-spacing: 0.5px;
    }

    .btn-primary {
        background: var(--mobile-gradient);
        color: white;
        border-color: var(--mobile-primary);
        box-shadow: var(--mobile-shadow);
    }

    .btn-primary::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
        transition: left 0.6s;
    }

    .btn-primary:hover {
        background: var(--mobile-primary-dark);
        transform: translateY(-3px) scale(1.02);
        box-shadow: var(--mobile-shadow-heavy);
    }

    .btn-primary:hover::before {
        left: 100%;
    }

    .btn-primary:active {
        transform: translateY(-1px) scale(0.98);
    }

    .btn-outline {
        background: var(--mobile-text-inverse);
        color: var(--mobile-primary);
        border-color: var(--mobile-primary);
        box-shadow: var(--mobile-shadow-soft);
    }

    .btn-outline:hover {
        background: var(--mobile-gradient);
        color: white;
        transform: translateY(-3px) scale(1.02);
        box-shadow: var(--mobile-shadow-heavy);
    }

    .btn-outline:active {
        transform: translateY(-1px) scale(0.98);
    }

    .btn-add-cart {
        font-size: 15px;
        padding: 14px 20px;
        border-radius: var(--mobile-radius);
        font-weight: 700;
        background: var(--mobile-gradient);
        color: white;
        transition: var(--mobile-transition);
        min-height: 44px;
        position: relative;
        overflow: hidden;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
    }

    .btn-add-cart::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        background: rgba(255, 255, 255, 0.2);
        border-radius: 50%;
        transform: translate(-50%, -50%);
        transition: none; /* Disable ripple animation on mobile */
    }

    .btn-add-cart:hover::before {
        width: 0; /* Disable ripple effect on mobile */
        height: 0;
    }

    .btn-add-cart:hover {
        transform: none; /* Disable button movement on mobile */
        box-shadow: var(--mobile-shadow);
    }

    .btn-add-cart:active {
        transform: none; /* Disable button movement on mobile */
    }

    /* Prevent layout shift during button state changes */
    .btn-add-cart.loading,
    .btn-add-cart.success,
    .btn-add-cart.error {
        min-height: 44px;
        padding: 14px 20px;
    }

    /* Loading spinner */
    .btn-add-cart .spinner {
        width: 16px;
        height: 16px;
        border: 2px solid transparent;
        border-top: 2px solid currentColor;
        border-radius: 50%;
        animation: spin 1s linear infinite;
        display: inline-block;
        margin-right: 8px;
    }

    /* Loading state for buttons */
    .btn.loading {
        pointer-events: none;
        opacity: 0.7;
    }

    .btn.loading::after {
        content: '';
        width: 20px;
        height: 20px;
        border: 2px solid transparent;
        border-top: 2px solid currentColor;
        border-radius: 50%;
        animation: spin 1s linear infinite;
        margin-left: 8px;
    }

    @keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }

    /* ===========================
       MOBILE FOOTER
       =========================== */

    .footer {
        background: var(--mobile-text);
        color: white;
        padding: 40px 0 20px 0;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 32px;
        text-align: center;
    }

    .footer-logo {
        margin: 0 auto;
    }

    .footer-links {
        justify-content: center;
        flex-wrap: wrap;
        gap: 24px;
    }

    .footer-social {
        justify-content: center;
        gap: 20px;
    }

    .footer-social a {
        width: 48px;
        height: 48px;
        background: var(--mobile-primary);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: var(--mobile-transition);
    }

    .footer-social a:hover {
        transform: scale(1.1);
        background: var(--mobile-primary-dark);
    }

    /* Input focus states */
    input:focus,
    textarea:focus,
    select:focus {
        outline: none;
        border-color: var(--mobile-primary);
        box-shadow: 0 0 0 3px rgba(0, 181, 173, 0.1);
    }
}

/* Extra small devices (Portrait Phones) */
@media (max-width: 480px) {
    /* Responsive grid for very small screens */
    .products-grid,
    .products-table,
    .collection-products,
    .search-results .products-container {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
        gap: 12px;
    }

    .product-card {
        padding: 12px;
        display: flex;
        flex-direction: column;
    }

    .product-image {
        margin-bottom: 8px;
        position: relative;
        padding-top: 140%; /* Maintain aspect ratio */
        overflow: hidden;
        border-radius: var(--mobile-radius);
    }

    .product-image img {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        border-radius: var(--mobile-radius);
    }

    .product-info {
        flex: 1;
        display: flex;
        flex-direction: column;
    }

    .product-title {
        font-size: 13px;
        margin-bottom: 6px;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .product-price {
        font-size: 16px;
        margin-bottom: 8px;
    }

    .variant-selector {
        gap: 6px;
    }

    .variant-badge {
        font-size: 11px;
        padding: 6px 8px;
    }

    .product-actions {
        margin-top: 8px;
        gap: 6px;
    }

    .btn-add-cart {
        padding: 8px 10px;
        font-size: 12px;
        width: 100%;
    }

    /* Hide quick view on small screens */
    .btn-quick-view {
        display: none !important;
    }

    /* Smaller filter dropdown on very small screens */
    .mobile-filter-toggle {
        padding: 14px 16px;
        font-size: 15px;
    }

    .mobile-filters-dropdown {
        max-height: 60vh;
    }

    .mobile-filters-content {
        padding: 16px;
    }

    /* Smaller hero for very small screens */
    .hero-content h1 {
        font-size: 28px;
    }

    .hero-content p {
        font-size: 16px;
    }

    /* Full-width mobile menu on small screens */
    .mobile-menu {
        width: 100%;
        max-width: none;
    }

    /* Single column collections */
    .collections-grid {
        grid-template-columns: 1fr;
    }

    /* Smaller container padding */
    .container {
        padding: 0 12px;
    }

    /* Adjust mobile header for small screens */
    .nav-content {
        padding: 0 16px;
    }

    .logo {
        margin: 0 16px;
    }

    .logo img {
        width: 160px;
        max-height: 45px;
    }

    /* Slightly smaller buttons on very small screens */
    .mobile-menu-toggle,
    .mobile-cart-icon {
        width: 52px;
        height: 52px;
        padding: 14px;
    }

    .mobile-menu-toggle {
        gap: 4px;
    }

    .hamburger-line {
        width: 26px;
        height: 3px;
    }

    /* Smaller buttons on very small screens */
    .btn,
    .btn-primary,
    .btn-outline {
        padding: 14px 20px;
        font-size: 15px;
    }
}

/* ===========================
   LANDSCAPE ORIENTATION
   =========================== */

@media (max-width: 768px) and (orientation: landscape) {
    .mobile-menu {
        width: 60%;
        max-width: 400px;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 12px;
    }

    .product-card {
        display: block;
        padding: 12px;
    }

    .product-image {
        position: relative;
        padding-top: 140%; /* Maintain aspect ratio */
        overflow: hidden;
        border-radius: var(--mobile-radius);
    }

    .product-image img {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        border-radius: var(--mobile-radius);
    }

    /* Adjust hero for landscape */
    .hero-section {
        padding: 30px 0;
    }

    .hero-content h1 {
        font-size: 28px;
    }
}

/* ===========================
   TOUCH-FRIENDLY ADJUSTMENTS
   =========================== */

@media (hover: none) and (pointer: coarse) {
    /* Increase touch target sizes for accessibility */
    .btn,
    .nav-link,
    .mobile-menu-link,
    .variant-badge,
    .mobile-menu-toggle,
    .mobile-cart-icon {
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Remove hover effects and quick view on touch devices */
    .product-overlay,
    .btn-quick-view {
        display: none !important;
    }

    /* Only show add to cart button on mobile */
    .product-card .btn-add-cart {
        opacity: 1 !important;
        visibility: visible !important;
        position: relative !important;
        margin-top: 12px !important;
        width: 100% !important;
    }

    /* Larger tap targets for filter checkboxes */
    .filter-checkbox {
        min-height: 48px;
        padding: 12px 0;
    }

    /* Better touch scrolling */
    .mobile-menu,
    .filters-sidebar,
    .products-table {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
}

/* ===========================
   iOS SPECIFIC OPTIMIZATIONS
   =========================== */

@supports (-webkit-touch-callout: none) {
    /* Prevent iOS zoom on form focus */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    select,
    textarea {
        font-size: 16px !important;
        transform: translateZ(0); /* Force hardware acceleration */
    }

    /* Fix iOS momentum scrolling */
    .mobile-menu,
    .filters-sidebar {
        -webkit-overflow-scrolling: touch;
    }

    /* Fix iOS safe area */
    .mobile-menu {
        padding-bottom: env(safe-area-inset-bottom);
    }

    .main-nav {
        padding-top: env(safe-area-inset-top);
    }
}

/* ===========================
   DARK MODE SUPPORT
   =========================== */

@media (prefers-color-scheme: dark) {
    :root {
        --mobile-text: #ffffff;
        --mobile-text-light: #b0b0b0;
        --mobile-secondary: #1a1a1a;
        --mobile-border: #333333;
    }

    .mobile-menu,
    .filters-sidebar {
        background: #1a1a1a;
        color: white;
    }

    .product-card {
        background: var(--mobile-secondary); /* Consistent dark background */
        border-color: var(--mobile-border); /* Harmonious border */
        color: var(--mobile-text); /* Light text */
    }

    .hamburger-line {
        background: white;
    }
}

/* ===========================
   PRINT STYLES
   =========================== */

@media print {
    .mobile-menu-toggle,
    .mobile-menu,
    .mobile-menu-overlay,
    .filters-sidebar,
    .mobile-header-actions,
    .mobile-filter-toggle,
    .mobile-filters-container,
    .mobile-filters-dropdown,
    .top-header,
    .main-nav {
        display: none !important;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
    }

    .product-card {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
}

/* ===========================
   ENHANCED ANIMATIONS & MICRO-INTERACTIONS
   =========================== */

/* Smooth page transitions */
.page-transition {
    animation: fadeInUp 0.6s ease-out;
}

/* Enhanced scroll animations */
@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

/* Loading shimmer effect */
.shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite;
}

/* Enhanced focus states for accessibility */
*:focus {
    outline: 2px solid var(--mobile-primary);
    outline-offset: 2px;
    border-radius: var(--mobile-radius-small);
}

/* Enhanced selection styling */
::selection {
    background: rgba(0, 181, 173, 0.2);
    color: var(--mobile-text);
}

/* Enhanced scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--mobile-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--mobile-primary);
    border-radius: 4px;
    transition: var(--mobile-transition);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--mobile-primary-dark);
}

/* Enhanced touch feedback - disabled for product cards */
@media (hover: none) and (pointer: coarse) {
    .touch-feedback:active:not(.product-card):not(.btn-add-cart) {
        transform: scale(0.95);
        opacity: 0.8;
    }
}

/* ===========================
   PERFORMANCE OPTIMIZATIONS
   =========================== */

/* GPU acceleration for smooth animations - disabled for product cards */
.mobile-menu,
.mobile-menu-overlay,
.mobile-menu-toggle,
.btn:not(.btn-add-cart),
.section-header,
.hero-content {
    will-change: transform;
    transform: translateZ(0);
}

/* Disable GPU acceleration for product cards to prevent movement */
.product-card {
    will-change: auto !important;
    transform: none !important;
    transition: none !important;
}

.btn-add-cart {
    will-change: auto !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
}

/* Keep image sizing intact but disable movement transforms */
.product-card .product-image,
.product-card .product-image img {
    transition: none !important;
}

/* Optimize images for mobile */
@media (max-width: 768px) {
    img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }

    .product-image {
        position: relative;
        padding-top: 140%; /* Maintain aspect ratio */
        overflow: hidden;
        border-radius: var(--mobile-radius);
    }

    .product-image img {
        transition: none !important; /* Disable all transitions on mobile */
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        border-radius: var(--mobile-radius);
    }
}

/* Enhanced 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;
    }
}

/* Enhanced dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --mobile-text: #E8E8E8;
        --mobile-text-light: #B8B8B8;
        --mobile-secondary: #252525;
        --mobile-secondary-dark: #1A1A1A;
        --mobile-border: #3A3A3A;
        --mobile-text-inverse: #252525;
    }

    body.is-mobile {
        background: linear-gradient(180deg, #1a1a1a 0%, #2a2a2a 100%);
    }

    .mobile-menu,
    .product-card,
    .btn-outline,
    .mobile-filter-toggle {
        background: var(--mobile-secondary); /* Consistent dark background */
        color: var(--mobile-text); /* Light text for dark background */
    }

    /* Hero sections for mobile dark mode */
    .hero-section,
    .singles-page-hero,
    .backorder-page-hero,
    .collection-page-hero,
    .format-page-hero,
    .page-hero,
    .sealed-page-hero,
    .releases-page-hero,
    .deckbuilder-header,
    [class*="hero"],
    [class*="banner"] {
        background: linear-gradient(135deg, var(--mobile-secondary) 0%, var(--mobile-secondary-dark) 100%) !important;
        color: var(--mobile-text) !important;
        border-bottom: 1px solid var(--mobile-border) !important;
    }

    /* Hero text elements for mobile */
    .hero-section *,
    .singles-page-hero *,
    .backorder-page-hero *,
    .collection-page-hero *,
    .format-page-hero *,
    .page-hero *,
    .sealed-page-hero *,
    .releases-page-hero *,
    .deckbuilder-header *,
    [class*="hero"] *,
    [class*="banner"] * {
        color: var(--mobile-text) !important;
    }

    /* Mobile Banner Text Fixes - Ensure all banners have white text */
    .singles-page-hero,
    .backorder-page-hero,
    .collection-page-hero,
    .format-page-hero,
    .page-hero,
    .hero-section {
        color: #ffffff !important;
    }

    .singles-page-hero h1,
    .singles-page-hero p,
    .singles-page-hero .hero-badge,
    .singles-page-hero .hero-notice,
    .singles-page-hero .hero-notice span,
    .backorder-page-hero h1,
    .backorder-page-hero p,
    .collection-page-hero h1,
    .collection-page-hero p,
    .format-page-hero h1,
    .format-page-hero p,
    .page-hero h1,
    .page-hero p,
    .hero-section h1,
    .hero-section p {
        color: #ffffff !important;
    }

    .hero-badge,
    .mobile-hero-badge {
        color: #ffffff !important;
    }

    .hero-notice,
    .hero-notice span,
    .hero-notice i {
        color: #ffffff !important;
    }
}

/* ===========================
   DARK MODE SUPPORT
   ========================== */

@media (prefers-color-scheme: dark) {
    /* Root variables for dark mode - Harmonious colors */
    :root {
        --dark-bg-primary: #1A1A1A;
        --dark-bg-secondary: #252525;
        --dark-bg-tertiary: #303030;
        --dark-text-primary: #E8E8E8;
        --dark-text-secondary: #B8B8B8;
        --dark-text-muted: #888888;
        --dark-border: #3A3A3A;
        --dark-border-light: #2A2A2A;
        --dark-accent: #4A90E2;
        --dark-accent-hover: #7BB3F0;
        --dark-success: #4ECDC4;
        --dark-warning: #F39C12;
        --dark-error: #E74C3C;
        --dark-card-bg: #252525;
        --dark-input-bg: #252525;
        --dark-shadow: rgba(0, 0, 0, 0.5);
    }

    /* Body and main containers */
    body {
        background-color: var(--dark-bg-primary) !important;
        color: var(--dark-text-primary) !important;
    }

    /* Headers and navigation */
    .mobile-header,
    .header-main,
    .navbar {
        background-color: var(--dark-bg-secondary) !important;
        border-bottom-color: var(--dark-border) !important;
        color: var(--dark-text-primary) !important;
    }

    /* Announcement Bar - Harmonious dark mode styling */
    .announcement-bar {
        background-color: var(--dark-bg-tertiary) !important; /* Consistent dark background */
        color: var(--dark-text-primary) !important; /* Light text for dark background */
        border-bottom: 1px solid var(--dark-border) !important;
    }

    .announcement-text {
        color: var(--dark-text-primary) !important; /* Light text on dark background */
    }

    .mobile-header .logo,
    .mobile-header .site-title,
    .navbar-brand {
        color: var(--dark-text-primary) !important;
    }

    /* Navigation links */
    .mobile-nav a,
    .navbar-nav .nav-link,
    .nav-link {
        color: var(--dark-text-secondary) !important;
    }

    .mobile-nav a:hover,
    .navbar-nav .nav-link:hover,
    .nav-link:hover {
        color: var(--dark-text-primary) !important;
        background-color: var(--dark-bg-tertiary) !important;
    }

    /* Cards and containers - Sleek rounded styling */
    .card,
    .product-card,
    .collection-card,
    .filter-card,
    .mobile-filter-card {
        background-color: var(--dark-card-bg) !important; /* Consistent dark background */
        border-color: var(--dark-border) !important; /* Harmonious border */
        color: var(--dark-text-primary) !important; /* Light text for dark background */
        border-radius: 12px !important; /* Rounded corners */
        box-shadow: var(--dark-shadow) !important; /* Subtle shadow */
    }

    /* Text elements - Light text for dark backgrounds */
    h1, h2, h3, h4, h5, h6 {
        color: var(--dark-text-primary) !important; /* Light text for dark backgrounds */
    }

    p, span, div {
        color: var(--dark-text-secondary) !important; /* Secondary light text */
    }

    .text-muted {
        color: var(--dark-text-muted) !important;
    }

    /* Forms and inputs */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="search"],
    textarea,
    select,
    .form-control {
        background-color: var(--dark-input-bg) !important;
        border-color: var(--dark-border) !important;
        color: var(--dark-text-primary) !important;
    }

    input[type="text"]:focus,
    input[type="email"]:focus,
    input[type="password"]:focus,
    input[type="search"]:focus,
    textarea:focus,
    select:focus,
    .form-control:focus {
        border-color: var(--dark-accent) !important;
        box-shadow: 0 0 0 0.2rem rgba(187, 134, 252, 0.25) !important;
    }

    /* Buttons */
    .btn-primary {
        background-color: var(--dark-accent) !important;
        border-color: var(--dark-accent) !important;
        color: var(--dark-text-primary) !important;
    }

    .btn-primary:hover {
        background-color: var(--dark-accent-hover) !important;
        border-color: var(--dark-accent-hover) !important;
    }

    .btn-secondary {
        background-color: var(--dark-bg-tertiary) !important;
        border-color: var(--dark-border) !important;
        color: var(--dark-text-primary) !important;
    }

    .btn-secondary:hover {
        background-color: var(--dark-border) !important;
    }

    .btn-outline {
        border-color: var(--dark-border) !important;
        color: var(--dark-text-secondary) !important;
    }

    .btn-outline:hover {
        background-color: var(--dark-bg-tertiary) !important;
        color: var(--dark-text-primary) !important;
    }

    /* Mobile specific elements */
    .mobile-menu-overlay {
        background-color: rgba(0, 0, 0, 0.8) !important;
    }

    .mobile-menu {
        background-color: var(--dark-bg-secondary) !important;
        border-color: var(--dark-border) !important;
    }

    .mobile-filter-toggle {
        background-color: var(--dark-bg-tertiary) !important;
        border-color: var(--dark-border) !important;
        color: var(--dark-text-primary) !important;
    }

    /* Hamburger icons - ensure visibility in dark mode */
    .hamburger-line {
        background: #ffffff !important; /* White in dark mode */
    }

    .mobile-filter-toggle .filter-hamburger span {
        background: #ffffff !important; /* White in dark mode */
    }

    /* Cart icon - ensure visibility in dark mode */
    .mobile-cart-icon {
        color: #ffffff !important; /* White in dark mode */
    }

    /* Active state hamburger lines */
    .mobile-menu-toggle.active .hamburger-line:nth-child(1),
    .mobile-menu-toggle.active .hamburger-line:nth-child(3) {
        background: #ffffff !important;
    }

    .mobile-filters-dropdown {
        background-color: var(--dark-bg-secondary) !important;
        border-color: var(--dark-border) !important;
        box-shadow: 0 4px 12px var(--dark-shadow) !important;
    }

    /* Filter elements */
    .filter-checkbox,
    .mobile-filter-option {
        color: var(--dark-text-secondary) !important;
    }

    .filter-checkbox:hover,
    .mobile-filter-option:hover {
        color: var(--dark-text-primary) !important;
        background-color: var(--dark-bg-tertiary) !important;
    }

    .mobile-filter-option:has(input[type="checkbox"]:checked) {
        background-color: rgba(187, 134, 252, 0.2) !important;
        color: var(--dark-accent) !important;
    }

    /* Product elements - Light text for dark backgrounds */
    .product-title,
    .product-name {
        color: var(--dark-text-primary) !important; /* Light text for titles */
    }

    .product-price,
    .price {
        color: var(--dark-accent-hover) !important; /* Accent color for prices */
        font-weight: 600 !important;
    }

    .product-meta,
    .set-code {
        color: var(--dark-text-secondary) !important; /* Secondary light text */
    }

    /* Product overlay styling for dark mode (when visible on larger mobile devices) */
    .product-overlay {
        background: rgba(0, 0, 0, 0.8) !important; /* Dark overlay */
    }

    .btn-quick-view {
        background-color: var(--dark-accent) !important; /* Primary color button */
        color: var(--dark-text-primary) !important; /* Light text */
        border: 1px solid var(--dark-accent) !important;
    }

    .btn-quick-view:hover {
        background-color: var(--dark-accent-hover) !important; /* Lighter on hover */
        color: var(--dark-text-primary) !important;
    }

    /* Mobile form elements and dropdowns - Sleek styling */
    .mobile-sort-select,
    .mobile-price-inputs input,
    select,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    textarea {
        background-color: var(--dark-input-bg) !important;
        border-color: var(--dark-border) !important;
        color: var(--dark-text-primary) !important;
        border-radius: 8px !important; /* Rounded corners */
        box-shadow: var(--dark-shadow) !important; /* Subtle shadow */
    }

    .mobile-sort-select:focus,
    .mobile-price-inputs input:focus,
    select:focus,
    input:focus,
    textarea:focus {
        border-color: var(--dark-accent) !important;
        box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2) !important;
    }

    /* Mobile buttons - Sleek rounded styling */
    .btn,
    .btn-primary,
    .btn-secondary,
    .btn-outline,
    .btn-add-cart,
    .mobile-filter-toggle {
        background-color: var(--dark-accent) !important;
        border-color: var(--dark-accent) !important;
        color: var(--dark-text-primary) !important;
        border-radius: 8px !important; /* Rounded corners */
        box-shadow: var(--dark-shadow) !important; /* Subtle shadow */
        transition: all 0.3s ease !important; /* Smooth transitions */
    }

    .btn:hover,
    .btn-primary:hover,
    .btn-secondary:hover,
    .btn-outline:hover,
    .btn-add-cart:hover,
    .mobile-filter-toggle:hover {
        background-color: var(--dark-accent-hover) !important;
        border-color: var(--dark-accent-hover) !important;
        color: var(--dark-text-primary) !important;
        transform: translateY(-1px) !important; /* Subtle lift effect */
    }

    /* Rarity indicators */
    .rarity-indicator.common {
        color: #9e9e9e !important;
    }

    .rarity-indicator.uncommon {
        color: #c0c0c0 !important;
    }

    .rarity-indicator.rare {
        color: #ffd700 !important;
    }

    .rarity-indicator.mythic {
        color: #ff6b35 !important;
    }

    /* Tables */
    .table,
    .collection-table {
        background-color: var(--dark-card-bg) !important;
        color: var(--dark-text-primary) !important;
    }

    .table th,
    .collection-table th {
        background-color: var(--dark-bg-tertiary) !important;
        border-color: var(--dark-border) !important;
        color: var(--dark-text-primary) !important;
    }

    .table td,
    .collection-table td {
        border-color: var(--dark-border-light) !important;
        color: var(--dark-text-secondary) !important;
    }

    .table-striped tbody tr:nth-of-type(odd) {
        background-color: rgba(255, 255, 255, 0.05) !important;
    }

    /* Alerts and notifications */
    .alert {
        background-color: var(--dark-bg-tertiary) !important;
        border-color: var(--dark-border) !important;
        color: var(--dark-text-primary) !important;
    }

    .alert-success {
        background-color: rgba(76, 175, 80, 0.2) !important;
        border-color: var(--dark-success) !important;
        color: var(--dark-success) !important;
    }

    .alert-warning {
        background-color: rgba(255, 152, 0, 0.2) !important;
        border-color: var(--dark-warning) !important;
        color: var(--dark-warning) !important;
    }

    .alert-danger {
        background-color: rgba(244, 67, 54, 0.2) !important;
        border-color: var(--dark-error) !important;
        color: var(--dark-error) !important;
    }

    /* Cart elements */
    .cart-count-badge {
        background-color: var(--dark-accent) !important;
        color: var(--dark-text-primary) !important;
    }

    /* Pagination */
    .pagination .page-link {
        background-color: var(--dark-bg-tertiary) !important;
        border-color: var(--dark-border) !important;
        color: var(--dark-text-secondary) !important;
    }

    .pagination .page-link:hover {
        background-color: var(--dark-border) !important;
        color: var(--dark-text-primary) !important;
    }

    .pagination .page-link.active {
        background-color: var(--dark-accent) !important;
        border-color: var(--dark-accent) !important;
        color: var(--dark-text-primary) !important;
    }

    /* Borders and dividers */
    hr {
        border-color: var(--dark-border) !important;
    }

    .border {
        border-color: var(--dark-border) !important;
    }

    .border-top {
        border-top-color: var(--dark-border) !important;
    }

    .border-bottom {
        border-bottom-color: var(--dark-border) !important;
    }

    /* Shadows */
    .shadow,
    .card-shadow {
        box-shadow: 0 2px 8px var(--dark-shadow) !important;
    }

    .shadow-lg {
        box-shadow: 0 4px 16px var(--dark-shadow) !important;
    }

    /* Loading states */
    .loading {
        background-color: var(--dark-bg-tertiary) !important;
    }

    /* Dropdown menus */
    .dropdown-menu {
        background-color: var(--dark-bg-secondary) !important;
        border-color: var(--dark-border) !important;
    }

    .dropdown-item {
        color: var(--dark-text-secondary) !important;
    }

    .dropdown-item:hover {
        background-color: var(--dark-bg-tertiary) !important;
        color: var(--dark-text-primary) !important;
    }

    /* Search elements */
    .search-box,
    .search-form {
        background-color: var(--dark-input-bg) !important;
        border-color: var(--dark-border) !important;
    }

    .search-input {
        background-color: var(--dark-input-bg) !important;
        color: var(--dark-text-primary) !important;
    }

    .search-input::placeholder {
        color: var(--dark-text-muted) !important;
    }

    /* Footer */
    .footer {
        background-color: var(--dark-bg-secondary) !important;
        border-top-color: var(--dark-border) !important;
        color: var(--dark-text-secondary) !important;
    }

    /* Ensure images don't become too bright */
    img {
        opacity: 0.9;
    }

    img:hover {
        opacity: 1;
    }

    /* Fix any white backgrounds that might appear - Use light grey for better readability */
    .bg-white {
        background-color: #2d2d2d !important; /* Light grey instead of dark card bg */
    }

    .bg-light {
        background-color: #2d2d2d !important; /* Light grey for better readability */
    }

    /* Additional mobile white background fixes */
    .mobile-card,
    .mobile-product-card,
    .mobile-content-section {
        background-color: #2d2d2d !important;
        border-color: #404040 !important;
    }

    /* Mobile filter sidebar - ensure light grey background */
    .mobile-filters-dropdown,
    .filters-sidebar {
        background-color: #2d2d2d !important;
        border-color: #404040 !important;
    }

    /* Text colors */
    .text-dark {
        color: var(--dark-text-primary) !important;
    }

    .text-secondary {
        color: var(--dark-text-secondary) !important;
    }

    .text-muted {
        color: var(--dark-text-muted) !important;
    }
}
