/* =============================================================================
 * app-shell.css — MOBILE-ONLY "app style" layout chrome.
 *
 * Adds a native-app feel on phones: a pinned top app-bar, a fixed bottom tab
 * bar (Home · Services · Book · Enquiry · Contact) with an elevated centre
 * "Book" button, a scrollable middle, and a repositioned floating chat bubble.
 *
 * SCOPE: every rule below lives inside `@media (max-width: 920px)` — the same
 * breakpoint the site already uses for mobile. Desktop / tablet-wide layouts
 * are never touched. Nothing here changes PHP logic, data, or behaviour; it is
 * purely presentational and fully reversible (delete this file + its <link>
 * and the two small markup blocks to restore the original site exactly).
 * ========================================================================== */

/* Desktop default: the app-only elements simply do not exist visually. */
.app-tabbar { display: none; }
.appbar-call { display: none; }

@media (max-width: 920px) {

  /* ---------------------------------------------------------------------------
   * 1. Scroll model — header pinned on top, tab bar fixed at the bottom,
   *    the page content scrolls in between. Body padding keeps the last of the
   *    content clear of the fixed bar (incl. iOS home-indicator safe area).
   * ------------------------------------------------------------------------ */
  :root { --tabbar-h: 64px; }

  body {
    padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 8px);
  }

  /* Keep the existing sticky header behaving as a solid app bar. */
  .site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #ffffff;
    box-shadow: 0 4px 18px rgba(6, 77, 59, 0.08);
  }

  .nav-wrap {
    padding: 10px 0;
    gap: 10px;
  }

  /* ---------------------------------------------------------------------------
   * 2. Header "Call Now" chip (mobile only) — matches the mockup: a compact
   *    outlined green pill sitting to the left of the burger.
   * ------------------------------------------------------------------------ */
  .appbar-call {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    margin-left: auto;
    padding: 6px 14px;
    border: 1.5px solid var(--green, #0f8f63);
    border-radius: 14px;
    color: var(--green-dark, #064d3b);
    background: #fff;
    font-weight: 800;
    font-size: 12px;
    line-height: 1;
    box-shadow: 0 4px 12px rgba(15, 143, 99, 0.12);
  }
  .appbar-call svg { width: 20px; height: 20px; stroke: var(--green, #0f8f63); }

  /* The burger sits right after the call chip; drop the nav's auto-margin so
   * the two group together on the right like the mockup. */
  .menu-btn { margin-left: 0; }

  /* ---------------------------------------------------------------------------
   * 3. Bottom tab bar — fixed, white, rounded top, subtle top shadow.
   * ------------------------------------------------------------------------ */
  .app-tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #ffffff;
    border-top: 1px solid #e7f1ec;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -6px 24px rgba(6, 77, 59, 0.10);
    justify-content: space-around;
    align-items: stretch;
  }

  .app-tabbar .tab {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: #6b7c77;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    padding-top: 6px;
    position: relative;
  }

  .app-tabbar .tab svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.9;
  }

  /* Active tab — green with a small underline accent, like the mockup. */
  .app-tabbar .tab.active { color: var(--green, #0f8f63); }
  .app-tabbar .tab.active::after {
    content: "";
    position: absolute;
    bottom: 6px;
    width: 22px;
    height: 3px;
    border-radius: 3px;
    background: var(--green, #0f8f63);
  }

  /* ---------------------------------------------------------------------------
   * 4. Centre "Book" FAB — raised circular button that breaks above the bar.
   * ------------------------------------------------------------------------ */
  .app-tabbar .tab-book {
    flex: 0 0 auto;
    justify-content: flex-end;
    padding: 0 8px 6px;
    color: var(--green-dark, #064d3b);
  }
  .app-tabbar .tab-book .fab {
    display: grid;
    place-items: center;
    width: 60px;
    height: 60px;
    margin-top: -28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--green, #0f8f63), var(--teal, #0aa6a6));
    box-shadow: 0 10px 24px rgba(15, 143, 99, 0.40);
    border: 4px solid #ffffff;
  }
  .app-tabbar .tab-book .fab svg {
    width: 26px; height: 26px;
    stroke: #ffffff; fill: none; stroke-width: 2;
  }
  .app-tabbar .tab-book span { color: var(--green-dark, #064d3b); }

  /* ---------------------------------------------------------------------------
   * 5. Floating actions & chat bubble — the old Call/WhatsApp pills are
   *    redundant with the tab bar on mobile, so hide them. The site chat
   *    launcher is lifted to sit just above the tab bar (mockup shows one
   *    round bubble there).
   * ------------------------------------------------------------------------ */
  .floating-actions { display: none !important; }

  #iocChatLauncher {
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px) !important;
    right: 16px !important;
    z-index: 999 !important;
  }
  /* Keep the open chat panel clear of the bar too. */
  #iocChatPanel {
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 84px) !important;
    max-height: calc(100vh - var(--tabbar-h) - 150px) !important;
  }
}
