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

:root {
  --c-bg: #1e1e1e;
  --c-surface: #2a2a2a;
  --c-surface-alt: #333333;
  --c-border: #3a3a3a;
  --c-text: #ffffff;
  --c-muted: #a0a0a0;
  --c-accent: #00e5d4;
  --c-accent-hover: #00c4b5;
  --c-success: #4ade80;
  --c-error: #f87171;
  --radius: 6px;
  --radius-lg: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,.35);
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ── */
.container { max-width: 1300px; margin: 0 auto; padding: 24px 24px 96px; }

/* Zwei-Spalten-Wrapper */
.split-layout {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  justify-content: center;
}
.split-layout .form-col {
  width: 580px;
  flex-shrink: 0;
}
/* Startzustand: result-col nimmt keinen Platz ein */
.split-layout .result-col {
  width: 0;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-width .4s ease, opacity .3s ease .25s;
}
/* Schritt 1 — bei Klick: Layout-Shift (Platz aufmachen) */
.split-layout .result-col.expanding {
  max-width: 580px;
  width: auto;
}
/* Schritt 2 — nach Antwort: Inhalt einblenden */
.split-layout .result-col.visible {
  opacity: 1;
  overflow: visible;
}

header {
  display: flex; align-items: center; gap: 14px;
  padding: 20px 0 28px;
  border-bottom: 1px solid var(--c-border);
  margin-bottom: 32px;
}
header img { height: 40px; width: auto; display: block; }
header h1 { font-size: 1.4rem; font-weight: 700; letter-spacing: -.02em; }
header span { font-size: .85rem; color: var(--c-muted); }

/* ── Card ── */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.card-title {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--c-accent);
  margin-bottom: 16px;
}

/* ── Form ── */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--c-text);
}
.field input, .field select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-size: .95rem;
  background: var(--c-surface-alt);
  color: var(--c-text);
  transition: border-color .15s;
}
.field input::placeholder { color: var(--c-muted); }
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--c-accent);
}
.field-hint { font-size: .78rem; color: var(--c-muted); margin-top: 3px; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Upload-Bereich ── */
.upload-zone {
  border: 2px dashed var(--c-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: var(--c-surface-alt);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--c-accent);
  background: rgba(0, 229, 212, .07);
}
.upload-zone input[type="file"] { display: none; }
.upload-icon { font-size: 2rem; margin-bottom: 8px; }
.upload-zone p { color: var(--c-muted); font-size: .9rem; }
.upload-zone .file-name {
  margin-top: 8px;
  font-weight: 600;
  color: var(--c-accent);
  font-size: .9rem;
}

/* ── Button ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 24px;
  border: none; border-radius: var(--radius);
  font-size: .95rem; font-weight: 600;
  cursor: pointer; transition: background .15s, transform .15s;
  width: 100%;
}
.btn-primary { background: var(--c-accent); color: #0a0a0a; }
.btn-primary:hover { background: var(--c-accent-hover); }
.btn-primary:disabled { background: #555; color: #999; cursor: not-allowed; }
.btn-secondary { background: transparent; color: var(--c-text); border: 1px solid var(--c-border); }
.btn-secondary:hover { border-color: var(--c-accent); color: var(--c-accent); }

/* ── Angebot berechnen: immer sichtbar, damit er nicht übersehen wird ── */
#submit-btn {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  width: min(400px, calc(100% - 32px));
  z-index: 60;
  box-shadow: 0 8px 28px rgba(0,0,0,.55);
}

/* ── Spinner ── */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-block; }
.htmx-request.btn { opacity: .8; pointer-events: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(0,0,0,.3);
  border-top-color: #0a0a0a;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

/* ── Ergebnis-Tabelle ── */
.cost-table { width: 100%; border-collapse: collapse; }
.cost-table tr td { padding: 7px 0; font-size: .9rem; }
.cost-table tr td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.cost-table .separator td {
  border-top: 1px solid var(--c-border);
  padding-top: 10px;
}
.cost-table .total td {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--c-accent);
  border-top: 2px solid var(--c-border);
  padding-top: 10px;
}
.cost-table .muted td { color: var(--c-muted); font-size: .85rem; }
.cost-table .discount td { color: var(--c-success); }

/* ── Geometrie-Chips ── */
.geo-chips { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.chip {
  background: var(--c-surface-alt);
  border: 1px solid var(--c-border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: .82rem;
  color: var(--c-muted);
}
.chip strong { color: var(--c-text); }

/* ── E-Mail-Bereich ── */
.submit-section { margin-top: 4px; }
.submit-section p { font-size: .88rem; color: var(--c-muted); margin-bottom: 12px; }

/* ── Status-Meldungen ── */
.alert {
  padding: 12px 16px; border-radius: var(--radius);
  font-size: .9rem; margin-bottom: 16px;
}
.alert-error { background: rgba(248, 113, 113, .1); border: 1px solid rgba(248, 113, 113, .4); color: var(--c-error); }
.alert-success { background: rgba(74, 222, 128, .1); border: 1px solid rgba(74, 222, 128, .4); color: var(--c-success); }

/* ── Loading-Overlay ── */
#loading-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(30,30,30,.9);
  z-index: 100;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
#loading-overlay.visible { display: flex; }
.loading-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--c-border);
  border-top-color: var(--c-accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
#loading-overlay p { color: var(--c-muted); font-size: .95rem; }

/* ── Mobile ── */
@media (max-width: 768px) {
  .container { padding: 16px 16px 100px; }

  header { padding: 14px 0 20px; gap: 10px; margin-bottom: 20px; }
  header img { height: 30px; }
  header h1 { font-size: 1.15rem; }

  .split-layout { flex-direction: column; gap: 20px; }
  .split-layout .form-col { width: 100%; }
  /* Wachstumsanimation ist auf schmalen Screens unnötig — Zielbreite direkt setzen,
     keine Transition, damit nichts an der vorherigen 0-Breite haengen bleibt. */
  .split-layout .result-col {
    width: 100%; max-width: 100%; transition: opacity .3s ease;
  }

  .card { padding: 16px; }
  .upload-zone { padding: 20px; }

  /* .discount-badge und .contact-note sind seitenspezifisch in index.html
     definiert — ihre Mobile-Overrides liegen dort, nicht hier (Ladereihenfolge). */
  #submit-btn {
    position: static;
    width: 100%;
    transform: none;
    box-shadow: none;
    margin-top: 4px;
  }

  .field-row { grid-template-columns: 1fr; }
}
