/* ─────────────────────────────────────────────────────────────────
   style.css — Lofi Queue Frontend
   Esthetiek: warme nacht, vinyl, candlelight, analog warmth
   ───────────────────────────────────────────────────────────────── */

/* ── Fonts & Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0d0b08;
  --bg2:        #141108;
  --surface:    #1c1710;
  --surface2:   #241f13;
  --border:     #2e2718;
  --text:       #e8dcc8;
  --text-dim:   #8a7d65;
  --text-faint: #4a4130;
  --amber:      #d4852a;
  --amber-soft: #f0a84e;
  --amber-glow: rgba(212, 133, 42, 0.15);
  --cream:      #f5ead6;
  --red:        #c44b2b;
  --green:      #4a7c59;
  --radius:     14px;
  --radius-sm:  8px;
}

html { height: 100%; }

body {
  font-family: 'DM Mono', monospace;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ── Grain texture ──────────────────────────────────────────────── */
.grain {
  position: fixed; inset: 0; z-index: 100;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

/* ── Ambient blobs ──────────────────────────────────────────────── */
.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}
.blob-1 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(180, 90, 20, 0.12) 0%, transparent 70%);
  top: -100px; right: -100px;
  animation: drift1 20s ease-in-out infinite;
}
.blob-2 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(100, 60, 150, 0.08) 0%, transparent 70%);
  bottom: 10%; left: -80px;
  animation: drift2 25s ease-in-out infinite;
}
.blob-3 {
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(212, 133, 42, 0.06) 0%, transparent 70%);
  top: 40%; left: 40%;
  animation: drift3 18s ease-in-out infinite;
}

@keyframes drift1 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-30px, 40px); }
}
@keyframes drift2 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(40px, -30px); }
}
@keyframes drift3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-20px, 20px) scale(1.2); }
}

/* ── Views ──────────────────────────────────────────────────────── */
.view {
  display: none;
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: 0 0 40px;
}
.view.active { display: block; }

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 32px 20px;
}

/* ── Header ─────────────────────────────────────────────────────── */
header {
  text-align: center;
  margin-bottom: 36px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.15em;
  color: var(--amber);
  border: 1px solid var(--amber);
  border-radius: 100px;
  padding: 4px 12px;
  margin-bottom: 20px;
}
.badge::before {
  content: '';
  width: 6px; height: 6px;
  background: var(--amber);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(26px, 6vw, 34px);
  font-weight: 400;
  color: var(--cream);
  line-height: 1.2;
  margin-bottom: 10px;
}

.subtitle {
  font-size: 13px;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

/* ── Search bar ─────────────────────────────────────────────────── */
.search-wrapper { position: relative; }

.search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-bar:focus-within {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-glow);
}

.search-icon {
  width: 18px; height: 18px;
  color: var(--text-dim);
  flex-shrink: 0;
}

#search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: 'DM Mono', monospace;
  font-size: 15px;
  color: var(--text);
  caret-color: var(--amber);
}
#search-input::placeholder { color: var(--text-faint); }

/* ── Results ─────────────────────────────────────────────────────── */
.results-list {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  z-index: 50;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  animation: slideDown 0.15s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.12s;
  border-bottom: 1px solid var(--border);
}
.result-item:last-child { border-bottom: none; }
.result-item:hover, .result-item:focus {
  background: var(--surface2);
  outline: none;
}

.result-art {
  width: 42px; height: 42px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--border);
  flex-shrink: 0;
}
.result-art-placeholder {
  width: 42px; height: 42px;
  border-radius: 6px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.result-info { flex: 1; min-width: 0; }
.result-name {
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.result-artist {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.no-results {
  padding: 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}

/* ── Selected track ──────────────────────────────────────────────── */
.selected-track {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--amber);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 20px;
  animation: fadeIn 0.25s ease;
  box-shadow: 0 0 30px var(--amber-glow);
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to   { opacity: 1; transform: scale(1); }
}

.selected-art-wrap {
  position: relative;
  flex-shrink: 0;
}

.selected-art-wrap img {
  width: 52px; height: 52px;
  border-radius: 8px;
  object-fit: cover;
}

.playing-indicator {
  position: absolute;
  bottom: -2px; right: -2px;
  background: var(--amber);
  border-radius: 4px;
  padding: 3px 4px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
}
.playing-indicator span {
  width: 2px;
  background: var(--bg);
  border-radius: 1px;
  animation: bar 1s ease-in-out infinite;
}
.playing-indicator span:nth-child(1) { height: 6px; animation-delay: 0s; }
.playing-indicator span:nth-child(2) { height: 9px; animation-delay: 0.15s; }
.playing-indicator span:nth-child(3) { height: 5px; animation-delay: 0.3s; }

@keyframes bar {
  0%, 100% { transform: scaleY(0.4); }
  50%       { transform: scaleY(1); }
}

.selected-info { flex: 1; min-width: 0; }
.track-name {
  font-size: 15px;
  color: var(--cream);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-artist {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 3px;
}

.clear-btn {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.15s;
  flex-shrink: 0;
}
.clear-btn:hover { color: var(--text-dim); }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 24px;
  margin-top: 20px;
  background: var(--amber);
  color: var(--bg);
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  animation: fadeIn 0.25s ease;
}
.btn-primary svg { width: 18px; height: 18px; }
.btn-primary:hover {
  background: var(--amber-soft);
  box-shadow: 0 8px 30px rgba(212, 133, 42, 0.35);
}
.btn-primary:active { transform: scale(0.98); }

.back-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  cursor: pointer;
  padding: 8px 0;
  margin-bottom: 24px;
  transition: color 0.15s;
}
.back-btn svg { width: 16px; height: 16px; }
.back-btn:hover { color: var(--text); }

/* ── Pricing cards ───────────────────────────────────────────────── */
.mini-track {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 28px;
}
.mini-track img {
  width: 40px; height: 40px;
  border-radius: 6px;
  object-fit: cover;
}
.mini-name {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}
.mini-artist {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

.pricing-cards {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pricing-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s;
  width: 100%;
}
.pricing-card:hover {
  border-color: var(--amber);
  box-shadow: 0 0 30px var(--amber-glow);
  transform: translateY(-1px);
}
.pricing-card:active { transform: scale(0.99); }
.pricing-card.featured {
  border-color: var(--amber);
  background: linear-gradient(135deg, var(--surface) 0%, rgba(212,133,42,0.08) 100%);
}

.popular-badge {
  position: absolute;
  top: -11px; right: 16px;
  background: var(--amber);
  color: var(--bg);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 100px;
}

.price-tag {
  font-family: 'Playfair Display', serif;
  font-size: 36px;
  color: var(--amber-soft);
  margin-bottom: 4px;
}
.price-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--cream);
  margin-bottom: 8px;
}
.price-desc {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 12px;
}
.price-cta {
  font-size: 12px;
  color: var(--amber);
  letter-spacing: 0.05em;
}

/* ── Payment view ────────────────────────────────────────────────── */
.payment-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 28px;
}
.payment-summary img {
  width: 52px; height: 52px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}
.payment-track-info { flex: 1; min-width: 0; }
.payment-track-info > div:first-child {
  font-size: 14px;
  color: var(--cream);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.payment-track-info > div:nth-child(2) {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}
.priority-badge {
  display: inline-block;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 100px;
  margin-top: 6px;
  background: var(--amber-glow);
  color: var(--amber);
  border: 1px solid rgba(212,133,42,0.3);
}
.payment-amount {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  color: var(--amber-soft);
  flex-shrink: 0;
}

.payconiq-section {
  text-align: center;
}
.payconiq-label {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.payconiq-logo {
  margin-bottom: 24px;
}
.payconiq-logo svg { height: 28px; }

.payment-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 30px;
  color: var(--text-dim);
  font-size: 13px;
}

.qr-instructions {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 20px;
}

.qr-wrap {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  display: inline-block;
  margin-bottom: 20px;
  box-shadow: 0 0 40px rgba(212,133,42,0.15);
}
.qr-wrap img {
  width: 180px; height: 180px;
  display: block;
}

.divider-text {
  font-size: 12px;
  color: var(--text-faint);
  margin: 16px 0;
}

.btn-payconiq {
  display: inline-block;
  background: #FF4785;
  color: white;
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  text-decoration: none;
  padding: 14px 28px;
  border-radius: var(--radius);
  transition: background 0.2s, transform 0.1s;
  margin-bottom: 20px;
}
.btn-payconiq:hover {
  background: #e53d77;
  transform: translateY(-1px);
}

.waiting-text {
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.waiting-text::before {
  content: '';
  width: 8px; height: 8px;
  border: 2px solid var(--amber);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ── Thanks view ─────────────────────────────────────────────────── */
.thanks-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: 60px;
}

.thanks-animation {
  margin-bottom: 28px;
}

.thanks-circle {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--amber) 0%, var(--amber-soft) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 50px rgba(212,133,42,0.4);
}
.thanks-circle svg {
  width: 40px; height: 40px;
  stroke: var(--bg);
}

@keyframes popIn {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.thanks-title {
  font-family: 'Playfair Display', serif;
  font-size: 32px;
  color: var(--cream);
  margin-bottom: 8px;
  animation: fadeUp 0.4s 0.2s ease both;
}
.thanks-subtitle {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 32px;
  animation: fadeUp 0.4s 0.3s ease both;
}

.thanks-track {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 16px;
  width: 100%;
  animation: fadeUp 0.4s 0.4s ease both;
  text-align: left;
}
.thanks-track img {
  width: 48px; height: 48px;
  border-radius: 8px;
  object-fit: cover;
}
.thanks-track > div > div:first-child {
  font-size: 14px;
  color: var(--cream);
  font-weight: 500;
}
.thanks-track > div > div:last-child {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 3px;
}

.thanks-msg {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 32px;
  animation: fadeUp 0.4s 0.5s ease both;
  line-height: 1.6;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Utilities ───────────────────────────────────────────────────── */
.hidden { display: none !important; }

.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Wheel pricing card ──────────────────────────────────────────── */
.pricing-card.wheel-card {
  border-color: rgba(147, 90, 220, 0.4);
  background: linear-gradient(135deg, var(--surface) 0%, rgba(147, 90, 220, 0.08) 100%);
}
.pricing-card.wheel-card:hover {
  border-color: #9b5de5;
  box-shadow: 0 0 30px rgba(147, 90, 220, 0.2);
}

.wheel-badge {
  position: absolute;
  top: -11px; right: 16px;
  background: linear-gradient(135deg, #9b5de5, #c77dff);
  color: white;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 100px;
}

/* ── Wheel view ──────────────────────────────────────────────────── */
.wheel-track-preview {
  margin-bottom: 24px;
}

.wheel-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 28px;
  position: relative;
}

.wheel-pointer {
  font-size: 22px;
  color: #c77dff;
  margin-bottom: -4px;
  z-index: 2;
  filter: drop-shadow(0 0 8px rgba(199, 125, 255, 0.8));
  animation: pointerPulse 2s ease-in-out infinite;
}
@keyframes pointerPulse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.wheel-container {
  position: relative;
  width: 320px;
  height: 320px;
  cursor: pointer;
}

#wheel-canvas {
  border-radius: 50%;
  box-shadow:
    0 0 0 4px rgba(147, 90, 220, 0.3),
    0 0 40px rgba(147, 90, 220, 0.15),
    0 20px 60px rgba(0,0,0,0.5);
  transition: box-shadow 0.3s;
}
.wheel-container:hover #wheel-canvas {
  box-shadow:
    0 0 0 4px rgba(199, 125, 255, 0.5),
    0 0 60px rgba(147, 90, 220, 0.3),
    0 20px 60px rgba(0,0,0,0.5);
}

.wheel-center-btn {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 68px; height: 68px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid rgba(147, 90, 220, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  pointer-events: none;
  box-shadow: 0 0 20px rgba(0,0,0,0.6);
  transition: border-color 0.3s;
}
.wheel-container:hover .wheel-center-btn {
  border-color: #9b5de5;
}
.wheel-center-icon { font-size: 20px; line-height: 1; }
.wheel-center-text {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  font-weight: 500;
  color: #c77dff;
  letter-spacing: 0.1em;
}

/* Disable spin button once spinning */
.wheel-container.spinning {
  cursor: not-allowed;
  pointer-events: none;
}
.wheel-container.spinning .wheel-center-text { display: none; }

/* ── Wheel result ────────────────────────────────────────────────── */
.wheel-result {
  text-align: center;
  animation: fadeUp 0.4s ease both;
  background: var(--surface);
  border: 1px solid rgba(147, 90, 220, 0.3);
  border-radius: var(--radius);
  padding: 24px 20px;
  margin-top: 8px;
}

.wheel-result-emoji {
  font-size: 48px;
  line-height: 1;
  margin-bottom: 12px;
}
.wheel-result-title {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  color: var(--cream);
  margin-bottom: 8px;
}
.wheel-result-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 20px;
}