/* base.css — Global reset, CSS variables, body, header, menu, main, screen transitions */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --cr-teal: #469E92;
  --cr-teal-dark: #3a857a;
  --cr-teal-light: #5BA99E;
  --cr-teal-muted: rgba(70, 158, 146, 0.08);
  --cr-teal-glow: rgba(70, 158, 146, 0.15);
  --cr-lime: #DAE244;
  --cr-orange: #DD693A;
  --cr-yellow: #FCB040;
  --cr-light-teal: #A3C6C0;
  --slate-900: #1a1d21;
  --slate-800: #2d3139;
  --slate-700: #374151;
  --slate-600: #4b5563;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --white: #ffffff;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.15);
  --shadow-teal: 0 4px 20px rgba(70, 158, 146, 0.25);
  --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'Fraunces', Georgia, serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --school-primary: var(--cr-teal);
  --school-primary-text: var(--white);
  --school-primary-border: rgba(255,255,255,0.2);
  --school-secondary: var(--slate-700);
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: auto;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-sans);
  background: #F8F9FA;
  color: var(--slate-700);
  line-height: 1.6;
  height: 100%;
  overflow: hidden;
}

/* ==================== SHARED LIST ROUTE (DEC-431) ====================
   When body has .shared-list-mode (set by bottom-nav.js route detection),
   release the DEC-517 contained-scroll lock and force-hide all app chrome.
   Uses !important because other modules (landing.js → showScreen) reset
   inline display styles on a setTimeout after the route detection runs,
   and we need these rules to win over the resulting inline styles. */
html.shared-list-mode,
body.shared-list-mode {
  height: auto !important;
  overflow: auto !important;
}
body.shared-list-mode .page-bg,
body.shared-list-mode .header,
body.shared-list-mode #loadingGate,
body.shared-list-mode .main,
body.shared-list-mode #bottomNav,
body.shared-list-mode #pageFooter,
body.shared-list-mode #floatingCart {
  display: none !important;
}

/* Page background gradient */
.page-bg {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, rgba(91, 169, 158, 0.12) 0%, rgba(91, 169, 158, 0) 50%);
  pointer-events: none;
  z-index: -1;
}

.container { width: 100%; max-width: 600px; margin: 0 auto; padding: 0 24px; }

/* Header */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: #F8F9FA;
  min-height: 80px;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

.header-inner {
  max-width: 600px;
  margin: 0 auto;
  padding: 8px 24px 0px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  min-height: 80px;
}

.header-logo {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  cursor: pointer;
}

.header-logo img {
  height: 50px;
  width: auto;
}

/* Header back button */
.header-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  color: var(--slate-600);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 80px;
}

.header-back-btn:hover {
  background: var(--slate-200);
  color: var(--slate-700);
}

.header-back-btn svg {
  width: 16px;
  height: 16px;
}

.header-back-btn.hidden {
  visibility: hidden;
}

.header-spacer { width: 80px; }

/* Hamburger menu */
.menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.menu-btn:hover { background: var(--slate-100); }

.menu-dropdown {
  position: absolute;
  top: 100%;
  right: 24px;
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 200;
  min-width: 220px;
  display: none;
}

.menu-dropdown.visible { display: block; }

.menu-dropdown a {
  display: block;
  padding: 14px 20px;
  color: var(--slate-700);
  text-decoration: none;
  font-size: 0.9375rem;
  border-bottom: 1px solid var(--slate-100);
  transition: background 0.15s ease;
}

.menu-dropdown a:last-child { border-bottom: none; }
.menu-dropdown a:hover { background: var(--slate-50); }
.menu-dropdown .menu-divider {
  height: 1px;
  background: var(--slate-200);
  margin: 0;
}
.menu-dropdown .menu-action {
  font-weight: 500;
}
.menu-dropdown .menu-action#menuSignOut {
  color: var(--cr-orange);
}

/* Main content — scroll container (document scroll is locked) */
.main {
  margin-top: 80px;
  padding: 20px 0 40px;
  height: calc(100vh - 80px);
  height: calc(100dvh - 80px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: none;
  display: flex;
  flex-direction: column;
}

/* Screen transitions */
.screen {
  display: none;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out);
}
.screen.active { display: block; }
.screen.visible { opacity: 1; transform: translateY(0); }
