/* Bestpreis-Kalkulator · Compact v5 · v3.0
   (c) Bädermaxx GmbH 2026 */

:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --surface-2: #f5f5f4;
  --border: #e7e5e4;
  --border-strong: #d6d3d1;
  --text: #1c1917;
  --text-mute: #57534e;
  --text-faint: #a8a29e;
  --accent: #15803d;
  --accent-soft: #dcfce7;
  --accent-subtle: #f0fdf4;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --error: #b91c1c;
  --error-soft: #fee2e2;
  --shadow: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.07);
  --gw-orange: #f37021;
  --dsv-blue: #192862;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 1380px; margin: 0 auto; padding: 24px 24px 60px; }
@media (min-width: 1024px) { .wrap { padding: 32px 40px 80px; } }

.head {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 18px; margin-bottom: 22px;
  border-bottom: 1px solid var(--border); gap: 16px; flex-wrap: wrap;
}
.head-title { font-size: 22px; font-weight: 700; letter-spacing: -0.025em; }
.head-sub { font-size: 12px; color: var(--text-faint); font-weight: 500; }
.head-status {
  font-size: 12px; color: var(--text-mute); text-align: right;
  font-family: 'JetBrains Mono', monospace; line-height: 1.6;
}
.head-status .pct {
  display: inline-block; background: var(--text); color: white;
  padding: 1px 6px; border-radius: 3px; font-weight: 700;
  font-size: 11px; margin-left: 6px;
}
.head-status.is-loading .pct { background: var(--text-faint); }
.head-status.is-error { color: var(--error); }

.tabs {
  display: flex; gap: 4px; margin-bottom: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 3px; max-width: 480px;
}
.tabs button {
  flex: 1; background: none; border: none;
  font-family: inherit; font-size: 13px; font-weight: 500;
  padding: 8px 12px; border-radius: 5px; cursor: pointer;
  color: var(--text-mute); transition: all 0.15s;
}
.tabs button.active { background: var(--text); color: white; font-weight: 600; }

.datepick {
  margin-bottom: 18px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 14px; display: none; align-items: center;
  gap: 12px; max-width: 480px;
}
.datepick.is-active { display: flex; }
.datepick label { font-size: 12px; font-weight: 500; color: var(--text-mute); white-space: nowrap; }
.datepick input[type="date"] {
  font-family: 'JetBrains Mono', monospace; font-size: 13px;
  padding: 6px 10px; border: 1px solid var(--border-strong);
  border-radius: 5px; background: var(--surface); outline: none; flex: 1;
}

.grid { display: grid; grid-template-columns: 1fr; gap: 22px; align-items: start; }
@media (min-width: 1024px) {
  .grid { grid-template-columns: minmax(0, 460px) minmax(0, 1fr); gap: 28px; }
}

.section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 18px 20px; margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.section-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-mute); margin-bottom: 12px;
  display: flex; align-items: center; justify-content: space-between;
}
.section-title .ct {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  color: var(--text-faint); font-weight: 500; text-transform: none;
}
.btn-reset {
  background: none; border: 1px solid var(--border-strong);
  font-family: inherit; font-size: 11px; padding: 4px 9px;
  border-radius: 4px; cursor: pointer; color: var(--text-mute); font-weight: 500;
}
.btn-reset:hover { background: var(--surface-2); color: var(--text); }

.row { display: grid; gap: 12px; margin-bottom: 12px; }
.row:last-child { margin-bottom: 0; }
.row.c2 { grid-template-columns: 1fr 1fr; }
.row.c4 { grid-template-columns: repeat(4, 1fr); }
.fld { display: flex; flex-direction: column; gap: 5px; }
.fld label { font-size: 11px; font-weight: 600; color: var(--text-mute); letter-spacing: 0.02em; }
.fld label em { font-style: normal; color: var(--text-faint); margin-left: 3px; font-weight: 400; }
input, select {
  font-family: inherit; font-size: 14px; width: 100%;
  padding: 9px 11px; border: 1px solid var(--border-strong);
  border-radius: 6px; background: var(--surface); color: var(--text);
  outline: none; font-weight: 500;
  transition: border-color 0.15s, box-shadow 0.15s;
  -moz-appearance: textfield;
}
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; }
input:focus, select:focus { border-color: var(--text); box-shadow: 0 0 0 3px rgba(0,0,0,0.06); }
.row.c4 input { padding: 7px 9px; font-size: 13px; }

.seg {
  display: flex; background: var(--bg); border: 1px solid var(--border-strong);
  border-radius: 6px; padding: 2px; width: 100%;
}
.seg button {
  flex: 1; background: none; border: none;
  font-family: inherit; font-size: 13px; font-weight: 500;
  padding: 7px 10px; border-radius: 4px; cursor: pointer; color: var(--text-mute);
}
.seg button.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }

.pkg {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 7px; padding: 12px 14px; margin-bottom: 8px;
  position: relative; transition: opacity 0.2s;
}
.pkg-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; font-size: 12px; font-weight: 600; color: var(--text);
}
.pkg-head .num {
  display: inline-block; background: var(--text); color: white;
  width: 18px; height: 18px; text-align: center; line-height: 18px;
  border-radius: 4px; margin-right: 8px; font-size: 10px; font-weight: 700;
}
.pkg-rm {
  background: none; border: 1px solid var(--border);
  width: 22px; height: 22px; font-size: 14px; line-height: 1;
  cursor: pointer; border-radius: 4px; color: var(--text-faint);
}
.pkg-rm:hover { color: var(--error); border-color: var(--error); background: var(--error-soft); }
.pkg-vol-row { margin-top: 8px; }
.pkg-add {
  width: 100%; background: transparent; border: 1.5px dashed var(--border-strong);
  padding: 11px; border-radius: 7px; color: var(--text-mute);
  font-family: inherit; font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all 0.15s;
}
.pkg-add:hover { border-color: var(--text); color: var(--text); }
@keyframes pkgIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.pkg.is-new { animation: pkgIn 0.25s ease-out; }

.tgrid { display: grid; gap: 8px; }
.tg-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 13px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 7px;
}
.tg-name { font-size: 13px; font-weight: 500; }
.tg-name small {
  display: block; font-size: 11px; color: var(--text-faint);
  font-weight: 400; margin-top: 1px;
}
.switch { position: relative; width: 36px; height: 20px; flex-shrink: 0; }
.switch input { display: none; }
.slider {
  position: absolute; inset: 0; background: var(--border-strong);
  border-radius: 20px; cursor: pointer; transition: 0.18s;
}
.slider::before {
  content: ""; position: absolute; width: 14px; height: 14px;
  left: 3px; top: 3px; background: white; border-radius: 50%;
  transition: 0.18s; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(16px); }

details.settings {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; margin-top: 8px;
}
details.settings summary {
  cursor: pointer; list-style: none;
  padding: 11px 14px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-mute); user-select: none;
}
details.settings summary::-webkit-details-marker { display: none; }
details.settings summary::before { content: "+"; color: var(--text); margin-right: 8px; }
details.settings[open] summary::before { content: "−"; }
.settings-body { padding: 0 14px 14px; border-top: 1px dashed var(--border); padding-top: 12px; }
.settings-note { font-size: 11px; color: var(--text-faint); margin-top: 10px; line-height: 1.5; }
.diesel-info-mini {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 6px;
  font-family: 'JetBrains Mono', monospace; font-size: 11px; margin-bottom: 12px;
  gap: 8px; flex-wrap: wrap;
}
.diesel-info-mini button {
  background: none; border: 1px solid var(--border-strong);
  font-family: inherit; font-size: 10px;
  padding: 3px 8px; border-radius: 3px; cursor: pointer; color: var(--text-mute);
}

.cta {
  width: 100%; background: var(--text); color: white; border: none;
  padding: 13px 20px; font-family: inherit; font-size: 14px; font-weight: 600;
  border-radius: 7px; cursor: pointer; margin-top: 14px; letter-spacing: 0.01em;
  transition: background 0.15s, transform 0.08s; box-shadow: var(--shadow-md);
}
.cta:hover { background: #292524; box-shadow: var(--shadow-lg); }
.cta:active { transform: translateY(1px); }

.result-meta {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 14px; padding: 0 4px;
}
.result-meta .label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-mute); font-weight: 600;
}
.result-meta .meta { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-faint); }

.result-empty {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 80px 32px; text-align: center;
  color: var(--text-faint); font-size: 12px; letter-spacing: 0.04em;
  text-transform: uppercase; font-weight: 500;
}
.result-empty .icon { font-size: 36px; display: block; margin-bottom: 14px; opacity: 0.4; }
.result-empty.is-error { color: var(--error); border-color: var(--error); background: var(--error-soft); }

.bestprice {
  background: linear-gradient(135deg, var(--accent) 0%, #166534 100%);
  color: white; border-radius: 12px;
  padding: 22px 26px; margin-bottom: 14px;
  position: relative; overflow: hidden;
  box-shadow: 0 6px 20px rgba(21,128,61,0.18);
}
.bestprice::before {
  content: ""; position: absolute; top: -40%; right: -10%;
  width: 240px; height: 240px;
  background: radial-gradient(circle, rgba(255,255,255,0.10) 0%, transparent 60%);
}
.bp-tag {
  font-size: 10px; letter-spacing: 0.18em; font-weight: 700;
  text-transform: uppercase; opacity: 0.85; margin-bottom: 8px;
}
.bp-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.bp-logo-wrap {
  display: inline-flex; align-items: center; background: #ffffff;
  padding: 8px 14px; border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08); position: relative; z-index: 1;
}
.bp-logo { width: auto; display: block; -webkit-user-drag: none; user-select: none; }
.bp-logo[alt="Gebrüder Weiss"] { height: 24px; }
.bp-logo[alt="DSV"] { height: 26px; }
.bp-amt {
  font-family: 'JetBrains Mono', monospace;
  font-size: 32px; font-weight: 800; letter-spacing: -0.03em;
  position: relative; z-index: 1;
}
.bp-saving {
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  margin-top: 8px; opacity: 0.85; position: relative; z-index: 1;
}

.providers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 760px) { .providers { grid-template-columns: 1fr; } }

.provider {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 18px 20px;
  display: flex; flex-direction: column;
}
.provider.is-winner {
  border-color: var(--accent); border-width: 2px;
  background: linear-gradient(180deg, var(--accent-subtle) 0%, var(--surface) 100%);
  padding: 17px 19px;
}
.provider.is-error {
  border-color: var(--error); background: var(--error-soft); padding: 17px 19px;
}
.provider-brand { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.brand-text { font-size: 18px; font-weight: 700; letter-spacing: -0.015em; font-family: 'Inter', sans-serif; }
.brand-dsv-text { color: var(--dsv-blue); }
.brand-gw-text { color: var(--gw-orange); }
.tag-win {
  background: var(--accent); color: white;
  font-size: 9px; font-weight: 700; padding: 3px 7px;
  border-radius: 3px; letter-spacing: 0.08em; text-transform: uppercase;
}
.provider-meta { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-faint); margin-bottom: 14px; }
.provider-amt { font-family: 'JetBrains Mono', monospace; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 4px; }
.provider.is-winner .provider-amt { color: var(--accent); }
.provider-base { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-mute); margin-bottom: 14px; }
.breakdown { margin-top: auto; padding-top: 12px; border-top: 1px dashed var(--border-strong); }
.bd-line { display: flex; justify-content: space-between; font-family: 'JetBrains Mono', monospace; font-size: 12px; padding: 4px 0; }
.bd-line .l { color: var(--text-mute); flex: 1; padding-right: 8px; }
.bd-line .v { color: var(--text); font-weight: 500; }
.bd-line.tot { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 8px; font-weight: 700; font-size: 13px; }
.bd-line.tot .l { color: var(--text); font-weight: 700; }
.error-msg { font-size: 13px; color: var(--error); font-weight: 500; }

.warn {
  margin-top: 12px; padding: 11px 14px;
  background: var(--warn-soft); border: 1px solid #fde68a;
  border-radius: 7px; font-size: 12px; color: var(--warn);
}
.warn-hd { font-weight: 600; margin-bottom: 4px; }
.warn ul { list-style: none; }
.warn li { font-family: 'JetBrains Mono', monospace; font-size: 11px; padding: 1px 0; }

.footer {
  margin-top: 32px; padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 10px; color: var(--text-faint); text-align: center;
  font-family: 'JetBrains Mono', monospace; letter-spacing: 0.04em;
}
.footer a { color: inherit; text-decoration: none; }
.footer a:hover { color: var(--text); }

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.3s ease-out; }

.loading-overlay {
  position: fixed; inset: 0; background: rgba(255,255,255,0.95);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; font-family: 'JetBrains Mono', monospace;
  font-size: 12px; color: var(--text-mute); letter-spacing: 0.06em;
  text-align: center;
}
