/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input  { font-family: inherit; }
a      { text-decoration: none; color: inherit; }

/* ── Design tokens ──────────────────────────────────────────────────────── */
:root {
  --bg:          #FDF2F0;   /* pale coral/blush app background */
  --surface:     #FFFBFA;   /* cards, bars, surfaces */
  --navy:        #1A1A2E;   /* primary text */
  --muted:       #6B6B7D;   /* secondary/muted text */
  --orange:      #F5A623;   /* primary action, active nav */
  --orange-pale: #FEF3DF;   /* very light orange for segmented bg */
  --cyan:        #29D9E8;   /* secondary accent — use sparingly */
  --pink:        #E91E8C;   /* heart/favourite active state */
  --border:      #F0DEDB;   /* dividers / card borders */
  --danger:      #D94040;   /* error text */

  --r-sm:   12px;
  --r-md:   18px;
  --r-lg:   24px;
  --r-pill: 9999px;

  --shadow-sm: 0 1px 4px rgba(26, 26, 46, 0.07);
  --shadow-md: 0 4px 20px rgba(26, 26, 46, 0.10);
  --shadow-lg: 0 12px 40px rgba(26, 26, 46, 0.14);

  /* Inter with Cyrillic coverage, falls back to clean system sans */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
          'Helvetica Neue', Arial, sans-serif;
}

/* ── Base ────────────────────────────────────────────────────────────────── */
html { height: 100%; background: var(--bg); }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--navy);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100%;
}

/* ── Full-page centered layout (gated / login) ───────────────────────────── */
.page {
  min-height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 24px max(48px, env(safe-area-inset-bottom));
  max-width: 430px;
  margin: 0 auto;
}

/* ── Logo ────────────────────────────────────────────────────────────────── */
.logo-wrap { width: 120px; margin-bottom: 32px; overflow: hidden; }
.logo-wrap img { width: 100%; height: auto; display: block; max-width: 100%; }

/* ── Auth card ───────────────────────────────────────────────────────────── */
.card {
  width: 100%;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  padding: 24px;
}

/* ── Segmented control (Login / Sign up) ─────────────────────────────────── */
.seg {
  display: flex;
  background: var(--orange-pale);
  border-radius: var(--r-pill);
  padding: 4px;
  margin-bottom: 24px;
  gap: 4px;
}
.seg-btn {
  flex: 1;
  padding: 10px;
  border-radius: var(--r-pill);
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  transition: all 0.18s ease;
  text-align: center;
}
.seg-btn.active {
  background: var(--surface);
  color: var(--navy);
  box-shadow: var(--shadow-sm);
}

/* ── Form panels ─────────────────────────────────────────────────────────── */
.form-panel { display: none; }
.form-panel.active { display: block; }

/* ── Inputs ──────────────────────────────────────────────────────────────── */
.input-wrap { margin-bottom: 12px; }
.field {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-size: 16px;
  color: var(--navy);
  background: #FAFAFA;
  outline: none;
  transition: border-color 0.18s;
  -webkit-appearance: none;
}
.field:focus { border-color: var(--orange); background: var(--surface); }
.field::placeholder { color: var(--muted); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 15px 20px;
  border-radius: var(--r-pill);
  font-size: 16px;
  font-weight: 600;
  transition: opacity 0.18s, box-shadow 0.18s;
  cursor: pointer;
}
.btn:active { opacity: 0.88; }
.btn:disabled { opacity: 0.5; pointer-events: none; }

.btn-primary { background: var(--orange); color: var(--surface); }
.btn-primary:hover { box-shadow: 0 4px 16px rgba(245, 166, 35, 0.35); }

.btn-outline {
  background: transparent;
  color: var(--navy);
  border: 1.5px solid var(--border);
}
.btn-google {
  background: var(--surface);
  color: var(--navy);
  border: 1.5px solid var(--border);
  font-weight: 500;
}

.btn-stack { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }

/* ── Divider ─────────────────────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  margin: 20px 0;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Aux text & links ────────────────────────────────────────────────────── */
.link {
  color: var(--orange);
  font-size: 14px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-weight: 500;
}
.link:hover { text-decoration: underline; }
.forgot-row { text-align: right; margin-top: 4px; }
.error-msg  { color: var(--danger); font-size: 14px; margin-top: 8px; text-align: center; min-height: 1.4em; }
.success-msg { color: #1B8B4B; font-size: 14px; margin-top: 8px; text-align: center; }
.info-msg   { color: var(--muted); font-size: 14px; margin-top: 8px; text-align: center; }

/* ── Guest name inline expansion ─────────────────────────────────────────── */
.guest-expand { display: none; margin-top: 12px; }
.guest-expand.open { display: block; }

/* ── Gated screen ────────────────────────────────────────────────────────── */
.gated-card {
  width: 100%;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  padding: 32px 28px;
  text-align: center;
}
.gated-icon { font-size: 40px; margin-bottom: 16px; }
.gated-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 12px;
}
.gated-msg { font-size: 16px; color: var(--muted); line-height: 1.6; }

/* ═══════════════════════════════════════════════════════════════════════════
   APP SHELL
   ═══════════════════════════════════════════════════════════════════════════ */

.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 430px;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

/* ── Top bar ─────────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(16px, env(safe-area-inset-top)) 16px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}
.topbar-logo-wrap {
  width: 38px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.topbar-logo-wrap img {
  height: 100%;
  width: auto;
  display: block;
}
.icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-pill);
  color: var(--navy);
  transition: background 0.15s;
}
.icon-btn:hover { background: var(--border); }
.icon-btn svg { width: 22px; height: 22px; }

/* ── Tab content ─────────────────────────────────────────────────────────── */
.tab-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.tab-pane {
  display: none;
  flex-direction: column;
  min-height: 100%;
  padding: 24px 20px;
}
.tab-pane.active { display: flex; }

/* ── Placeholder tab content ─────────────────────────────────────────────── */
.placeholder-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  padding: 40px 0;
}
.placeholder-icon { font-size: 48px; opacity: 0.35; }
.placeholder-title { font-size: 20px; font-weight: 700; color: var(--navy); }
.placeholder-sub   { font-size: 15px; color: var(--muted); max-width: 260px; line-height: 1.5; }

/* ── Bottom nav ──────────────────────────────────────────────────────────── */
.bottom-nav {
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}
.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  gap: 4px;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.nav-btn.active { color: var(--orange); }
.nav-btn svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
/* Center Favourites button: slightly elevated */
.nav-btn.nav-center {
  position: relative;
}
.nav-btn.nav-center::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 48px;
  height: 3px;
  background: var(--orange);
  border-radius: 0 0 var(--r-pill) var(--r-pill);
  opacity: 0;
  transition: opacity 0.15s;
}
.nav-btn.nav-center.active::before { opacity: 1; }
/* Heart inherits the pink colour when active on the center button */
.nav-btn.nav-center.active { color: var(--pink); }
.nav-btn.nav-center.active::before { background: var(--pink); }

/* ── Profile drawer ──────────────────────────────────────────────────────── */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 46, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
  z-index: 50;
}
.drawer-backdrop.open { opacity: 1; pointer-events: all; }

.profile-drawer {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: 430px;
  background: var(--surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--shadow-lg);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  z-index: 51;
  padding-bottom: max(32px, env(safe-area-inset-bottom));
}
.profile-drawer.open { transform: translateX(-50%) translateY(0); }

.drawer-handle {
  width: 36px; height: 4px;
  background: var(--border);
  border-radius: var(--r-pill);
  margin: 14px auto 4px;
}

.drawer-inner { padding: 8px 24px 0; }

.drawer-user {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0 20px;
  border-bottom: 1px solid var(--border);
}
.avatar {
  width: 48px; height: 48px;
  border-radius: var(--r-pill);
  background: var(--orange-pale);
  color: var(--orange);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  flex-shrink: 0;
}
.drawer-name-area { flex: 1; min-width: 0; }
.drawer-name {
  font-size: 17px;
  font-weight: 600;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drawer-badge {
  display: inline-block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.edit-name-btn {
  color: var(--orange);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

/* Name edit row */
.name-edit-row {
  display: none;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.name-edit-row.open { display: flex; }
.name-edit-row .field { margin: 0; flex: 1; padding: 10px 14px; font-size: 15px; }
.name-save-btn {
  padding: 10px 16px;
  background: var(--orange);
  color: var(--surface);
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

/* Drawer menu items */
.drawer-menu { margin-top: 8px; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  font-size: 16px;
  color: var(--navy);
  cursor: pointer;
  width: 100%;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.menu-item:last-child { border-bottom: none; }
.menu-item svg {
  width: 22px; height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--muted);
  flex-shrink: 0;
}
.menu-item.danger { color: var(--danger); }
.menu-item.danger svg { color: var(--danger); }

/* Guest nudge in drawer */
.guest-nudge {
  margin: 16px 0 8px;
  padding: 14px 16px;
  background: var(--orange-pale);
  border-radius: var(--r-md);
  font-size: 14px;
  color: var(--navy);
  line-height: 1.5;
}
.guest-nudge strong { color: var(--orange); }

/* ── Password-reset page ─────────────────────────────────────────────────── */
.reset-page {
  min-height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 24px max(48px, env(safe-area-inset-bottom));
  max-width: 430px;
  margin: 0 auto;
}
.reset-page .logo-wrap { margin-bottom: 24px; }
.reset-page h1 { font-size: 22px; font-weight: 700; margin-bottom: 6px; text-align: center; }
.reset-page p  { font-size: 15px; color: var(--muted); text-align: center; margin-bottom: 24px; }

/* ── Utility ─────────────────────────────────────────────────────────────── */
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-sm { font-size: 14px; }
.text-muted { color: var(--muted); }
.hidden { display: none !important; }
