/* ── Raum.Sieben Wertermittlung ───────────────────────── */

:root {
  --primary:       #C87C3A;
  --primary-dark:  #A8622A;
  --primary-light: #F0D4B8;
  --dark:          #1A1A1A;
  --gray:          #555;
  --light-gray:    #F4F3F1;
  --border:        #DDDBD8;
  --white:         #FFFFFF;
  --radius:        10px;
  --shadow:        0 4px 24px rgba(0,0,0,0.10);
}

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

body {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  background: var(--light-gray);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 20px 10px 40px;
  color: var(--dark);
}

/* ── Outer Wrapper ── */
.calc-wrapper {
  width: 100%;
  max-width: 820px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Progress Bar ── */
.progress-track {
  height: 7px;
  background: #E0DEDD;
  flex-shrink: 0;
}
.progress-fill {
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width 0.4s ease;
}

/* ── Step Viewport (fixed height) ── */
.step-viewport {
  position: relative;
  min-height: 560px;
  flex: 1;
}

/* ── Individual Steps ── */
.step {
  display: none;
  flex-direction: column;
  padding: 40px 48px 32px;
  min-height: 560px;
}
.step.active {
  display: flex;
}

h2 {
  font-size: 1.55rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 32px;
  line-height: 1.3;
}

/* ── Card Grids ── */
.card-grid {
  display: grid;
  gap: 16px;
  flex: 1;
}
.grid-2x2  { grid-template-columns: repeat(2, 1fr); }
.grid-2x3  { grid-template-columns: repeat(3, 1fr); }
.grid-1x2  { grid-template-columns: repeat(2, 1fr); }
.grid-heating { grid-template-columns: repeat(5, 1fr); gap: 10px; }

/* ── Type Card ── */
.type-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 16px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  text-align: center;
  user-select: none;
}
.type-card:hover {
  border-color: var(--primary);
  background: #FDF5EE;
  transform: translateY(-1px);
}
.type-card.selected {
  border-color: var(--primary);
  background: #FDF5EE;
}
.type-card span {
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.3;
}
.type-card small {
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--gray);
}

.card-icon {
  width: 72px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dark);
}
.card-icon svg { width: 100%; height: 100%; }
.card-icon.small { width: 44px; height: 40px; }
.card-icon.small svg { width: 100%; height: 100%; }

/* small cards for heating */
.small-card {
  padding: 14px 8px 12px;
  gap: 8px;
}
.small-card span { font-size: 0.78rem; }

/* ── Nav Row ── */
.nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 28px;
}

.btn-back, .btn-next, .btn-submit {
  padding: 14px 32px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: background 0.2s, opacity 0.2s, transform 0.15s;
  letter-spacing: 0.02em;
}
.btn-back {
  background: var(--light-gray);
  color: var(--dark);
  border: 2px solid var(--border);
}
.btn-back:hover { background: #E8E6E3; }

.btn-next {
  background: var(--primary);
  color: var(--white);
}
.btn-next:hover  { background: var(--primary-dark); transform: translateY(-1px); }
.btn-next:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-submit {
  background: var(--primary);
  color: var(--white);
  padding: 16px 40px;
}
.btn-submit:hover { background: var(--primary-dark); }

/* ── Details Step ── */
.details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px 24px;
  flex: 1;
  align-content: start;
}

.field-group { display: flex; flex-direction: column; gap: 8px; }
.field-group.full-width { grid-column: 1 / -1; }

.field-group label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--gray);
}

.input-text {
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  color: var(--dark);
  background: var(--white);
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}
.input-text:focus { border-color: var(--primary); }

/* ── Counter ── */
.counter {
  display: flex;
  align-items: center;
  gap: 0;
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  overflow: hidden;
  width: fit-content;
}
.counter-btn {
  width: 42px;
  height: 42px;
  background: var(--white);
  border: none;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}
.counter-btn:hover { background: #FDF5EE; }
#zimmer-display, #stockwerk-display {
  padding: 0 18px;
  font-weight: 700;
  font-size: 1rem;
  min-width: 40px;
  text-align: center;
  border-left: 1px solid var(--primary);
  border-right: 1px solid var(--primary);
  line-height: 42px;
}

/* ── Sliders ── */
.slider-row { padding: 4px 0; }
input[type="range"] {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(to right, var(--primary) 0%, var(--primary) var(--val, 20%), #E0DEDD var(--val, 20%));
  border-radius: 3px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--white);
  border: 2.5px solid var(--primary);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--white);
  border: 2.5px solid var(--primary);
  cursor: pointer;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--gray);
  margin-top: 8px;
}
.manual-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--gray);
}
.manual-input-row input {
  width: 80px;
  padding: 6px 10px;
  border: 2px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  text-align: right;
  outline: none;
}
.manual-input-row input:focus { border-color: var(--primary); }

/* ── Dropdowns ── */
.form-fields {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
}
.select-field {
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  color: var(--dark);
  background: var(--white);
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2'%3E%3Cpolyline points='6,9 12,15 18,9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  transition: border-color 0.2s;
}
.select-field:focus { border-color: var(--primary); }

/* ── Address Step ── */
.address-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
  flex: 1;
  align-items: start;
}
.address-fields { display: flex; flex-direction: column; gap: 14px; position: relative; }

.search-input { font-size: 0.95rem; }

.autocomplete-list {
  position: absolute;
  top: 52px;
  left: 0;
  right: 0;
  background: var(--white);
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  z-index: 1000;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.autocomplete-list .ac-item {
  padding: 10px 14px;
  font-size: 0.88rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  line-height: 1.4;
}
.autocomplete-list .ac-item:last-child { border-bottom: none; }
.autocomplete-list .ac-item:hover { background: #FDF5EE; }

.addr-row { display: flex; gap: 12px; }
.flex-1 { flex: 1; }
.flex-2 { flex: 2; }
.flex-3 { flex: 3; }

.map-container {
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--border);
}
#map { height: 280px; width: 100%; }

/* ── Contact Step ── */
.contact-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  gap: 20px;
}
.contact-header h2 { text-align: left; margin-bottom: 10px; }
.contact-hint { font-size: 0.9rem; color: var(--gray); line-height: 1.6; }
.highlight-email { color: var(--primary); font-weight: 600; }

.shield-icon { width: 56px; height: 66px; flex-shrink: 0; }
.shield-icon svg { width: 100%; height: 100%; }

.checkbox-label {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--gray);
  line-height: 1.6;
}
.checkbox-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  accent-color: var(--primary);
  cursor: pointer;
  margin-top: 2px;
}
.checkbox-label a { color: var(--primary); font-weight: 600; text-decoration: underline; }

.form-error {
  margin-top: 12px;
  padding: 12px 16px;
  background: #FFF0F0;
  border: 1px solid #F5BCBC;
  border-radius: 8px;
  color: #C0392B;
  font-size: 0.88rem;
}

/* ── Result Step ── */
.result-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 8px 0;
  text-align: center;
  flex: 1;
}
.result-address {
  font-size: 0.9rem;
  color: var(--gray);
}
.result-title {
  font-size: 1.4rem;
  font-weight: 700;
}
.result-range-bar {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0;
  width: 100%;
  max-width: 540px;
  margin: 8px 0;
}
.range-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
}
.range-col.mid { flex: 1.2; }
.range-line {
  height: 4px;
  background: var(--primary-light);
  width: 100%;
  position: relative;
}
.range-line::after {
  content: '';
  position: absolute;
  left: 50%; top: -4px;
  width: 12px; height: 12px;
  background: var(--primary);
  border-radius: 50%;
  transform: translateX(-50%);
}
.range-col.mid .range-line { background: var(--primary); height: 6px; }
.range-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary);
}
.range-col:not(.mid) .range-value { font-size: 1.1rem; color: var(--gray); }
.range-label { font-size: 0.75rem; color: var(--gray); }

.result-disclaimer {
  background: var(--light-gray);
  border-radius: var(--radius);
  padding: 16px 20px;
  font-size: 0.85rem;
  color: var(--gray);
  line-height: 1.6;
  max-width: 540px;
  text-align: left;
  border-left: 3px solid var(--primary);
}
.result-disclaimer strong { color: var(--dark); }

.result-no-valuation {
  background: var(--light-gray);
  border-radius: var(--radius);
  padding: 24px 28px;
  font-size: 0.95rem;
  line-height: 1.7;
  max-width: 480px;
  text-align: center;
}
.result-checkmark {
  width: 64px;
  height: 64px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}
.result-checkmark svg { width: 36px; height: 36px; }

.result-doi-notice {
  background: #EEF7EE;
  border: 1px solid #A8D5A2;
  border-radius: var(--radius);
  padding: 14px 20px;
  font-size: 0.88rem;
  color: #2E6E2E;
  line-height: 1.6;
  max-width: 540px;
  text-align: center;
}

/* ── Trust Bar ── */
.trust-bar {
  display: flex;
  justify-content: center;
  gap: 40px;
  padding: 16px 24px;
  background: #F9F7F4;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.trust-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--gray);
}
.trust-item svg { width: 18px; height: 18px; color: var(--primary); }

/* ── Loading Spinner ── */
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 640px) {
  .step { padding: 28px 20px 24px; }
  h2 { font-size: 1.2rem; margin-bottom: 20px; }
  .grid-2x3 { grid-template-columns: repeat(2, 1fr); }
  .grid-heating { grid-template-columns: repeat(3, 1fr); }
  .address-layout { grid-template-columns: 1fr; }
  .map-container { order: -1; }
  #map { height: 200px; }
  .trust-bar { gap: 16px; flex-wrap: wrap; justify-content: flex-start; }
  .details-grid { grid-template-columns: 1fr 1fr; }
  .contact-header { flex-direction: column; }
  .shield-icon { display: none; }
  .range-value { font-size: 1.2rem; }
  .range-col:not(.mid) .range-value { font-size: 0.9rem; }
}
@media (max-width: 440px) {
  .grid-2x2 { grid-template-columns: 1fr 1fr; }
  .details-grid { grid-template-columns: 1fr; }
  .addr-row { flex-direction: column; }
}
