/* ======================================================================== *
 * Odhad ceny nemovitosti — UI v2                                         *
 * Drop-in Flask/Jinja + vanilla CSS implementation                        *
 * ======================================================================== */

:root {
  --estimate-navy-950: #001d45;
  --estimate-navy-900: #002b58;
  --estimate-navy-800: #003d70;
  --estimate-blue-600: #0078e8;
  --estimate-blue-500: #118bff;
  --estimate-blue-100: #eaf5ff;
  --estimate-ink: #061d4d;
  --estimate-muted: #657189;
  --estimate-border: #d8e0eb;
  --estimate-surface: #ffffff;
  --estimate-background: #00345f;
  --estimate-danger: #c91f2d;
  --estimate-shadow: 0 28px 90px rgba(0, 19, 51, .22);
  --estimate-radius-xl: 34px;
  --estimate-radius-lg: 20px;
  --estimate-radius-md: 14px;
}

.estimate-page,
.estimate-page * { box-sizing: border-box; }

.estimate-page {
  min-height: 100vh;
  padding: clamp(16px, 3vw, 34px) 12px;
  color: var(--estimate-ink);
  background:
    radial-gradient(circle at 50% 0%, rgba(20, 139, 255, .22), transparent 35%),
    linear-gradient(135deg, #003b6a 0%, #002a51 50%, #004d78 100%);
  font-family: inherit;
}

.estimate-shell { width: min(100%, 680px); margin-inline: auto; }

.estimate-card {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: var(--estimate-radius-xl);
  background: rgba(255, 255, 255, .985);
  box-shadow: var(--estimate-shadow);
}

/* ---- Progress ---- */
.estimate-progress { padding: clamp(18px, 3vw, 28px) clamp(16px, 3vw, 36px) 4px; }
.progress-list { display: grid; grid-template-columns: auto 1fr auto 1fr auto; align-items: start; gap: 8px; margin: 0; padding: 0; list-style: none; }
.progress-item { display: grid; justify-items: center; gap: 8px; min-width: 72px; color: #a2aab8; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; font-size: 11px; }
.progress-bubble { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: #edf0f5; color: #8790a1; font-size: 18px; transition: .25s ease; }
.progress-item.is-active,
.progress-item.is-complete { color: var(--estimate-ink); }
.progress-item.is-active .progress-bubble,
.progress-item.is-complete .progress-bubble { color: #fff; background: linear-gradient(135deg, var(--estimate-navy-800), var(--estimate-blue-600)); box-shadow: 0 8px 18px rgba(0, 111, 219, .22); }
.progress-item.is-complete .progress-bubble::after { content: "\2713"; font-size: 19px; }
.progress-item.is-complete .progress-bubble { font-size: 0; }
.progress-rail { display: flex; flex-direction: column; align-items: center; gap: 6px; padding-top: 14px; color: var(--estimate-blue-600); font-weight: 800; font-size: 12px; }
.progress-line { position: relative; width: 100%; height: 3px; overflow: hidden; border-radius: 99px; background: #dfe4eb; }
.progress-percent { text-align: center; order: -1; }
.progress-line-fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; background: var(--estimate-blue-600); transition: width .3s ease; }
.progress-rail.is-active .progress-line-fill { width: 100%; }

/* ---- Steps ---- */
.estimate-step { padding: clamp(18px, 3vw, 30px) clamp(16px, 3vw, 36px) clamp(22px, 4vw, 34px); }
.estimate-step[hidden] { display: none !important; }
.step-heading { margin-bottom: 20px; }
.step-kicker { margin: 0 0 6px; color: var(--estimate-blue-600); font-weight: 900; letter-spacing: .09em; text-transform: uppercase; font-size: 12px; }
.step-heading h1,
.result-hero h1 { margin: 0; color: var(--estimate-ink); font-size: clamp(22px, 3.5vw, 30px); line-height: 1.12; }
.step-heading > p:last-child { margin: 8px 0 0; color: var(--estimate-muted); font-size: 15px; line-height: 1.5; }

.form-alert { margin: 12px clamp(16px, 3vw, 36px) 0; padding: 10px 14px; border: 1px solid #ffbbc1; border-radius: 10px; color: #7a1220; background: #fff0f2; font-size: 14px; }

/* ---- Mode Switch ---- */
.mode-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.mode-button { min-height: 56px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 16px; border: 1px solid var(--estimate-border); border-radius: var(--estimate-radius-md); color: #5e7084; background: #fff; font: inherit; font-weight: 800; font-size: 15px; cursor: pointer; transition: .2s ease; }
.mode-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.mode-button:hover { border-color: #9fc8f3; transform: translateY(-1px); }
.mode-button.is-active { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--estimate-navy-900), var(--estimate-navy-800) 54%, var(--estimate-blue-600)); box-shadow: 0 10px 20px rgba(0, 50, 99, .18); }

/* ---- Address panels ---- */
.address-panel { position: relative; margin-bottom: 16px; }
.field-grid { display: grid; gap: 12px; }
.field-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-group { min-width: 0; }
.field-group--wide { grid-column: span 1; }
.field-label { display: block; margin: 0 0 6px; font-size: 14px; font-weight: 800; color: var(--estimate-ink); }
.field-label span { color: var(--estimate-danger); }
.field-caption { display: block; margin: -3px 0 8px; color: var(--estimate-muted); font-size: 13px; }
.field-help { margin: 6px 2px 0; color: var(--estimate-muted); font-size: 12px; }

/* ---- Form inputs ---- */
.estimate-page input:not([type="checkbox"]):not([type="radio"]),
.estimate-page select,
.estimate-page textarea {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--estimate-border);
  border-radius: 10px;
  outline: none;
  color: var(--estimate-ink);
  background: #fff;
  font: inherit;
  font-size: 15px;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.estimate-page input::placeholder { color: #8b96a9; }
.estimate-page input:focus,
.estimate-page select:focus,
.estimate-page textarea:focus { border-color: var(--estimate-blue-500); box-shadow: 0 0 0 4px rgba(17, 139, 255, .12); }
.estimate-page [aria-invalid="true"] { border-color: var(--estimate-danger) !important; box-shadow: 0 0 0 4px rgba(201, 31, 45, .1) !important; }

.input-with-icon { position: relative; }
.input-with-icon > svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; fill: none; stroke: #647086; stroke-width: 1.8; pointer-events: none; }
.input-with-icon > input { padding-left: 44px !important; }
.input-status { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--estimate-muted); font-size: 12px; }

/* ---- Suggestions ---- */
.suggestions { position: absolute; z-index: 20; top: calc(100% - 22px); left: 0; right: 0; max-height: 240px; overflow-y: auto; border: 1px solid var(--estimate-border); border-radius: 10px; background: #fff; box-shadow: 0 14px 35px rgba(0, 29, 69, .16); }
.suggestion-item { display: block; width: 100%; padding: 10px 14px; border: 0; border-bottom: 1px solid #eef1f5; text-align: left; color: var(--estimate-ink); background: transparent; cursor: pointer; font: inherit; font-size: 14px; }
.suggestion-item:last-child { border-bottom: 0; }
.suggestion-item:hover,
.suggestion-item[aria-selected="true"] { background: var(--estimate-blue-100); }
.suggestion-item strong { display: block; }
.suggestion-item span { display: block; margin-top: 2px; color: var(--estimate-muted); font-size: 12px; }

/* ---- Trust / Privacy notes ---- */
.trust-note,
.privacy-note { display: flex; align-items: center; gap: 14px; margin-top: 20px; padding: 16px 18px; border: 1.5px solid var(--estimate-blue-500); border-radius: var(--estimate-radius-md); background: linear-gradient(135deg, #fff, #edf7ff); }
.trust-note svg,
.privacy-note svg { flex: 0 0 auto; width: 32px; height: 32px; fill: none; stroke: var(--estimate-blue-600); stroke-width: 1.7; }
.trust-note p,
.privacy-note p { margin: 0; font-size: 14px; line-height: 1.45; }

/* ---- Property Summary ---- */
.property-summary { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; padding: 16px; border: 1px solid var(--estimate-border); border-radius: var(--estimate-radius-md); background: #fff; }
.property-summary > svg { width: 36px; height: 36px; fill: none; stroke: var(--estimate-blue-600); stroke-width: 1.7; flex: 0 0 auto; }
.property-summary span { display: block; margin-bottom: 4px; font-weight: 800; font-size: 13px; }
.property-summary strong { display: block; font-size: 15px; text-transform: uppercase; }
.property-summary p { margin: 3px 0 0; color: #26354f; font-size: 13px; }

/* ---- Detail Panels ---- */
.detail-panel { margin-top: 16px; padding: 16px 18px; border: 1px solid #cfe4f8; border-radius: var(--estimate-radius-lg); background: #f8fcff; }
.detail-panel h2 { margin: 0 0 14px; font-size: 17px; }
.choice-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 14px 0 0; padding: 0; border: 0; }
.choice-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choice-grid legend { grid-column: 1 / -1; margin-bottom: 4px; font-weight: 800; font-size: 14px; }
.check-card { position: relative; display: block; }
.check-card input { position: absolute; opacity: 0; pointer-events: none; }
.check-card span { display: grid; place-items: center; min-height: 40px; padding: 8px 6px; border: 1px solid var(--estimate-border); border-radius: 9px; background: #fff; font-weight: 700; font-size: 13px; text-align: center; cursor: pointer; transition: .2s ease; }
.check-card input:checked + span { border-color: var(--estimate-blue-600); color: var(--estimate-blue-600); background: var(--estimate-blue-100); box-shadow: inset 0 0 0 1px var(--estimate-blue-600); }
.check-card input:focus-visible + span { outline: 3px solid rgba(17, 139, 255, .25); outline-offset: 2px; }

/* ---- Consent ---- */
.consent-row { display: flex; align-items: flex-start; gap: 10px; margin-top: 18px; cursor: pointer; font-size: 14px; }
.consent-row input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--estimate-blue-600); }
.consent-row span { line-height: 1.45; }
.consent-row a { color: var(--estimate-blue-600); font-weight: 800; }

/* ---- Buttons ---- */
.form-actions { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 22px; }
.form-actions--single { grid-template-columns: 1fr; }
.button { min-height: 50px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 10px 20px; border-radius: 11px; border: 1px solid transparent; font: inherit; font-size: 17px; font-weight: 800; cursor: pointer; transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease; }
.button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.button:hover { transform: translateY(-2px); }
.button:disabled { cursor: not-allowed; opacity: .58; transform: none; }
.button--primary { color: #fff; background: linear-gradient(110deg, var(--estimate-navy-950), var(--estimate-navy-800) 58%, var(--estimate-blue-600)); box-shadow: 0 10px 22px rgba(0, 45, 90, .2); }
.button--secondary { color: var(--estimate-ink); border-color: #b8cce0; background: #fff; }

/* ---- Result Step ---- */
.result-hero { text-align: center; padding-top: 4px; }
.result-hero .step-kicker { color: var(--estimate-ink); }
.result-hero h1 { margin-top: 10px; font-size: clamp(36px, 6vw, 52px); letter-spacing: -.03em; }
.result-range { min-height: 20px; margin: 8px 0 0; color: var(--estimate-muted); font-size: 15px; }
.result-divider { display: flex; align-items: center; gap: 14px; margin: 20px 0; color: var(--estimate-ink); }
.result-divider::before,
.result-divider::after { content: ""; height: 1px; flex: 1; background: var(--estimate-border); }
.result-divider span { display: grid; place-items: center; width: 22px; height: 22px; border: 2px solid currentColor; border-radius: 50%; font-family: Georgia, serif; font-weight: 800; font-size: 14px; }
.result-advice { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 22px; margin-bottom: 24px; }
.result-advice p { margin: 0 0 6px; font-size: 18px; }
.result-advice strong { display: block; max-width: 560px; font-size: 16px; line-height: 1.4; }
.agent-placeholder { display: grid; place-items: center; width: 110px; aspect-ratio: 1; border: 5px solid #fff; border-radius: 50%; overflow: hidden; outline: 1px solid var(--estimate-border); color: #fff; background: linear-gradient(145deg, #d8e1eb, #637b98); box-shadow: 0 8px 20px rgba(0, 29, 69, .14); flex-shrink: 0; }
.agent-placeholder img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }

/* ---- Privacy note ---- */
.privacy-note { margin-top: 16px; border-color: transparent; background: #f5f8fb; }
.privacy-note svg { stroke: var(--estimate-ink); width: 26px; height: 26px; }

/* ---- Credentials / Badges ---- */
.credentials { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 22px 0; }
.credential { min-height: 100px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px; padding: 10px 6px; border-radius: 10px; color: #fff; text-align: center; background: linear-gradient(145deg, #b96937, #8a3e1c); box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); }
.credential:nth-child(2) { background: linear-gradient(145deg, #c9c9c9, #8b8b8b); }
.credential:nth-child(3) { background: linear-gradient(145deg, #d5a936, #a8750a); }
.credential--special { color: var(--estimate-ink); background: linear-gradient(145deg, #fff, #e8eef6); border: 6px solid var(--estimate-navy-950); }
.credential small { font-weight: 700; font-size: 11px; }
.credential strong { font-size: 16px; }
.credential span { font-weight: 900; font-size: 12px; }

/* ---- Badge SVG images ---- */
.credential-img { display: grid; place-items: center; min-height: 100px; padding: 8px; }
.credential-img img { max-width: 100%; max-height: 90px; object-fit: contain; }

/* ---- Footer ---- */
.estimate-footer { padding: 14px clamp(16px, 3vw, 36px) 18px; border-top: 1px solid #eef1f5; color: var(--estimate-muted); background: #fbfcfe; font-size: 12px; }
.estimate-footer p { margin: 0 0 6px; font-style: italic; }
.estimate-footer strong { color: #3f4f66; }
.estimate-footer em { color: #df1121; font-style: normal; font-weight: 900; }

/* ---- Calculator Loading ---- */
.estimate-loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 40px 20px; color: var(--estimate-muted); }
.estimate-loading::before { content: ""; width: 28px; height: 28px; border: 3px solid var(--estimate-border); border-top-color: var(--estimate-blue-600); border-radius: 50%; animation: est-spin .7s linear infinite; }
@keyframes est-spin { to { transform: rotate(360deg); } }

/* ---- Result panel details ---- */
.estimate-factors { margin-top: 20px; padding: 16px; border-radius: var(--estimate-radius-md); background: #f8fafc; }
.estimate-factors summary { font-weight: 800; cursor: pointer; color: var(--estimate-ink); }
.estimate-factors ul { margin: 12px 0 0; padding: 0; list-style: none; }
.estimate-factors li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #edf1f5; font-size: 14px; }
.estimate-factors li:last-child { border-bottom: 0; }
.estimate-factors li span { color: var(--estimate-muted); }
.estimate-factors li strong { color: var(--estimate-ink); }

/* ---- Responsive ---- */
@media (min-width: 761px) {
  .form-actions { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  .estimate-page { padding: 16px 8px 28px; }
  .estimate-card { border-radius: 22px; }
  .estimate-progress { padding-inline: 14px; }
  .progress-list { grid-template-columns: auto 1fr auto 1fr auto; gap: 4px; }
  .progress-item { min-width: 50px; font-size: 9px; gap: 6px; }
  .progress-bubble { width: 38px; height: 38px; font-size: 16px; }
  .progress-rail { gap: 4px; padding-top: 10px; font-size: 10px; }
  .estimate-step { padding-inline: 16px; }
  .mode-switch,
  .field-grid--2,
  .result-advice { grid-template-columns: 1fr; }
  .mode-button { min-height: 56px; font-size: 14px; }
  .trust-note { align-items: flex-start; padding: 14px; }
  .trust-note p { font-size: 13px; }
  .choice-grid,
  .choice-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .result-advice { justify-items: center; text-align: center; }
  .agent-placeholder { width: 100px; grid-row: 1; }
  .credentials { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .button { min-height: 50px; font-size: 16px; }
  .form-actions { grid-template-columns: 1fr; }

  .estimate-page input:not([type="checkbox"]):not([type="radio"]),
  .estimate-page select,
  .estimate-page textarea { min-height: 50px; font-size: 16px; padding: 0 14px; }
  .field-label { font-size: 15px; }

  /* Thicker check-cards on mobile */
  .check-card span { min-height: 48px; padding: 10px 8px; font-size: 14px; border-radius: 10px; }
  .choice-grid, .choice-grid--3 { gap: 8px; }
  .detail-panel h2 { font-size: 16px; }
  .consent-row { font-size: 14px; }
}

@media (max-width: 430px) {
  .progress-percent { font-size: 10px; }
  .progress-item { min-width: 44px; }
  .progress-label { max-width: 58px; text-align: center; }
  .step-heading h1 { font-size: 24px; }
  .mode-switch { gap: 8px; }
  .mode-button { padding: 10px 6px; gap: 6px; font-size: 13px; }
  .mode-button svg { width: 18px; height: 18px; }
  .property-summary { align-items: flex-start; padding: 12px; }
  .property-summary > svg { width: 30px; height: 30px; }
  .detail-panel { padding: 14px; }
  .result-hero h1 { font-size: 34px; }
  .credentials { gap: 6px; }
  .credential { min-height: 90px; }
  .credential-img { min-height: 90px; }

  .estimate-page input:not([type="checkbox"]):not([type="radio"]),
  .estimate-page select,
  .estimate-page textarea { min-height: 48px; font-size: 16px; }

  /* Even thicker check-cards on small phones */
  .check-card span { min-height: 46px; padding: 10px 6px; font-size: 14px; }
  .choice-grid legend { font-size: 14px; }
  .detail-panel { padding: 12px 10px; }
  .detail-panel h2 { font-size: 15px; }
  .field-label { font-size: 14px; }
  .consent-row { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .estimate-page *, .estimate-page *::before, .estimate-page *::after { scroll-behavior: auto !important; transition: none !important; }
}
