@import './theme.css';

/* Native shell styles. Every value below resolves to a token from theme.css —
   no raw hex, so the whole shell rethemes from one place. All screens share
   these classes, so a change here cascades to setup, login, loading, biometric. */

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

html, body, #root {
  height: 100%;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
}

/* ── App shell / splash ─────────────────────────────────────────── */

.setup-root,
.app-splash {
  min-height: 100dvh;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.setup-root {
  padding: var(--space-5) var(--space-4);
}

.setup-card {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.setup-card.center {
  align-items: center;
  text-align: center;
}

/* ── Brand block ────────────────────────────────────────────────── */

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-4) 0 var(--space-2);
}

.logo-mark {
  width: 56px;
  height: 56px;
  border-radius: 26%;
  overflow: hidden;
  display: block;
}

.logo-mark svg {
  width: 100%;
  height: 100%;
  display: block;
}

.wordmark {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

.wordmark b {
  color: var(--color-primary);
  font-weight: 800;
}

.setup-title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.setup-subtitle {
  text-align: center;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* Accent-colored icon wrapper (e.g. biometric fingerprint) */
.icon-accent {
  color: var(--color-primary);
}

/* ── Choice "doors" (first-run mode picker) ─────────────────────── */

.choices {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.door {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  text-align: left;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  color: var(--color-text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.05s;
  -webkit-tap-highlight-color: transparent;
}

.door:hover {
  border-color: var(--color-border-strong);
}

.door:active {
  transform: scale(0.99);
}

.door:focus-visible {
  outline: 2px solid var(--color-ring);
  outline-offset: 2px;
}

.door__icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--color-primary-tint);
  color: var(--color-primary);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.door__icon svg {
  width: 21px;
  height: 21px;
}

.door__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.door__title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--color-text);
}

.door__desc {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

.door__chev {
  margin-left: auto;
  color: var(--color-text-faint);
  font-size: 1.25rem;
  line-height: 1;
}

/* ── Form ───────────────────────────────────────────────────────── */

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.form-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.form-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 0.9375rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
}

.form-input::placeholder {
  color: var(--color-text-faint);
}

.form-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-ring);
}

.form-input:disabled {
  opacity: 0.5;
}

.form-error {
  font-size: 0.8125rem;
  color: var(--color-danger);
  line-height: 1.5;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--color-text-faint);
  line-height: 1.5;
}

/* ── Buttons ────────────────────────────────────────────────────── */

.btn-primary,
.btn-secondary {
  width: 100%;
  padding: 0.8125rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-on-primary);
  border: none;
  font-weight: 700;
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
}

.btn-primary:active:not(:disabled) {
  background: var(--color-primary-active);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  color: var(--color-text-dim);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--color-border-strong);
  color: var(--color-text);
}

.btn-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.form-input:focus-visible {
  outline: 2px solid var(--color-ring);
  outline-offset: 2px;
}

/* ── Footer note ────────────────────────────────────────────────── */

.setup-footer {
  font-size: 0.75rem;
  color: var(--color-text-faint);
  text-align: center;
  line-height: 1.6;
  padding: 0 var(--space-1);
}

.setup-footer strong {
  color: var(--color-text-muted);
  font-weight: 500;
}

/* ── Spinner ────────────────────────────────────────────────────── */

.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 1.6s;
  }
}

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