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

:root {
  --bg:          #121212;
  --bg-card:     #1e1e1e;
  --bg-card2:    #262626;
  --orange:      #FF6D00;
  --orange-dim:  rgba(255,109,0,.15);
  --orange-dark: #e05e00;
  --text:        #ffffff;
  --text-muted:  #9e9e9e;
  --text-dim:    #616161;
  --border:      #2e2e2e;
  --radius:      14px;
  --radius-sm:   8px;
  --shadow:      0 4px 24px rgba(0,0,0,.5);
  --transition:  .2s ease;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─── Screen system ────────────────────────────────────────────────────── */
.screen {
  display: none;
  min-height: 100dvh;
}
.screen.active { display: block; }

/* ─── LOGIN SCREEN ─────────────────────────────────────────────────────── */
.login-container {
  max-width: 420px;
  margin: 0 auto;
  padding: 48px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.logo-block {
  text-align: center;
  margin-bottom: 8px;
}

.logo-badge {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: var(--orange);
  color: #fff;
  font-size: 26px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(255,109,0,.4);
}

.logo-block h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.5px;
}

.tagline {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

/* Buttons */
.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  padding: 14px 20px;
  transition: opacity var(--transition), transform var(--transition);
}
.btn-primary  { background: var(--orange); color: #fff; }
.btn-secondary{ background: var(--bg-card2); color: var(--text); border: 1px solid var(--border); }
.btn-full     { width: 100%; }
.btn-primary:active, .btn-secondary:active { opacity: .85; transform: scale(.98); }

.btn-icon-left { font-size: 18px; }

/* Login message */
.login-message {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
}
.login-message.info    { background: rgba(33,150,243,.15); color: #64b5f6; }
.login-message.success { background: rgba(76,175,80,.15);  color: #81c784; }
.login-message.warning { background: rgba(255,152,0,.15);  color: #ffb74d; }
.login-message.error   { background: rgba(244,67,54,.15);  color: #ef9a9a; }

/* Divider */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-dim);
  font-size: 12px;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Manual form */
.manual-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.manual-form label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: .5px;
  text-transform: uppercase;
  margin-bottom: -4px;
}

.manual-form input {
  width: 100%;
  padding: 13px 14px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color var(--transition);
}
.manual-form input:focus { border-color: var(--orange); }
.manual-form input::placeholder { color: var(--text-dim); }

/* ─── OAuth Paste Panel ────────────────────────────────────────────────── */
.oauth-paste-panel {
  background: var(--bg-card2);
  border: 1px solid rgba(255,109,0,.35);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.oauth-steps-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--orange);
  margin-bottom: 6px;
}

.oauth-steps ol {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.oauth-steps li {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
}

.oauth-steps li strong {
  color: var(--text);
}

.paste-row {
  display: flex;
  gap: 8px;
}

.paste-row input {
  flex: 1;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: monospace;
  outline: none;
  min-width: 0;
  transition: border-color var(--transition);
}
.paste-row input:focus { border-color: var(--orange); }
.paste-row input::placeholder { color: var(--text-dim); font-size: 11px; }

.paste-row .btn-primary {
  padding: 10px 16px;
  font-size: 14px;
  white-space: nowrap;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

/* ─── People ID form ───────────────────────────────────────────────────── */
.peopleid-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.peopleid-hint {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.peopleid-hint-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: .5px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.peopleid-hint ol {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.peopleid-hint li {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
}

.peopleid-hint li strong { color: var(--text); }

.link-orange {
  color: var(--orange);
  text-decoration: none;
}
.link-orange:hover { text-decoration: underline; }

.peopleid-form label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: .5px;
  text-transform: uppercase;
  margin-bottom: -4px;
}

.peopleid-form input {
  width: 100%;
  padding: 13px 14px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition);
  font-family: inherit;
}
.peopleid-form input:focus { border-color: var(--orange); }
.peopleid-form input::placeholder { color: var(--text-dim); font-size: 12px; }

/* ─── DASHBOARD SCREEN ─────────────────────────────────────────────────── */
.dashboard-container {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dash-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
}

.dash-header h2 {
  font-size: 22px;
  font-weight: 700;
}

.dash-club {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}

.btn-icon {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition);
}
.btn-icon:hover { background: var(--border); }

/* QR card button */
.qr-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--orange-dim);
  border: 1px solid rgba(255,109,0,.3);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background var(--transition), transform var(--transition);
}
.qr-card:active { transform: scale(.98); }

.qr-card-icon { font-size: 28px; flex-shrink: 0; }

.qr-card-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.qr-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.qr-card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.qr-card-arrow {
  font-size: 24px;
  color: var(--orange);
  font-weight: 300;
}

/* Info card */
.info-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.info-label { font-size: 13px; color: var(--text-muted); }

.info-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ─── QR CODE MODAL ────────────────────────────────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: flex-end;
}
.modal-backdrop.open {
  display: flex;
  animation: fade-in .2s ease;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal-sheet {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg-card);
  border-radius: 24px 24px 0 0;
  padding: 24px 24px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  position: relative;
  animation: slide-up .3s cubic-bezier(.34,1.56,.64,1);
}

@keyframes slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-title {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
}

.modal-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

/* Warning banner */
.qr-warning {
  background: rgba(255,152,0,.15);
  border: 1px solid rgba(255,152,0,.4);
  border-radius: var(--radius-sm);
  color: #ffb74d;
  font-size: 12px;
  font-weight: 500;
  padding: 10px 14px;
  text-align: center;
  width: 100%;
}

/* QR image wrapper */
.qr-wrapper {
  margin: 4px 0;
}

.qr-border {
  background: var(--orange);
  padding: 6px;
  border-radius: 6px;
  display: inline-block;
}

.qr-border canvas {
  display: block;
  border-radius: 2px;
}

/* Progress bar */
.progress-track {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,.12);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--orange);
  border-radius: 2px;
}

.progress-fill.animating {
  animation: progress-fill 5s linear forwards;
}

@keyframes progress-fill {
  from { width: 0%; }
  to   { width: 100%; }
}

/* Card number under QR */
.qr-card-number {
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ─── LOADING OVERLAY ──────────────────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(18,18,18,.85);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-overlay p {
  color: var(--text-muted);
  font-size: 14px;
}

/* ─── Responsive ───────────────────────────────────────────────────────── */
@media (min-width: 480px) {
  .modal-sheet { border-radius: 24px; margin-bottom: 40px; }
}
