/* =============================================
   Luxury Real Estate Quiz — Stylesheet
   Dark theme, gold accents, glass-morphism
   Mobile-first responsive design
   ============================================= */

/* --- Custom Properties --- */
:root {
  /* Colors */
  --bg-primary: #0A0A0F;
  --bg-secondary: #1A1A2E;
  --bg-card: rgba(26, 26, 46, 0.6);
  --bg-card-solid: #1A1A2E;
  --bg-glass: rgba(26, 26, 46, 0.45);
  --border-glass: rgba(201, 169, 110, 0.15);
  --text-primary: #FFFFFF;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.45);
  --gold: #C9A96E;
  --gold-bright: #D4AF37;
  --gold-light: rgba(201, 169, 110, 0.15);
  --gold-glow: rgba(201, 169, 110, 0.35);
  --success: #4CAF50;
  --error: #E53935;
  --error-bg: rgba(229, 57, 53, 0.1);
  --success-bg: rgba(76, 175, 80, 0.1);

  /* Typography */
  --font-heading: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --space-4xl: 96px;

  /* Border radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Transitions */
  --transition-fast: 200ms ease;
  --transition-base: 300ms ease;
  --transition-slow: 500ms ease;

  /* Shadows */
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-gold: 0 4px 20px rgba(201, 169, 110, 0.2);
  --shadow-gold-strong: 0 4px 30px rgba(201, 169, 110, 0.35);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--gold);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--gold-bright);
}

/* --- Typography Scale --- */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 {
  font-size: 1.75rem;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.5rem;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 1.25rem;
}

p {
  color: var(--text-secondary);
  line-height: 1.7;
}

/* --- Layout Container --- */
.container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

/* --- Hero Section --- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: var(--space-2xl) var(--space-md);
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(201, 169, 110, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(201, 169, 110, 0.04) 0%, transparent 50%),
    linear-gradient(180deg, rgba(10, 10, 15, 0) 0%, rgba(10, 10, 15, 0.8) 100%);
  pointer-events: none;
  z-index: 1;
}

.hero__content {
  position: relative;
  z-index: 2;
  max-width: 600px;
}

.hero__badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid rgba(201, 169, 110, 0.3);
  padding: var(--space-sm) var(--space-md);
  border-radius: 100px;
  margin-bottom: var(--space-lg);
}

.hero__headline {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: var(--space-md);
  line-height: 1.15;
}

.hero__subheadline {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-xl);
  line-height: 1.6;
}

.hero__benefits {
  list-style: none;
  margin-bottom: var(--space-xl);
  text-align: left;
  display: inline-block;
}

.hero__benefits li {
  position: relative;
  padding-left: var(--space-lg);
  margin-bottom: var(--space-sm);
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.hero__benefits li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  opacity: 0.7;
}

/* --- CTA Button --- */
.btn-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  min-height: 56px;
  min-width: 220px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: var(--bg-primary);
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-bright) 100%);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-base);
  box-shadow: var(--shadow-gold);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.btn-cta:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-gold-strong);
}

.btn-cta:active {
  transform: scale(0.98);
}

.btn-cta:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-cta--outline {
  background: transparent;
  color: var(--gold);
  border: 1.5px solid var(--gold);
  box-shadow: none;
}

.btn-cta--outline:hover {
  background: var(--gold-light);
  box-shadow: none;
}

/* --- Progress Bar --- */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.05);
  z-index: 100;
}

.progress-bar__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright), var(--gold));
  background-size: 200% 100%;
  border-radius: 0 2px 2px 0;
  transition: width var(--transition-slow);
  animation: progressShimmer 2s linear infinite;
}

@keyframes progressShimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* --- Quiz Section --- */
.quiz-section {
  min-height: 100vh;
  min-height: 100dvh;
  display: none;
  padding: var(--space-3xl) var(--space-md) var(--space-2xl);
}

.quiz-section.active {
  display: block;
}

.quiz-step {
  display: none;
  opacity: 0;
  transform: translate3d(0, 20px, 0);
  transition: opacity var(--transition-base), transform var(--transition-base);
  will-change: transform, opacity;
}

.quiz-step.active {
  display: block;
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.quiz-step.slide-out-left {
  opacity: 0;
  transform: translate3d(-40px, 0, 0);
}

.quiz-step.slide-in-right {
  opacity: 0;
  transform: translate3d(40px, 0, 0);
}

.quiz__step-indicator {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-sm);
}

.quiz__question {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  color: var(--text-primary);
  margin-bottom: var(--space-xl);
}

/* --- Answer Cards (Glass-morphism) --- */
.answer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.answer-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg);
  min-height: 64px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1.5px solid var(--border-glass);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color var(--transition-base), background var(--transition-base),
              transform var(--transition-fast), box-shadow var(--transition-base);
  -webkit-tap-highlight-color: transparent;
}

.answer-card:hover {
  border-color: var(--gold);
  background: rgba(201, 169, 110, 0.08);
  transform: translate3d(0, -2px, 0);
}

.answer-card.selected {
  border-color: var(--gold);
  background: rgba(201, 169, 110, 0.12);
  box-shadow: 0 0 20px rgba(201, 169, 110, 0.15);
}

.answer-card.selected .answer-card__icon {
  color: var(--gold-bright);
}

.answer-card__icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--text-muted);
  transition: color var(--transition-base);
}

.answer-card__text {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
}

.answer-card__desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* --- Quiz Navigation --- */
.quiz__nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  min-height: 48px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.btn-back:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-next {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  min-height: 48px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--bg-primary);
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-bright) 100%);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-base), opacity var(--transition-fast);
  box-shadow: var(--shadow-gold);
  -webkit-tap-highlight-color: transparent;
}

.btn-next:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-gold-strong);
}

.btn-next:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* --- Contact Form --- */
.form-section {
  max-width: 480px;
  margin: 0 auto;
}

.form-section__title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.form-section__subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: var(--space-xl);
}

.form-group {
  margin-bottom: var(--space-lg);
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
  letter-spacing: 0.03em;
}

.form-input {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  min-height: 56px;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-primary);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1.5px solid var(--border-glass);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition-base), box-shadow var(--transition-base),
              background var(--transition-base);
  -webkit-appearance: none;
  appearance: none;
}

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

.form-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 169, 110, 0.12);
  background: rgba(26, 26, 46, 0.7);
}

.form-input.valid {
  border-color: var(--success);
  box-shadow: 0 0 0 3px var(--success-bg);
}

.form-input.invalid {
  border-color: var(--error);
  box-shadow: 0 0 0 3px var(--error-bg);
}

.form-hint {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
  transition: color var(--transition-fast);
}

.form-hint.error {
  color: var(--error);
}

/* --- Privacy Checkbox --- */
.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.checkbox-group input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkbox-custom {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--border-glass);
  border-radius: 6px;
  background: var(--bg-glass);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--transition-fast), background var(--transition-fast);
  margin-top: 1px;
}

.checkbox-group input[type="checkbox"]:checked + .checkbox-custom {
  border-color: var(--gold);
  background: var(--gold);
}

.checkbox-custom::after {
  content: '';
  width: 6px;
  height: 10px;
  border: solid var(--bg-primary);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform var(--transition-fast);
}

.checkbox-group input[type="checkbox"]:checked + .checkbox-custom::after {
  transform: rotate(45deg) scale(1);
}

.checkbox-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.checkbox-label a {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* --- Loading Dots --- */
.loading-dots {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg-primary);
  animation: loadingDot 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes loadingDot {
  0%, 80%, 100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  40% {
    opacity: 1;
    transform: scale(1);
  }
}

/* --- Success Screen --- */
.success-screen {
  display: none;
  text-align: center;
  padding: var(--space-4xl) var(--space-md);
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.success-screen.active {
  display: flex;
}

.success-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-bright) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-xl);
  animation: successPulse 2s ease-in-out infinite;
}

.success-icon svg {
  width: 36px;
  height: 36px;
  stroke: var(--bg-primary);
  stroke-width: 3;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.success-icon svg .checkmark-path {
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: checkmarkDraw 0.6s ease 0.3s forwards;
}

@keyframes successPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(201, 169, 110, 0.3);
  }
  50% {
    box-shadow: 0 0 0 20px rgba(201, 169, 110, 0);
  }
}

@keyframes checkmarkDraw {
  to {
    stroke-dashoffset: 0;
  }
}

.success-screen h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  color: var(--gold);
  margin-bottom: var(--space-md);
}

.success-screen p {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 400px;
  margin: 0 auto;
}

/* --- Scroll Animations --- */
.fade-in {
  opacity: 0;
  transform: translate3d(0, 30px, 0);
  transition: opacity 0.6s ease, transform 0.6s ease;
  will-change: transform, opacity;
}

.fade-in.visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* --- Keyframes --- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translate3d(0, 30px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translate3d(40px, 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translate3d(-40px, 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

.animate-fade-in-up {
  animation: fadeInUp 0.6s ease forwards;
}

.animate-slide-in-right {
  animation: slideInRight 0.4s ease forwards;
}

.animate-slide-in-left {
  animation: slideInLeft 0.4s ease forwards;
}

/* --- Privacy Page --- */
.privacy-page {
  padding: var(--space-2xl) var(--space-md) var(--space-4xl);
}

.privacy-page h1 {
  font-family: var(--font-heading);
  color: var(--gold);
  margin-bottom: var(--space-xl);
}

.privacy-page h2 {
  font-size: 1.15rem;
  color: var(--gold);
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
}

.privacy-page p,
.privacy-page li {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.7;
  margin-bottom: var(--space-sm);
}

.privacy-page ul {
  list-style: none;
  padding-left: var(--space-lg);
}

.privacy-page ul li::before {
  content: '\2014';
  color: var(--gold);
  margin-right: var(--space-sm);
}

.privacy-page .back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--gold);
  font-size: 0.9rem;
  margin-bottom: var(--space-xl);
}

/* --- Decorative Line --- */
.gold-line {
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  border: none;
  margin: var(--space-lg) 0;
}

/* --- Utility: visually hidden --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =============================================
   Responsive — Tablet (768px+)
   ============================================= */
@media (min-width: 768px) {
  h1 {
    font-size: 2.5rem;
  }

  h2 {
    font-size: 1.75rem;
  }

  .hero__headline {
    font-size: 2.75rem;
  }

  .hero__subheadline {
    font-size: 1.15rem;
  }

  .answer-grid {
    grid-template-columns: 1fr 1fr;
  }

  .quiz__question {
    font-size: 1.75rem;
  }

  .container {
    padding: 0 var(--space-xl);
  }

  .success-icon {
    width: 100px;
    height: 100px;
  }

  .success-icon svg {
    width: 44px;
    height: 44px;
  }

  .success-screen h2 {
    font-size: 1.75rem;
  }
}

/* =============================================
   Responsive — Small Mobile (480px and below)
   ============================================= */
@media (max-width: 480px) {
  :root {
    --space-lg: 20px;
    --space-xl: 28px;
  }

  h1 {
    font-size: 1.5rem;
  }

  .hero__headline {
    font-size: 1.6rem;
  }

  .hero__subheadline {
    font-size: 0.9rem;
  }

  .hero__benefits li {
    font-size: 0.85rem;
  }

  .quiz__question {
    font-size: 1.25rem;
  }

  .answer-card {
    padding: var(--space-md);
    min-height: 56px;
  }

  .btn-cta {
    width: 100%;
    min-height: 52px;
  }

  .btn-next {
    flex: 1;
  }
}

/* Large touch targets on mobile */
@media (pointer: coarse) {
  .answer-card {
    min-height: 64px;
  }

  .btn-cta,
  .btn-next,
  .btn-back {
    min-height: 52px;
  }

  .form-input {
    min-height: 56px;
    font-size: 1rem;
  }
}

/* =============================================
   Performance: reduce backdrop-filter on
   low-end mobile (prefers-reduced-motion)
   and narrow screens where GPU cost is high
   ============================================= */
@media (prefers-reduced-motion: reduce) {
  .quiz-step,
  .fade-in {
    transition: none;
    animation: none;
    will-change: auto;
  }

  .answer-card {
    transition: border-color var(--transition-fast), background var(--transition-fast);
  }

  .progress-bar__fill {
    animation: none;
  }

  .success-icon {
    animation: none;
  }
}

@media (max-width: 480px) {
  /* Downgrade backdrop-filter blur on small mobile for perf */
  .answer-card,
  .form-input {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
}
