/* ============================================================
   Shared Auto Cars — Service Appointment Form
   style.css  |  v1.0.0
   Mobile-first, Typeform-inspired UI
   ============================================================ */

/* ── Custom Properties ─────────────────────────────────────── */
:root {
  --red:        #CC0000;
  --red-dark:   #A30000;
  --red-light:  #FF4444;
  --bg:         #F5F5F5;
  --surface:    #FFFFFF;
  --text:       #1A1A1A;
  --text-muted: #6B6B6B;
  --border:     #CCCCCC;
  --border-focus: #CC0000;
  --choice-bg:  #FFFFFF;
  --choice-hover: #FFF0F0;
  --choice-selected: #CC0000;
  --error:      #D32F2F;
  --success:    #2E7D32;
  --btn-back-bg:       #E0E0E0;
  --btn-back-bg-hover: #CCCCCC;
  --btn-back-text:     #444444;
  --summary-border:    #F0D0D0;
  --summary-divider:   #F0EEE8;
  --radius:     8px;
  --radius-lg:  16px;
  --shadow:     0 2px 12px rgba(0,0,0,0.08);
  --transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --font:       'Inter', system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

/* Dark mode — toggled by assets/js/theme.js via <html data-theme="dark">,
   shared localStorage key 'sac-theme' with /linkmaker */
[data-theme="dark"] {
  --red:        #FF5252;
  --red-dark:   #E03A3A;
  --red-light:  #FF7B7B;
  --bg:         #10141C;
  --surface:    #1B2130;
  --text:       #E8ECF4;
  --text-muted: #9AA3B2;
  --border:     #3A4356;
  --border-focus: #FF5252;
  --choice-bg:  #1B2130;
  --choice-hover: #2E1B1E;
  --choice-selected: #FF5252;
  --error:      #FF6B6B;
  --success:    #5DC97B;
  --btn-back-bg:       #2A3040;
  --btn-back-bg-hover: #394154;
  --btn-back-text:     #C6CBD6;
  --summary-border:    #4A3038;
  --summary-divider:   #2A3040;
  --shadow:     0 2px 12px rgba(0,0,0,0.4);
  color-scheme: dark;
}

/* Logo is designed for light backgrounds — sit it on a white chip in dark mode */
[data-theme="dark"] .logo-img {
  background: #FFFFFF;
  padding: 8px 12px;
  border-radius: 10px;
}

/* ── Theme Toggle ───────────────────────────────────────────── */
.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 120;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
  box-shadow: var(--shadow);
  transition: transform 0.15s, border-color 0.2s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.theme-toggle:hover {
  transform: scale(1.05);
  border-color: var(--red);
}

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

html {
  height: 100%;
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  min-height: 100vh;
  overflow: hidden;
  position: relative;
}

/* ── Progress Bar ───────────────────────────────────────────── */
.progress-bar-wrap {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(204, 0, 0, 0.15);
  z-index: 100;
}

.progress-bar {
  height: 100%;
  background: var(--red);
  width: 0%;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 0 2px 2px 0;
}

/* ── Form Container ─────────────────────────────────────────── */
.form-container {
  position: relative;
  width: 100%;
  height: 100dvh;
  height: 100vh;
  overflow: hidden;
}

/* ── Slides ─────────────────────────────────────────────────── */
.slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  opacity: 0;
  transform: translateY(60px);
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.slide.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.slide.slide-out-up {
  opacity: 0;
  transform: translateY(-60px);
  pointer-events: none;
}

.slide-inner {
  width: 100%;
  max-width: 600px;
  padding: 16px 0 48px;
}

/* ── Welcome Slide ──────────────────────────────────────────── */
.welcome-logo {
  margin-bottom: 28px;
  text-align: left;
}

.logo-img {
  height: 52px;
  width: auto;
  object-fit: contain;
}

.logo-text-fallback {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--red);
  letter-spacing: -0.02em;
}

.welcome-title {
  font-size: clamp(2rem, 7vw, 2.75rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 24px;
}

.welcome-sub {
  font-size: clamp(1rem, 3.5vw, 1.125rem);
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 4px;
}

.welcome-highlight {
  font-size: clamp(1.25rem, 4.5vw, 1.5rem);
  font-weight: 700;
  color: var(--red);
  margin-bottom: 4px;
}

.welcome-note {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin-top: 16px;
  margin-bottom: 36px;
  font-style: italic;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 16px 28px;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(204, 0, 0, 0.35);
  -webkit-tap-highlight-color: transparent;
  letter-spacing: -0.01em;
}

.btn-primary:hover {
  background: var(--red-dark);
  box-shadow: 0 6px 24px rgba(204, 0, 0, 0.45);
  transform: translateY(-1px);
}

.btn-primary:active { transform: translateY(0); }

.btn-ok {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 14px 24px;
  font-family: var(--font);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 20px;
  transition: background 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.btn-ok:hover { background: var(--red-dark); transform: translateY(-1px); }
.btn-ok:active { transform: translateY(0); }

.btn-check {
  font-size: 0.875rem;
  opacity: 0.9;
}

.btn-hint {
  font-size: 0.75rem;
  font-weight: 400;
  opacity: 0.65;
  color: inherit;
  margin-left: 4px;
}

/* ── Question Elements ──────────────────────────────────────── */
.q-number {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--red);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.q-arrow {
  font-size: 1rem;
}

.q-label {
  display: block;
  font-size: clamp(1.25rem, 4.5vw, 1.625rem);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: 20px;
  letter-spacing: -0.02em;
}

.q-hint-text {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.55;
}

.req {
  color: var(--red);
  font-size: 0.875em;
}

.q-input {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--border);
  border-radius: 0;
  padding: 10px 4px 12px;
  font-family: var(--font);
  font-size: clamp(1rem, 3.5vw, 1.25rem);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.q-input::placeholder { color: var(--text-muted); opacity: 0.6; }
.q-input:focus { border-bottom-color: var(--red); }

/* Remove number input arrows */
.q-input[type="number"]::-webkit-inner-spin-button,
.q-input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }
.q-input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

.q-error {
  font-size: 0.875rem;
  color: var(--error);
  margin-top: 8px;
  min-height: 20px;
  font-weight: 500;
}

/* ── Choice Buttons (Service Type) ─────────────────────────── */
.choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 8px;
}

.choice-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--choice-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.18s, background 0.18s, color 0.18s, transform 0.12s;
  -webkit-tap-highlight-color: transparent;
  box-shadow: var(--shadow);
}

.choice-btn:hover {
  border-color: var(--red);
  background: var(--choice-hover);
  transform: translateX(4px);
}

.choice-btn.selected {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
  box-shadow: 0 4px 16px rgba(204, 0, 0, 0.3);
}

.choice-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  border: 1.5px solid currentColor;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  opacity: 0.7;
}

.choice-btn.selected .choice-key {
  border-color: rgba(255,255,255,0.6);
  opacity: 1;
}

/* ── Date Inputs ────────────────────────────────────────────── */
.date-picker-wrap {
  max-width: 280px;
  margin-bottom: 4px;
}

.date-picker-input {
  font-weight: 600;
  color: var(--red);
  cursor: pointer;
}

.date-picker-input::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.85;
}

.date-inputs {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 4px;
}

.date-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.date-input {
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--border);
  border-radius: 0;
  padding: 8px 4px 10px;
  font-family: var(--font);
  font-size: clamp(1rem, 4vw, 1.375rem);
  font-weight: 600;
  color: var(--red);
  outline: none;
  width: 60px;
  text-align: center;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  -moz-appearance: textfield;
  appearance: none;
}

.date-input--year { width: 88px; }

.date-input::-webkit-inner-spin-button,
.date-input::-webkit-outer-spin-button { -webkit-appearance: none; }

.date-input::placeholder { color: var(--text-muted); opacity: 0.4; font-weight: 400; }
.date-input:focus { border-bottom-color: var(--red); }

.date-sep {
  font-size: 1.5rem;
  font-weight: 300;
  color: var(--text-muted);
  padding-bottom: 10px;
}

/* ── Thank You Slide ────────────────────────────────────────── */
.thankyou-icon {
  width: 72px;
  height: 72px;
  color: var(--red);
  margin-bottom: 24px;
}

.thankyou-icon svg { width: 100%; height: 100%; }

.ty-title {
  font-size: clamp(1.75rem, 6vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 16px;
}

.ty-body {
  font-size: clamp(1rem, 3.5vw, 1.125rem);
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 20px;
}

.ty-contact {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.8;
  margin-bottom: 24px;
}

.ty-phone {
  color: var(--red);
  font-weight: 700;
  text-decoration: none;
  font-size: 1.0625rem;
}

.ty-phone:hover { text-decoration: underline; }

.ty-summary {
  background: var(--surface);
  border: 1.5px solid var(--summary-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.ty-summary-row {
  display: flex;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--summary-divider);
  font-size: 0.9375rem;
}

.ty-summary-row:last-child { border-bottom: none; }

.ty-summary-label {
  font-weight: 600;
  color: var(--red);
  min-width: 120px;
  flex-shrink: 0;
  font-size: 0.875rem;
}

.ty-summary-value {
  color: var(--text);
}

.ty-footer {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-style: italic;
}

.submit-status {
  margin-top: 12px;
  font-size: 0.875rem;
  font-weight: 500;
  min-height: 20px;
}

.submit-status.success { color: var(--success); }
.submit-status.error   { color: var(--error); }

/* ── Dynamic name highlight ─────────────────────────────────── */
.dyn-name, .dyn-reg {
  color: var(--red);
}

/* ── Nav Arrows (desktop) ───────────────────────────────────── */
.btn-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

.btn-row .btn-ok { margin-top: 0; }

.btn-row-solo { justify-content: flex-start; }

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--btn-back-bg);
  color: var(--btn-back-text);
  border: none;
  border-radius: var(--radius);
  padding: 14px 22px;
  font-family: var(--font);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.btn-back:hover { background: var(--btn-back-bg-hover); transform: translateY(-1px); }
.btn-back:active { transform: translateY(0); }

.nav-arrows {
  position: fixed;
  right: 20px;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
}

.nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  box-shadow: var(--shadow);
}

.nav-btn svg { width: 16px; height: 16px; }

.nav-btn:hover {
  border-color: var(--red);
  color: var(--red);
  background: var(--choice-hover);
}

/* ── Animations ─────────────────────────────────────────────── */
@keyframes slideInUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes checkPop {
  0%   { transform: scale(0); opacity: 0; }
  70%  { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

.thankyou-icon.animate svg {
  animation: checkPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (min-width: 640px) {
  .slide { padding: 32px 40px; }
  .choices { gap: 12px; }
  .nav-arrows { right: 28px; bottom: 32px; }
}

@media (min-width: 1024px) {
  .slide { padding: 40px 60px; }
}

/* ── Reduced Motion ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ── Focus Visible ──────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ── Loading state ──────────────────────────────────────────── */
.btn-ok.loading, .btn-primary.loading {
  opacity: 0.7;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-ok.loading::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 8px;
}

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