/* =============================================================
   Ordora shared chrome — utility top bar + floating buttons.
   Linked from the landing + app layouts. All motion respects
   prefers-reduced-motion.
   ============================================================= */

/* ---- Utility top bar ---- */
#utilbar, #utilbar-app {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2.25rem;
  z-index: 30;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: #102e33;
  color: #e6f0f0;
  font-size: 12px;
  transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1);
}
body.util-hidden #utilbar, body.util-hidden #utilbar-app { transform: translateY(-100%); }

/* App layout: slimmer and subtler than landing. */
#utilbar-app {
  height: 1.75rem;
  font-size: 11px;
}
@media (min-width: 768px) {
  #utilbar-app { left: 16rem; }
  body.sidebar-collapsed #utilbar-app { left: 4.5rem; }
}
body.impersonating #utilbar-app { top: 2.5rem; }

/* Bars below the utility strip: visible state offsets (landing 2.25rem,
   app 1.75rem). */
#landing-nav, #topbar { transition: top 300ms cubic-bezier(0.16, 1, 0.3, 1); }
body:not(.util-hidden) #landing-nav { top: 2.25rem; }
body:not(.util-hidden) #topbar { top: 1.75rem; }
body.impersonating:not(.util-hidden) #topbar { top: 4.25rem; }
body.impersonating.util-hidden #topbar { top: 2.5rem; }

/* App content clears the fixed bars (topbar h-16 + util h-7). */
body:not(.util-hidden) #content-wrapper main { padding-top: 5.75rem; }
body.impersonating:not(.util-hidden) #content-wrapper main { padding-top: 8.25rem; }
body.impersonating.util-hidden #content-wrapper main { padding-top: 6.5rem; }

/* ---- Scroll-up button (left) ---- */
#scroll-top-btn {
  position: fixed;
  left: 1.25rem; bottom: 1.25rem;
  z-index: 50;
  width: 3rem; height: 3rem;
  border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  background: #005f6b; color: #fff;
  box-shadow: 0 8px 20px -6px rgba(0, 65, 74, 0.5);
  opacity: 0; transform: translateY(1rem) scale(0.9);
  pointer-events: none;
  transition: opacity 300ms ease, transform 300ms cubic-bezier(0.16, 1, 0.3, 1),
              background-color 200ms ease;
}
body.scrolled-down #scroll-top-btn {
  opacity: 1; transform: translateY(0) scale(1);
  pointer-events: auto;
}
#scroll-top-btn:hover { background: #00414a; transform: translateY(-2px); }
body.scrolled-down #scroll-top-btn:hover { transform: translateY(-2px); }

/* ---- WhatsApp float (right, expands on hover/focus) ---- */
.wa-float {
  position: fixed;
  right: 1.25rem; bottom: 1.25rem;
  z-index: 50;
  height: 3.5rem; max-width: 3.5rem;
  display: flex; align-items: center;
  overflow: hidden; white-space: nowrap;
  border-radius: 9999px;
  background: #25d366; color: #fff;
  box-shadow: 0 8px 20px -6px rgba(37, 211, 102, 0.6);
  transition: max-width 350ms cubic-bezier(0.16, 1, 0.3, 1),
              background-color 200ms ease, transform 200ms ease;
}
.wa-float:hover, .wa-float:focus-visible {
  max-width: 15rem;
  background: #1eb856;
  transform: translateY(-2px);
  outline: none;
}
.wa-float .wa-icon {
  flex-shrink: 0;
  width: 3.5rem; height: 3.5rem;
  display: flex; align-items: center; justify-content: center;
}
.wa-float .wa-label {
  opacity: 0;
  font-size: 14px; font-weight: 600;
  padding-right: 1.25rem;
  transition: opacity 250ms ease 60ms;
}
.wa-float:hover .wa-label, .wa-float:focus-visible .wa-label { opacity: 1; }
.wa-float .wa-dot {
  position: absolute; top: 0.15rem; right: 0.15rem;
  width: 0.8rem; height: 0.8rem;
  border-radius: 9999px;
  background: #ff3b30;
  border: 2px solid #fff;
}

/* ---- Mobile bottom tab bar (app layout, mobile only) ----
 * NOTE: hide/show lives here (not just Tailwind's md:hidden) because the
 * #mobile-bottomnav ID selector below would otherwise beat the md:hidden
 * class on desktop and the bar would leak onto wide screens. */
#mobile-bottomnav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 45;
  display: flex;
  align-items: stretch;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(195, 207, 209, 0.6);
  padding-bottom: env(safe-area-inset-bottom);
}
.mnav-item {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0.55rem 0 0.5rem;
  color: #455556;
  text-decoration: none;
  background: none;
  border: none;
  font: inherit;
  cursor: pointer;
  position: relative;
  transition: color 200ms ease;
}
.mnav-item:hover { color: #0c2226; }
.mnav-icon { font-size: 24px; line-height: 1; }
.mnav-label { font-size: 11px; font-weight: 600; letter-spacing: 0.01em; }
.mnav-item.is-active { color: #005f6b; }
.mnav-item.is-active .mnav-icon {
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}
.mnav-item.is-active::before {
  content: "";
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 2rem; height: 3px;
  border-radius: 0 0 4px 4px;
  background: #005f6b;
}

/* Keep page content + PWA banner clear of the tab bar on mobile. */
@media (max-width: 767.98px) {
  #content-wrapper { padding-bottom: 4.25rem; }
  #pwa-install-banner { bottom: 5.25rem; }
  /* The bottom tab bar owns the menu on mobile: drop the topbar hamburger. */
  #sidebar-toggler { display: none; }

  /* Mobile utility bar shows all contact items in a 2-row grid, so it is
   * taller here — and every bar below it shifts accordingly. */
  #utilbar, #utilbar-app { height: 3.25rem; }
  body:not(.util-hidden) #landing-nav { top: 3.25rem; }
  body:not(.util-hidden) #topbar { top: 3.25rem; }
  body.impersonating:not(.util-hidden) #topbar { top: 5.75rem; }
  body:not(.util-hidden) #content-wrapper main { padding-top: 7.25rem; }
  body.impersonating:not(.util-hidden) #content-wrapper main { padding-top: 9.75rem; }
}

/* Desktop: no tab bar, ever. The topbar toggler owns the sidebar there. */
@media (min-width: 768px) {
  #mobile-bottomnav { display: none; }
}

/* ---- Landing section spotlight: past sections go grey ---- */
[data-spotlight] {
  transition: filter 600ms ease, opacity 600ms ease;
}
[data-spotlight].is-past {
  filter: grayscale(1);
  opacity: 0.5;
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  #utilbar, #utilbar-app, #landing-nav, #topbar, #scroll-top-btn, .wa-float,
  [data-spotlight] {
    transition-duration: 0.001ms !important;
  }
  [data-spotlight].is-past { filter: grayscale(1); }
}
