/* ═══════════════════════════════════════════
   DrivePersona — Shared Design System
   ═══════════════════════════════════════════ */

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

:root {
  --bg-deep: #0a0a0f;
  --bg-card: #12121a;
  --bg-elevated: #1a1a28;
  --accent: #e8543e;
  --accent-hover: #ff6b52;
  --accent-glow: rgba(232, 84, 62, 0.15);
  --accent-glow-strong: rgba(232, 84, 62, 0.25);
  --text-primary: #f0ede8;
  --text-secondary: #8a8696;
  --text-muted: #5a5668;
  --border: rgba(255,255,255,0.06);
  --border-hover: rgba(255,255,255,0.12);
  --success: #27ae60;
  --radius: 12px;
  --radius-lg: 20px;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Grain texture overlay */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1000;
}

/* ═══ SHARED NAV ═══ */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 48px;
  position: relative;
  z-index: 10;
}

.logo {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  text-decoration: none;
}

.logo span { color: var(--accent); }

.nav-tag {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 500;
}

/* ═══ BUTTONS ═══ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 36px;
  border: none;
  border-radius: var(--radius);
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  letter-spacing: -0.3px;
}

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 0 30px var(--accent-glow);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 50px var(--accent-glow-strong);
  transform: translateY(-2px);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-hover);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-sm {
  padding: 10px 20px;
  font-size: 14px;
}

/* ═══ QUIZ PAGE ═══ */
.quiz-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 24px 80px;
}

.quiz-progress {
  display: flex;
  gap: 6px;
  margin-bottom: 48px;
}

.quiz-progress-bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.4s ease;
}

.quiz-progress-bar.active {
  background: var(--accent);
}

.quiz-progress-bar.done {
  background: var(--accent);
  opacity: 0.5;
}

.quiz-question-num {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 16px;
}

.quiz-question {
  font-family: 'Syne', sans-serif;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -1px;
  margin-bottom: 40px;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.25s ease;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.quiz-option:hover {
  border-color: var(--border-hover);
  background: var(--bg-elevated);
  color: var(--text-primary);
  transform: translateX(4px);
}

.quiz-option.selected {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--text-primary);
}

.quiz-option-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  flex-shrink: 0;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quiz-option.selected .quiz-option-dot {
  border-color: var(--accent);
  background: var(--accent);
}

.quiz-option.selected .quiz-option-dot::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: white;
}

.quiz-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 48px;
}

.quiz-loading {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  gap: 24px;
  text-align: center;
}

.quiz-loading.visible { display: flex; }

.quiz-loading h2 {
  font-family: 'Syne', sans-serif;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -1px;
}

.quiz-loading p {
  color: var(--text-secondary);
  font-size: 17px;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ═══ RESULTS PAGE ═══ */
.results-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 24px 80px;
}

.results-header {
  text-align: center;
  margin-bottom: 64px;
}

.results-persona-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 4px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 16px;
}

.results-persona-title {
  font-family: 'Syne', sans-serif;
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 800;
  letter-spacing: -2px;
  line-height: 1.1;
  margin-bottom: 20px;
}

.results-persona-desc {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 32px;
  line-height: 1.7;
  font-weight: 300;
}

/* Trait bars */
.trait-bars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  max-width: 800px;
  margin: 0 auto 32px;
}

.trait-bar {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px 18px;
}

.trait-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
}

.trait-bar-name {
  color: var(--text-secondary);
  font-weight: 500;
}

.trait-bar-value {
  color: var(--accent);
  font-family: 'Syne', sans-serif;
  font-weight: 700;
}

.trait-bar-track {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.trait-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 1s ease;
}

/* Car cards grid */
.cars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
  margin-top: 48px;
}

.car-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: all 0.3s ease;
}

.car-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.car-card-image {
  width: 100%;
  height: 220px;
  background: linear-gradient(135deg, var(--bg-elevated), var(--bg-card));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.car-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.car-card:hover .car-card-image img {
  transform: scale(1.05);
}

.car-card-image .placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 14px;
}

.car-card-image .placeholder-icon {
  font-size: 48px;
  opacity: 0.3;
}

.car-card-match {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--accent);
  color: white;
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 8px;
  z-index: 2;
}

.car-card-body {
  padding: 24px;
}

.car-card-year {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 6px;
}

.car-card-name {
  font-family: 'Syne', sans-serif;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 12px;
  line-height: 1.2;
}

.car-card-specs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.car-card-spec {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.car-card-spec-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.car-card-spec-value {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.car-card-colors {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.color-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: default;
  transition: transform 0.2s;
}

.color-dot:hover {
  transform: scale(1.3);
}

.car-card-blurb {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  font-style: italic;
  font-weight: 300;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

/* Results actions */
.results-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 48px;
  flex-wrap: wrap;
}

/* Section heading for cars */
.cars-section-title {
  font-family: 'Syne', sans-serif;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
  text-align: center;
  margin-bottom: 8px;
}

.cars-section-sub {
  text-align: center;
  color: var(--text-secondary);
  font-size: 16px;
  font-weight: 300;
  margin-bottom: 32px;
}

/* Footer */
.footer {
  padding: 40px 48px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer p {
  font-size: 13px;
  color: var(--text-muted);
}

/* ═══ SHARE TOAST ═══ */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--accent);
  color: white;
  padding: 14px 28px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 14px;
  z-index: 9999;
  transition: transform 0.3s ease;
  pointer-events: none;
}

.toast.visible {
  transform: translateX(-50%) translateY(0);
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
  .nav { padding: 20px 24px; }

  .quiz-container { padding: 16px 20px 60px; }
  .quiz-question { font-size: 26px; }
  .quiz-option { padding: 16px 18px; font-size: 15px; }

  .results-container { padding: 16px 20px 60px; }
  .cars-grid { grid-template-columns: 1fr; }

  .trait-bars { grid-template-columns: 1fr 1fr; }

  .footer {
    padding: 32px 24px;
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .results-actions {
    flex-direction: column;
    align-items: center;
  }
}
