/* ======================================================================
   MoodMeal — Styles
   Dark mode, friendly/rounded aesthetic, production-grade
   ====================================================================== */

:root {
  /* Core palette — warm, moody dark with amber/coral accents */
  --bg-deep:        #0a0910;
  --bg:             #100e17;
  --bg-raised:      #1a1724;
  --bg-card:        #181520;
  --bg-card-hover:  #211d2d;
  --bg-input:       #14121c;

  --border:         rgba(255, 245, 230, 0.07);
  --border-strong:  rgba(255, 245, 230, 0.14);
  --border-focus:   rgba(255, 168, 120, 0.5);

  --text:           #f2ece1;
  --text-muted:     #a29c91;
  --text-dim:       #6b6558;

  /* Accent — warm amber/coral, friendly but premium */
  --accent:         #ffa878;
  --accent-bright:  #ffc49a;
  --accent-dim:     rgba(255, 168, 120, 0.15);
  --accent-glow:    rgba(255, 168, 120, 0.25);

  /* Semantic */
  --safety:         #7ad3a8;
  --rating:         #ffa878;
  --danger:         #ff8b8b;

  /* Category accents */
  --c-cheapest:     #7ad3a8;
  --c-nicest:       #8ecfff;
  --c-biggroup:     #ffc266;
  --c-romantic:     #ff9fc5;
  --c-mustsee:      #ff9e7a;
  --c-deluxe:       #c9a4ff;
  --c-kidfriendly:  #7fd5e8;
  --c-latenight:    #9d8cff;
  --c-outdoor:      #a5d982;
  --c-hidden:       #67c9a7;
  --c-quick:        #ffd166;
  --c-vegan:        #8dd97f;
  --c-business:     #9fb8e8;
  --c-petfriendly:  #ffab87;

  /* Type */
  --font-display: 'Fraunces', ui-serif, Georgia, serif;
  --font-body:    'DM Sans', system-ui, -apple-system, sans-serif;

  /* Layout */
  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --radius-xl:  28px;
  --radius-full: 999px;

  --shadow-card: 0 1px 0 0 rgba(255, 245, 230, 0.03) inset;
  --shadow-hover: 0 8px 24px -8px rgba(0, 0, 0, 0.5), 0 1px 0 0 rgba(255, 245, 230, 0.06) inset;
  --shadow-focus: 0 0 0 3px var(--accent-glow);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ===== Reset & base ===== */
*, *::before, *::after {
  box-sizing: border-box;
}
html, body {
  margin: 0;
  padding: 0;
}
html {
  background: var(--bg-deep);
  color-scheme: dark;
  -webkit-tap-highlight-color: transparent;
}
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(255, 168, 120, 0.08), transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 20%, rgba(201, 164, 255, 0.05), transparent 60%),
    var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}
a {
  color: var(--accent);
  text-decoration: none;
}

/* ===== Layout ===== */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
}

.header {
  padding: 24px 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent) 0%, #ff7a9c 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 12px -2px var(--accent-glow);
}
.brand-mark svg { display: block; }
.brand-name {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  font-style: italic;
  letter-spacing: -0.02em;
  line-height: 1;
}
.brand-name b {
  font-style: normal;
  font-weight: 600;
}

/* Language switcher */
.lang-switch {
  position: relative;
}
.lang-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  font-size: 14px;
  color: var(--text);
  transition: all 0.2s var(--ease);
}
.lang-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}
.lang-btn .chev {
  width: 12px;
  height: 12px;
  opacity: 0.6;
}
.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 6px;
  box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.6);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: all 0.18s var(--ease);
}
.lang-menu.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  width: 100%;
  text-align: left;
  color: var(--text);
  transition: background 0.12s;
}
.lang-option:hover {
  background: var(--bg-card);
}
.lang-option.active {
  background: var(--accent-dim);
  color: var(--accent-bright);
}
.lang-option .flag {
  font-size: 16px;
  line-height: 1;
}

/* ===== Hero ===== */
.hero {
  padding: 24px 0 32px;
  text-align: left;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(36px, 6vw, 56px);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.035em;
  margin: 0 0 12px;
  color: var(--text);
}
.hero h1 em {
  font-style: italic;
  font-weight: 300;
  color: var(--accent);
}
.hero .subtitle {
  font-size: 17px;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0;
}

/* ===== Card (form + results) ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
}
@media (max-width: 560px) {
  .card { padding: 20px; border-radius: var(--radius-lg); }
}

.card-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0 0 20px;
  color: var(--text);
}

/* ===== Form ===== */
.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.field label .optional {
  color: var(--text-dim);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  margin-left: 4px;
}

input[type="text"],
input[type="date"],
select {
  height: 46px;
  padding: 0 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 15px;
  transition: all 0.18s var(--ease);
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
}
input[type="text"]::placeholder {
  color: var(--text-dim);
}
input[type="text"]:hover,
input[type="date"]:hover,
select:hover {
  border-color: var(--border-strong);
}
input[type="text"]:focus,
input[type="date"]:focus,
select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus);
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23a29c91' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}
input[type="date"] {
  font-family: var(--font-body);
}
input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.65);
  cursor: pointer;
}

/* ===== Categories ===== */
.categories-block {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  margin-top: 18px;
}
.categories-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.categories-header h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  margin: 0;
  letter-spacing: -0.01em;
}
.categories-header .hint {
  font-size: 13px;
  color: var(--text-muted);
}
.categories-header .count {
  color: var(--accent);
  font-weight: 500;
}
.category-actions {
  display: flex;
  gap: 6px;
}
.chip-btn {
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text-muted);
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: transparent;
  transition: all 0.15s var(--ease);
}
.chip-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 8px;
}
.category-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s var(--ease);
  user-select: none;
}
.category-pill:hover {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
}
.category-pill.selected {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.category-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.category-pill .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: transform 0.2s var(--ease);
}
.category-pill.selected .dot {
  transform: scale(1.3);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}
.category-pill .label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.2;
}
.category-pill.selected .label {
  color: var(--accent-bright);
}

/* ===== Primary button ===== */
.btn-primary {
  margin-top: 22px;
  width: 100%;
  height: 54px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, var(--accent) 0%, #f58e5e 100%);
  color: #2a1608;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.005em;
  transition: all 0.2s var(--ease);
  box-shadow: 0 4px 14px -4px var(--accent-glow), 0 1px 0 0 rgba(255, 255, 255, 0.15) inset;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -4px var(--accent-glow), 0 1px 0 0 rgba(255, 255, 255, 0.2) inset;
}
.btn-primary:active {
  transform: translateY(0);
  transition: transform 0.1s;
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ===== Results ===== */
.results-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 14px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.results-summary strong {
  color: var(--text);
  font-weight: 500;
}
.results-summary .sep {
  color: var(--text-dim);
}

.cat-section {
  margin-bottom: 32px;
  scroll-margin-top: 20px;
}
.cat-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.cat-header h2 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 400;
  margin: 0;
  letter-spacing: -0.022em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.cat-header .cat-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.cat-header .cat-desc {
  font-size: 13px;
  color: var(--text-dim);
  text-align: right;
}

.restaurants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.restaurant-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  transition: all 0.2s var(--ease);
}
.restaurant-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}
.r-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 4px;
}
.r-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.2;
  color: var(--text);
}
.r-nb {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-input);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  flex-shrink: 0;
}
.r-price {
  font-size: 15px;
  color: var(--text);
  margin: 10px 0 16px;
  font-variant-numeric: tabular-nums;
}
.r-price .per {
  color: var(--text-dim);
  font-size: 13px;
  margin-left: 4px;
}

.bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bar {
  display: grid;
  grid-template-columns: minmax(80px, auto) 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}
.bar-label {
  color: var(--text-muted);
  font-weight: 500;
}
.bar-track {
  height: 6px;
  background: var(--bg-input);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}
.bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s var(--ease);
}
.bar-fill.safety { background: var(--safety); }
.bar-fill.rating { background: var(--rating); }
.bar-score {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  min-width: 30px;
  text-align: right;
}

/* ===== Jump nav ===== */
.jump-nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 10px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.jump-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
  transition: all 0.15s var(--ease);
}
.jump-chip:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}
.jump-chip .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

/* ===== Toast / error ===== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 12px 20px;
  background: var(--bg-raised);
  border: 1px solid var(--danger);
  border-radius: var(--radius-full);
  color: var(--text);
  font-size: 14px;
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s var(--ease);
  z-index: 100;
  max-width: calc(100% - 40px);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== Footer ===== */
.footer {
  padding: 40px 0 60px;
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
}

/* ===== Animations ===== */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cat-section {
  animation: fade-up 0.5s var(--ease) both;
}
.cat-section:nth-child(2) { animation-delay: 0.05s; }
.cat-section:nth-child(3) { animation-delay: 0.1s; }
.cat-section:nth-child(4) { animation-delay: 0.15s; }
.cat-section:nth-child(5) { animation-delay: 0.2s; }
.cat-section:nth-child(6) { animation-delay: 0.25s; }
.cat-section:nth-child(7) { animation-delay: 0.3s; }

/* ===== Accessibility ===== */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===== Responsive ===== */
@media (max-width: 560px) {
  .container { padding: 0 16px; }
  .header { padding: 16px 0 8px; }
  .hero { padding: 16px 0 24px; }
  .hero h1 { font-size: 36px; }
  .hero .subtitle { font-size: 15px; }
  .cat-header h2 { font-size: 22px; }
  .cat-header .cat-desc { display: none; }
  .results-summary { font-size: 13px; padding: 12px 14px; }
  .brand-name { font-size: 20px; }
  .brand-mark { width: 36px; height: 36px; }
}

/* Safe area for iOS */
@supports (padding: max(0px)) {
  .container {
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
  }
}

/* ===== v2 additions: real data states ===== */

/* Loading spinner inside search button */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(42, 22, 8, 0.2);
  border-top-color: #2a1608;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Demo mode badge */
.badge-mock {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(255, 193, 102, 0.15);
  border: 1px solid rgba(255, 193, 102, 0.3);
  color: #ffc266;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Editorial summary on restaurant card */
.r-summary {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 6px 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Open / closed status badge */
.open-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-full);
  vertical-align: middle;
}
.open-badge.open {
  background: rgba(122, 211, 168, 0.15);
  color: var(--safety);
}
.open-badge.closed {
  background: rgba(255, 139, 139, 0.15);
  color: var(--danger);
}

/* Restaurant action buttons (Call, Directions, Website) */
.r-actions {
  display: flex;
  gap: 6px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.r-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s var(--ease);
}
.r-action:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
  color: var(--accent-bright);
}

/* Small meta line at bottom of card (Google rating info) */
.r-meta {
  font-size: 11px;
  color: var(--text-dim);
  margin: 10px 0 0;
  font-variant-numeric: tabular-nums;
}

/* Empty state when no results */
.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 15px;
}
