/* =========================================================================
   LD HOME — Estimation Immobilière
   Tunnel d'estimation en 4 étapes + résultat
   Style : éditorial premium, mobile-first
   ========================================================================= */

/* ---------- Reset & root ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

#ld-estimator-root {
  /* Palette */
  --bg: #FAF7F2;
  --bg-card: #FFFFFF;
  --bg-soft: #F4EFE6;
  --ink: #1A2238;
  --ink-soft: #4A5468;
  --ink-mute: #8892A6;
  --line: #E5DFD3;
  --line-strong: #D4CBB8;
  --accent: #B08D57;
  --accent-deep: #8E6E3F;
  --accent-soft: #EFE3CE;
  --success: #2E7D5B;
  --warning: #C97A3F;
  --danger: #B84A3B;

  /* Typography */
  --serif: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
  --sans: 'DM Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;

  /* Layout */
  --radius: 12px;
  --radius-lg: 18px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(26,34,56,0.06), 0 8px 24px rgba(26,34,56,0.04);
  --shadow-lg: 0 4px 12px rgba(26,34,56,0.08), 0 24px 48px rgba(26,34,56,0.08);
  --transition: 220ms cubic-bezier(0.4, 0, 0.2, 1);

  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#ld-estimator-root *, #ld-estimator-root *::before, #ld-estimator-root *::after {
  box-sizing: border-box;
  font-family: inherit;
}

/* ---------- Layout container ---------- */
.lde-container {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

/* ---------- Header ---------- */
.lde-header {
  text-align: center;
  margin-bottom: 32px;
}
.lde-eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-deep);
  margin-bottom: 14px;
  padding: 6px 14px;
  background: var(--accent-soft);
  border-radius: 100px;
}
.lde-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
  color: var(--ink);
}
.lde-title em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent-deep);
}
.lde-subtitle {
  font-size: 16px;
  color: var(--ink-soft);
  max-width: 520px;
  margin: 0 auto;
}

/* ---------- Progress bar ---------- */
.lde-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 0 0 28px;
  padding: 0;
}
.lde-progress-step {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 1;
  max-width: 120px;
}
.lde-progress-step:last-child { flex: 0; }
.lde-progress-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--line-strong);
  color: var(--ink-mute);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
  transition: all var(--transition);
  position: relative;
  z-index: 1;
}
.lde-progress-line {
  flex: 1;
  height: 2px;
  background: var(--line-strong);
  transition: background var(--transition);
}
.lde-progress-step.active .lde-progress-dot {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg-card);
}
.lde-progress-step.done .lde-progress-dot {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.lde-progress-step.done .lde-progress-line {
  background: var(--accent);
}
.lde-progress-label {
  display: none;
}

/* ---------- Card ---------- */
.lde-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: var(--shadow);
}
@media (max-width: 540px) {
  .lde-card { padding: 24px 18px; border-radius: var(--radius); }
  .lde-container { padding: 20px 14px 32px; }
}

.lde-step { display: none; animation: fadeSlide 380ms cubic-bezier(0.16, 1, 0.3, 1); }
.lde-step.active { display: block; }
@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.lde-step-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
  line-height: 1.25;
  margin: 0 0 6px;
  color: var(--ink);
}
.lde-step-desc {
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0 0 24px;
}

/* ---------- Form fields ---------- */
.lde-field {
  margin-bottom: 20px;
}
.lde-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}
@media (max-width: 540px) {
  .lde-field-row { grid-template-columns: 1fr; gap: 0; margin-bottom: 0; }
  .lde-field-row .lde-field { margin-bottom: 20px; }
}

.lde-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
  letter-spacing: 0.005em;
}
.lde-label-helper {
  font-weight: 400;
  color: var(--ink-mute);
  font-size: 12px;
  margin-left: 6px;
}

.lde-input,
.lde-select {
  width: 100%;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--bg-card);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  appearance: none;
}
.lde-input:focus,
.lde-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(176,141,87,0.15);
}
.lde-input::placeholder { color: var(--ink-mute); }

.lde-select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3e%3cpath d='M1 1.5L6 6.5L11 1.5' stroke='%231A2238' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
  cursor: pointer;
}

/* ---------- Autocomplete ---------- */
.lde-autocomplete {
  position: relative;
}
.lde-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  max-height: 280px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}
.lde-suggestions.open { display: block; }
.lde-suggestion {
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  transition: background var(--transition);
}
.lde-suggestion:last-child { border-bottom: none; }
.lde-suggestion:hover,
.lde-suggestion.focus {
  background: var(--bg-soft);
}
.lde-suggestion-cp {
  color: var(--ink-mute);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* ---------- Radio / Choice cards ---------- */
.lde-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.lde-choices.col-2 { grid-template-columns: repeat(2, 1fr); }
.lde-choices.col-3 { grid-template-columns: repeat(3, 1fr); }
.lde-choices.col-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 540px) {
  .lde-choices.col-3, .lde-choices.col-4 { grid-template-columns: repeat(2, 1fr); }
}

.lde-choice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 10px;
  background: var(--bg-card);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  text-align: center;
  transition: all var(--transition);
  user-select: none;
  min-height: 48px;
}
.lde-choice:hover {
  border-color: var(--ink-soft);
  background: var(--bg-soft);
}
.lde-choice input { display: none; }
.lde-choice.selected,
.lde-choice input:checked + span {
  /* fallback */
}
.lde-choice.selected {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg-card);
}
.lde-choice-icon {
  font-size: 16px;
  opacity: 0.7;
}
.lde-choice.selected .lde-choice-icon { opacity: 1; }

/* ---------- Number stepper ---------- */
.lde-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  width: fit-content;
  background: var(--bg-card);
}
.lde-stepper-btn {
  width: 40px;
  height: 44px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  transition: background var(--transition);
}
.lde-stepper-btn:hover { background: var(--bg-soft); }
.lde-stepper-btn:disabled { color: var(--line-strong); cursor: not-allowed; }
.lde-stepper-value {
  width: 50px;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* ---------- Buttons / nav ---------- */
.lde-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.lde-btn {
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 13px 24px;
  border-radius: 100px;
  cursor: pointer;
  transition: all var(--transition);
  border: 1.5px solid transparent;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.lde-btn-primary {
  background: var(--ink);
  color: var(--bg-card);
  border-color: var(--ink);
}
.lde-btn-primary:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.lde-btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: transparent;
}
.lde-btn-ghost:hover {
  color: var(--ink);
  background: var(--bg-soft);
}
.lde-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

/* ---------- Field grouping ---------- */
.lde-fieldset {
  border: none;
  padding: 0;
  margin: 0 0 24px;
}
.lde-fieldset:last-child { margin-bottom: 0; }
.lde-fieldset-title {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  letter-spacing: 0.005em;
}

/* ---------- Checkbox / consent ---------- */
.lde-checkbox-wrap {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
}
.lde-checkbox-wrap input { display: none; }
.lde-checkbox-box {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--line-strong);
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 2px;
  position: relative;
  transition: all var(--transition);
}
.lde-checkbox-wrap input:checked + .lde-checkbox-box {
  background: var(--ink);
  border-color: var(--ink);
}
.lde-checkbox-wrap input:checked + .lde-checkbox-box::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ---------- Errors ---------- */
.lde-error {
  color: var(--danger);
  font-size: 12px;
  margin-top: 6px;
  display: none;
}
.lde-field.has-error .lde-error { display: block; }
.lde-field.has-error .lde-input,
.lde-field.has-error .lde-select { border-color: var(--danger); }

/* ===========================================================
   RESULT SCREEN
   =========================================================== */
.lde-result {
  text-align: center;
}
.lde-result-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-deep);
  margin-bottom: 12px;
}
.lde-result-headline {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(20px, 4vw, 26px);
  color: var(--ink-soft);
  margin: 0 0 8px;
}
.lde-result-price {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(40px, 8vw, 60px);
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin: 8px 0 4px;
  font-variant-numeric: tabular-nums;
}
.lde-result-permsq {
  font-size: 13px;
  color: var(--ink-mute);
  margin-bottom: 32px;
}

/* ---------- Range bar ---------- */
.lde-range {
  margin: 32px 0;
  padding: 0 8px;
}
.lde-range-track {
  position: relative;
  height: 8px;
  background: linear-gradient(90deg,
    var(--accent-soft) 0%,
    var(--accent) 50%,
    var(--accent-soft) 100%);
  border-radius: 100px;
  margin: 24px 0 8px;
}
.lde-range-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ink);
  border: 3px solid var(--bg-card);
  box-shadow: 0 0 0 1.5px var(--ink), 0 4px 8px rgba(26,34,56,0.2);
  z-index: 2;
}
.lde-range-tick {
  position: absolute;
  top: -8px;
  width: 2px;
  height: 24px;
  background: var(--ink);
  opacity: 0.3;
}
.lde-range-tick.left { left: 0; }
.lde-range-tick.right { right: 0; }
.lde-range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  margin-top: 12px;
}
.lde-range-label-bound { font-weight: 500; }
.lde-range-label-bound small {
  display: block;
  font-size: 10px;
  color: var(--ink-mute);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

/* ---------- Confidence gauge ---------- */
.lde-confidence {
  background: var(--bg-soft);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 32px 0;
  display: flex;
  align-items: center;
  gap: 20px;
  text-align: left;
}
@media (max-width: 540px) {
  .lde-confidence { flex-direction: column; text-align: center; padding: 20px 16px; }
}
.lde-gauge {
  flex-shrink: 0;
  width: 90px;
  height: 90px;
  position: relative;
}
.lde-gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.lde-gauge-track { fill: none; stroke: var(--line-strong); stroke-width: 8; }
.lde-gauge-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 800ms cubic-bezier(0.16, 1, 0.3, 1);
}
.lde-gauge-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.lde-confidence-content { flex: 1; }
.lde-confidence-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent-deep);
  margin-bottom: 4px;
}
.lde-confidence-status {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 4px;
}
.lde-confidence-desc {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* ---------- Disclaimer ---------- */
.lde-disclaimer {
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-mute);
  background: var(--bg-soft);
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  margin: 24px 0;
  text-align: left;
}
.lde-disclaimer strong { color: var(--ink-soft); font-weight: 600; }

/* ---------- CTA block ---------- */
.lde-cta {
  background: var(--ink);
  color: var(--bg-card);
  padding: 32px 28px;
  border-radius: var(--radius);
  margin-top: 28px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.lde-cta::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -10%;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(176,141,87,0.18), transparent 70%);
  pointer-events: none;
}
.lde-cta-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(22px, 4vw, 26px);
  line-height: 1.2;
  margin: 0 0 12px;
  position: relative;
}
.lde-cta-desc {
  font-size: 14px;
  color: rgba(250,247,242,0.75);
  max-width: 480px;
  margin: 0 auto 22px;
  position: relative;
}
.lde-cta-btn {
  background: var(--accent);
  color: var(--bg-card);
  border: 1.5px solid var(--accent);
  padding: 14px 28px;
  border-radius: 100px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  position: relative;
  letter-spacing: 0.01em;
}
.lde-cta-btn:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  transform: translateY(-1px);
}

/* ---------- Loading state ---------- */
.lde-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  border-radius: var(--radius-lg);
  z-index: 50;
}
.lde-loading-overlay.active { display: flex; }
.lde-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.lde-loading-text {
  font-size: 14px;
  color: var(--ink-soft);
  font-weight: 500;
}

/* ---------- Footer (estimation) ---------- */
.lde-footer-note {
  text-align: center;
  font-size: 11px;
  color: var(--ink-mute);
  margin-top: 20px;
  letter-spacing: 0.05em;
}

/* ---------- Card position relative for overlays ---------- */
.lde-card { position: relative; }
/* ---------- Selecteur de langue ---------- */
.lde-langswitch {
  display: flex; align-items: center; gap: 6px;
  justify-content: flex-end; margin-bottom: 10px;
  font-family: 'DM Sans', system-ui, sans-serif; font-size: 12.5px; font-weight: 600;
  letter-spacing: .04em;
}
.lde-langswitch .lde-lang {
  color: rgba(26,34,56,.45); text-decoration: none; padding: 3px 7px;
  border-radius: 5px; transition: color .15s, background .15s;
}
.lde-langswitch .lde-lang:hover { color: var(--ink); background: rgba(26,34,56,.06); }
.lde-langswitch .lde-lang.active { color: #fff; background: var(--accent); }
.lde-langswitch .lde-lang-sep { color: rgba(26,34,56,.2); }
