/* Mobile App Styles */

/* 1. Safe Areas (Notches) */
body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

/* 2. Hide Desktop Navigation on Mobile */
@media (max-width: 768px) {

    /* Hide specific parts of the desktop navbar */
    .nav-container .top-row>.search-bar,
    .nav-container .top-row>.nav-actions,
    .nav-container .bottom-row,
    #navbar-placeholder .bottom-row,
    #main-header .bottom-row {
        display: none !important;
    }

    /* Adjust Top Row */
    .top-row {
        justify-content: space-between !important;
        padding: 0.5rem 1rem !important;
        background: white;
        /* Clean White */
        border-bottom: 1px solid #f0f0f0;
    }

    /* Logo - Left Aligned */
    .logo {
        margin-right: auto;
    }

    .logo img {
        height: 32px !important;
        /* Compact Logo */
    }

    /* Mobile Header Icons (Hamburger, Location, Heart) */
    .mobile-header-actions {
        display: flex;
        gap: 1rem;
        align-items: center;
    }

    .header-icon-btn {
        background: none;
        border: none;
        font-size: 1.4rem;
        color: #1e293b;
        cursor: pointer;
        padding: 0;
    }

    /* 3. Hero Quick Actions (The Grid) */
    .mobile-hero-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        /* 4 Columns */
        gap: 0.75rem;
        padding: 1rem;
        margin-top: 0.5rem;
        background: #eff6ff;
        /* bg-blue-50 */
        border-radius: 12px;
        margin: 1rem;
    }

    .action-card {
        background: transparent;
        border: none;
        padding: 0;
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        text-decoration: none;
        height: auto;
    }

    .action-card:hover {
        background: transparent;
        border-color: transparent;
    }

    .action-icon-wrapper {
        width: 48px;
        height: 48px;
        background: white;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
        margin-bottom: 0.25rem;
    }

    .action-icon {
        font-size: 1.5rem;
    }

    .action-text {
        font-size: 0.7rem;
        font-weight: 500;
        color: #1e293b;
        line-height: 1.2;
    }

    /* 4. Horizontal Scroll Containers */
    .mobile-section-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0 1rem;
        margin-bottom: 0.5rem;
    }

    .mobile-section-title {
        font-size: 1rem;
        font-weight: 700;
        color: #1e293b;
        margin: 0;
    }

    .mobile-view-all {
        font-size: 0.8rem;
        color: var(--primary);
        text-decoration: none;
        font-weight: 600;
    }

    .mobile-horizontal-scroll {
        display: flex;
        overflow-x: auto;
        gap: 1rem;
        padding: 0.5rem 1rem 1.5rem 1rem;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        /* Smooth scroll iOS */
    }

    .mobile-horizontal-scroll::-webkit-scrollbar {
        display: none;
        /* Hide scrollbar */
    }

    /* Product Cards in Mobile Scroll */
    .mobile-product-card {
        flex: 0 0 160px;
        /* Fixed width */
        background: white;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        overflow: hidden;
        scroll-snap-align: start;
        text-decoration: none;
        color: inherit;
    }

    .mobile-card-img {
        width: 100%;
        height: 100px;
        object-fit: cover;
        background: #f1f5f9;
    }

    .mobile-card-content {
        padding: 0.5rem;
    }

    .mobile-card-title {
        font-size: 0.85rem;
        font-weight: 600;
        margin-bottom: 0.25rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mobile-card-price {
        font-size: 0.85rem;
        font-weight: 700;
        color: var(--primary);
    }

    .mobile-card-meta {
        font-size: 0.7rem;
        color: #64748b;
    }

    /* Brand Bubbles */
    .mobile-brand-item {
        flex: 0 0 auto;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
        text-decoration: none;
        color: #1e293b;
    }

    .mobile-brand-logo {
        width: 60px;
        height: 60px;
        border-radius: 50%;
        object-fit: contain;
        background: white;
        border: 1px solid #e2e8f0;
        padding: 5px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }

    .mobile-brand-name {
        font-size: 0.75rem;
        font-weight: 500;
        text-align: center;
    }

    /* 5. Bottom Tab Bar */
    .bottom-tab-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: white;
        border-top: 1px solid #e2e8f0;
        display: flex;
        justify-content: space-around;
        padding: 0.5rem 0;
        padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
        z-index: 1000;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    }

    .tab-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.25rem;
        text-decoration: none;
        color: #64748b;
        font-size: 0.7rem;
        font-weight: 500;
        width: 25%;
    }

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

    .tab-icon {
        font-size: 1.25rem;
    }

    /* Spacing for Bottom Bar */
    body {
        padding-bottom: 70px;
    }

    /* 6. Premium Sidebar Styles */
    .mobile-sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        /* Hidden */
        width: 280px;
        height: 100%;
        background: white;
        z-index: 2000;
        transition: left 0.3s ease;
        display: flex;
        flex-direction: column;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

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

    .mobile-sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1999;
        display: none;
    }

    .mobile-sidebar-overlay.active {
        display: block;
    }

    .sidebar-header-premium {
        padding: 1rem 1rem;
        /* Reduced padding */
        background: var(--primary);
        color: white;
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
    }

    .sidebar-user-info {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        /* Reduced gap */
    }

    .sidebar-avatar-img {
        width: 40px;
        /* Reduced size */
        height: 40px;
        border-radius: 50%;
        object-fit: cover;
        border: 2px solid white;
    }

    .sidebar-avatar-placeholder {
        width: 40px;
        /* Reduced size */
        height: 40px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.2);
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1rem;
        /* Reduced font */
        font-weight: bold;
        border: 2px solid white;
    }

    .sidebar-user-name {
        font-weight: 600;
        font-size: 0.9rem;
        /* Reduced font */
        margin-bottom: 0.1rem;
    }

    .sidebar-edit-link {
        color: rgba(255, 255, 255, 0.8);
        font-size: 0.75rem;
        /* Reduced font */
        text-decoration: none;
    }

    .close-sidebar-btn {
        background: none;
        border: none;
        color: white;
        font-size: 1.25rem;
        /* Reduced icon */
        cursor: pointer;
        padding: 0;
    }

    .sidebar-scroll-content {
        flex: 1;
        overflow-y: auto;
        padding: 0.5rem 0;
        /* Reduced padding */
    }

    .sidebar-group {
        margin-bottom: 1rem;
        /* Reduced margin */
    }

    .sidebar-group-title {
        padding: 0 1rem 0.25rem 1rem;
        /* Reduced padding */
        font-size: 0.7rem;
        /* Reduced font */
        font-weight: 600;
        color: #94a3b8;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .sidebar-link-premium {
        display: flex;
        align-items: center;
        padding: 0.5rem 1.25rem;
        /* Reduced padding */
        /* Indented items */
        text-decoration: none;
        color: #334155;
        font-size: 0.85rem;
        /* Reduced font */
        font-weight: 500;
        transition: background 0.2s;
        border-left: 3px solid transparent;
        line-height: 1.2;
        /* Tighten line height */
    }

    .sidebar-link-premium:hover {
        background: #f8fafc;
        color: var(--primary);
        border-left-color: var(--primary);
    }

    .sidebar-link-premium .icon {
        margin-right: 0.6rem;
        /* Reduced margin */
        font-size: 1rem;
        /* Reduced icon */
        width: 20px;
        text-align: center;
    }

    .sidebar-footer {
        padding: 1rem;
        border-top: 1px solid #f1f5f9;
        text-align: center;
        background: #f8fafc;
    }

    .sidebar-socials a {
        color: #64748b;
        text-decoration: none;
        margin: 0 0.5rem;
        font-weight: 600;
        font-size: 0.85rem;
    }

    .sidebar-version {
        font-size: 0.7rem;
        color: #94a3b8;
        margin-top: 0.5rem;
    }

    /* 7. More Modal (Grid) */
    .more-modal-container {
        position: fixed;
        bottom: -300px;
        left: 0;
        width: 100%;
        background: white;
        z-index: 2000;
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
        transition: bottom 0.3s ease;
        padding: 1rem 1rem 2rem 1rem;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    }

    .more-modal-container.active {
        bottom: 70px;
        /* Above tab bar */
    }

    .more-modal-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 1rem;
        padding-bottom: 0.5rem;
        border-bottom: 1px solid #f1f5f9;
    }

    .more-modal-header h3 {
        margin: 0;
        font-size: 1.1rem;
        color: #1e293b;
    }

    .more-modal-header button {
        background: none;
        border: none;
        font-size: 1.5rem;
        color: #64748b;
    }

    .more-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    .more-grid-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        padding: 1rem;
        text-decoration: none;
        color: #334155;
        transition: all 0.2s;
        height: 100px;
    }

    .more-grid-item:active {
        background: #e2e8f0;
        transform: scale(0.98);
    }

    .more-icon {
        font-size: 1.5rem;
    }

    .more-label {
        font-size: 0.8rem;
        font-weight: 600;
        text-align: center;
    }
}

/* Ensure these are hidden on Desktop */
@media (min-width: 769px) {

    .mobile-header-actions,
    .mobile-hero-grid,
    .bottom-tab-bar,
    .mobile-sidebar,
    .mobile-sidebar-overlay,
    .more-modal-container,
    .mobile-header-row,
    #mobile-menu-btn,
    button.mobile-header-actions,
    .header-icon-btn.mobile-header-actions {
        display: none !important;
    }
}