/*
 * GoWay driver signup — standalone page styled to match gowayapp.net.
 * Tokens are lifted from goway-front/src/index.css light (:root) set: clean
 * near-white canvas, deeper logo greens that clear WCAG AA on white.
 */

:root {
  --background: oklch(0.992 0.003 160);
  --foreground: oklch(0.21 0.02 165);
  --card: oklch(1 0 0);
  --muted-foreground: oklch(0.48 0.015 165);
  --brand: oklch(0.53 0.15 152);
  --brand-bright: oklch(0.63 0.17 146);
  --brand-deep: oklch(0.43 0.12 153);
  --brand-foreground: oklch(0.99 0.01 150);
  --destructive: oklch(0.58 0.22 27);
  --border: oklch(0.9 0.01 165);
  --input: oklch(0.985 0.004 160);
  --ring: oklch(0.55 0.15 151);

  --radius: 0.75rem;
  --font-sans: 'Geist', 'Readex Pro', system-ui, sans-serif;
  --font-heading: 'Readex Pro', 'Geist', system-ui, sans-serif;
}

* { box-sizing: border-box; border-color: var(--border); }

/* hidden must beat any display set by layout rules (e.g. the step-2 grid) */
[hidden] { display: none !important; }

html { color-scheme: light; }

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-heading); /* Arabic-first page: Readex Pro leads */
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.page {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------- Decorative background ---------- */

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Faint brand-tinted dot grid, fading out toward the center so the form stays calm */
.bg-grid {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(
    color-mix(in oklch, var(--brand) 22%, transparent) 1px,
    transparent 1px
  );
  background-size: 26px 26px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 42%, transparent 30%, black 100%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 42%, transparent 30%, black 100%);
}

/* Dashed trip route with pins */
.bg-route {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: color-mix(in oklch, var(--brand) 45%, transparent);
}

.route-path { opacity: 0.55; }

.pin-halo { fill: color-mix(in oklch, var(--brand) 12%, transparent); }
.pin-dot  { fill: color-mix(in oklch, var(--brand) 55%, transparent); }
.pin-mark { fill: color-mix(in oklch, var(--brand) 30%, transparent); }
.pin-hole { fill: var(--background); }

/* Keep the busy pattern light on small screens */
@media (max-width: 640px) {
  .bg-route { opacity: 0.6; }
}

/* ---------- Header / footer ---------- */

.site-header {
  display: flex;
  justify-content: center;
  padding: 1.25rem 1.5rem;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: inherit;
}

.logo img {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.9rem;
  object-fit: cover;
  box-shadow: 0 0 0 1px oklch(0 0 0 / 10%);
}

.wordmark {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.wordmark .brand { color: var(--brand); }

.site-footer {
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--muted-foreground);
  font-size: 0.85rem;
}

/* ---------- Layout ---------- */

.main {
  flex: 1;
  width: 100%;
  max-width: 34rem;
  margin-inline: auto;
  padding: 1rem 1.25rem 3rem;
  transition: max-width 0.3s ease;
}

/* Step 2 lays fields out side by side — give the card room to breathe */
body.is-step-2 .main { max-width: 46rem; }

.intro { text-align: center; margin-bottom: 1.75rem; }

.intro h1 {
  font-family: var(--font-heading);
  font-size: clamp(1.6rem, 5vw, 2.1rem);
  font-weight: 700;
  margin: 0 0 0.5rem;
}

.text-brand-gradient {
  background: linear-gradient(100deg, var(--brand-bright), var(--brand));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.intro p { margin: 0; color: var(--muted-foreground); }

/* ---------- Step indicator ---------- */

.steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.step-dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: color-mix(in oklch, var(--foreground) 18%, transparent);
  transition: background 0.3s, box-shadow 0.3s;
}

.step-dot.is-active {
  background: var(--brand);
  box-shadow: 0 0 0 4px color-mix(in oklch, var(--brand) 22%, transparent);
}

.step-line {
  width: 3.5rem;
  height: 2px;
  border-radius: 1px;
  background: color-mix(in oklch, var(--foreground) 14%, transparent);
}

/* ---------- Back button (step 2) ---------- */

.back {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 1rem;
  padding: 0;
  font: inherit;
  font-size: 0.85rem;
  color: var(--muted-foreground);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.15s;
}

.back:hover { color: var(--foreground); }

.back svg { width: 1rem; height: 1rem; }

/* ---------- Step 2: horizontal layout ---------- */

/* Vehicle type + category sit side by side (on mobile too); the back button
   and the docs section span the full row. */
.step[data-step="2"] {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 0.9rem;
  align-items: start;
}

.step[data-step="2"] > .back,
.step[data-step="2"] > #docs-section {
  grid-column: 1 / -1;
}

/* Until the category select is revealed, the type select spans the row */
.step[data-step="2"]:has(> #category-field[hidden]) > .field {
  grid-column: 1 / -1;
}

/* ---------- Progressive reveal ---------- */

.docs-title {
  margin: 0 0 0.3rem;
  font-weight: 600;
}

/* Supported-files note under the docs title */
.docs-hint {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--muted-foreground);
}

@media (prefers-reduced-motion: no-preference) {
  .reveal-item {
    opacity: 0;
    transform: translateY(14px);
    transition:
      opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
      transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .reveal-item.is-in {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Card ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.8);
  padding: 1.75rem 1.5rem;
  box-shadow: 0 14px 40px -24px color-mix(in oklch, var(--foreground) 25%, transparent);
}

/* ---------- Fields ---------- */

.field { margin-bottom: 1.25rem; }

.field > label,
.upload-label {
  display: block;
  font-weight: 500;
  font-size: 0.95rem;
  margin-bottom: 0.45rem;
}

input[type="text"],
input[type="tel"],
select {
  width: 100%;
  padding: 0.7rem 0.9rem;
  font: inherit;
  color: var(--foreground);
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input::placeholder { color: color-mix(in oklch, var(--muted-foreground) 75%, transparent); }

input[dir="ltr"] { text-align: start; }

select { appearance: auto; cursor: pointer; }

select:disabled { opacity: 0.55; cursor: not-allowed; }

input:focus-visible,
select:focus-visible {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 30%, transparent);
}

.is-invalid input,
.is-invalid select,
.is-invalid .dropzone {
  border-color: var(--destructive);
}

/* ---------- Uploads ---------- */

.uploads {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 0.9rem;
  margin-bottom: 1.4rem;
}

/* Uploads stay two-across even on phones — just tighten the gaps */
@media (max-width: 480px) {
  .uploads { gap: 0.75rem 0.6rem; }
  .step[data-step="2"] { column-gap: 0.6rem; }
}

.upload-field { margin-bottom: 0; }

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 6.5rem;
  padding: 0.9rem 0.75rem;
  text-align: center;
  cursor: pointer;
  color: var(--muted-foreground);
  background: color-mix(in oklch, var(--input) 60%, transparent);
  border: 1.5px dashed color-mix(in oklch, var(--foreground) 22%, transparent);
  border-radius: var(--radius);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  overflow: hidden;
}

.dropzone:hover {
  border-color: var(--brand);
  color: var(--foreground);
}

.dropzone .icon { width: 1.5rem; height: 1.5rem; }

.dz-text { font-size: 0.82rem; }

.dropzone .preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.85;
}

/* Uploaded-state checkmark badge, floating over the zone's corner */
.dz-check {
  position: absolute;
  top: 0.45rem;
  inset-inline-end: 0.45rem;
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  color: var(--brand-foreground);
  background: var(--brand);
  box-shadow: 0 2px 8px -2px color-mix(in oklch, var(--brand) 60%, transparent);
}

.dz-check svg { width: 0.9rem; height: 0.9rem; }

@media (prefers-reduced-motion: no-preference) {
  .dz-check { animation: pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
  @keyframes pop {
    from { transform: scale(0.4); opacity: 0; }
    to   { transform: none; opacity: 1; }
  }
}

/* When a file is chosen the zone shows the preview + brand edge */
.upload-field.has-file .dropzone {
  border-style: solid;
  border-color: color-mix(in oklch, var(--brand) 55%, transparent);
}

/* PDFs have no thumbnail — tint the zone brand-green instead */
.upload-field.is-pdf .dropzone {
  color: var(--brand);
  background: color-mix(in oklch, var(--brand) 7%, transparent);
}


/* ---------- Errors ---------- */

.error {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
  color: var(--destructive);
}

.form-error { margin-bottom: 1rem; font-size: 0.9rem; }

/* ---------- Submit ---------- */

.submit {
  width: 100%;
  padding: 0.8rem 1rem;
  font: inherit;
  font-weight: 600;
  color: var(--brand-foreground);
  background: var(--brand);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: filter 0.15s, transform 0.05s;
}

.submit:hover { filter: brightness(1.08); }
.submit:active { transform: translateY(1px); }

.submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  filter: none;
}

.submit:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 40%, transparent);
}

/* ---------- Success panel ---------- */

.success { text-align: center; }

.success-icon {
  width: 3rem;
  height: 3rem;
  color: var(--brand);
  margin-bottom: 0.5rem;
}

.success h2 {
  font-family: var(--font-heading);
  margin: 0 0 0.4rem;
}

.success p { margin: 0; color: var(--muted-foreground); }

@media (prefers-reduced-motion: no-preference) {
  .success { animation: rise 0.5s cubic-bezier(0.16, 1, 0.3, 1); }
  @keyframes rise {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: none; }
  }
}
