/* 
  =========================================
  MOBILE MASTER OPTIMIZATION
  Subject: Full Website Mobile Optimization
  Strictly for screens <= 768px
  =========================================
*/

@media (max-width: 768px) {
    /* 1. GLOBAL RESET & STRUCTURE */
    html, body {
        overflow-x: hidden !important;
        width: 100vw !important;
        position: relative;
    }

    .container {
        width: 94% !important;
        max-width: none !important;
        padding-left: 3% !important;
        padding-right: 3% !important;
        margin: 0 auto !important;
    }

    /* 2. TYPOGRAPHY SCALING */
    h1 { font-size: 1.5rem !important; line-height: 1.2 !important; }
    h2 { font-size: 1.3rem !important; line-height: 1.2 !important; }
    h3 { font-size: 1.1rem !important; line-height: 1.2 !important; }
    p, span, a, li { font-size: 0.9rem !important; }

    /* 3. HEADER & NAVIGATION */
    .header, .top-nav {
        position: sticky !important;
        top: 0 !important;
        height: auto !important;
        padding: 10px 0 !important;
        background: #fff !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
        z-index: 10000 !important;
    }

    .top-nav {
        background: #111 !important; /* Specific to gallery */
        position: fixed !important;
        width: 100% !important;
        padding: 15px 5% !important;
    }

    .header .container, .top-nav {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    .nav-links, .header-nav, .topbar, .nav-menu-bar, .topbar-links {
        display: none !important; /* Hide all desktop navs */
    }

    .logo-area, .logo {
        gap: 8px !important;
        flex: 1;
    }

    .logo-box {
        width: 32px !important;
        height: 32px !important;
    }

    .logo-text h1 {
        font-size: 1rem !important;
    }

    /* 4. HAMBURGER TOGGLE */
    .mobile-toggle {
        display: flex !important;
        flex-direction: column;
        gap: 4px;
        background: #f0f0f0;
        border: none;
        cursor: pointer;
        padding: 8px;
        border-radius: 6px;
        z-index: 10001;
        margin-left: 10px;
    }

    .mobile-toggle span {
        display: block;
        width: 20px;
        height: 2px;
        background: #333;
        border-radius: 2px;
    }

    .gallery-wrapper .mobile-toggle span {
        background: #fff;
    }

    /* 5. USER DASHBOARD & PROFILE (FULL POWER FIX) */
    .app-container, .profile-container {
        padding: 10px !important;
        flex-direction: column !important;
        margin-top: 10px !important;
    }

    .sidebar {
        display: none !important;
    }

    .dashboard-grid, .profile-card, .content-grid {
        grid-template-columns: 1fr !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
        width: 100% !important;
    }

    .profile-card {
        padding: 20px !important;
        align-items: center !important;
        text-align: center !important;
    }

    .profile-avatar {
        width: 120px !important;
        height: 120px !important;
    }

    .main-content {
        padding: 0 !important;
        width: 100% !important;
    }

    .top-nav-dashboard {
        flex-direction: column !important;
        gap: 15px !important;
        align-items: flex-start !important;
    }

    .nav-pills {
        width: 100% !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        padding: 8px !important;
        scrollbar-width: none;
        display: flex !important;
        gap: 8px !important;
    }

    .nav-pills::-webkit-scrollbar { display: none; }

    .pastel-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }

    .profile-card, .detailed-info, .listings-section, .perf-card {
        border-radius: 15px !important;
        padding: 15px !important;
    }

    .sleek-table {
        display: block !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .perf-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    /* 6. CATEGORY STRIP (LISTINGS PAGE) */
    .cat-strip {
        padding: 10px 0 !important;
        background: #fff !important;
        border-bottom: 1px solid #eee !important;
        overflow: hidden;
    }

    .cat-strip .container {
        display: flex !important;
        overflow-x: auto !important;
        flex-wrap: nowrap !important;
        gap: 12px !important;
        padding: 5px 10px !important;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .cat-strip .container::-webkit-scrollbar { display: none; }

    .cat-tab {
        flex: 0 0 auto !important; /* Prevent squashing */
        padding: 8px 16px !important;
        background: #f8f9fa !important;
        border-radius: 40px !important;
        border: 1px solid #e9ecef !important;
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
        text-decoration: none !important;
    }

    .cat-tab .c-text {
        font-size: 0.85rem !important;
        display: inline !important; /* Ensure labels are visible */
        white-space: nowrap !important;
    }

    .cat-tab .c-count {
        font-size: 0.75rem !important;
        opacity: 0.7;
    }

    /* 7. HOME PAGE CATEGORY CARDS FIX */
    .cat-card:hover {
        transform: none !important;
        z-index: 1 !important;
    }

    /* 8. BUSINESS GALLERY OVERRIDES */
    .gallery-header {
        padding: 70px 4% 15px !important;
    }

    .cat-bar {
        gap: 8px !important;
        padding-bottom: 10px !important;
    }

    .cat-btn {
        padding: 8px 16px !important;
        font-size: 13px !important;
        white-space: nowrap !important;
    }

    /* 9. SEARCH & FORMS */
    .search-grid, .hero-search-grid {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }

    /* 10. DRAWER ENHANCEMENT */
    .mobile-drawer {
        width: 80% !important;
        max-width: 300px !important;
    }
}
