/* =========================================================
   Tennessee Riverwalk Tracker — Stylesheet
   Design language: Strava-inspired, athletic, data-forward
   Primary accent: Strava orange #FC4C02
   ========================================================= */

/* ── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --orange:        #FC4C02;
  --orange-dark:   #d93e00;
  --orange-light:  #fff0eb;
  --nav-bg:        #1a1a1a;
  --nav-text:      #e0e0e0;
  --body-bg:       #f5f5f5;
  --card-bg:       #ffffff;
  --text-primary:  #1a1a1a;
  --text-secondary:#666666;
  --text-muted:    #999999;
  --border:        #e5e5e5;
  --success-bg:    #e8f5e9;
  --success-text:  #2e7d32;
  --error-bg:      #ffebee;
  --error-text:    #c62828;
  --info-bg:       #e3f2fd;
  --info-text:     #1565c0;
  --radius:        10px;
  --shadow:        0 2px 12px rgba(0,0,0,0.08);
  --shadow-hover:  0 4px 20px rgba(0,0,0,0.14);
  --font:          -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--body-bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--orange); text-decoration: none; }
a:hover { color: var(--orange-dark); text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ── Navigation ─────────────────────────────────────────── */
.nav {
  background: var(--nav-bg);
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: 1rem;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  text-decoration: none;
}

.nav-logo:hover { color: var(--orange); text-decoration: none; }

.nav-logo svg { flex-shrink: 0; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
}

.nav-links a {
  color: var(--nav-text);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}

.nav-links a:hover,
.nav-links a.active {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.nav-links a.nav-btn {
  background: var(--orange);
  color: #fff;
  font-weight: 600;
}

.nav-links a.nav-btn:hover { background: var(--orange-dark); }

.nav-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--orange);
  display: block;
}

/* Desktop: auth text items hidden (shown via dropdown) */
.nav-auth-item { display: none; }

/* Desktop: dropdown container */
.nav-dropdown-item {
  position: relative;
  display: flex;
  align-items: center;
}

.nav-dropdown-trigger {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.15s;
}

.nav-dropdown-trigger:hover { background: rgba(255,255,255,0.1); }

.nav-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  min-width: 150px;
  list-style: none;
  z-index: 200;
  overflow: hidden;
}

.nav-dropdown.open { display: block; }

.nav-dropdown li + li { border-top: 1px solid var(--border); }

.nav-dropdown a {
  display: block;
  padding: 0.65rem 1rem;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.12s;
}

.nav-dropdown a:hover {
  background: var(--body-bg);
  color: var(--orange);
  text-decoration: none;
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  color: var(--nav-text);
}

/* ── Page layout ─────────────────────────────────────────── */
main {
  flex: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
}

.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.page-header p {
  color: var(--text-secondary);
  margin-top: 0.4rem;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

/* ── Stats grid ──────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
  border-top: 3px solid var(--orange);
  transition: box-shadow 0.2s;
}

.stat-card:hover { box-shadow: var(--shadow-hover); }

.stat-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.stat-unit {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-left: 0.15rem;
}

.stat-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* ── Activity feed ───────────────────────────────────────── */
.activity-list {
  list-style: none;
}

.activity-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  align-items: start;
}

.activity-item:last-child { border-bottom: none; }

.activity-name {
  font-weight: 600;
  font-size: 0.97rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.activity-miles {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--orange);
  white-space: nowrap;
  text-align: right;
}

.activity-time {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: right;
}

.activity-badge {
  display: inline-block;
  background: var(--orange-light);
  color: var(--orange-dark);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-left: 0.5rem;
}

/* ── Projection banner ───────────────────────────────────── */
.projection-banner {
  background: linear-gradient(135deg, #FC4C02 0%, #e03800 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.projection-icon { font-size: 2rem; flex-shrink: 0; }

.projection-text { flex: 1; min-width: 180px; }

.projection-headline {
  font-size: 1.05rem;
  font-weight: 700;
}

.projection-sub {
  font-size: 0.85rem;
  opacity: 0.85;
  margin-top: 0.15rem;
}

/* ── Leaderboard table ───────────────────────────────────── */
.leaderboard-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.4rem;
}

.tab-btn {
  flex: 1;
  padding: 0.55rem 1rem;
  background: none;
  border: none;
  border-radius: 7px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s;
}

.tab-btn.active,
.tab-btn:hover {
  background: var(--orange);
  color: #fff;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard-table th {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  padding: 0.6rem 1rem;
  text-align: left;
  border-bottom: 2px solid var(--border);
}

.leaderboard-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.leaderboard-table tr:last-child td { border-bottom: none; }

.leaderboard-table tr:hover td { background: #fafafa; }

.lb-rank {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text-muted);
  width: 2.5rem;
}

.lb-rank-1 { color: #f9a825; }
.lb-rank-2 { color: #9e9e9e; }
.lb-rank-3 { color: #a1582a; }

.lb-name {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
}

.lb-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.lb-avatar-placeholder {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--orange-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--orange);
  flex-shrink: 0;
}

.lb-miles {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--orange);
}

.lb-count {
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* ── Forms ───────────────────────────────────────────────── */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.form-control {
  width: 100%;
  padding: 0.6rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-size: 0.95rem;
  font-family: var(--font);
  color: var(--text-primary);
  background: #fff;
  transition: border-color 0.15s;
  outline: none;
}

.form-control:focus { border-color: var(--orange); }

/* Toggle switch */
.toggle-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.toggle-row:last-child { border-bottom: none; }

.toggle-info { flex: 1; }

.toggle-info strong { display: block; font-size: 0.95rem; margin-bottom: 0.2rem; }
.toggle-info span   { font-size: 0.82rem; color: var(--text-secondary); }

.toggle {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 26px;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.toggle input:checked + .toggle-slider { background: var(--orange); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.3rem;
  border-radius: 7px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s, box-shadow 0.15s;
  text-decoration: none;
  line-height: 1;
}

.btn-primary {
  background: var(--orange);
  color: #fff;
}

.btn-primary:hover {
  background: var(--orange-dark);
  color: #fff;
  text-decoration: none;
}

.btn-secondary {
  background: var(--body-bg);
  color: var(--text-primary);
  border: 1.5px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
  text-decoration: none;
}

.btn-danger {
  background: #c62828;
  color: #fff;
}

.btn-danger:hover { background: #b71c1c; }

.btn-sm {
  padding: 0.4rem 0.9rem;
  font-size: 0.82rem;
}

.btn-lg {
  padding: 0.85rem 2rem;
  font-size: 1.05rem;
  border-radius: 9px;
}

/* Strava connect button */
.btn-strava {
  background: #FC4C02;
  color: #fff;
  font-size: 1rem;
  padding: 0.8rem 1.8rem;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.btn-strava:hover {
  background: #d93e00;
  color: #fff;
  text-decoration: none;
}

/* ── Flash messages ──────────────────────────────────────── */
.flash {
  padding: 0.85rem 1.2rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: 0.92rem;
  font-weight: 500;
}

.flash-success { background: var(--success-bg); color: var(--success-text); }
.flash-error   { background: var(--error-bg);   color: var(--error-text); }
.flash-info    { background: var(--info-bg);     color: var(--info-text); }

/* ── Hero (landing page) ─────────────────────────────────── */
.hero {
  text-align: center;
  padding: 5rem 1.5rem 4rem;
}

.hero-eyebrow {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--orange);
  margin-bottom: 1rem;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 800;
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  letter-spacing: -0.5px;
}

.hero h1 span { color: var(--orange); }

.hero p {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0 auto 2.5rem;
  line-height: 1.65;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin-top: 3.5rem;
  flex-wrap: wrap;
}

.hero-stat-val {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.hero-stat-lbl {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* ── FAQ ─────────────────────────────────────────────────── */
.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 0;
}

.faq-item:first-child { padding-top: 0; }
.faq-item:last-child  { border-bottom: none; }

.faq-q {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.faq-a {
  font-size: 0.93rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

/* ── Empty states ────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 0.5rem; }
.empty-state p  { font-size: 0.9rem; }

/* ── Footer ──────────────────────────────────────────────── */
footer {
  background: var(--nav-bg);
  color: #888;
  text-align: center;
  padding: 1.5rem;
  font-size: 0.82rem;
  margin-top: auto;
}

footer a { color: var(--orange); }

/* ── Utilities ───────────────────────────────────────────── */
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-muted   { color: var(--text-muted); }
.text-orange  { color: var(--orange); }
.mt-1  { margin-top: 0.5rem; }
.mt-2  { margin-top: 1rem; }
.mt-3  { margin-top: 1.5rem; }
.mb-2  { margin-bottom: 1rem; }
.flex  { display: flex; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.flex-between { justify-content: space-between; }
.w-full { width: 100%; }

/* Divider */
.divider { height: 1px; background: var(--border); margin: 1.5rem 0; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    padding: 1rem;
    gap: 0.25rem;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
  }

  .nav-links.open { display: flex; }

  .nav-links a { padding: 0.7rem 1rem; }

  .nav-toggle { display: block; }

  .nav { position: relative; }

  /* Mobile: show auth text items in hamburger, hide avatar dropdown */
  .nav-auth-item { display: list-item; }
  .nav-dropdown-item { display: none; }

  main { padding: 1.5rem 1rem; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  .stat-value { font-size: 1.65rem; }

  .leaderboard-table th:nth-child(3),
  .leaderboard-table td:nth-child(3) { display: none; }

  .hero { padding: 3rem 1rem 2.5rem; }

  .hero-stats { gap: 2rem; }

  .projection-banner { padding: 1rem; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }

  .activity-item {
    grid-template-columns: 1fr;
  }

  .activity-miles, .activity-time {
    text-align: left;
  }

  .section-bleed { margin-left: -1rem; margin-right: -1rem; padding: 2.5rem 1rem; }
  .how-steps { flex-direction: column; align-items: center; }
  .how-step-connector::after { content: '↓'; }
  .how-step-connector { padding-top: 0; padding-bottom: 0; }
  .how-step { padding: 0; max-width: 320px; }
}

/* ── Landing page: hero CTA & trust elements ────────────────── */

.hero-cta {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: .75rem;
}

.hero-password-note {
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: .75rem;
}

.hero-trust {
  font-size: .875rem;
  color: var(--text-secondary);
  margin-bottom: .75rem;
}

.hero-badges {
  display: flex;
  gap: .5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.hero-badge {
  background: var(--orange-light);
  color: var(--orange-dark);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  padding: .25rem .75rem;
  border-radius: 20px;
}

/* ── Landing page: How it works (full-width bleed) ──────────── */

.section-bleed {
  scroll-margin-top: 68px;
  margin-left: -1.5rem;
  margin-right: -1.5rem;
  padding: 3.5rem 1.5rem;
  background: #f0f0f0;
}

.section-bleed-inner {
  max-width: 860px;
  margin: 0 auto;
}

.section-title {
  font-size: 1.6rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 2.5rem;
}

.section-sub {
  text-align: center;
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin-bottom: 2rem;
}

.how-steps {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.how-step {
  flex: 1;
  text-align: center;
  padding: 0 1.5rem;
  max-width: 260px;
}

.how-step p {
  font-size: .9rem;
  color: var(--text-secondary);
  margin-top: .4rem;
  line-height: 1.55;
}

.how-step-num {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--orange);
  color: #fff;
  font-size: 1.75rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
  box-shadow: 0 4px 16px rgba(252,76,2,.3);
}

.how-step-connector {
  flex-shrink: 0;
  width: 40px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 1.75rem;
  color: var(--text-muted);
  font-size: 1.5rem;
}

.how-step-connector::after {
  content: '→';
}

/* ── Landing page: Features grid ────────────────────────────── */

.section-features {
  padding: 3rem 0 2rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  max-width: 900px;
  margin: 0 auto;
}

.feature-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.25rem;
  text-align: center;
}

.feature-card p {
  font-size: .85rem;
  color: var(--text-secondary);
  margin-top: .35rem;
  line-height: 1.5;
}

.feature-icon {
  font-size: 2.25rem;
  margin-bottom: .75rem;
}

/* ── Landing page: Mock dashboard preview ───────────────────── */

.section-preview {
  padding: 2.5rem 0 3rem;
}

.mock-dash {
  max-width: 700px;
  margin: 0 auto;
  opacity: .92;
  pointer-events: none;
  user-select: none;
}

.sample-note {
  text-align: center;
  font-size: .78rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: .75rem;
}
