/* ===================================================================
   Beautician Index – mobile.css
   Dedicated responsive layer for phones & small tablets
   Scoped carefully so nothing bleeds onto desktop.
   ─────────────────────────────────────────────────────────────────
   Breakpoints used:
     xs  : max  575px    (small phones: 320–575)
     sm  : 576 – 767px   (large phones: 576–767)
     md  : 768 – 991px   (tablets: 768–991)
   Desktop (lg+, 992px+) is NEVER touched here.
   =================================================================== */

/* ═══════════════════════════════════════════════════════════════
   1. SAFE AREA + NOTCH SUPPORT
   ═══════════════════════════════════════════════════════════════ */
:root {
    /* Safe area env vars – fall back to 0 on non-notch devices */
    --sat: env(safe-area-inset-top, 0px);
    --sab: env(safe-area-inset-bottom, 0px);
    --sal: env(safe-area-inset-left, 0px);
    --sar: env(safe-area-inset-right, 0px);
}

/* Sticky navbar respects notch */
@media (max-width: 991px) {
    .bi-navbar.sticky-top {
        padding-top: max(.5rem, var(--sat));
    }

    /* Prevent content from hiding behind gesture nav bar */
    body {
        padding-bottom: var(--sab);
    }
}

/* ═══════════════════════════════════════════════════════════════
   2. MOBILE SPACING SYSTEM
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 991px) {
    :root {
        --bi-page-px: 16px;
        /* horizontal page padding */
        --bi-section-py: 32px;
        /* vertical section spacing */
        --bi-card-p: 16px;
        /* card internal padding */
        --bi-btn-h: 48px;
        /* button height */
        --bi-gap: 12px;
        /* gap between stacked elements */
    }
}

/* ═══════════════════════════════════════════════════════════════
   3. MOBILE HEADER  (logo + toggle only, no search bar)
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 991px) {
    .bi-navbar {
        height: auto !important;
        min-height: 56px;
        padding-top: max(.5rem, var(--sat));
        padding-bottom: .5rem;
        padding-left: max(var(--bi-page-px, 16px), var(--sal));
        padding-right: max(var(--bi-page-px, 16px), var(--sar));
    }

    /* Container fills safe-inset-adjusted width */
    .bi-navbar>.container-xl {
        padding-left: 0;
        padding-right: 0;
    }

    /* Logo icon on mobile */
    .bi-brand-logo {
        height: 36px !important;
    }

    /* Toggler icon – Hibiscus colour already set via SVG data-uri */
    .navbar-toggler {
        padding: .4rem;
        border: 1.5px solid var(--bi-beauty-bush) !important;
        border-radius: 8px !important;
    }
}

/* ═══════════════════════════════════════════════════════════════
   4. HAMBURGER DROPDOWN  – theme-consistent
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 991px) {

    /* Solid white panel with Hibiscus shadow */
    #mainNav.show,
    #mainNav.collapsing {
        background: #fff;
        border-radius: 0 0 16px 16px;
        box-shadow: 0 10px 28px rgba(166, 42, 96, .14);
        padding: 0 var(--bi-page-px, 16px) 12px;
        margin: 0 -1px;
        /* flush to navbar edge */
        border-top: 1.5px solid var(--bi-beauty-bush);
    }

    /* Stack all nav items in a column */
    #mainNav .navbar-nav {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 4px !important;
        width: 100%;
    }

    #mainNav .nav-item {
        width: 100%;
    }

    /* Nav links – full-width rows with pill hover */
    #mainNav .bi-nav-link {
        display: block;
        padding: .7rem 1rem !important;
        border-radius: var(--bi-r-md) !important;
        font-size: .95rem;
        font-weight: 600;
        color: var(--bi-text) !important;
        transition: background .15s, color .15s;
    }

    #mainNav .bi-nav-link:hover,
    #mainNav .bi-nav-link.active {
        background: #fdf0f3 !important;
        color: var(--bi-hibiscus) !important;
    }

    /* CTA "List Your Business" – full-width Hibiscus pill */
    .bi-cta-nav-btn {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        height: 48px !important;
        margin-top: 8px !important;
        padding: 0 1.25rem !important;
        background: var(--bi-hibiscus) !important;
        color: #fff !important;
        border-radius: var(--bi-r-md) !important;
        border: none !important;
        font-weight: 700;
        font-size: .9rem;
        letter-spacing: .02em;
    }

    .bi-cta-nav-btn:hover {
        background: var(--bi-hibiscus-dk) !important;
    }

    /* Divider before CTA */
    #mainNav .navbar-nav>li:last-child {
        border-top: 1px solid var(--bi-beauty-bush);
        padding-top: 8px;
        margin-top: 4px;
    }

    /* ── Hamburger Search Pill ──────────────────────────────── */
    .bi-hamburger-search {
        padding: 10px 0 4px;
    }

    .bi-ham-search-pill {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center;
        height: 48px;
        border: 1.5px solid var(--bi-beauty-bush);
        border-radius: 999px;
        overflow: hidden;
        background: #fff;
        box-shadow: 0 1px 6px rgba(166, 42, 96, .08);
        transition: border-color .2s, box-shadow .2s;
    }

    .bi-ham-search-pill:focus-within {
        border-color: var(--bi-sunglo);
        box-shadow: 0 0 0 3px rgba(219, 108, 124, .15);
    }

    /* Raw inputs (not .form-control) */
    .bi-ham-input {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        width: auto !important;
        height: 100%;
        border: none !important;
        outline: none !important;
        box-shadow: none !important;
        background: transparent !important;
        font-family: 'Open Sans', system-ui, sans-serif;
        font-size: .9rem;
        color: var(--bi-text);
        padding: 0 .9rem;
        line-height: 48px;
    }

    .bi-ham-input::placeholder {
        color: var(--bi-muted);
        font-size: .875rem;
    }

    .bi-ham-city {
        flex: 0 0 96px !important;
        width: 96px !important;
        max-width: 96px !important;
        padding: 0 .6rem;
        border-left: 1.5px solid var(--bi-beauty-bush) !important;
        font-size: .82rem;
        color: var(--bi-muted);
    }

    /* Pill right-end Hibiscus search button */
    .bi-ham-search-btn {
        flex-shrink: 0;
        width: 52px;
        height: 100%;
        border: none;
        border-radius: 0 999px 999px 0;
        background: var(--bi-hibiscus);
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.1rem;
        cursor: pointer;
        transition: background .2s;
    }

    .bi-ham-search-btn:hover,
    .bi-ham-search-btn:active {
        background: var(--bi-sunglo);
    }

    /* Hide on tiny phones */
    @media (max-width: 360px) {
        .bi-ham-city {
            display: none !important;
        }
    }
}

/* ═══════════════════════════════════════════════════════════════
   5. HERO SECTION  – compact + search button visible
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
    .bi-search-hero {
        padding-top: 2.25rem;
        padding-bottom: 5rem;
        /* room above wave */
    }

    /* Push wave 20px lower so Search btn is never clipped */
    .bi-search-hero::after {
        height: 36px;
        bottom: -20px;
        /* ← 20px lower than default */
    }

    .bi-search-hero-title {
        font-size: clamp(1.3rem, 5.5vw, 1.65rem);
        line-height: 1.2;
        margin-bottom: .4rem;
    }

    .bi-search-hero-sub {
        font-size: clamp(.85rem, 3.5vw, 1rem);
        line-height: 1.5;
        margin-bottom: 1.5rem;
    }

    /* Hero mega search form */
    .bi-mega-search-form .row {
        row-gap: .6rem !important;
    }

    .bi-mega-search-form .form-control,
    .bi-mega-search-form .form-select {
        height: 48px;
        font-size: .9rem;
        padding-left: .9rem;
        border-radius: var(--bi-r-md) !important;
    }

    /* Search button – gradient blend, no side gap */
    .bi-search-hero .bi-search-btn,
    .bi-mega-search-form .bi-search-btn {
        height: 48px !important;
        min-height: 48px;
        width: 100% !important;
        padding: 0 1.5rem !important;
        background: var(--bi-hibiscus) !important;
        border-color: var(--bi-hibiscus) !important;
        color: #fff !important;
        font-size: .95rem;
        font-weight: 700;
        border-radius: var(--bi-r-md) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: .5rem;
        margin: 0 !important;
        /* no left/right gap */
    }

    .bi-search-hero .bi-search-btn:hover,
    .bi-mega-search-form .bi-search-btn:hover {
        background: var(--bi-hibiscus-dk) !important;
        border-color: var(--bi-hibiscus-dk) !important;
    }

    /* Carousel image height on mobile */
    .bi-carousel-img {
        height: 200px !important;
    }
}

/* ═══════════════════════════════════════════════════════════════
   6. TYPOGRAPHY SCALING  (fluid via clamp)
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
    body {
        font-size: clamp(.9rem, 3.8vw, 1rem);
    }

    h1,
    .bi-search-hero-title {
        font-size: clamp(1.3rem, 5.5vw, 1.7rem);
    }

    h2,
    .bi-section-title {
        font-size: clamp(1.1rem, 4.5vw, 1.4rem);
    }

    h3 {
        font-size: clamp(1rem, 4vw, 1.2rem);
    }

    h4 {
        font-size: clamp(.9rem, 3.5vw, 1.05rem);
    }

    /* Headings left aligned on mobile */
    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
        text-align: left;
    }

    .bi-search-hero h1,
    .bi-search-hero p {
        text-align: center;
    }

    /* keep hero centred */
}

/* ═══════════════════════════════════════════════════════════════
   7. BUTTON PERFECTION
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 991px) {
    .btn {
        min-height: 48px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 6px !important;
        font-size: clamp(.875rem, 3.8vw, 1rem);
        padding-left: 1.1rem !important;
        padding-right: 1.1rem !important;
        white-space: normal;
        line-height: 1.25;
    }

    /* Full-width CTAs on mobile */
    .bi-cta-section .btn,
    .bi-search-hero .btn,
    .bi-footer .btn {
        width: 100% !important;
    }
}

/* ═══════════════════════════════════════════════════════════════
   8. SINGLE-COLUMN GRID  (< 576px)
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 575px) {

    /* Force single column – override row-cols-* */
    .row-cols-2>* {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Container full-width with safe padding */
    .container,
    .container-xl,
    .container-fluid {
        padding-left: max(16px, var(--sal));
        padding-right: max(16px, var(--sar));
    }
}

/* Category cards stay 2-col at 576px+ */
@media (min-width: 576px) and (max-width: 767px) {
    .row-cols-2>* {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

/* ═══════════════════════════════════════════════════════════════
   9. CARD VISUAL BALANCE
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {

    /* Listing cards */
    .bi-listing-card {
        border-radius: var(--bi-r-md) !important;
        overflow: hidden;
        margin-bottom: 16px;
    }

    .bi-card-img-wrap {
        height: 180px;
        border-radius: var(--bi-r-md) var(--bi-r-md) 0 0;
    }

    .bi-listing-card .card-body {
        padding: 14px 16px 10px !important;
    }

    .bi-listing-card .card-footer {
        padding: 8px 16px 12px !important;
    }

    /* Card footer buttons – don't wrap */
    .bi-listing-card .card-footer .d-flex {
        gap: 8px !important;
        flex-wrap: wrap;
    }

    .bi-listing-card .card-footer .btn {
        flex: 1 1 auto;
        min-width: 80px;
    }

    /* Category cards */
    .bi-cat-card-inner {
        padding: 1.1rem .75rem .9rem;
        border-radius: var(--bi-r-md) !important;
    }

    .bi-cat-icon {
        width: 52px;
        height: 52px;
        font-size: 1.4rem;
    }

    .bi-cat-name {
        font-size: .85rem;
        margin-top: .5rem;
    }

    .bi-cat-desc {
        font-size: .72rem;
        line-height: 1.4;
    }
}

/* ═══════════════════════════════════════════════════════════════
   10. SECTIONS – spacing rhythm
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
    .bi-section {
        padding-top: 28px;
        padding-bottom: 28px;
    }

    .bi-cta-card {
        padding: 2rem 1.25rem;
        border-radius: var(--bi-r-lg);
        text-align: center;
    }

    .bi-cta-card h3 {
        font-size: 1.15rem;
    }

    /* Section title + browse all row */
    .bi-section>.container-xl>.d-flex {
        flex-wrap: wrap;
        gap: 8px;
    }

    .bi-section-title {
        font-size: 1.1rem !important;
    }
}

/* ═══════════════════════════════════════════════════════════════
   11. LISTING DETAIL – STICKY BOTTOM ACTION BAR
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
    .bi-sticky-cta {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #fff;
        border-top: 1.5px solid var(--bi-beauty-bush);
        box-shadow: 0 -4px 16px rgba(166, 42, 96, .12);
        padding: 10px max(16px, var(--sar)) max(12px, var(--sab)) max(16px, var(--sal));
        z-index: 1040;
        display: flex;
        gap: 10px;
    }

    .bi-sticky-cta .btn {
        flex: 1;
        height: 48px !important;
        font-size: .875rem;
        border-radius: 12px !important;
        gap: 6px;
    }

    /* Push page content above sticky bar */
    body:has(.bi-sticky-cta) {
        padding-bottom: calc(80px + var(--sab));
    }
}

/* ═══════════════════════════════════════════════════════════════
   12. BORDER RADIUS CONSISTENCY
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 575px) {
    :root {
        --bi-r-lg: 14px;
        --bi-r-xl: 18px;
    }

    /* Prevent pill from looking weird on very narrow screens */
    .bi-auth-card {
        border-radius: var(--bi-r-lg) !important;
        margin: 0 8px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   13. LANDSCAPE ORIENTATION
   ═══════════════════════════════════════════════════════════════ */
@media (max-height: 500px) and (orientation: landscape) {
    .bi-navbar {
        position: relative !important;
    }

    /* un-sticky on landscape to save height */
    .bi-search-hero {
        padding-top: 1.5rem;
        padding-bottom: 3rem;
    }

    .bi-search-hero-title {
        font-size: 1.15rem;
    }

    .bi-carousel-img {
        height: 150px !important;
    }
}

/* ═══════════════════════════════════════════════════════════════
   14. OVERFLOW / HORIZONTAL SCROLL FIX
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {

    html,
    body {
        overflow-x: hidden;
    }

    /* Prevent any child from stretching beyond viewport */
    .container-xl,
    .container,
    section,
    footer {
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Admin nav – scrollable pill strip */
    .bi-admin-nav {
        overflow-x: auto;
        flex-wrap: nowrap !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
    }

    .bi-admin-nav::-webkit-scrollbar {
        display: none;
    }

    .bi-admin-nav-item {
        white-space: nowrap;
    }
}

/* ═══════════════════════════════════════════════════════════════
   15. TABLET (768–991px)
   ═══════════════════════════════════════════════════════════════ */
@media (min-width: 768px) and (max-width: 991px) {
    .bi-navbar {
        height: auto;
        min-height: 60px;
    }

    .bi-search-hero {
        padding: 3rem 0 4.5rem;
    }

    .bi-search-hero::after {
        height: 40px;
    }

    .bi-card-img-wrap {
        height: 190px;
    }

    .bi-admin-nav {
        flex-wrap: wrap;
    }

    .bi-admin-nav-item {
        font-size: .82rem;
    }

    .bi-carousel-img {
        height: 300px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   16. PERFORMANCE – prevent layout shift
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 991px) {

    /* Reserve image dimensions so no CLS */
    .bi-card-img-wrap,
    .bi-carousel-img,
    .bi-detail-hero {
        contain: layout;
    }

    img {
        max-width: 100%;
        height: auto;
    }
}

/* ═══════════════════════════════════════════════════════════════
   FOOTER – mobile
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
    .bi-footer-bottom .container-xl {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: .35rem;
    }

    .bi-footer-copy {
        font-size: .8rem;
    }

    /* "List Your Business" pill in footer */
    .bi-footer .btn {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-height: 48px !important;
        white-space: normal;
        line-height: 1.3;
        text-align: center !important;
        padding: .55rem 1.5rem !important;
    }
}