/* ==========================================================================
   Stagertuning – Datei-Service / Fahrzeug-Konfigurator
   ========================================================================== */

/* hidden-Attribut muss immer Vorrang haben */
[hidden] { display: none !important; }

/* ── Hero ── */
.kfz-hero { padding-bottom: 0.5rem; }
.kfz-hero__content { max-width: 700px; }

/* ── Step indicator ── */
.kfz-steps {
  display: flex;
  align-items: center;
  padding: 1.5rem 0 2rem;
  max-width: 480px;
}

.kfz-step {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.88rem;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}

.kfz-step__dot {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg-elev);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  transition: background 0.3s, border-color 0.3s, color 0.3s;
}

.kfz-step--active .kfz-step__dot {
  border-color: var(--brand-1);
  background: var(--brand-1);
  color: white;
}

.kfz-step--done .kfz-step__dot {
  border-color: var(--brand-2);
  background: var(--brand-2);
  color: white;
}

.kfz-step--active,
.kfz-step--done { color: var(--text); font-weight: 600; }

.kfz-step__label { line-height: 1.2; }
.kfz-step__sub {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 400;
}

.kfz-step--active .kfz-step__label { color: var(--brand-1); }

.kfz-step__line {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 0.75rem;
  min-width: 40px;
  transition: background 0.3s;
}

.kfz-step--done + .kfz-step__line,
.kfz-step--active + .kfz-step__line { background: var(--brand-1); }

/* ── Selector wrap ── */
.kfz-selector-wrap {
  max-width: 780px;
  margin: 0 auto;
}

/* ── Vehicle type bar ── */
.kfz-vehicle-type-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
}

.kfz-vehicle-type-bar .kfz-field-group { flex: 1; min-width: 200px; }

.kfz-hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0.3rem 0 0;
}

.kfz-missing-btn {
  --btn-bg: #e53e3e;
  background: linear-gradient(180deg, #fc5757, #e53e3e);
  border-color: #c53030;
  flex-shrink: 0;
  white-space: nowrap;
  align-self: flex-start;
}
.kfz-missing-btn:hover { opacity: 0.9; }

/* ── Center header ── */
.kfz-center-header {
  text-align: center;
  margin-bottom: 2rem;
}

.kfz-center-logo {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--bg-elev);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  border: 2px solid var(--border);
  overflow: hidden;
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--border) 40%, transparent);
}

.kfz-center-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.kfz-center-header h2 {
  margin: 0 0 0.4rem;
  font-size: 1.9rem;
}

/* ── Red accent divider ── */
.kfz-divider {
  height: 2px;
  background: linear-gradient(90deg, var(--brand-1), var(--brand-2));
  border-radius: 2px;
  margin-bottom: 2rem;
}

/* ── Selector card ── */
.kfz-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.kfz-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 4px;
  background: linear-gradient(90deg, var(--brand-1), var(--brand-2));
}

.kfz-card__header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.kfz-card__icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kfz-card__icon svg { width: 22px; height: 22px; }

.kfz-card__title { font-weight: 700; font-size: 1rem; }
.kfz-card__sub { font-size: 0.78rem; color: var(--muted); }

/* ── Progress bar ── */
.kfz-progress-wrap {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.kfz-progress-bar {
  width: 110px; height: 7px;
  background: var(--bg-elev);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.kfz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-1), var(--brand-2));
  border-radius: 4px;
  transition: width 0.4s cubic-bezier(.4,0,.2,1);
}

.kfz-progress-label {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--brand-1);
  min-width: 36px;
  text-align: right;
}

/* ── Loading spinner ── */
.kfz-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3rem 1rem;
  color: var(--muted);
  gap: 1rem;
}

.kfz-spinner {
  width: 44px; height: 44px;
  border: 3px solid var(--border);
  border-top-color: var(--brand-1);
  border-radius: 50%;
  animation: kfz-spin 0.75s linear infinite;
}

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

/* ── Form fields ── */
.kfz-fields {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.kfz-field-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.kfz-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: 0.02em;
}

.kfz-count {
  font-size: 0.72rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  padding: 0.1em 0.55em;
  border-radius: 999px;
  color: var(--muted);
}

.kfz-select-wrap { position: relative; }

.kfz-select-wrap::after {
  content: "";
  position: absolute;
  right: 0.9rem; top: 50%;
  transform: translateY(-50%);
  width: 11px; height: 7px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 11 7'%3E%3Cpath d='M1 1l4.5 4.5L10 1' stroke='%2398a0b2' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  pointer-events: none;
}

.kfz-select {
  width: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 0.8rem 2.5rem 0.8rem 1rem;
  font-size: 0.97rem;
  color: var(--text);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.kfz-select:focus {
  outline: none;
  border-color: var(--brand-1);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-1) 18%, transparent);
}

.kfz-select:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.kfz-select--active { border-color: var(--brand-1); }

/* ── Category bar ── */
.kfz-category-bar {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.75rem;
  flex-wrap: wrap;
}

.kfz-category-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  flex: 1;
  justify-content: center;
  white-space: nowrap;
}

.kfz-category-item svg { width: 15px; height: 15px; flex-shrink: 0; }

.kfz-category-item--blue {
  background: color-mix(in srgb, var(--brand-1) 14%, transparent);
  color: var(--brand-1);
  border: 1px solid color-mix(in srgb, var(--brand-1) 28%, transparent);
}

.kfz-category-item--green {
  background: color-mix(in srgb, var(--ok) 14%, transparent);
  color: var(--ok);
  border: 1px solid color-mix(in srgb, var(--ok) 28%, transparent);
}

.kfz-category-item--purple {
  background: color-mix(in srgb, #a855f7 14%, transparent);
  color: #a855f7;
  border: 1px solid color-mix(in srgb, #a855f7 28%, transparent);
}

/* ── Results Layout ── */
.kfz-results-layout {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 880px) {
  .kfz-results-layout { grid-template-columns: 1fr; }
}

/* ── Vehicle Sidebar ── */
.kfz-vehicle-sidebar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  position: sticky;
  top: 80px;
}

.kfz-sidebar-eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.kfz-sidebar-name {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.4rem;
}

.kfz-sidebar-badge {
  display: inline-flex;
  font-size: 0.75rem;
  color: var(--brand-1);
  background: color-mix(in srgb, var(--brand-1) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--brand-1) 25%, transparent);
  padding: 0.25em 0.75em;
  border-radius: 999px;
  margin-bottom: 1rem;
  font-weight: 600;
}

.kfz-sidebar-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.kfz-sidebar-stat {
  background: var(--bg-elev);
  border-radius: 0.6rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
}

.kfz-sidebar-stat__label {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 0.15rem;
}

.kfz-sidebar-stat__value {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--brand-1);
  line-height: 1;
}

.kfz-sidebar-info {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 1rem;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  overflow: hidden;
}

.kfz-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.kfz-info-row:last-child { border-bottom: none; }
.kfz-info-row:nth-child(odd) { background: var(--bg-elev); }

.kfz-info-key { color: var(--muted); }
.kfz-info-val { font-weight: 600; text-align: right; font-size: 0.75rem; }

.kfz-sidebar-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

.kfz-sidebar-counts {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.kfz-count-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  font-size: 0.82rem;
}

.kfz-count-row-left {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.kfz-count-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
}

.kfz-count-num {
  font-weight: 800;
  font-size: 0.88rem;
}

.kfz-credits-info {
  font-size: 0.79rem;
  color: var(--muted);
  padding: 0.55rem 0.75rem;
  background: color-mix(in srgb, var(--brand-2) 10%, transparent);
  border-radius: 0.5rem;
  border: 1px solid color-mix(in srgb, var(--brand-2) 20%, transparent);
  margin-bottom: 1rem;
}

.kfz-credits-info strong { color: var(--brand-2); font-weight: 700; }

.kfz-sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ── Buttons ── */
.kfz-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1rem;
  border-radius: 0.6rem;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  border: none;
  font-family: inherit;
}

.kfz-btn--secondary {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
}
.kfz-btn--secondary:hover { background: var(--border); }

.kfz-btn--primary {
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  color: white;
}
.kfz-btn--primary:hover { opacity: 0.9; }

/* ── Options main area ── */
.kfz-options-main {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── Options block (card wrapper) ── */
.kfz-options-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.kfz-options-block::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 3px;
  background: linear-gradient(90deg, var(--brand-1), var(--brand-2));
}

/* ── Section header ── */
.kfz-section-hd {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}

.kfz-section-icon {
  width: 38px; height: 38px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kfz-section-icon svg { width: 20px; height: 20px; }

.kfz-section-text { flex: 1; }
.kfz-section-text h3 { margin: 0 0 0.1rem; font-size: 1.05rem; }
.kfz-section-text p { margin: 0; font-size: 0.78rem; color: var(--muted); }

.kfz-avail-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25em 0.8em;
  border-radius: 999px;
  white-space: nowrap;
}

.kfz-avail-badge--blue {
  background: color-mix(in srgb, var(--brand-1) 14%, transparent);
  color: var(--brand-1);
  border: 1px solid color-mix(in srgb, var(--brand-1) 30%, transparent);
}

.kfz-avail-badge--green {
  background: color-mix(in srgb, var(--ok) 14%, transparent);
  color: var(--ok);
  border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent);
}

.kfz-avail-badge--purple {
  background: color-mix(in srgb, #a855f7 14%, transparent);
  color: #a855f7;
  border: 1px solid color-mix(in srgb, #a855f7 30%, transparent);
}

/* ── Stage cards ── */
.kfz-stages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
}

.kfz-stage-card {
  background: var(--bg-elev);
  border: 1.5px solid var(--border);
  border-radius: 0.9rem;
  padding: 1.15rem;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  user-select: none;
}

.kfz-stage-card:hover {
  border-color: var(--brand-1);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(58, 165, 255, 0.15);
}

.kfz-stage-card.is-selected {
  border-color: var(--brand-1);
  box-shadow: 0 0 0 2px var(--brand-1), 0 8px 24px rgba(58, 165, 255, 0.18);
}

.kfz-stage-hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 0.5rem;
}

.kfz-stage-badge-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.kfz-stage-icon {
  width: 34px; height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 900;
  color: white;
  letter-spacing: -0.03em;
  flex-shrink: 0;
}

.kfz-stage-icon--s1 { background: linear-gradient(135deg, #3aa5ff, #00cdb3); }
.kfz-stage-icon--s2 { background: linear-gradient(135deg, #ff6b35, #f7c948); }
.kfz-stage-icon--s3 { background: linear-gradient(135deg, #e53e3e, #c53030); }

.kfz-stage-name-text { font-weight: 700; font-size: 0.9rem; }
.kfz-stage-desc-text { font-size: 0.75rem; color: var(--muted); }

.kfz-stage-radio {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  flex-shrink: 0;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
}

.kfz-stage-radio::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: transparent;
  transition: background 0.2s;
}

.kfz-stage-card.is-selected .kfz-stage-radio {
  border-color: var(--brand-1);
}

.kfz-stage-card.is-selected .kfz-stage-radio::after {
  background: var(--brand-1);
}

.kfz-stage-gains {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.kfz-stage-gain-box {
  background: var(--card);
  border-radius: 0.5rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
}

.kfz-gain-plus {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ok);
  line-height: 1;
  margin-bottom: 0.15rem;
}

.kfz-gain-detail {
  font-size: 0.7rem;
  color: var(--muted);
  line-height: 1.35;
}

.kfz-stage-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.kfz-hw-note {
  font-size: 0.68rem;
  color: var(--muted);
  font-style: italic;
  line-height: 1.35;
  flex: 1;
}

.kfz-credits-tag {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.3em 0.85em;
  border-radius: 0.45rem;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  color: white;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Motor/Getriebe option grid ── */
.kfz-opt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 0.7rem;
}

.kfz-opt-card {
  background: var(--bg-elev);
  border: 1.5px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.85rem 0.6rem 0.75rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  position: relative;
  user-select: none;
}

.kfz-opt-card:hover {
  border-color: var(--brand-1);
  transform: translateY(-2px);
}

.kfz-opt-card.is-selected {
  border-color: var(--brand-1);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-1) 35%, transparent);
}

/* Bonus-Option (kostenlos mit Stage 2) */
.kfz-opt-card.is-bonus {
  border-color: #00cdb3;
  box-shadow: 0 0 0 2px rgba(0,205,179,.25);
  background: rgba(0,205,179,.05);
}
.kfz-opt-card.is-bonus::before {
  content: '🎁 Inklusive';
  position: absolute;
  top: .3rem; left: 50%; transform: translateX(-50%);
  font-size: .58rem; font-weight: 800; color: #00cdb3;
  text-transform: uppercase; letter-spacing: .05em;
  white-space: nowrap;
}

.kfz-opt-check {
  position: absolute;
  top: 0.4rem; right: 0.4rem;
  width: 17px; height: 17px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: transparent;
  transition: border-color 0.2s, background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kfz-opt-check svg { display: none; width: 10px; height: 10px; }

.kfz-opt-card.is-selected .kfz-opt-check {
  background: var(--brand-1);
  border-color: var(--brand-1);
}

.kfz-opt-card.is-selected .kfz-opt-check svg { display: block; }

.kfz-opt-icon {
  width: 50px; height: 50px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.55rem;
}

.kfz-opt-icon svg { width: 26px; height: 26px; }

.kfz-opt-name {
  font-size: 0.73rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.3rem;
  color: var(--text);
}

.kfz-opt-credits {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
}

/* ── Order summary bar ── */
.kfz-order-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: color-mix(in srgb, var(--card) 95%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 500;
  gap: 1rem;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(.4,0,.2,1);
  flex-wrap: wrap;
}

.kfz-order-bar.is-visible { transform: translateY(0); }

.kfz-order-bar-left { display: flex; flex-direction: column; gap: 0.2rem; }
.kfz-order-bar-label { font-size: 0.78rem; color: var(--muted); }
.kfz-order-bar-total { font-size: 1.1rem; font-weight: 800; color: var(--brand-1); }

.kfz-order-bar-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

/* ── No options placeholder ── */
.kfz-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .kfz-stages-grid { grid-template-columns: 1fr; }
  .kfz-opt-grid { grid-template-columns: repeat(3, 1fr); }
  .kfz-category-bar { flex-direction: column; }
  .kfz-vehicle-type-bar { flex-direction: column; }
  .kfz-steps { max-width: 100%; }
  .kfz-order-bar { padding: 0.75rem 1rem; }
}

@media (max-width: 400px) {
  .kfz-opt-grid { grid-template-columns: repeat(2, 1fr); }
}
