/* ============================================================
   Jellyfish Jukebox — mobile-first dark theme
   Vibe: jukebox at the back of a pub, glow + warmth, big tappable
   ============================================================ */

:root {
  --bg: #0e0f12;
  --surface: #181a20;
  --surface-2: #20232b;
  --border: #2a2e38;
  --text: #f0f2f7;
  --muted: #8b93a3;
  --accent: #ff5d8f;        /* hot-pink jukebox glow */
  --accent-2: #ffd166;      /* warm yellow accent */
  --success: #6fd49f;
  --danger: #ff6b6b;
  --shadow: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 36px rgba(0,0,0,0.6);
  --radius: 14px;
  --radius-lg: 20px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: env(safe-area-inset-bottom);
}
button { font-family: inherit; cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ----- punter view ----- */

.punter-header {
  padding: 32px 20px 16px;
  text-align: center;
  background: radial-gradient(ellipse at top, rgba(255, 93, 143, 0.15), transparent 60%);
}
.venue-strip {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 4px 10px;
  border: 1px solid rgba(255,93,143,0.35);
  border-radius: 99px;
  margin-bottom: 14px;
}
.punter-header h1 {
  font-size: 32px;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}
.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}
.subtitle strong { color: var(--accent-2); font-weight: 700; }

.banner {
  margin: 12px 20px;
  padding: 12px 16px;
  border-radius: var(--radius);
  text-align: center;
  font-size: 14px;
}
.banner-info {
  background: rgba(111, 212, 159, 0.12);
  border: 1px solid rgba(111, 212, 159, 0.3);
  color: var(--success);
}

.tile-grid {
  display: grid;
  gap: 12px;
  padding: 16px 16px 32px;
  grid-template-columns: 1fr;
}
@media (min-width: 600px) {
  .tile-grid { grid-template-columns: 1fr 1fr; max-width: 720px; margin: 0 auto; }
}

.tile {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 64px 18px 20px;
  color: var(--text);
  transition: transform 80ms ease, background 150ms ease, border-color 150ms ease;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.tile:not(:disabled):hover { background: var(--surface-2); border-color: var(--accent); }
.tile:not(:disabled):active { transform: scale(0.98); }
.tile:disabled { opacity: 0.4; cursor: default; }
.tile::before {
  content: "♪";
  position: absolute;
  right: -10px; top: -10px;
  font-size: 80px;
  color: rgba(255, 93, 143, 0.06);
  pointer-events: none;
}
.tile-title {
  display: block;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}
.tile-artist {
  display: block;
  font-size: 13px;
  color: var(--muted);
}
.tile-price {
  position: absolute;
  right: 16px; top: 50%;
  transform: translateY(-50%);
  background: var(--accent);
  color: white;
  font-weight: 700;
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 99px;
  letter-spacing: 0.02em;
}
.tile-price::after { content: " kr"; opacity: 0.8; font-weight: 500; }

/* Taken (already requested) state — greyed out, badge replaces the price */
.tile-taken {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.6);
}
.tile-taken:hover { background: var(--surface); border-color: var(--border); }
.tile-badge {
  position: absolute;
  right: 16px; top: 50%;
  transform: translateY(-50%);
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
  font-weight: 700;
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 99px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.punter-footer {
  padding: 24px 20px 40px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

/* ----- modal ----- */

/* Generic: respect HTML `hidden` attribute even when CSS sets display elsewhere. */
[hidden] { display: none !important; }

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: fadeIn 160ms ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 22px;
  width: 100%;
  max-width: 380px;
  max-height: 90vh;
  max-height: 90dvh;             /* iOS-aware viewport — avoids hiding content under the URL bar */
  overflow-y: auto;              /* scroll inside the modal if the content (Stripe element) expands */
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: modalIn 200ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes modalIn {
  from { transform: translateY(20px) scale(0.95); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
.modal h2 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 700;
}
.modal-price {
  color: var(--muted);
  margin: 0 0 18px;
  font-size: 14px;
}
.modal-price strong { color: var(--accent-2); font-size: 17px; }
.modal-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}
.modal-buttons button { flex: 1; }
.modal-disclaimer {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
}

/* Payment modal — wider to fit Stripe's PaymentElement */
.modal-payment {
  max-width: 440px;
  text-align: left;
  padding-bottom: 0;             /* sticky buttons handle their own bottom spacing */
}
/* Sticky-bottom button strip so 'Pay now' stays visible even when Stripe's
   element expands (e.g. billing-details fields drop in). Strip pins to the
   bottom of the modal viewport; content above scrolls. */
.modal-payment .modal-buttons {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  margin: 8px -22px 0;
  padding: 14px 22px 20px;
  border-top: 1px solid var(--border);
  z-index: 2;
}
.modal-payment h2 {
  text-align: center;
}
.modal-payment .modal-price {
  text-align: center;
  margin-bottom: 16px;
}
#payment-element-container {
  margin-bottom: 14px;
  min-height: 200px;
}
.payment-error {
  background: rgba(255, 107, 107, 0.12);
  border: 1px solid rgba(255, 107, 107, 0.4);
  color: var(--danger);
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 13px;
}

/* ----- buttons ----- */

.btn-primary, .btn-secondary, .btn-ghost {
  display: inline-block;
  border: 0;
  border-radius: 99px;
  padding: 13px 22px;
  font-size: 15px;
  font-weight: 700;
  transition: transform 80ms ease, background 150ms ease, opacity 150ms ease;
}
.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover:not(:disabled) { background: #ff7aa3; }
.btn-primary:active:not(:disabled) { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.5; cursor: wait; }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: #2a2e38; }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--text); }

.btn-small { padding: 8px 14px; font-size: 13px; }

/* ----- success screen ----- */

.modal-success { padding: 36px 24px; }
.success-check {
  width: 64px; height: 64px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: rgba(111, 212, 159, 0.15);
  border: 2px solid var(--success);
  color: var(--success);
  font-size: 36px;
  line-height: 60px;
  text-align: center;
}
.modal-success h2 { font-size: 18px; margin-bottom: 6px; }
.modal-success p { color: var(--muted); margin: 0; font-size: 14px; }

/* ----- admin views ----- */

.admin-header, .queue-header {
  padding: 24px 20px 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  border-bottom: 1px solid var(--border);
}
.admin-header h1, .queue-header h1 {
  margin: 0;
  font-size: 24px;
}
.queue-header .venue-strip { margin-bottom: 6px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 16px;
  padding: 18px 18px 22px;
  box-shadow: var(--shadow);
}
.card h2 {
  margin: 0 0 14px;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 700;
}
.card label {
  display: block;
  margin-bottom: 12px;
}
.card label span {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--muted);
}
.card input[type="text"],
.card input[type="number"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 16px;
  font-family: inherit;
}
.card input:focus {
  outline: 0;
  border-color: var(--accent);
}
.card form button { margin-top: 6px; }

.session-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.session-list li {
  border-bottom: 1px solid var(--border);
}
.session-list li:last-child { border-bottom: 0; }
.session-list a {
  display: block;
  padding: 12px 0;
  color: var(--text);
}
.session-list a:hover { text-decoration: none; color: var(--accent); }
.muted { color: var(--muted); font-size: 13px; }

.qr-row {
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
}
.qr-image {
  background: #fff;
  padding: 10px;
  border-radius: 12px;
  line-height: 0;
  flex: 0 0 auto;
  box-shadow: 0 4px 16px rgba(255, 93, 143, 0.18);
}
.qr-image img { display: block; width: 220px; height: 220px; }
.qr-info { flex: 1 1 240px; min-width: 240px; }
.qr-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.qr-actions .btn-small { padding: 6px 12px; }

.qr-card .qr-url {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  word-break: break-all;
  margin: 0 0 8px;
}

.queue-controls .inline,
.queue-controls form { display: inline; }
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.badge-ended {
  background: rgba(139, 147, 163, 0.15);
  color: var(--muted);
  border: 1px solid var(--border);
}

.request-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.request-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.request-row:last-child { border-bottom: 0; }
.request-main { flex: 1; min-width: 0; }
.request-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.request-meta {
  font-size: 12px;
  color: var(--muted);
}
.request-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.request-list.dimmed { opacity: 0.55; }
.request-list .empty {
  padding: 18px 0;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.inline { display: inline; }

/* ----- ended screen ----- */

.ended-screen {
  text-align: center;
  padding: 80px 24px;
  max-width: 480px;
  margin: 0 auto;
}
.ended-screen h1 {
  font-size: 28px;
  margin-bottom: 14px;
}
.ended-screen p {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}
