@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #f5f6fa;
  --bg-accent: #eef2ff;
  --card: #ffffff;
  --text: #0f172a;
  --text-soft: #64748b;
  --line: #e8ecf3;
  --line-strong: #d6dce8;
  --primary: #3256ff;
  --primary-hover: #2445e8;
  --primary-soft: #eef0ff;
  --danger: #d34444;
  --success: #2e9e6b;
  --shadow-sm: 0 1px 4px rgba(15, 23, 42, 0.06), 0 2px 8px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.10), 0 1px 4px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.14), 0 4px 12px rgba(15, 23, 42, 0.08);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ─── HEADER & NAV ─────────────────────────────────────────── */

header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

.nav {
  max-width: 1140px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
}

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

.nav-user-button {
  display: none;
}

.nav-right button {
  width: auto;
}

.nav-logout {
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
}

/* Brand logo */
.nav-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 800;
  font-size: 16px;
  color: var(--text) !important;
  text-decoration: none;
  letter-spacing: -0.03em;
  padding: 7px 10px 7px 4px !important;
  background: none !important;
  margin-right: 6px;
  border-radius: var(--radius-sm);
  transition: opacity 150ms ease;
}

.nav-brand:hover {
  opacity: 0.8;
  background: none !important;
  color: var(--text) !important;
  box-shadow: none !important;
}

.nav-brand-icon {
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #3256ff 0%, #5b78ff 100%);
  border-radius: 9px;
  box-shadow: 0 2px 8px rgba(50, 86, 255, 0.35);
}

.nav a {
  color: var(--text-soft);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  transition: background 120ms ease, color 120ms ease;
}

.nav a:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.nav a.nav-active {
  background: var(--primary-soft);
  color: var(--primary);
}

/* ─── MAIN LAYOUT ───────────────────────────────────────────── */

main {
  max-width: 1140px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

/* ─── PAGE HEADER ───────────────────────────────────────────── */

.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  margin: 0 0 4px;
}

.page-header p {
  margin: 0;
  color: var(--text-soft);
  font-size: 15px;
}

/* ─── TYPOGRAPHY ────────────────────────────────────────────── */

h1 {
  margin: 0 0 20px;
  font-size: clamp(26px, 3.6vw, 40px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 800;
}

h2 {
  margin-top: 0;
  margin-bottom: 14px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h3 {
  margin-top: 0;
  font-size: 15px;
  font-weight: 700;
}

/* ─── CARDS ─────────────────────────────────────────────────── */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 200ms ease, transform 200ms ease;
}

/* ─── FILTER BAR ────────────────────────────────────────────── */

.filter-bar {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.filter-bar .row {
  margin-bottom: 0;
}

/* ─── RESTAURANT GRID ───────────────────────────────────────── */

.restaurant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.restaurant-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  transition: box-shadow 200ms ease, transform 200ms ease;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.restaurant-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.restaurant-card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.restaurant-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  background: var(--bg-accent);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
}

.restaurant-info {
  flex: 1;
  min-width: 0;
}

.restaurant-name {
  font-weight: 700;
  font-size: 14.5px;
  color: var(--text);
  text-decoration: none;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.restaurant-name:hover {
  color: var(--primary);
}

.restaurant-meta {
  font-size: 11.5px;
  color: var(--text-soft);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.distance-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 3px 9px;
  border-radius: 999px;
  flex-shrink: 0;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.menu-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
}

.menu-pill {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  color: var(--text-soft);
  padding: 2px 8px;
  font-weight: 500;
}

.restaurant-links {
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.restaurant-links a {
  font-size: 12px;
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.restaurant-links a:hover {
  text-decoration: underline;
}

/* ─── RESULTS META ──────────────────────────────────────────── */

.results-meta {
  font-size: 13px;
  color: var(--text-soft);
  margin: 0 0 14px;
  font-weight: 500;
}

/* ─── FORMS ─────────────────────────────────────────────────── */

.form-section {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.form-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.01em;
}

input,
select,
textarea,
button {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line-strong);
  font: inherit;
  font-size: 14px;
}

input,
select,
textarea {
  background: #fff;
  color: var(--text);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(50, 86, 255, 0.12);
}

textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.5;
}

button {
  cursor: pointer;
  background: linear-gradient(135deg, #3256ff 0%, #4a6bff 100%);
  border-color: transparent;
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: transform 150ms ease, box-shadow 150ms ease, filter 150ms ease;
  box-shadow: 0 2px 8px rgba(50, 86, 255, 0.28);
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(50, 86, 255, 0.32);
  filter: brightness(1.04);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(50, 86, 255, 0.2);
}

button.secondary {
  background: #fff;
  color: var(--text-soft);
  border: 1.5px solid var(--line-strong);
  box-shadow: none;
  font-weight: 600;
}

button.secondary:hover {
  box-shadow: var(--shadow-sm);
  background: var(--bg);
  border-color: var(--primary);
  color: var(--primary);
  filter: none;
}

/* ─── LAYOUT HELPERS ─────────────────────────────────────────── */

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

/* ─── LIST ───────────────────────────────────────────────────── */

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.list li:last-child {
  border-bottom: none;
}

/* ─── PILL / TAGS ────────────────────────────────────────────── */

.pill {
  display: inline-flex;
  align-items: center;
  margin-right: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--text-soft);
  font-size: 11.5px;
  font-weight: 600;
}

/* ─── MUTED / STATUS ─────────────────────────────────────────── */

.muted {
  color: var(--text-soft);
  font-size: 13px;
}

.error {
  color: var(--danger);
  font-size: 13.5px;
  font-weight: 500;
}

.success {
  color: var(--success);
  font-size: 13.5px;
  font-weight: 500;
}

/* ─── AUTH ───────────────────────────────────────────────────── */

.auth-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.auth-row button,
.auth-row a {
  width: auto;
}

.auth-main .auth-row {
  justify-content: center;
}

.auth-row a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  font-size: 14px;
}

.auth-row a:hover {
  text-decoration: underline;
}

#clerkSignIn {
  width: 100%;
  max-width: 420px;
}

.auth-main {
  max-width: 1140px;
  min-height: calc(100vh - 90px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  padding: 20px;
}

.home-landing {
  min-height: calc(100vh - 64px);
  background:
    radial-gradient(circle at 18% -8%, rgba(229, 236, 255, 0.85) 0%, rgba(229, 236, 255, 0) 38%),
    linear-gradient(180deg, #f9fbff 0%, #f4f6fb 52%, #f6f8fc 100%);
}

.home-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

.home-hero-surface {
  padding: 56px 0 46px;
}

.home-hero-copy {
  text-align: center;
  max-width: 900px;
  margin: 0 auto;
}

.home-title {
  margin: 14px 0 12px;
  font-size: clamp(56px, 10vw, 104px);
  line-height: 0.9;
  letter-spacing: -0.04em;
}

.home-subtitle {
  margin: 0 auto;
  max-width: 820px;
  color: var(--text-soft);
  font-size: 23px;
  line-height: 1.42;
}

.home-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(232, 237, 255, 0.9);
  color: #2d4cdc;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 13px;
  border-radius: 999px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.home-hero-actions {
  margin-top: 26px;
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.home-hero-actions a,
.home-hero-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  background: #fff;
  text-decoration: none;
  width: auto;
  cursor: pointer;
  box-shadow: none;
}

.home-hero-actions button {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.home-hero-actions a:hover,
.home-hero-actions button:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #f8faff;
}

.home-hero-actions button:hover {
  color: #fff;
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.home-stats {
  margin-top: 30px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.home-stat {
  border: 1px solid rgba(220, 227, 240, 0.95);
  border-radius: 14px;
  padding: 15px 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.home-stat strong {
  display: block;
  font-size: 24px;
  color: var(--primary);
  text-transform: lowercase;
}

.home-stat span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-soft);
  text-transform: lowercase;
}

.home-auth-panel {
  border: 1px solid rgba(219, 227, 242, 0.95);
  border-radius: 18px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.96);
  text-align: center;
  max-width: 460px;
  margin: 26px auto 0;
  box-shadow: var(--shadow-md);
}

.home-auth-panel h2 {
  margin-bottom: 8px;
}

.home-auth-panel .muted {
  margin-bottom: 8px;
}

.home-auth-panel #clerkSignIn {
  margin-top: 10px;
}

.home-value-band {
  padding: 6px 0 54px;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
}

.home-feature {
  border: 1px solid rgba(220, 228, 241, 0.95);
  border-radius: 18px;
  background: #fff;
  padding: 24px;
  min-height: 196px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.05);
}

.home-feature h2 {
  margin-bottom: 10px;
  font-size: 22px;
}

.home-feature p {
  margin: 0;
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.5;
}

.home-post-auth {
  padding: 14px 0 30px;
  text-align: center;
}

.home-post-auth h2 {
  margin-bottom: 8px;
}

.home-quick-links {
  justify-content: center;
  margin-top: 12px;
}

/* ─── LEADERBOARD ────────────────────────────────────────────── */

.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

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

.rank-medal {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
  width: 36px;
  text-align: center;
}

.rank-number-plain {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-soft);
  width: 36px;
  text-align: center;
  flex-shrink: 0;
}

.leaderboard-info {
  flex: 1;
  min-width: 0;
}

.leaderboard-name {
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: block;
}

.leaderboard-stats {
  display: flex;
  gap: 12px;
  margin-top: 3px;
}

.leaderboard-stats span {
  font-size: 12px;
  color: var(--text-soft);
  font-weight: 500;
}

.influence-score {
  font-size: 16px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

/* ─── PROFILE STATS ──────────────────────────────────────────── */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 0;
}

.stat-card {
  background: var(--bg-accent);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  text-align: center;
}

.stat-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--primary);
  line-height: 1;
}

.stat-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-soft);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ─── BADGE CHIPS ────────────────────────────────────────────── */

.badge-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid rgba(50, 86, 255, 0.15);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  margin: 3px 4px 3px 0;
}

.badge-chip.group-exploration { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.badge-chip.group-influence { background: #fdf4ff; color: #7e22ce; border-color: #e9d5ff; }
.badge-chip.group-review { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.badge-chip.group-category { background: #fff1f2; color: #be123c; border-color: #fecdd3; }

/* ─── TOP DISHES CARD ────────────────────────────────────────── */

.top-dishes-card {
  border: 1.5px solid #e2d5b8;
  background: #fffdf8;
}

.top-dishes-card .list {
  margin-top: 8px;
}

.top-dishes-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.restaurant-name-label {
  color: #aaaaaa;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.top-dishes-badge {
  background: #e9c46a;
  color: #7a5200;
  font-size: 10px;
  font-weight: 800;
  border-radius: 999px;
  padding: 4px 13px;
}

.dish-row {
  border-bottom: 1px solid #f0eae0;
  padding: 14px 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
}

.dish-left {
  min-width: 0;
}

.dish-main-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.rank-number {
  color: #d34444;
  font-size: 13px;
  font-weight: 800;
}

.dish-name {
  color: #1f2933;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.rank-number.is-dim,
.dish-name.is-dim {
  color: #bbbbbb;
}

.review-quote {
  margin-top: 4px;
  color: #999999;
  font-size: 12px;
  font-style: italic;
  line-height: 1.4;
}

.meta-line {
  margin-top: 4px;
  color: #bbbbbb;
  font-size: 11px;
}

.verified {
  color: #2e9e6b;
  font-weight: 700;
}

.tag-row {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag-pill {
  border-radius: 999px;
  border: 1px solid;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
}

.tag-spice {
  background: #fff3e0;
  color: #b45309;
  border-color: #f6d28a;
}

.tag-price {
  background: #f0faf4;
  color: #276749;
  border-color: #a7d9b8;
}

.tag-trending {
  background: #f3f0ff;
  color: #5b4ebb;
  border-color: #c4bcee;
}

.tag-new {
  background: #fff0f0;
  color: #d34444;
  border-color: #f5c0c0;
}

.dish-right {
  text-align: right;
  min-width: 92px;
}

.stars-line {
  color: #e9c46a;
  font-size: 13px;
  letter-spacing: 1px;
}

.score-number {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.score-top {
  color: #d34444;
}

.score-mid {
  color: #888888;
}

.score-low {
  color: #cccccc;
}

.review-count {
  color: #bbbbbb;
  font-size: 10px;
}

.log-order-row {
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1.5px solid #f0eae0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.log-order-row input {
  background: #f8f4ec;
  border: none;
  border-radius: 9px;
}

.log-order-row input::placeholder {
  color: #aaaaaa;
}

.log-order-row button {
  width: auto;
  border-radius: 9px;
  padding: 9px 18px;
}

/* ─── FEED ───────────────────────────────────────────────────── */

#feed .card {
  border: 1px solid var(--line);
  box-shadow: none;
}

#feed .card:hover {
  box-shadow: var(--shadow-sm);
  transform: none;
}

#feed p {
  margin: 8px 0;
  font-size: 14px;
  line-height: 1.5;
}

/* ─── ACTION STATUS ──────────────────────────────────────────── */

#actionStatus {
  font-size: 13px;
  font-weight: 500;
  color: var(--success);
  min-height: 20px;
  margin-top: 6px;
}

/* ─── RESPONSIVE ─────────────────────────────────────────────── */

@media (max-width: 860px) {
  .nav {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-right {
    width: 100%;
    justify-content: flex-start;
  }

  .row {
    grid-template-columns: 1fr;
  }

  .row-3 {
    grid-template-columns: 1fr;
  }

  .home-hero-surface {
    padding: 28px 0 34px;
  }

  .home-stats {
    grid-template-columns: 1fr;
  }

  .home-value-band {
    padding: 14px 0 28px;
  }

  .home-grid {
    grid-template-columns: 1fr;
  }

  .home-title {
    font-size: clamp(44px, 12vw, 64px);
  }

  .home-subtitle {
    font-size: 20px;
  }

  .home-feature {
    min-height: 0;
  }

  .stat-grid {
    grid-template-columns: 1fr 1fr;
  }

  .auth-layout {
    grid-template-columns: 1fr;
  }

  .auth-panel {
    min-height: unset;
  }

  .dish-row {
    grid-template-columns: 1fr;
  }

  .dish-right {
    text-align: left;
  }

  .log-order-row {
    grid-template-columns: 1fr;
  }
}

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

  .stat-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }

  h1 {
    font-size: 26px;
  }
}
