/* ==========================================================================
   GLOBAL MOBILE RESPONSIVE & TOUCH-FRIENDLY OVERRIDES (<= 768px)
   ========================================================================== */

html, body {
    max-width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

/* Bottom App Bar hidden on desktop */
.mobile-bottom-nav {
    display: none;
}

@media (max-width: 768px) {
    /* 1. Prevent mobile browser zoom when tapping inputs */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="password"],
    input[type="date"],
    select,
    textarea {
        font-size: 16px !important;
        min-height: 44px;
    }

    /* 2. Touch-friendly buttons */
    button, .btn, .btn-sm, .btn-save, .btn-primary, .btn-submit, .card-btn {
        min-height: 42px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* 3. Top Announcement Bar & Sticky Header */
    .top-bar {
        font-size: 11px;
        padding: 6px 12px;
        text-align: center;
        justify-content: center;
    }
    .top-bar div:first-child {
        display: none;
    }

    .nav-container, .nav-wrap {
        padding: 10px 14px !important;
        gap: 10px !important;
    }

    .logo {
        font-size: 19px !important;
    }

    /* Horizontal scrollable pill tabs in Admin / Vendor / Delivery headers */
    .nav-wrap .nav-links {
        width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap !important;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .nav-wrap .nav-links::-webkit-scrollbar {
        display: none;
    }
    .nav-wrap .nav-links a {
        white-space: nowrap;
        flex-shrink: 0;
        font-size: 12.5px;
        padding: 7px 11px;
    }

    /* Storefront Sub-Nav */
    .sub-nav-inner {
        padding: 8px 14px !important;
        gap: 14px !important;
        font-size: 13px !important;
        -webkit-overflow-scrolling: touch;
    }

    /* 4. Containers & Panels */
    .container {
        margin: 18px auto !important;
        padding: 0 12px !important;
    }
    .panel, .form-card, .auth-card, .task-card {
        padding: 16px 14px !important;
        border-radius: 12px !important;
    }
    .panel h1, .panel h2 {
        font-size: 17px !important;
    }

    /* 5. Storefront Product & Property Grids (2-column compact cards) */
    .grid, .rel-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
    }
    .card-img, .rel-card img {
        height: 135px !important;
    }
    .card-body, .rel-body {
        padding: 10px !important;
    }
    .card-title, .rel-title {
        font-size: 13px !important;
        line-height: 1.3;
    }
    .card-price, .rel-price {
        font-size: 15px !important;
    }
    .card-meta {
        font-size: 11px !important;
        margin-bottom: 8px !important;
    }
    .card-btn {
        width: 100%;
        font-size: 12px !important;
        padding: 8px 6px !important;
    }

    /* 6. Single-Column Stacking for Grids & Checkout */
    .checkout-grid,
    .property-grid,
    .product-box,
    .contact-grid,
    .portal-grid,
    .pillars-grid,
    .form-grid,
    .form-grid-3,
    .grid-2,
    .info-grid,
    .stats-row,
    .stats-bar {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }

    /* 7. Filter Bar on Shop Page */
    .filter-bar {
        padding: 12px !important;
    }
    .filter-inputs {
        width: 100%;
    }
    .filter-inputs input, .filter-inputs select {
        flex: 1 1 45%;
        width: auto !important;
    }
    .btn-filter {
        width: 100%;
    }

    /* 8. Portal Tables: Smooth Horizontal Scroll with Touch Momentum */
    table {
        font-size: 12.5px !important;
    }
    th, td {
        padding: 10px 8px !important;
    }

    /* 9. Live Map Modal on Mobile */
    .map-card {
        padding: 14px !important;
    }
    #adminMapIframe {
        height: 260px !important;
    }

    /* 10. Fixed Bottom Navigation Bar for Mobile Storefront */
    body.has-bottom-nav {
        padding-bottom: 68px;
    }
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: #ffffff;
        border-top: 1px solid #e2e8f0;
        box-shadow: 0 -4px 14px rgba(15, 23, 42, 0.08);
        z-index: 950;
        justify-content: space-around;
        align-items: center;
        padding: 0 6px;
    }
    .mobile-bottom-nav a {
        flex: 1;
        text-align: center;
        text-decoration: none;
        color: #64748b;
        font-size: 11px;
        font-weight: 600;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 4px 0;
    }
    .mobile-bottom-nav a.active,
    .mobile-bottom-nav a:hover {
        color: #2563eb;
        font-weight: 700;
    }
    .mobile-bottom-nav .nav-ico {
        font-size: 17px;
        line-height: 1;
    }
}
