/* Mobile Overrides & Bottom Navigation bar */

/* Default desktop helpers */
.hide-mobile {
    display: inline-flex !important;
}
.show-mobile {
    display: none !important;
}
.auth-buttons-desktop {
    display: inline-flex;
    gap: 0.75rem;
}

@media (max-width: 768px) {
    /* Main Layout overrides */
    .container {
        padding: 1rem;
    }

    .hide-mobile {
        display: none !important;
    }
    .show-mobile {
        display: flex !important;
    }

    .main-header {
        display: grid !important;
        grid-template-columns: auto 1fr auto !important;
        grid-template-rows: auto auto !important;
        row-gap: 0.75rem !important;
        column-gap: 0.5rem !important;
        align-items: center !important;
        padding: 0.75rem 1rem !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 1000 !important;
    }

    .logo-container {
        grid-column: 1 / span 2 !important;
        grid-row: 1 !important;
        display: flex !important;
        align-items: center !important;
        gap: 0.4rem !important;
        font-size: 1.3rem !important;
        margin: 0 !important;
    }

    .logo-container img {
        height: 28px !important;
        width: 28px !important;
    }

    .header-logo-text {
        display: inline !important;
        font-weight: 800 !important;
    }

    .header-actions {
        grid-column: 3 !important;
        grid-row: 1 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 0.75rem !important;
    }

    .search-wrapper {
        grid-column: 1 / span 3 !important;
        grid-row: 2 !important;
        width: 100% !important;
        margin: 0 !important;
    }

    .search-wrapper .search-input {
        padding: 0.65rem 1rem 0.65rem 2.5rem !important;
        font-size: 0.9rem !important;
        border-radius: var(--radius-sm) !important;
        width: 100% !important;
    }

    /* Hide desktop nav */
    .nav-links {
        display: none;
    }

    .banner-slider {
        height: 240px;
        border-radius: var(--radius-md);
        margin-bottom: 1.5rem;
    }

    .banner-content {
        bottom: 24px;
        left: 24px;
        max-width: calc(100% - 48px);
    }

    .banner-content h2 {
        font-size: 1.5rem;
    }

    /* Product grid columns */
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        margin: 1rem 0;
    }

    .product-card-body {
        padding: 0.75rem;
    }

    .product-title {
        font-size: 0.9rem;
        height: 2.4rem;
        margin-bottom: 0.25rem;
    }

    .product-price {
        font-size: 1rem;
    }

    /* Bottom Spacer for Sticky Navigation */
    .body-spacer {
        display: block;
        height: 64px;
    }

    /* Mobile Sticky Bottom Navigation Bar */
    .mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 60px;
        background: var(--bg-card);
        backdrop-filter: blur(16px);
        border-top: 1px solid var(--border-glass);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
        display: flex;
        align-items: center;
        justify-content: space-around;
        z-index: 900;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: var(--color-text-secondary);
        font-size: 0.7rem;
        font-weight: 500;
        text-decoration: none;
        position: relative;
        flex: 1;
        height: 100%;
        gap: 2px;
    }

    .mobile-nav-item.active {
        color: var(--primary);
    }

    .mobile-nav-item svg {
        width: 20px;
        height: 20px;
        fill: currentColor;
    }

    .mobile-nav-badge {
        position: absolute;
        top: 6px;
        right: 22%;
        background: var(--danger);
        color: white;
        font-size: 0.65rem;
        font-weight: 700;
        min-width: 16px;
        height: 16px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Search bar width on mobile */
    .search-wrapper {
        width: 100%;
        margin: 0.5rem 0;
    }

    /* Hide footer on mobile or simplify */
    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    /* Collapsing Grids & Spacing Adjustments */
    #cart-layout-grid,
    #product-main-grid,
    #search-landing-layout,
    #shop-products-layout {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
    
    #create-shop-grid,
    #create-shop-urls,
    #create-shop-coords {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }

    body {
        padding-bottom: 90px !important;
    }

    .horizontal-scroll-wrap {
        margin-bottom: 1.75rem !important;
    }

    #featured-shops-section {
        margin-bottom: 2rem !important;
    }

    /* Hero Section Adjustments */
    .hero-container {
        padding: 1.5rem 1.25rem !important;
        min-height: auto !important;
        flex-direction: column !important;
        align-items: stretch !important;
        text-align: center !important;
        margin-bottom: 1.5rem !important;
        gap: 1.25rem !important;
    }

    .hero-content {
        max-width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
    }

    .hero-title {
        font-size: 1.8rem !important;
        line-height: 1.25 !important;
        margin-bottom: 0.75rem !important;
    }

    .hero-subtitle {
        font-size: 0.95rem !important;
        margin-bottom: 1.25rem !important;
        max-width: 100% !important;
    }

    .hero-content div[style*="display:flex; gap:0.75rem; margin-top:1.5rem"],
    .hero-content div[style*="display: flex; gap: 0.75rem; margin-top: 1.5rem"] {
        display: flex !important;
        flex-direction: row !important;
        gap: 0.5rem !important;
        width: 100% !important;
        justify-content: center !important;
        margin-top: 1rem !important;
    }

    .hero-content .btn {
        flex: 1 !important;
        padding: 0.65rem 1rem !important;
        font-size: 0.9rem !important;
        text-align: center !important;
        min-height: 44px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* Category Shortcuts Responsive Auto-grid */
    .category-shortcuts-row {
        display: grid !important;
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)) !important;
        gap: 0.75rem !important;
        margin-bottom: 1.75rem !important;
        margin-top: 0.5rem !important;
    }

    /* Mobile Bottom Navigation Redesign Styles */
    .mobile-bottom-nav {
        background: rgba(255, 255, 255, 0.85) !important;
        backdrop-filter: blur(20px) saturate(180%) !important;
        -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
        border-top: 1px solid rgba(226, 232, 240, 0.8) !important;
        box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.04) !important;
        height: 64px !important;
        padding-bottom: 0 !important;
    }

    .dark-theme .mobile-bottom-nav {
        background: rgba(15, 23, 42, 0.85) !important;
        border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
        box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.2) !important;
    }

    .mobile-nav-item {
        transition: all var(--transition-fast) !important;
        position: relative !important;
        min-height: 44px !important;
    }

    .mobile-nav-item svg {
        width: 22px !important;
        height: 22px !important;
        transition: transform 0.2s ease, fill 0.2s ease !important;
    }

    .mobile-nav-item.active {
        color: var(--primary) !important;
        font-weight: 700 !important;
    }

    .mobile-nav-item.active svg {
        transform: translateY(-2px) scale(1.08) !important;
        fill: var(--primary) !important;
    }

    .mobile-nav-item span {
        font-size: 0.72rem !important;
        letter-spacing: -0.2px !important;
    }

    .mobile-nav-item.active::before {
        content: '' !important;
        position: absolute !important;
        top: 0 !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: 24px !important;
        height: 3px !important;
        background: var(--primary) !important;
        border-radius: 0 0 4px 4px !important;
        box-shadow: 0 1px 6px var(--primary-glow) !important;
    }

    /* Product Cards Mobile-first Layout & Aspect Ratio */
    .product-image-wrap {
        aspect-ratio: 1 / 1 !important;
        padding-top: 0 !important;
    }

    .product-image-wrap img {
        position: relative !important;
        object-fit: contain !important;
    }

    .product-card-body div[style*="display:flex; align-items:center; justify-content:space-between"],
    .product-card-body div[style*="display: flex; align-items: center; justify-content: space-between"] {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.5rem !important;
        margin-top: auto !important;
    }

    .product-pricing {
        flex-direction: row !important;
        align-items: baseline !important;
        gap: 0.25rem !important;
        margin-bottom: 0.25rem !important;
    }

    .add-to-cart-btn {
        width: 100% !important;
        text-align: center !important;
        padding: 0.4rem 0.5rem !important;
        font-size: 0.8rem !important;
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
}
