/* =====================================================
   FAMLETICS — Shared App Navigation & Base Styles
   ===================================================== */

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

:root {
  --orange:       #FF6B35;
  --orange-light: #FF8C5A;
  --orange-dark:  #E5521A;
  --purple:       #6C3FC5;
  --purple-light: #8B5CF6;
  --bg:           #F7F7FB;
  --card:         #FFFFFF;
  --text-1:       #1A1A2E;
  --text-2:       #6B6B8A;
  --text-3:       #A0A0C0;
  --border:       #EBEBF5;
  --success:      #22C55E;
  --gold:         #F59E0B;
  --nav-height:   64px;
  --top-height:   60px;
  --radius:       16px;
  --radius-sm:    10px;
  --shadow:       0 2px 12px rgba(26,26,46,0.08);
  --shadow-md:    0 4px 24px rgba(26,26,46,0.12);
}

html, body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-1);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body {
  padding-top: calc(var(--top-height) + env(safe-area-inset-top));
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 12px);
}

/* ── Top Bar ──────────────────────────────────────── */
.app-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: calc(var(--top-height) + env(safe-area-inset-top));
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: env(safe-area-inset-top) max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left));
  z-index: 100;
  box-shadow: 0 1px 8px rgba(26,26,46,0.06);
}

.app-topbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 18px;
  color: var(--orange);
  text-decoration: none;
}

.app-topbar-logo .logo-dot {
  width: 10px;
  height: 10px;
  background: var(--orange);
  border-radius: 50%;
  display: inline-block;
}

.app-topbar-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-1);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.app-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.back-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-1);
  font-size: 15px;
  font-weight: 600;
  font-family: 'Poppins', sans-serif;
  padding: 8px;
  margin: -8px;
  min-width: 44px;
  min-height: 44px;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.back-btn:active {
  transform: scale(0.95);
}

.back-btn i {
  font-size: 16px;
  color: var(--orange);
}

.profile-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--orange), var(--orange-light));
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 15px;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(255,107,53,0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  padding: 4px;
  margin: -4px;
}

.profile-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(255,107,53,0.45);
}

.profile-btn:active {
  transform: scale(0.95);
}

.notif-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  font-size: 15px;
  position: relative;
}

.notif-badge {
  position: absolute;
  top: 4px; right: 4px;
  width: 8px; height: 8px;
  background: var(--orange);
  border-radius: 50%;
  border: 2px solid white;
}

/* ── Bottom Nav ───────────────────────────────────── */
.app-bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  /* Extend behind the home indicator so nothing shows through underneath,
     while keeping the tappable row itself at --nav-height. */
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 8px env(safe-area-inset-bottom);
  z-index: 100;
  box-shadow: 0 -2px 16px rgba(26,26,46,0.08);
}

.nav-items {
  display: flex;
  width: 100%;
  justify-content: space-around;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 500;
  transition: color 0.2s ease, background-color 0.25s ease;
  min-width: 60px;
  border-radius: 999px;
  background-color: transparent;
}

.nav-item i {
  font-size: 20px;
  transition: transform 0.2s ease;
}

.nav-item.active {
  color: var(--orange);
  background-color: rgba(128, 128, 128, 0.14);
  background-color: color-mix(in srgb, var(--orange) 14%, transparent);
}

.nav-item.active i {
  transform: translateY(-2px);
}

.nav-item span {
  line-height: 1;
}

/* ── Shared Card ──────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 10px;
}

/* ── XP Pill ──────────────────────────────────────── */
.xp-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,107,53,0.12);
  color: var(--orange-dark);
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
}

/* ── Btn ──────────────────────────────────────────── */
.btn-primary {
  background: linear-gradient(135deg, var(--orange), var(--orange-light));
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(255,107,53,0.35);
  transition: transform 0.15s, box-shadow 0.15s;
  font-family: 'Poppins', sans-serif;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(255,107,53,0.45);
}

.btn-outline {
  background: transparent;
  color: var(--orange);
  border: 2px solid var(--orange);
  padding: 10px 22px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-family: 'Poppins', sans-serif;
}

.btn-outline:hover {
  background: var(--orange);
  color: white;
}

/* ── Profile Dropdown ─────────────────────────────── */
.profile-menu-wrapper {
  position: relative;
  flex-shrink: 0;
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 200px;
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(26,26,46,0.16), 0 2px 8px rgba(26,26,46,0.08);
  border: 1px solid var(--border);
  overflow: hidden;
  z-index: 200;
  opacity: 0;
  transform: scale(0.9) translateY(-8px);
  transform-origin: top right;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s cubic-bezier(0.34,1.56,0.64,1);
}

.profile-dropdown.open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: all;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-1);
  text-decoration: none;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: 'Poppins', sans-serif;
  transition: background 0.12s;
}

.dropdown-item:hover {
  background: var(--bg);
}

.dropdown-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-2);
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}

.dropdown-item:hover .dropdown-item-icon {
  background: rgba(255,107,53,0.1);
  color: var(--orange);
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.dropdown-signout {
  color: #EF4444;
}

.dropdown-signout .dropdown-item-icon {
  color: #EF4444;
}

.dropdown-signout:hover {
  background: rgba(239,68,68,0.06);
}

.dropdown-signout:hover .dropdown-item-icon {
  background: rgba(239,68,68,0.1);
  color: #EF4444;
}

/* ── Streak dots ──────────────────────────────────── */
.streak-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.streak-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-3);
  font-weight: 600;
}

.streak-dot.done {
  background: var(--orange);
  border-color: var(--orange);
  color: white;
}

.streak-dot.today {
  border-color: var(--orange);
  color: var(--orange);
  font-weight: 700;
}
