/* ============================================================================
   public/css/pk-mobile.css: phone & tablet experience (below 992px)
   ============================================================================
   Loaded AFTER pk.css in layouts/site.blade.php, so these rules win.

   Idea: on a phone the site behaves like a property APP, not a shrunken
   website:
     • hamburger opens a full-height slide-in menu
     • the hero search collapses into ONE search bar → opens a bottom sheet
     • listings scroll sideways (swipe) instead of a long vertical column
     • an app-style tab bar sits at the bottom (Home, Search, WhatsApp, Call, Account)
     • the property page has a sticky price + WhatsApp bar
   Bootstrap's "offcanvas" component powers the menu and sheets.
   ========================================================================== */

/* ── 0. ALL SCREEN SIZES ───────────────────────────────────────────────────── */

/* Calmer section labels: sentence case instead of tracked-out capitals. */
.pk-section-title span { text-transform: none; letter-spacing: 0; font-size: .95rem; }

/* Responsive offcanvas (".offcanvas-lg") becomes NORMAL page content on
   desktop, but Bootstrap turns its body into a flex row there. Our forms
   need normal block layout. */
@media (min-width: 992px) {
    .pk-sheet .offcanvas-body { display: block; }
    /* Bootstrap makes a desktop offcanvas transparent; the hero search card must stay white. */
    .pk-search-card.offcanvas-lg { background-color: #fff !important; }
    /* Desktop: the menu's inner wrapper stretches so the links sit on the right. */
    .pk-menu-inner { display: flex; align-items: center; flex-grow: 1; }
}

/* SAFETY NET against sideways scrolling: anything that pokes past the right
   edge is clipped instead of making the whole page swipe left/right.
   "clip" (unlike "hidden") does NOT break the sticky header. */
html, body { overflow-x: clip; }

/* Keyboard users: a clearly visible focus ring everywhere. */
:focus-visible { outline: 3px solid rgba(37, 99, 235, .45); outline-offset: 2px; }

/* People who ask their phone/PC for less motion get none. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}


/* ── 1. PHONES & TABLETS (below 992px) ─────────────────────────────────────── */
@media (max-width: 991.98px) {

    /* ROOT CAUSE of the sideways gap: Bootstrap's .g-5 rows use a 48px gutter,
    so the row hangs 24px outside each side, but the container only has 12px
    padding → the page became 12px wider than the phone. Use the normal 24px
    gutter on phones (rows then fit exactly). */
    .row.g-5 { --bs-gutter-x: 1.5rem; --bs-gutter-y: 2rem; }

    /* Scroll animations are switched off on mobile: content shows instantly. */
    [data-aos] { opacity: 1 !important; transform: none !important; transition: none !important; }

    /* Room for the bottom tab bar (+ the iPhone home-indicator area). */
    body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }

    /* ── Header ── */
    .pk-header .navbar { padding: 10px 0; }
    .pk-logo { width: 38px; height: 38px; border-radius: 10px; font-size: .95rem; }
    .pk-brand { font-size: 1.1rem; }
    .navbar-toggler { padding: 6px 8px; border-radius: 10px; background: var(--pk-light); }

    /* ── Drop-down menu (slides DOWN from the header) ──
    Bootstrap "collapse" animates the height open/closed. The panel floats
    over the page (position: absolute) instead of pushing content down. */
    .navbar-toggler .bi-x-lg { display: none; }
    .navbar-toggler[aria-expanded="true"] .bi-list { display: none; }
    .navbar-toggler[aria-expanded="true"] .bi-x-lg { display: inline-block; }
    .navbar-toggler[aria-expanded="true"] { background: var(--pk-blue); color: #fff; }

    .pk-menu {
        position: absolute; top: 100%; left: 0; right: 0;
        background: #fff;
        border-top: 1px solid var(--pk-border);
        border-radius: 0 0 22px 22px;
        box-shadow: 0 28px 48px rgba(17, 24, 39, .22);
        max-height: calc(100vh - 70px); overflow-y: auto;
    }
    .pk-menu-inner { padding: 16px 16px 20px; }

    /* Menu items become a 3-column grid of tiles (icon above label) */
    .pk-menu .navbar-nav { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .pk-menu .nav-link {
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
        min-height: 82px; padding: 12px 6px !important;
        background: var(--pk-light); border-radius: 16px;
        color: var(--pk-navy) !important; font-size: .86rem; font-weight: 500; text-align: center;
    }
    .pk-menu .nav-link i { font-size: 1.45rem; color: var(--pk-blue); }
    .pk-menu .nav-link.active { background: rgba(37, 99, 235, .1); color: var(--pk-blue) !important; box-shadow: inset 0 0 0 1.5px rgba(37, 99, 235, .35); }
    .pk-menu .nav-link-hot i { color: #EA580C; }

    /* Account / "List Your Property" buttons span the whole row */
    .pk-menu .nav-item-wide { grid-column: 1 / -1; }
    .pk-menu .nav-item-wide .btn { width: 100%; padding: 12px; font-size: 1rem; border-radius: 14px; }

    .pk-menu-contact { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--pk-border); }
    .pk-menu-contact a {
        flex: 1 1 140px; display: flex; align-items: center; justify-content: center; gap: 8px;
        padding: 10px; border-radius: 12px; border: 1px solid var(--pk-border);
        color: var(--pk-navy); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .pk-menu-contact a i { color: var(--pk-blue); }

    /* ── Hero ── */
    .pk-hero { padding: 40px 0 30px; text-align: center; }
    .pk-hero h1 { font-size: 1.9rem; line-height: 1.2; margin: 12px auto 8px; max-width: 22ch; }
    .pk-hero .lead { font-size: 1rem; margin-bottom: 0; }
    .pk-eyebrow { font-size: .78rem; padding: 4px 12px; }

    /* The single search bar that opens the search sheet */
    .pk-search-pill {
        display: flex; align-items: center; gap: 12px; width: 100%;
        margin-top: 22px; padding: 14px 16px;
        background: #fff; border: 0; border-radius: 16px;
        color: var(--pk-slate); font-size: .98rem; text-align: left;
        box-shadow: 0 12px 30px rgba(0, 0, 0, .25);
    }
    .pk-search-pill > i { font-size: 1.2rem; color: var(--pk-blue); }
    /* Only the TEXT stretches. (Bug fix: the old rule ".pk-search-pill span"
       also stretched the blue filter button, which squeezed the text.) */
    .pk-search-pill > span:not(.pk-pill-action) { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .pk-search-pill .pk-pill-action {
        flex: 0 0 38px; display: grid; place-items: center; width: 38px; height: 38px;
        border-radius: 10px; background: var(--pk-blue); color: #fff;
    }

    /* Property-type chips: one swipeable line under the search bar */
    .pk-chips {
        display: flex; gap: 8px; overflow-x: auto; margin: 16px -12px 0; padding: 0 12px 4px;
        justify-content: safe center;   /* centred when they fit, scrollable from the left when they don't */
        scrollbar-width: none; -webkit-overflow-scrolling: touch;
    }
    .pk-chips::-webkit-scrollbar { display: none; }
    .pk-chip {
        flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px;
        padding: 8px 14px; border-radius: 50px;
        background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .16);
        color: #E2E8F0; font-size: .88rem; white-space: nowrap;
    }
    .pk-chip i { color: #93C5FD; }
    .pk-chip:active { background: rgba(37, 99, 235, .35); color: #fff; }

    /* ── Bottom sheets (hero search + search-page filters) ── */
    .pk-sheet.offcanvas-lg {
        --bs-offcanvas-height: auto;
        max-height: 88vh;
        border-radius: 22px 22px 0 0;
        margin: 0; padding: 0; box-shadow: none;
    }
    .pk-sheet .offcanvas-header { padding: 18px 20px 8px; position: relative; }
    .pk-sheet .offcanvas-header::before {          /* the little drag handle */
        content: ''; position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
        width: 40px; height: 4px; border-radius: 4px; background: var(--pk-border);
    }
    .pk-sheet .offcanvas-title { font-size: 1.1rem; font-weight: 600; margin: 0; }
    .pk-sheet .offcanvas-body { padding: 8px 20px calc(20px + env(safe-area-inset-bottom)); overflow-y: auto; }
    .pk-sheet .form-select, .pk-sheet .form-control { padding-top: .7rem; padding-bottom: .7rem; font-size: 1rem; } /* 16px stops iPhone zooming in */
    .pk-sheet .btn { padding: .8rem; font-size: 1rem; }

    /* ── Stats strip: one compact bar with dividers ── */
    .pk-stats { padding: 18px 0; }
    .pk-stats .row { --bs-gutter-y: 0; }
    .pk-stats .col-4 + .col-4 { border-left: 1px solid var(--pk-border); }
    .pk-stat-number { font-size: 1.45rem; }
    .pk-stat-label { font-size: .78rem; }

    /* ── Sections ── */
    .pk-section { padding: 40px 0; }
    .pk-section-title { text-align: left; margin: 0 0 18px; max-width: none; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 4px 12px; }
    .pk-section-title > span { width: 100%; }
    .pk-section-title h2 { font-size: 1.35rem; margin: 2px 0 0; }
    .pk-section-title p { display: none; }
    .pk-see-all { font-weight: 600; font-size: .92rem; white-space: nowrap; }

    /* Swipeable card rows: cards are 84% wide, so the next one "peeks" in */
    .pk-snap-row {
        flex-wrap: nowrap; overflow-x: auto;
        scroll-snap-type: x mandatory; scroll-padding-left: 12px;
        margin-right: -12px; padding-bottom: 6px;
        scrollbar-width: none; -webkit-overflow-scrolling: touch;
    }
    .pk-snap-row::-webkit-scrollbar { display: none; }
    .pk-snap-row > [class*="col-"] { flex: 0 0 84%; max-width: 84%; scroll-snap-align: start; }

    /* ── Property card ── */
    .pk-card:hover { transform: none; }                 /* no hover jumps on touch screens */
    .pk-card-body { padding: 14px 14px 6px; }
    .pk-card-price { font-size: 1.15rem; }
    .pk-card-title { font-size: 1rem; }
    .pk-card-footer { padding: 10px 14px; }

    /* ── "Why us": compact rows, icon on the left ── */
    .pk-feature { display: grid; grid-template-columns: 48px 1fr; column-gap: 14px; padding: 18px; }
    .pk-feature i { grid-row: span 2; width: 48px; height: 48px; font-size: 1.3rem; margin: 0; }
    .pk-feature h3 { font-size: 1.02rem; margin: 2px 0 4px; }
    .pk-feature p { font-size: .9rem; }
    .pk-cta { padding: 44px 0; }
    .pk-cta h2 { font-size: 1.4rem; }

    /* ── Search page: sticky toolbar with "Filters" + sort ── */
    .pk-results-toolbar {
        position: sticky; top: 58px; z-index: 5;
        background: #fff; padding: 10px 0; margin-bottom: 12px !important;
        border-bottom: 1px solid var(--pk-border);
    }
    .pk-filter-btn { display: inline-flex; align-items: center; gap: 8px; border-radius: 50px; padding: 6px 14px; }
    .pk-filter-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 50px; background: var(--pk-blue); color: #fff; font-size: .72rem; padding: 0 6px; }
    .pk-page-header { padding: 26px 0 20px; }
    .pk-page-header h1 { font-size: 1.5rem; }
    .pk-filter-card { border: 0; padding: 0; position: static; }

    /* ── Property detail page ── */
    .pk-detail-head { padding: 18px 0; }
    .pk-detail-head .breadcrumb { display: none; }
    .pk-detail-price { font-size: 1.4rem; }
    .pk-gallery { grid-template-columns: 1fr; gap: 8px; height: auto; }
    .pk-gallery-main { height: 260px; }
    .pk-gallery-thumbs {
        display: flex; height: 74px; gap: 8px; overflow-x: auto; scrollbar-width: none;
    }
    .pk-gallery-thumbs::-webkit-scrollbar { display: none; }
    .pk-gallery-thumbs a { flex: 0 0 96px; }
    .pk-box { padding: 18px; border-radius: 16px; }
    .pk-sidebar > .pk-box:first-child { display: none; }   /* price box: replaced by the sticky action bar */

    /* Sticky action bar on the property page (replaces the tab bar there) */
    .pk-actionbar {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
        display: flex; align-items: center; gap: 10px;
        padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
        background: #fff; border-top: 1px solid var(--pk-border);
        box-shadow: 0 -8px 24px rgba(17, 24, 39, .08);
    }
    .pk-actionbar-price { flex: 1; min-width: 0; line-height: 1.2; }
    .pk-actionbar-price small { display: block; color: var(--pk-slate); font-size: .75rem; }
    .pk-actionbar-price strong { display: block; font-family: 'Poppins', sans-serif; color: var(--pk-navy); font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .pk-actionbar .btn { padding: .65rem .95rem; border-radius: 12px; }

    /* ── App-style bottom tab bar ── */
    .pk-tabbar {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
        display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
        background: rgba(255, 255, 255, .96);
        backdrop-filter: saturate(180%) blur(12px);
        border-top: 1px solid var(--pk-border);
    }
    .pk-tabbar a {
        display: flex; flex-direction: column; align-items: center; gap: 2px;
        color: var(--pk-slate); font-size: .7rem; font-weight: 500; padding: 4px 0;
    }
    .pk-tabbar a i { font-size: 1.3rem; line-height: 1; }
    .pk-tabbar a.active { color: var(--pk-blue); }
    .pk-tabbar a.active i::before { font-weight: 700 !important; }
    /* The centre WhatsApp button is raised, the one bold element on the bar */
    .pk-tabbar .pk-tab-whatsapp i {
        display: grid; place-items: center; width: 50px; height: 50px; margin-top: -24px;
        border-radius: 50%; background: #25D366; color: #fff; font-size: 1.45rem;
        box-shadow: 0 8px 20px rgba(37, 211, 102, .45); border: 4px solid #fff;
    }
    .pk-tabbar .pk-tab-whatsapp { color: #15803D; }

    /* The floating bubble is replaced by the tab bar on mobile */
    .pk-whatsapp-float { display: none; }

    /* Footer: tighter, two columns of links */
    .pk-footer { padding-top: 40px; }
    .pk-footer-bottom { margin-top: 24px; }
}