/* ==========================================
   Onboarding
========================================== */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-focus: rgba(37, 99, 235, 0.14);

  --success: #16a34a;
  --success-background: #dcfce7;

  --danger: #dc2626;
  --danger-background: #fef2f2;

  --text: #0f172a;
  --muted: #64748b;

  --surface: #ffffff;
  --background: #f8fafc;
  --border: #e2e8f0;

  --radius: 16px;
  --radius-large: 24px;

  --shadow: 0 20px 60px rgba(15, 23, 42, 0.1);

  --transition: 180ms ease;
}

/* ==========================================
   Reset
========================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;

  min-width: 320px;

  color: var(--text);

  background: radial-gradient(
      circle at top right,
      rgba(37, 99, 235, 0.09),
      transparent 30%
    ),
    var(--background);

  font-family: Vazirmatn, Tahoma, Arial, sans-serif;
  line-height: 1.7;

  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select {
  font: inherit;
}

/* ==========================================
   Page layout
========================================== */

.onboarding {
  min-height: 100vh;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 48px 20px;
}

.onboarding > form {
  width: 100%;

  display: flex;
  justify-content: center;
}

/* ==========================================
   Card
========================================== */

.card {
  position: relative;

  width: min(620px, 100%);

  padding: 44px;

  overflow: hidden;

  background: rgba(255, 255, 255, 0.96);

  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--radius-large);

  box-shadow: var(--shadow);
}

.card::before {
  content: "";

  position: absolute;
  inset: 0;

  pointer-events: none;

  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.45),
    transparent 30%
  );
}

.card > * {
  position: relative;
  z-index: 1;
}

/* ==========================================
   Header
========================================== */

.hero {
  margin-bottom: 34px;
}

h1 {
  margin: 0;

  text-align: center;

  font-size: 32px;
  font-weight: 800;
  line-height: 1.35;
}

.subtitle {
  max-width: 460px;

  margin: 14px auto 0;

  text-align: center;

  color: var(--muted);

  font-size: 15px;
  line-height: 1.9;
}

/* ==========================================
   Fields
========================================== */

.field {
  position: relative;

  margin-bottom: 22px;
}

.field input,
.field select {
  width: 100%;
  height: 60px;

  padding: 21px 18px 7px;

  color: var(--text);
  background-color: var(--surface);

  border: 1px solid var(--border);
  border-radius: var(--radius);

  outline: none;

  transition: border-color var(--transition), box-shadow var(--transition),
    background-color var(--transition);
}

.field input:hover,
.field select:hover {
  border-color: #cbd5e1;
}

.field input:focus,
.field select:focus {
  border-color: var(--primary);

  box-shadow: 0 0 0 4px var(--primary-focus);
}

.field input::placeholder {
  color: transparent;
}

/* ==========================================
   Floating labels
========================================== */

.field label {
  position: absolute;

  top: 18px;
  right: 14px;

  padding: 0 7px;

  color: var(--muted);

  background: var(--surface);

  border-radius: 6px;

  pointer-events: none;

  transition: top var(--transition), color var(--transition),
    font-size var(--transition);
}

.field input:focus + label,
.field input:not(:placeholder-shown) + label,
.field select + label {
  top: -10px;

  color: var(--primary);

  font-size: 12px;
  font-weight: 600;
}

/* ==========================================
   Select
========================================== */
/* 
.field select {
  appearance: none;

  cursor: pointer;

  padding-left: 42px;

  background-image: linear-gradient(45deg, transparent 50%, #64748b 50%),
    linear-gradient(135deg, #64748b 50%, transparent 50%);

  background-position: 20px calc(50% - 3px), 14px calc(50% - 3px);

  background-size: 6px 6px, 6px 6px;

  background-repeat: no-repeat;
} */

/* .field select {
  color: var(--muted);
} */

.field select {
  appearance: none;

  cursor: pointer;

  color: var(--text);

  padding: 21px 18px 7px 42px;
  background-color: var(--surface);

  background-image: linear-gradient(45deg, transparent 50%, #64748b 50%),
    linear-gradient(135deg, #64748b 50%, transparent 50%);

  background-position: 20px calc(50% - 3px), 14px calc(50% - 3px);

  background-size: 6px 6px;

  background-repeat: no-repeat;
}

.field select option {
  color: var(--text);
}

.field select option {
  color: var(--text);
}

/* ==========================================
   Validation
========================================== */

.field-error input,
.field-error select,
.field input[aria-invalid="true"],
.field select[aria-invalid="true"] {
  border-color: var(--danger);

  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.08);
}

.error-message,
.errorlist {
  margin: 8px 0 0;
  padding: 0;

  color: var(--danger);

  font-size: 13px;
  line-height: 1.7;

  list-style: none;
}

.non-field-errors {
  margin-bottom: 24px;
  padding: 14px 16px;

  color: #991b1b;

  background: var(--danger-background);

  border: 1px solid #fecaca;
  border-radius: 12px;

  font-size: 14px;
}

/* ==========================================
   Button
========================================== */

.btn {
  position: relative;

  width: 100%;
  min-height: 54px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 0 28px;

  border: 0;
  border-radius: 14px;

  cursor: pointer;

  text-decoration: none;

  font-size: 15px;
  font-weight: 700;

  transition: background-color var(--transition), box-shadow var(--transition),
    transform var(--transition), opacity var(--transition);
}

.primary {
  color: #ffffff;

  background: linear-gradient(180deg, #3b82f6, var(--primary));

  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.2);
}

.primary:hover:not(:disabled) {
  transform: translateY(-1px);

  background: linear-gradient(180deg, #2563eb, var(--primary-hover));

  box-shadow: 0 16px 32px rgba(37, 99, 235, 0.25);
}

.primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  cursor: not-allowed;

  opacity: 0.7;

  box-shadow: none;
}

/* ==========================================
   Loading state
========================================== */

.btn.loading {
  pointer-events: none;
}

.btn.loading::after {
  content: "";

  position: absolute;

  left: 20px;
  top: 50%;

  width: 18px;
  height: 18px;

  margin-top: -9px;

  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;

  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================
   Success page
========================================== */

.success-card {
  text-align: center;
}

.success-icon {
  width: 82px;
  height: 82px;

  display: flex;
  align-items: center;
  justify-content: center;

  margin: 0 auto 28px;

  color: var(--success);

  background: var(--success-background);

  border-radius: 50%;

  font-size: 40px;
  font-weight: 800;
}

.success-card .subtitle {
  margin-bottom: 30px;
}

.success-card .btn {
  width: auto;
  min-width: 190px;
}

/* ==========================================
   Focus accessibility
========================================== */

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--primary-focus);
  outline-offset: 3px;
}

/* ==========================================
   Responsive
========================================== */

@media (max-width: 768px) {
  .onboarding {
    align-items: flex-start;

    padding: 24px 16px;
  }

  .card {
    padding: 32px 24px;

    border-radius: 20px;

    box-shadow: 0 12px 36px rgba(15, 23, 42, 0.09);
  }

  h1 {
    font-size: 27px;
  }

  .hero {
    margin-bottom: 32px;
  }

  .field {
    margin-bottom: 20px;
  }

  .success-card .btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .onboarding {
    padding: 14px;
  }

  .card {
    padding: 26px 18px;

    border-radius: 16px;
  }

  h1 {
    font-size: 23px;
  }

  .subtitle {
    font-size: 14px;
  }

  .field input,
  .field select {
    height: 56px;
  }

  .btn {
    min-height: 52px;
  }

  .success-icon {
    width: 72px;
    height: 72px;

    font-size: 34px;
  }
}

/* ==========================================
   Reduced motion
========================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;

    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;

    transition-duration: 0.01ms !important;
  }
}

/* ==========================================
   Selection
========================================== */

::selection {
  color: var(--text);

  background: rgba(37, 99, 235, 0.18);
}

.errorlist li {
  margin-top: 4px;
}

.field select:invalid {
  color: var(--muted);
}

.field select option {
  color: var(--text);
}

.field select:disabled {
  color: var(--text);
  opacity: 1;
  -webkit-text-fill-color: var(--text);
}
