/* ============================================================
   What to Eat? – stylesheet
   Design tokens and roulette mechanics are shared with
   what-movie-today. Card dimensions are CSS custom properties
   also read by app.js via getComputedStyle. Keep in sync.
   ============================================================ */

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

/* ----- Design tokens ----- */
:root {
  --bg:           #0a0a0f;
  --bg-card:      #12121e;
  --accent:       #f5c518;
  --accent-glow:  rgba(245, 197, 24, 0.35);
  --text-primary: #ffffff;
  --text-muted:   #8888aa;
  --border:       rgba(255, 255, 255, 0.08);

  /* Card dimensions – READ BY JS */
  --card-width:  130px;
  --card-height: 195px;
  --card-gap:    12px;
}

/* ----- Base ----- */
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ----- Layout ----- */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main { flex: 1; }

/* ----- Header ----- */
header {
  text-align: center;
  padding: 2rem 1rem 1.5rem;
  position: relative;
}

.back-link {
  display: inline-block;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-decoration: none;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 1rem;
  transition: color 0.2s;
}
.back-link:hover { color: var(--accent); }

header h1 {
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: clamp(3rem, 8vw, 6rem);
  letter-spacing: 0.04em;
  line-height: 1;
  color: var(--text-primary);
  text-shadow: 0 0 60px var(--accent-glow);
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 300;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 0.6rem;
}

/* ----- Permission screen ----- */
#permission-state {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem 4rem;
}

.permission-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3rem 2.5rem;
  max-width: 460px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.permission-icon {
  font-size: 3.5rem;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.permission-card h2 {
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: 2rem;
  letter-spacing: 0.04em;
  color: var(--text-primary);
}

.permission-desc {
  color: #ccccdd;
  font-size: 0.97rem;
  line-height: 1.65;
}

.permission-privacy {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.5;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 1rem;
}

/* ----- Loading ----- */
#loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5rem 1rem;
  gap: 1.25rem;
  color: var(--text-muted);
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Error state (replaces loading content) */
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  text-align: center;
  max-width: 480px;
  padding: 0 1rem;
}

.error-state .error-icon    { font-size: 2rem; }
.error-state .error-message {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.55;
}

/* ----- Roulette section ----- */
#roulette-section { padding: 1rem 0 2rem; }

.roulette-wrapper {
  position: relative;
  width: 100%;
  overflow: hidden;
  padding: 1.5rem 0;
}

/* Side vignettes */
.roulette-wrapper::before,
.roulette-wrapper::after {
  content: '';
  position: absolute;
  top: 0;
  width: clamp(60px, 12%, 160px);
  height: 100%;
  z-index: 10;
  pointer-events: none;
}

.roulette-wrapper::before {
  left: 0;
  background: linear-gradient(to right, var(--bg), transparent);
}

.roulette-wrapper::after {
  right: 0;
  background: linear-gradient(to left, var(--bg), transparent);
}

/* Golden selector frame */
.center-indicator {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: calc(var(--card-width) + 6px);
  height: calc(var(--card-height) + 6px);
  border: 2px solid var(--accent);
  border-radius: 8px;
  z-index: 11;
  pointer-events: none;
  box-shadow:
    0 0 16px var(--accent-glow),
    inset 0 0 12px rgba(245, 197, 24, 0.1);
}

/* Scrolling strip container */
#roulette-container { overflow: hidden; width: 100%; }

/* The strip itself */
#roulette-strip {
  display: flex;
  gap: var(--card-gap);
  will-change: transform;
  user-select: none;
  /* padding-inline set by JS for centering */
}

/* ----- Restaurant card (in roulette) ----- */
.roulette-card {
  flex-shrink: 0;
  width: var(--card-width);
  height: var(--card-height);
  background: var(--bg-card);
  border-radius: 6px;
  border: 2px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 0.5rem;
  transition: border-color 0.35s, box-shadow 0.35s;
}

.roulette-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 24px var(--accent-glow);
}

.card-emoji {
  font-size: 2.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.card-title {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-align: center;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.3;
  width: 100%;
}

/* ----- Result section ----- */
#result-section {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.45s ease, transform 0.45s ease;
  margin: 0 auto 4rem;
  max-width: 820px;
  padding: 0 1.25rem;
}

#result-section.visible {
  opacity: 1;
  transform: translateY(0);
}

.result-card {
  display: flex;
  gap: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  align-items: flex-start;
}

/* Emoji icon (replaces movie poster) */
.result-icon-wrapper {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.result-icon {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  box-shadow: 0 0 36px var(--accent-glow);
  background: rgba(245, 197, 24, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  line-height: 1;
}

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

.result-info h2 {
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: clamp(1.8rem, 4vw, 3rem);
  letter-spacing: 0.03em;
  line-height: 1.05;
  color: var(--text-primary);
  margin-bottom: 0.65rem;
}

.result-cuisine-wrap { margin-bottom: 0.75rem; }

.result-cuisine-badge {
  display: inline-block;
  background: rgba(245, 197, 24, 0.15);
  color: var(--accent);
  border: 1px solid rgba(245, 197, 24, 0.3);
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.result-details {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 1.5rem;
}

.result-detail-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #ccccdd;
  line-height: 1.5;
}

.detail-icon { flex-shrink: 0; }

.result-detail-item a {
  color: var(--accent);
  text-decoration: none;
}
.result-detail-item a:hover { text-decoration: underline; }

.result-actions {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
}

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 1.6rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: background 0.2s, color 0.2s, transform 0.18s, box-shadow 0.18s, opacity 0.2s;
}

.btn-large {
  padding: 0.9rem 2.2rem;
  font-size: 1rem;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-primary {
  background: var(--accent);
  color: #000;
}

.btn-primary:hover:not(:disabled) {
  background: #ffd700;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 197, 24, 0.4);
}

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

.btn-secondary:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

/* ----- Footer ----- */
footer {
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
}

footer a {
  color: var(--accent);
  text-decoration: none;
}
footer a:hover { text-decoration: underline; }

/* ----- Utility ----- */
.hidden { display: none !important; }

/* ----- Reduced motion ----- */
@media (prefers-reduced-motion: reduce) {
  .spinner        { animation: none; border-top-color: var(--accent); }
  #result-section { transition: none; }
  .btn            { transition: none; }
}

/* ----- Responsive ----- */
@media (max-width: 580px) {
  :root {
    --card-width:  96px;
    --card-height: 144px;
    --card-gap:    8px;
  }

  header { padding: 1.5rem 1rem 1.25rem; }

  .permission-card { padding: 2rem 1.5rem; }

  .card-emoji { font-size: 2rem; }

  .result-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.5rem 1.25rem;
  }

  .result-detail-item { justify-content: center; }

  .result-actions { justify-content: center; }
}
