/* ==========================================================================
   RingBD mobile stylesheet — bottom nav + mobile-only rules
   --------------------------------------------------------------------------
   STAGING ONLY. Loaded by themes/ringbd/layout/container.phtml after
   rb-2027-premium.css (filemtime cache-bust, same pattern).
   Every rule that changes layout lives inside @media (max-width:767px)
   so desktop rendering is untouched. The single rule outside the media
   query only HIDES the nav on desktop widths.
   Icons reuse the theme's already-loaded Font Awesome 4.7 (no new asset).
   Reference: mobile home feed — fixed white bottom bar, 5 tabs
   (Home / Friends / Create / Reels / Menu), central raised green
   Create circle, safe-area bottom padding, no content overlap.
   ========================================================================== */

/* Desktop default: the bottom nav never renders above 767px. */
.rb-mobile-bottom-nav {
  display: none;
}

@media (max-width: 767px) {

  /* --- No horizontal overflow on small phones --------------------------- */
  html,
  body {
    overflow-x: clip;
  }
  @supports not (overflow-x: clip) {
    html,
    body {
      overflow-x: hidden;
    }
  }

  /* --- Fixed bottom navigation bar -------------------------------------- */
  .rb-mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1040;
    display: flex;
    align-items: stretch;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    height: 64px;
    /* Safe-area: bar grows on notched phones instead of being covered. */
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
    -webkit-tap-highlight-color: transparent;
  }

  .rb-mobile-bottom-nav .rb-mbn-item {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 0 6px;
    background: none;
    border: 0;
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    color: #4b5563;
    text-decoration: none;
    white-space: nowrap;
    position: relative;
  }
  .rb-mobile-bottom-nav .rb-mbn-item:focus-visible {
    outline: 2px solid #006a4e;
    outline-offset: -2px;
  }
  .rb-mobile-bottom-nav .rb-mbn-item .fa {
    font-size: 22px;
    line-height: 1;
    display: block;
  }

  /* Active tab: green icon + label + green underline bar (reference). */
  .rb-mobile-bottom-nav .rb-mbn-item.active {
    color: #006a4e;
  }
  .rb-mobile-bottom-nav .rb-mbn-item.active::after {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 2px;
    width: 36px;
    height: 3px;
    border-radius: 3px;
    background: #006a4e;
  }

  /* Central Create: large vivid-green circle, raised above the bar. */
  .rb-mobile-bottom-nav .rb-mbn-create .rb-mbn-create-circle {
    width: 48px;
    height: 48px;
    flex: none;
    margin-top: -8px;
    border-radius: 50%;
    background: #00a651;
    box-shadow: 0 6px 16px rgba(0, 166, 81, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #ffffff;
  }
  .rb-mobile-bottom-nav .rb-mbn-create .rb-mbn-create-circle .fa {
    font-size: 26px;
    color: #ffffff;
  }
  .rb-mobile-bottom-nav .rb-mbn-create:active .rb-mbn-create-circle {
    background: #008f45;
  }

  /* --- Content must clear the fixed bar (no overlap at page bottom) ----- */
  body.rb-has-mobile-nav .content-container,
  body:has(> .rb-mobile-bottom-nav) .content-container {
    padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  }
  /* The raised Create circle pokes ~22px above the bar; keep the last
     feed content (e.g. "Load more") from sliding under it. */
  body.rb-has-mobile-nav #contnet,
  body:has(> .rb-mobile-bottom-nav) #contnet {
    padding-bottom: 8px;
  }

  /* --- Very small phones (320px): keep labels + circle fitting ---------- */
  @media (max-width: 360px) {
    .rb-mobile-bottom-nav .rb-mbn-item {
      font-size: 10px;
    }
    .rb-mobile-bottom-nav .rb-mbn-item .fa {
      font-size: 20px;
    }
    .rb-mobile-bottom-nav .rb-mbn-create .rb-mbn-create-circle {
      width: 48px;
      height: 48px;
      margin-top: -20px;
    }
    .rb-mobile-bottom-nav .rb-mbn-create .rb-mbn-create-circle .fa {
      font-size: 24px;
    }
  }
}

/* ==== WEBPHOTO 2026-11-21: bottom clearance must clear the RAISED Create circle ====
   78px + 8px = 86px exactly equalled the circle's top (64px bar + 22px raise),
   so the circle still sat on the last post's action row. 96px = 64 + 22 + 10 gap. */
@media (max-width: 767px) {
  body.rb-has-mobile-nav .content-container,
  body:has(> .rb-mobile-bottom-nav) .content-container {
    padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)) !important;
  }
  html { scroll-padding-bottom: 96px; }
}
/* ==== Fix A M2 (2026-11-28): bottom-nav Create (+) opens the real Create menu ==== */
/* The menu lives inside the header's left nav UL, which is display:none on
   mobile, so un-hide only that UL's box while the sheet is open (its buttons
   stay hidden) and pin the menu as a bottom sheet above the 64px nav. The
   sheet shows the REAL menu (same 6 destinations as desktop); the composer
   stays reachable by tapping "What's on your mind?". Toggled by the
   #rb-mbn-create handler in layout/container.phtml (body.rb-mbn-create-open). */
@media (max-width: 767px) {
  body.rb-mbn-create-open .wow_hdr_innr_left > ul.nav.navbar-nav:has(> li.head_name_links) {
    display: flex !important;
  }
  body.rb-mbn-create-open .wow_hdr_innr_left > ul.nav.navbar-nav:has(> li.head_name_links) > li:not(.head_name_links) {
    display: none !important;
  }
  body.rb-mbn-create-open li.head_name_links > a#wo_home_btns_create {
    display: none !important;
  }
  body.rb-mbn-create-open .create_head_menu {
    position: fixed !important;
    left: 8px !important;
    right: 8px !important;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
    top: auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-height: calc(100dvh - 200px) !important;
    overflow-y: auto !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: none !important;
    z-index: 1050 !important;
  }
}

/* RB LIVE 2026-12-01 (M2): the <header>'s backdrop-filter makes it the
   containing block for the fixed .create_head_menu sheet, so bottom:72px
   resolves against the 60px header and the sheet lands above the viewport
   (measured top -283px). While the sheet is open, neutralise the header's
   containing-block properties so the sheet resolves against the viewport
   (proven live: sheet rect [16,502,374,270], bottom 8px above the nav). */
@media (max-width: 767px) {
  body.rb-mbn-create-open header.header-container{backdrop-filter:none !important;-webkit-backdrop-filter:none !important;transform:none !important;filter:none !important;}
}
