/* ═══════════════════════════════════════════════════════════════
   WHITELIST GATE — T13.9
   state="none" cloned from search-screen design language.
   state="pending|approved|rejected" preserved untouched.
   ═══════════════════════════════════════════════════════════════ */

.whitelist-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, #0F0D1A 0%, #1A1726 100%);
  z-index: 9999;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* iOS system inset (notch/status bar) + Telegram chrome inset (Close / ⌄ / ⋯).
     --tg-chrome-top is set from JS via Telegram.WebApp.contentSafeAreaInset.top.
     Fallback 56px is calibrated for iPhone Telegram chrome height — covers older
     WebApp clients that don't expose contentSafeAreaInset. The gate has no
     visible app header, so we don't pull in the full --content-top token
     (which would add 64px of empty header clearance on top of this). */
  padding-top: calc(
    var(--safe-top, env(safe-area-inset-top, 0px)) +
    var(--tg-chrome-top, 56px) +
    12px
  );
  padding-bottom: calc(var(--safe-bottom, env(safe-area-inset-bottom, 0px)) + 24px);
  padding-left: 0;
  padding-right: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  color: #F5F3FF;
}

.whitelist-screen[hidden] { display: none; }

.wl-container {
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

/* ═══ STATE: NONE — search-screen tokens ═══ */

#whitelistScreen .wl-state-none {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md, 12px);
  /* No top-padding here — the .whitelist-screen wrapper already accounts for
     safe-area + 16px clearance. Adding more here would push content twice. */
  padding: 0 var(--screen-padding-x, 16px) var(--spacing-lg, 20px);
  width: 100%;
}

/* Header: logo left, lang switcher right */
#whitelistScreen .wl-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 4px 0;
}

#whitelistScreen .wl-logo {
  display: flex;
  align-items: center;
}
#whitelistScreen .wl-logo img,
#whitelistScreen .wl-logo svg {
  height: 40px;
  width: auto;
  display: block;
}

/* Lang switcher (compact pill row) */
#whitelistScreen #wlLangSwitcher {
  display: inline-flex;
  gap: 4px;
}
#whitelistScreen .wl-lang-btn {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: all 160ms ease;
  -webkit-tap-highlight-color: transparent;
}
#whitelistScreen .wl-lang-btn:hover {
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
}
#whitelistScreen .wl-lang-btn.is-active {
  background: linear-gradient(135deg, #8B5CF6 0%, #6D28D9 100%);
  border-color: transparent;
  color: #fff;
}

/* Title block */
#whitelistScreen .wl-titlebox {
  text-align: center;
  padding: 4px 0 0;
}
#whitelistScreen .wl-title {
  margin: 0;
  font-size: 26px;
  font-weight: var(--font-weight-bold, 700);
  letter-spacing: -0.5px;
  color: #fff;
  line-height: 1.15;
}
#whitelistScreen .wl-subtitle {
  margin: 6px 0 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.4;
}

/* ═══ Card — clone of .search-form ═══ */
#whitelistScreen .wl-card {
  position: relative;
  background: rgba(25, 22, 35, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-2xl, 28px);
  padding: var(--spacing-md, 12px) var(--spacing-lg, 16px);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md, 12px);
  box-shadow:
    inset 0 1px 0 0 rgba(255, 255, 255, 0.08),
    0 8px 32px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}
/* Top shine line, like .search-form::before */
#whitelistScreen .wl-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50px;
  right: 50px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  pointer-events: none;
}

/* Sections inside card */
#whitelistScreen .wl-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
#whitelistScreen .wl-section__label {
  font-size: var(--font-size-xs, 11px);
  font-weight: var(--font-weight-semibold, 600);
  letter-spacing: var(--tracking-widest, 0.06em);
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  padding-left: var(--spacing-xs, 4px);
  margin-bottom: 2px;
}
#whitelistScreen .wl-section__body {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm, 8px);
}

/* Form row (name/surname two-column) */
#whitelistScreen .wl-form-row {
  display: flex;
  gap: var(--spacing-sm, 8px);
}
@media (max-width: 380px) {
  #whitelistScreen .wl-form-row { flex-direction: column; }
}
#whitelistScreen .wl-form-row .wl-field { flex: 1; min-width: 0; }

#whitelistScreen .wl-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Inputs — copy from .search-form input. !important guards against any future
   global rule (e.g. shared/components.css form-group cascade) leaking onto
   .wl-input. The whitelist gate must own its visual surface unconditionally. */
#whitelistScreen .wl-input {
  width: 100%;
  height: var(--input-height, 44px);
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.10) !important;
  border: 1px solid rgba(255, 255, 255, 0.20) !important;
  border-radius: var(--radius-md, 14px);
  color: #fff !important;
  font-size: var(--input-font-size, 16px);
  font-weight: 500;
  font-family: inherit;
  box-sizing: border-box;
  transition: all var(--transition-fast, 160ms) var(--ease-smooth, ease);
  -webkit-appearance: none;
  appearance: none;
  outline: none;
}
#whitelistScreen .wl-input::placeholder {
  color: rgba(255, 255, 255, 0.45) !important;
}
#whitelistScreen .wl-input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.15) !important;
  border-color: rgba(255, 255, 255, 0.4) !important;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.10);
}
/* Date pill — no caret, pointer cursor (opens WheelDatePicker on click). */
#whitelistScreen .wl-input--datepick {
  cursor: pointer;
  caret-color: transparent;
}
#whitelistScreen .wl-input--error,
#whitelistScreen .wl-input.is-error {
  border-color: var(--color-danger, #F87171) !important;
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.15);
}
#whitelistScreen .wl-input--valid {
  border-color: rgba(16, 185, 129, 0.45);
}

#whitelistScreen .wl-error {
  display: block;
  min-height: 14px;
  font-size: 11px;
  line-height: 1.3;
  color: #FCA5A5;
  padding-left: var(--spacing-xs, 4px);
}
#whitelistScreen .wl-error:empty { min-height: 0; }

/* Hint under form */
#whitelistScreen .wl-hint {
  margin: 0;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
  text-align: center;
  line-height: 1.4;
}

/* ═══ Primary button — WHITE clone of .btn-search ═══ */
#whitelistScreen .wl-btn-primary {
  position: relative;
  width: 100%;
  height: 44px;
  border-radius: var(--radius-lg, 18px);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(245, 245, 250, 0.9));
  color: #1a1a2e;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  cursor: pointer;
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 1);
  transition: transform 120ms, box-shadow 160ms, opacity 160ms, background 160ms;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
  -webkit-tap-highlight-color: transparent;
}
#whitelistScreen .wl-btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0%, transparent 50%);
  pointer-events: none;
}
#whitelistScreen .wl-btn-primary:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow:
    0 8px 28px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 1);
}
#whitelistScreen .wl-btn-primary:not(:disabled):active {
  transform: translateY(1px) scale(0.98);
}
#whitelistScreen .wl-btn-primary:disabled {
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.35);
  box-shadow: none;
  opacity: 1;
}
#whitelistScreen .wl-btn-primary:disabled::before { display: none; }
#whitelistScreen .wl-btn-text { position: relative; z-index: 1; }

/* Spinner state */
#whitelistScreen .wl-btn-primary.is-loading .wl-btn-text { opacity: 0.5; }
#whitelistScreen .wl-btn-spinner {
  display: none;
  position: relative;
  z-index: 1;
}
#whitelistScreen .wl-btn-primary.is-loading .wl-btn-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(26, 26, 46, 0.25);
  border-top-color: #1a1a2e;
  border-radius: 50%;
  animation: wlSpin 700ms linear infinite;
}
@keyframes wlSpin { to { transform: rotate(360deg); } }

/* ═══ Feature pills ═══ */
#whitelistScreen .wl-features {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  padding: 0 4px;
}
#whitelistScreen .wl-feature-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: rgba(139, 92, 246, 0.10);
  border: 1px solid rgba(139, 92, 246, 0.22);
  border-radius: 999px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1;
}
#whitelistScreen .wl-feature-pill svg {
  color: #A78BFA;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   STATE: PENDING / APPROVED / REJECTED — preserved from prior design
   ═══════════════════════════════════════════════════════════════ */

.wl-status-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  margin: 0 var(--screen-padding-x, 16px);
  padding: 36px 22px 28px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
}

.wl-status-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
}

.wl-status-icon svg { width: 30px; height: 30px; }

.wl-status-icon-pending {
  color: #FBBF24;
  background: rgba(251, 191, 36, 0.10);
  animation: wl-pulse 2s ease-in-out infinite;
}

@keyframes wl-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.wl-status-icon-success {
  color: #4ADE80;
  background: rgba(74, 222, 128, 0.12);
}

.wl-status-icon-rejected {
  color: #F87171;
  background: rgba(248, 113, 113, 0.12);
}

.wl-status-title {
  font-size: 18px;
  font-weight: 600;
  color: #F5F3FF;
  margin-top: 4px;
}

.wl-status-text {
  font-size: 13px;
  color: #B8B4CC;
  line-height: 1.5;
  max-width: 320px;
}

.wl-status-meta {
  font-size: 11px;
  color: #6A6580;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

/* Secondary button (retry on rejected) */
.wl-btn-secondary {
  width: 100%;
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.08);
  color: #F5F3FF;
  cursor: pointer;
  margin-top: 12px;
  transition: background 160ms ease;
  -webkit-tap-highlight-color: transparent;
}
.wl-btn-secondary:hover { background: rgba(255, 255, 255, 0.14); }

/* Force-hide for state machine elements */
#whitelistScreen [data-show-state][hidden] {
  display: none !important;
}
