/* ================================================================
   BOTTOM NAVIGATION BAR + SKELETON LOADING + OFFLINE BANNER
   ================================================================ */

/* ── App shell safe-area bottom padding ─────────────────────────── */
.app-shell {
  padding-bottom: env(safe-area-inset-bottom);
}

/* ── Bottom Nav ─────────────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  /* Expand to include iPhone home-indicator zone; icons stay in top 60px */
  height: calc(60px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  
  /* Premium glassmorphism effect */
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  
  border-top: 1px solid rgba(198, 163, 132, 0.1);
  display: flex;
  align-items: stretch;
  z-index: 900;
  box-shadow: 
    0 -4px 24px rgba(0, 0, 0, 0.5),
    0 -1px 0 rgba(198, 163, 132, 0.05);
  
}

.bn-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 6px 0 4px;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s;
  position: relative;
}

.bn-tab.active { color: var(--accent-primary); }

.bn-icon {
  position: relative;
  font-size: 1.3rem;
  line-height: 1;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif; /* consistent Safari + PWA */
}

.bn-label {
  font-size: 0.7rem;  /* was 0.58rem — meets Apple HIG 10pt minimum */
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* Badges inside bottom nav */
.bn-icon .dm-badge,
.bn-icon .notif-badge {
  position: absolute;
  top: -5px;
  right: -8px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  background: #ff4444;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 8px;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
}

/* ── Page clearance for bottom nav ──────────────────────────────── */
.bottom-nav-page .dashboard-main,
.bottom-nav-page .group-main,
.bottom-nav-page .board-main,
.bottom-nav-page .profile-main {
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

/* ── Fixed header clearance — all pages with .has-header ────────── */
/* Clears the 60px fixed app-header + iPhone notch/Dynamic Island   */
.has-header {
  padding-top: calc(60px + env(safe-area-inset-top));
}

/* DM page: dm-main and chatView are flex children of app-content — no bottom offset needed */

/* FAB: sit above bottom nav */
.bottom-nav-page .fab {
  bottom: calc(76px + env(safe-area-inset-bottom));
}

/* Toasts: sit above bottom nav */
.bottom-nav-page #appToast,
.bottom-nav-page .app-toast {
  bottom: calc(76px + env(safe-area-inset-bottom));
}

/* ── Slim loading-progress bar (replaces full-screen spinner) ───── */
.bottom-nav-page .loading-overlay {
  top: 60px;       /* sit just below the header */
  height: 3px;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  z-index: 980;
}

.bottom-nav-page .loading-overlay .spinner { display: none; }

.bottom-nav-page .loading-overlay::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 3px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--accent-primary) 50%,
    transparent 100%
  );
  animation: bn-loading 1.2s ease-in-out infinite;
}

@keyframes bn-loading {
  from { left: -100%; }
  to   { left: 100%;  }
}

/* ── Skeleton loading cards ─────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}

.skel-card,
.skel-post {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skel-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
}

.skel-line {
  height: 12px;
  border-radius: 6px;
}

.skel-line.tall {
  height: 120px;
  border-radius: 8px;
}

.skel-icon,
.skel-line {
  background: linear-gradient(
    90deg,
    var(--bg-hover)    25%,
    var(--border-color) 50%,
    var(--bg-hover)    75%
  );
  background-size: 600px 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

.skel-line.w90 { width: 90%; }
.skel-line.w80 { width: 80%; }
.skel-line.w60 { width: 60%; }
.skel-line.w40 { width: 40%; }

/* ── Offline / Online banner ────────────────────────────────────── */
#offline-banner {
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  background: rgba(28, 22, 0, 0.97);
  border-bottom: 1px solid rgba(255, 200, 0, 0.3);
  color: rgba(255, 215, 50, 0.95);
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  padding: 8px 16px;
  z-index: 960;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  animation: offline-slide 0.25s ease;
}

#offline-banner.show    { display: flex; }
#offline-banner.online  {
  background: rgba(4, 18, 8, 0.97);
  border-bottom-color: rgba(76, 175, 80, 0.4);
  color: rgba(100, 220, 110, 0.95);
}

@keyframes offline-slide {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

.offline-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
  flex-shrink: 0;
  animation: blink 1.4s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1;    }
  50%       { opacity: 0.2; }
}

/* ── Hamburger / Side-Menu (shared across all pages) ────────────── */
/*
   GLOBAL RULE: Hamburger is ALWAYS top-right so it can NEVER
   overlap back buttons (which are always top-left).

   EXCEPTION: The cinematic home dashboard has notification bell +
   Profile on the right, so its hamburger stays top-left. It has
   no back button, so there is no collision there.
*/
.menu-btn {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  right: 16px;
  left: auto;           /* prevent any inherited left value */
  z-index: 999999;
  font-size: 22px;
  color: white;
  cursor: pointer;
  background: rgba(0,0,0,0.6);
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.1);
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.menu-btn:hover { background: rgba(0,0,0,0.5); border-color: rgba(255,255,255,0.2); }

/* Dashboard home exception — hamburger top-left (no back button conflict) */
.home-cinematic .menu-btn {
  right: auto;
  left: 20px;
  top: calc(20px + env(safe-area-inset-top));
}

/* On pages with app-header: hamburger is already top-right, but the
   notification bell in header-right lives at a right-edge that would
   collide. Pull the header-right away from the right edge by 56px. */
.has-header .app-header {
  padding-right: 60px;
}
/* Reset the old (broken) left-side integration attempt */
.has-header .app-header .header-left {
  padding-left: 0;
}
.has-header .menu-btn {
  /* Inherit the global top-right rule — remove all old overrides */
  top: calc(12px + env(safe-area-inset-top));
  right: 16px;
  left: auto;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.1);
  z-index: 999999;
}
.has-header .menu-btn:hover {
  background: rgba(0,0,0,0.5);
}

.menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 9997;
  display: none;
}

/* Drawer layout: see ham-drawer.css (transform-based; no left:-300px) */
.side-menu:not(.ham-drawer) {
  position: fixed;
  top: 0;
  left: -300px;
  width: 280px;
  height: 100vh;
  background: #0f0f10;
  z-index: 9998;
  padding: 96px 16px 32px;
  transition: left 0.3s ease;
  overflow-y: auto;
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-sizing: border-box;
}
.side-menu:not(.ham-drawer).open { left: 0; }

.menu-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Section structure */
.ham-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.ham-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

/* Section labels */
.ham-section-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  padding: 0 4px 8px;
}

/* Links & buttons inside side-menu */
.side-menu a,
.side-menu button#logoutMenuBtn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-family: 'Inter', sans-serif;
  color: rgba(255,255,255,0.82);
  text-decoration: none;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
.side-menu a:hover,
.side-menu button#logoutMenuBtn:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}
.side-menu a.active {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

/* Icon alignment — geometric symbols, monochrome */
.side-menu a .menu-icon,
.side-menu button .menu-icon {
  width: 20px;
  display: inline-block;
  text-align: center;
  flex-shrink: 0;
  font-size: 1rem;
  opacity: 0.55;
}

/* Logout specific */
#logoutMenuBtn {
  color: rgba(255,100,100,0.8) !important;
}
#logoutMenuBtn:hover {
  color: rgb(255,100,100) !important;
  background: rgba(255,100,100,0.08) !important;
}

/* Version pill */
#versionPill {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 0.68rem;
  color: rgba(255,255,255,0.25);
  text-align: center;
  letter-spacing: 0.05em;
}

/* ── Page Transition Animations ─────────────────────────────────── */
@keyframes pageSlideIn {
  from { opacity: 0; transform: translateX(18px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes pageSlideOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(-18px); }
}

.page-enter     { animation: pageSlideIn  0.28s cubic-bezier(0.4, 0, 0.2, 1) both; }
.page-exit      { animation: pageSlideOut 0.22s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
.page-exit-back { animation: pageSlideOut 0.22s cubic-bezier(0.4, 0, 0.2, 1) forwards; }

/* ── MV House topbar: force badge between back arrow and title ───── */
/* Uses order so it works regardless of which cached HTML version loads */
.mv-topbar .mv-back        { order: 1; }
.mv-topbar .mv-topbar-badge { order: 2; flex-shrink: 0; }
.mv-topbar .mv-topbar-title { order: 3; flex: 1; }

/* ── Dating topbar badge: keep it away from hamburger ────────────── */
.dt-topbar .dt-back         { order: 1; }
.dt-topbar .dt-topbar-badge { order: 2; flex-shrink: 0; margin-right: auto; }
.dt-topbar .dt-topbar-title { order: 3; }
