/* ─────────────────────────────────────────────────────────────
   SETUP / PAIRING SCREEN  –  ZappQ Flow TV
   ───────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

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

:root {
  --bg-from: #071a10;
  --bg-mid:  #0d2b15;
  --bg-to:   #0a2010;
  --blue:    #22c55e;
  --blue-d:  #16a34a;
  --teal:    #22c55e;
  --white:   #ffffff;
  --glass:   rgba(255,255,255,0.07);
  --glass-b: rgba(255,255,255,0.12);
  --text:    #e2e8f0;
  --muted:   rgba(255,255,255,0.45);
  --error:   #f87171;
  --radius:  20px;
}

html, body {
  width: 100%; height: 100%;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  overflow: hidden;
}

/* ── Dark gradient background scoped to setup screen only ── */
#setup-screen, #pairing-wait-screen {
  background: linear-gradient(135deg, var(--bg-from), var(--bg-mid), var(--bg-to));
}

/* ── SCREEN CONTAINER ── */
#setup-screen, #pairing-wait-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%; height: 100vh;
  /* background applied in the rule above */
}

.hidden { display: none !important; }

/* ── CARD ── */
.card {
  background: var(--glass);
  border: 1px solid var(--glass-b);
  border-radius: var(--radius);
  padding: 44px 48px;
  width: min(540px, 92vw);
  backdrop-filter: blur(24px);
  box-shadow: 0 24px 80px rgba(0,0,0,0.45);
  animation: cardIn 0.6s cubic-bezier(.22,1,.36,1) both;
}

@keyframes cardIn {
  from { opacity:0; transform: translateY(28px) scale(0.97); }
  to   { opacity:1; transform: translateY(0)   scale(1);    }
}

/* ── LOGO AREA ── */
.logo-wrap {
  display: flex; flex-direction: column; align-items: center; margin-bottom: 32px;
}
.logo-icon {
  width: 88px; height: 88px;
  background: rgba(34,197,94,0.12);
  border-radius: 24px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
  animation: floatBob 3s ease-in-out infinite;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(34,197,94,0.25);
}
.logo-icon img {
  width: 100%; height: 100%; object-fit: contain;
}
@keyframes floatBob {
  0%,100% { transform: translateY(0);   }
  50%      { transform: translateY(-7px); }
}
.logo-title {
  font-size: 30px; font-weight: 900; letter-spacing: 0.4px; color: #fff;
}
.logo-sub {
  font-size: 14px; font-weight: 500; color: var(--muted); margin-top: 4px;
}

/* ── PAIRING CODE DISPLAY ── */
.pair-code-section {
  display: flex; flex-direction: column; align-items: center;
  gap: 18px; margin-bottom: 32px;
}
.pair-code-label {
  font-size: 11px; font-weight: 800; letter-spacing: 2.5px;
  color: var(--muted); text-transform: uppercase;
}
.pair-code {
  display: flex; gap: 10px;
}
.pair-code span {
  width: 52px; height: 64px;
  background: rgba(255,255,255,0.08);
  border: 1.5px solid rgba(255,255,255,0.18);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 900; color: #fff;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  transition: background 0.3s;
}

/* ── QR CODE ── */
.qr-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.qr-box {
  position: relative;
  width: 140px; height: 140px;
  border-radius: 18px;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  padding: 8px;
  box-shadow: 0 0 0 6px rgba(59,130,246,0.15);
}
.qr-box img {
  width: 100%; height: 100%; border-radius: 10px;
}
.qr-pulse-ring {
  position: absolute;
  inset: -8px;
  border-radius: 26px;
  border: 2.5px solid rgba(59,130,246,0.4);
  animation: pulseRing 2s ease-out infinite;
}
@keyframes pulseRing {
  0%   { transform: scale(1);    opacity: 0.9; }
  100% { transform: scale(1.18); opacity: 0;   }
}
.qr-hint {
  font-size: 12px; font-weight: 600; color: var(--muted); text-align: center;
}

/* ── OR DIVIDER ── */
.or-divider {
  display: flex; align-items: center; gap: 14px;
  color: var(--muted); font-size: 12px; font-weight: 600;
  margin: 20px 0;
}
.or-divider::before, .or-divider::after {
  content: ''; flex: 1; height: 1px;
  background: rgba(255,255,255,0.12);
}

/* ── MANUAL CODE INPUT ── */
.code-input-row {
  display: flex; gap: 10px;
}
.code-input {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(255,255,255,0.14);
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 22px; font-weight: 800;
  color: #fff;
  letter-spacing: 8px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  outline: none;
  transition: border-color 0.25s, background 0.25s;
  font-family: 'Inter', monospace;
}
.code-input::placeholder { letter-spacing: 4px; font-size: 14px; font-weight: 500; color: var(--muted); }
.code-input:focus {
  border-color: var(--blue);
  background: rgba(59,130,246,0.08);
}

/* ── BUTTONS ── */
.btn {
  width: 100%; height: 52px;
  border: none; border-radius: 14px;
  font-size: 16px; font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
  letter-spacing: 0.3px;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #fff;
  box-shadow: 0 6px 24px rgba(22,163,74,0.4);
  margin-top: 18px;
}
.btn-primary:hover { box-shadow: 0 8px 32px rgba(22,163,74,0.55); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(255,255,255,0.12);
  font-size: 13px;
}
.btn-ghost:hover { background: rgba(255,255,255,0.05); color: #fff; }

/* ── STATUS / ERROR ── */
.status-msg {
  margin-top: 14px;
  font-size: 13px; font-weight: 600;
  text-align: center; padding: 10px 16px;
  border-radius: 10px;
}
.status-error   { color: var(--error); background: rgba(248,113,113,0.1); border: 1px solid rgba(248,113,113,0.2); }
.status-success { color: #34d399;     background: rgba(52,211,153,0.1);  border: 1px solid rgba(52,211,153,0.2);  }
.status-info    { color: #60a5fa;     background: rgba(96,165,250,0.1);  border: 1px solid rgba(96,165,250,0.2);  }

/* ── WAIT SCREEN (Pairing in progress on TV) ── */
.wait-card {
  background: var(--glass);
  border: 1px solid var(--glass-b);
  border-radius: var(--radius);
  padding: 60px 48px;
  width: min(480px, 92vw);
  backdrop-filter: blur(24px);
  box-shadow: 0 24px 80px rgba(0,0,0,0.45);
  text-align: center;
  animation: cardIn 0.6s cubic-bezier(.22,1,.36,1) both;
}
.wait-spinner {
  width: 56px; height: 56px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
  margin: 0 auto 24px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.wait-title { font-size: 22px; font-weight: 800; margin-bottom: 10px; color: #fff; }
.wait-sub   { font-size: 14px; color: var(--muted); line-height: 1.6; }

/* ── RESPONSIVE ── */
@media (max-width: 480px) {
  .card { padding: 32px 22px; }
  .pair-code span { width: 38px; height: 50px; font-size: 24px; }
}
