/* PickPlate App Styles — matches landing page design system */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=DM+Sans:wght@400;500;600&display=swap');

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

:root {
  --warm: #F97316;
  --warm-dark: #EA580C;
  --warm-light: #FFF7ED;
  --warm-glow: rgba(249, 115, 22, 0.15);
  --dark: #1C1917;
  --gray: #78716C;
  --gray-light: #A8A29E;
  --light: #FAFAF9;
  --cream: #FEF3C7;
  --green: #16A34A;
  --green-light: #DCFCE7;
  --red: #DC2626;
  --red-light: #FEE2E2;
  --blue: #2563EB;
  --blue-light: #DBEAFE;
  --border: #E7E5E4;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--dark);
  background: var(--light);
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ============ APP SHELL ============ */

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: white;
  position: relative;
  overflow: hidden;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: white;
  border-bottom: 1px solid var(--border);
  z-index: 100;
  min-height: 56px;
}

.app-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--dark);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.app-logo-icon {
  width: 30px;
  height: 30px;
  background: var(--warm);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Language picker */
.lang-picker {
  position: relative;
}

.lang-btn {
  background: var(--warm-light);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--warm);
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
}

.lang-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  z-index: 200;
  min-width: 140px;
  display: none;
}

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

.lang-option {
  display: block;
  width: 100%;
  padding: 0.6rem 1rem;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--dark);
  font-family: 'DM Sans', sans-serif;
  transition: background 0.15s;
}

.lang-option:hover { background: var(--warm-light); }
.lang-option.active { color: var(--warm); font-weight: 600; }

/* Main content area */
.app-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(70px + var(--safe-bottom));
}

/* Bottom Nav */
.bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: white;
  border-top: 1px solid var(--border);
  padding: 0.4rem 0 calc(0.4rem + var(--safe-bottom));
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.4rem 0;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--gray);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-item.active { color: var(--warm); }
.nav-item svg { width: 22px; height: 22px; }
.nav-item span {
  font-size: 0.65rem;
  font-weight: 500;
}

/* ============ SCREENS ============ */

/* --- Onboarding --- */
.screen-onboard {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 2rem 1.5rem;
  text-align: center;
}

.onboard-icon {
  width: 80px;
  height: 80px;
  background: var(--warm);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 8px 24px var(--warm-glow);
}

.onboard-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.onboard-desc {
  font-size: 1rem;
  color: var(--gray);
  line-height: 1.6;
  max-width: 320px;
  margin-bottom: 2.5rem;
}

.btn-primary {
  background: var(--warm);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.9rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  max-width: 320px;
  font-family: 'DM Sans', sans-serif;
  transition: background 0.2s, transform 0.1s;
}

.btn-primary:active { transform: scale(0.98); background: var(--warm-dark); }

.btn-secondary {
  background: none;
  border: none;
  color: var(--gray);
  padding: 0.75rem;
  font-size: 0.9rem;
  cursor: pointer;
  margin-top: 0.75rem;
  font-family: 'DM Sans', sans-serif;
}

/* --- Search Screen --- */
.search-bar {
  padding: 0.75rem 1rem;
  position: sticky;
  top: 0;
  background: white;
  z-index: 50;
  border-bottom: 1px solid var(--border);
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--light);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.75rem;
  border: 2px solid transparent;
  transition: border-color 0.2s;
}

.search-input-wrap:focus-within { border-color: var(--warm); background: white; }

.search-input-wrap svg {
  width: 18px;
  height: 18px;
  color: var(--gray);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  border: none;
  background: none;
  font-size: 0.9rem;
  color: var(--dark);
  outline: none;
  font-family: 'DM Sans', sans-serif;
}

.search-input::placeholder { color: var(--gray-light); }

.search-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 1rem 0;
}

.search-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--warm-light);
  color: var(--warm);
  border: none;
  border-radius: 20px;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  white-space: nowrap;
  transition: background 0.15s;
}

.search-chip:active { background: var(--cream); }
.search-chip.active { background: var(--warm); color: white; }
.search-chip svg { width: 14px; height: 14px; }

/* Restaurant cards */
.restaurant-list {
  padding: 0.5rem 1rem 1rem;
}

.restaurant-card {
  display: flex;
  gap: 0.75rem;
  padding: 1rem;
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.restaurant-card:active { transform: scale(0.98); box-shadow: var(--shadow-md); }

.rest-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--warm-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

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

.rest-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rest-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--gray);
}

.rest-rating {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  color: var(--warm);
  font-weight: 600;
}

.rest-cuisine {
  color: var(--gray);
}

.rest-address {
  font-size: 0.75rem;
  color: var(--gray-light);
  margin-top: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rest-price {
  font-size: 0.8rem;
  color: var(--gray);
}

/* Empty states */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  text-align: center;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.6;
}

.empty-text {
  font-size: 0.95rem;
  color: var(--gray);
  line-height: 1.5;
}

/* Section headers */
.section-header {
  padding: 1rem 1rem 0.5rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --- Restaurant Detail / Recommendations --- */
.rest-header {
  background: var(--warm);
  color: white;
  padding: 1.5rem 1rem 1.25rem;
  position: relative;
}

.rest-header-back {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  border-radius: 20px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  margin-bottom: 0.75rem;
  font-family: 'DM Sans', sans-serif;
}

.rest-header-back svg { width: 14px; height: 14px; }

.rest-header h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.rest-header-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  opacity: 0.9;
}

.rest-header-badge {
  background: rgba(255,255,255,0.2);
  border-radius: 20px;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
}

.rec-subtitle {
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: var(--gray);
  border-bottom: 1px solid var(--border);
}

.profile-prompt {
  margin: 0.75rem 1rem;
  padding: 0.75rem 1rem;
  background: var(--blue-light);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  color: var(--blue);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.profile-prompt svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Dish cards */
.dish-list {
  padding: 0.5rem 1rem 1rem;
}

.dish-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  margin-bottom: 0.75rem;
  transition: transform 0.1s;
}

.dish-card.top-pick {
  border-color: var(--warm);
  box-shadow: 0 0 0 1px var(--warm), var(--shadow-md);
}

.dish-top-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--warm);
  color: white;
  border-radius: 20px;
  padding: 0.2rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.dish-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.3rem;
}

.dish-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 1rem;
}

.dish-match {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  padding-left: 0.5rem;
}

.match-high { color: var(--green); }
.match-mid { color: var(--warm); }
.match-low { color: var(--gray); }

.dish-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.dish-price {
  font-size: 0.85rem;
  color: var(--dark);
  font-weight: 500;
}

.dish-mentions {
  font-size: 0.75rem;
  color: var(--gray);
}

.dish-category {
  font-size: 0.7rem;
  background: var(--light);
  color: var(--gray);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

/* Reason tags */
.dish-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.5rem;
}

.reason-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  font-weight: 500;
}

.reason-loved { background: var(--green-light); color: var(--green); }
.reason-popular { background: var(--cream); color: #B45309; }
.reason-taste { background: var(--warm-light); color: var(--warm); }
.reason-warning { background: var(--red-light); color: var(--red); }
.reason-diet { background: var(--blue-light); color: var(--blue); }
.reason-history { background: #F3E8FF; color: #7C3AED; }

/* Quotes */
.dish-quotes {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.dish-quotes-label {
  font-size: 0.7rem;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
  font-weight: 600;
}

.dish-quote {
  font-size: 0.8rem;
  color: var(--gray);
  font-style: italic;
  padding: 0.3rem 0;
  line-height: 1.4;
}

.dish-quote::before { content: '"'; color: var(--warm); font-weight: 700; }
.dish-quote::after { content: '"'; color: var(--warm); font-weight: 700; }

/* Pick button */
.dish-actions {
  margin-top: 0.75rem;
}

.btn-pick {
  width: 100%;
  background: var(--dark);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: background 0.2s, transform 0.1s;
}

.btn-pick:active { transform: scale(0.98); }
.btn-pick.picked { background: var(--green); }

/* --- Profile Screen --- */
.profile-screen {
  padding: 1.5rem 1rem;
}

.profile-screen h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.profile-screen .subtitle {
  font-size: 0.9rem;
  color: var(--gray);
  margin-bottom: 1.5rem;
}

.profile-section {
  margin-bottom: 1.5rem;
}

.profile-section h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.profile-section .desc {
  font-size: 0.8rem;
  color: var(--gray);
  margin-bottom: 0.75rem;
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.45rem 0.8rem;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: white;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--dark);
  font-family: 'DM Sans', sans-serif;
  transition: all 0.15s;
  user-select: none;
  -webkit-user-select: none;
}

.chip.selected {
  background: var(--warm-light);
  border-color: var(--warm);
  color: var(--warm);
  font-weight: 600;
}

.chip:active { transform: scale(0.96); }

/* Spice slider */
.spice-slider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
}

.spice-track {
  flex: 1;
  position: relative;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
}

.spice-fill {
  height: 100%;
  background: var(--warm);
  border-radius: 3px;
  transition: width 0.2s;
}

.spice-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.3rem;
}

.spice-label {
  font-size: 0.7rem;
  color: var(--gray);
  cursor: pointer;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  transition: color 0.15s;
}

.spice-label.active {
  color: var(--warm);
  font-weight: 600;
}

.profile-save-area {
  margin-top: 1.5rem;
}

.save-feedback {
  text-align: center;
  font-size: 0.85rem;
  margin-top: 0.5rem;
  color: var(--green);
  font-weight: 500;
  min-height: 1.5em;
}

/* --- History Screen --- */
.history-screen {
  padding: 1.5rem 1rem;
}

.history-screen h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.pick-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 0.5rem;
}

.pick-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--warm-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.pick-info { flex: 1; }

.pick-dish {
  font-weight: 600;
  font-size: 0.9rem;
}

.pick-rest {
  font-size: 0.75rem;
  color: var(--gray);
}

.pick-rating {
  display: flex;
  gap: 2px;
}

.pick-star {
  width: 14px;
  height: 14px;
  color: var(--cream);
}

.pick-star.filled { color: var(--warm); }

/* ============ LOADING & ANIMATIONS ============ */

.loading-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 2rem;
}

.loading-dot {
  width: 8px;
  height: 8px;
  background: var(--warm);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* View transitions */
.view-enter {
  animation: slideIn 0.25s ease-out;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ RESPONSIVE ============ */
@media (min-width: 481px) {
  .app-shell {
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
  }
}

/* iOS safe areas */
@supports (padding-top: env(safe-area-inset-top)) {
  .app-header {
    padding-top: calc(0.75rem + env(safe-area-inset-top));
  }
}

/* Scrollbar styling */
.app-content::-webkit-scrollbar { width: 0; }
.app-content { scrollbar-width: none; }

/* --- Demo & Live badges --- */
.demo-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: var(--cream);
  color: #B45309;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: var(--green-light);
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* --- Analyzing state --- */
.analyzing-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  text-align: center;
}

.analyzing-icon {
  margin-bottom: 1rem;
  color: var(--warm);
}

.analyzing-text {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  color: var(--dark);
  margin-bottom: 0.3rem;
}

.analyzing-sub {
  font-size: 0.85rem;
  color: var(--gray);
}

/* Spinning animation */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spin { animation: spin 1s linear infinite; }

/* --- Loading state (search) --- */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem;
}

.loading-text {
  font-size: 0.85rem;
  color: var(--gray);
  margin-top: 0.5rem;
}

/* --- Live search button in empty state --- */
.live-search-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1rem;
  background: var(--warm-light);
  color: var(--warm);
  border: 1px solid var(--warm);
  border-radius: var(--radius-md);
  padding: 0.6rem 1.2rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
}

.live-search-btn:active { background: var(--cream); }

/* --- Empty hint text --- */
.empty-hint {
  font-size: 0.8rem;
  color: var(--gray-light);
  margin-top: 0.75rem;
  font-style: italic;
}

/* Disable text selection on interactive elements */
button, .chip, .nav-item, .restaurant-card, .lang-option {
  -webkit-tap-highlight-color: transparent;
}
