/* INSTADRIVE THG-Flottenrechner
 * Alle Regeln sind mit .id-thg-calculator gescoped, damit Theme-Styles das Widget
 * nicht überschreiben. Farb-/Layout-kritische Properties werden zusätzlich mit
 * !important durchgesetzt (Themes stylen a/button/h3 oft mit höherer Spezifität).
 */

/* ---- Self-hosted Inter (DSGVO-konform, kein Google-CDN) ---- */
@font-face {
  font-family: "Inter THG";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/Inter-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "Inter THG";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/Inter-Medium.woff2") format("woff2");
}
@font-face {
  font-family: "Inter THG";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/Inter-SemiBold.woff2") format("woff2");
}
@font-face {
  font-family: "Inter THG";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/Inter-Bold.woff2") format("woff2");
}
@font-face {
  font-family: "Inter THG";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("../fonts/Inter-ExtraBold.woff2") format("woff2");
}

/* ---- Grundlagen ---- */
.id-thg-calculator,
.id-thg-calculator * {
  box-sizing: border-box;
}

.id-thg-calculator {
  width: min(100%, 540px);
  margin: 0 auto;
  font-family: "Inter THG", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #192033;
}

/* Defensiver Reset: neutralisiert Theme-Defaults für die Form-Elemente im Widget.
   Die echten Werte setzen die spezifischen Regeln weiter unten. */
.id-thg-calculator button,
.id-thg-calculator input,
.id-thg-calculator a.id-thg-button {
  margin: 0;
  font-family: inherit;
  text-transform: none;
  text-shadow: none;
  min-width: 0;
}

/* ---- Karte ---- */
.id-thg-calculator .id-thg-card {
  position: relative;
  width: 100%;
  padding: 34px 41px 36px;
  border: 1px solid rgba(20, 28, 45, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 24px 70px rgba(33, 41, 58, 0.15), 0 2px 12px rgba(33, 41, 58, 0.07);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  overflow: hidden;
}

.id-thg-calculator .id-thg-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 80%, rgba(66, 133, 244, 0.11), transparent 38%), linear-gradient(180deg, rgba(255,255,255,0.74), rgba(255,255,255,0.95));
  z-index: -1;
}

/* ---- Header ---- */
.id-thg-calculator .id-thg-header h3 {
  margin: 0 0 16px;
  padding: 0;
  font-size: clamp(26px, 4.3vw, 34px);
  line-height: 1.08;
  letter-spacing: -0.04em;
  font-weight: 800;
  color: #171c2d !important;
}

.id-thg-calculator .id-thg-header p {
  max-width: 415px;
  margin: 0;
  padding: 0;
  color: #4d5364 !important;
  font-size: 15px;
  line-height: 1.45;
  font-weight: 600;
}

.id-thg-calculator .id-thg-divider {
  height: 1px;
  margin: 34px 0 14px;
  background: linear-gradient(90deg, transparent, rgba(25,32,51,0.12), transparent);
}

/* ---- Fahrzeug-Zeilen ---- */
.id-thg-calculator .id-thg-rows {
  display: flex;
  flex-direction: column;
}

.id-thg-calculator .id-thg-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 156px;
  align-items: center;
  gap: 18px;
  min-height: 70px;
  border-bottom: 1px solid rgba(25, 32, 51, 0.08);
}

.id-thg-calculator .id-thg-row:last-child {
  border-bottom: 0;
}

.id-thg-calculator .id-thg-icon {
  width: 31px;
  height: 31px;
  color: #555e6f;
  display: flex;
  align-items: center;
  justify-content: center;
}

.id-thg-calculator .id-thg-icon svg {
  width: 31px;
  height: 31px;
  display: block;
}

.id-thg-calculator .id-thg-label {
  min-width: 0;
  font-size: 15px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: #394052 !important;
}

.id-thg-calculator .id-thg-label span {
  color: #252b3a !important;
  font-weight: 800;
}

/* ---- Stepper ---- */
.id-thg-calculator .id-thg-stepper {
  justify-self: end;
  display: grid;
  grid-template-columns: 43px 54px 43px;
  align-items: center;
  height: 48px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(245, 246, 248, 0.92);
  box-shadow: inset 0 0 0 1px rgba(20, 28, 45, 0.035), 0 8px 18px rgba(20, 28, 45, 0.045);
}

.id-thg-calculator .id-thg-stepper button {
  appearance: none;
  -webkit-appearance: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(236, 238, 242, 0.94);
  color: #2a3040 !important;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 24px;
  line-height: 1;
  font-weight: 700;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.id-thg-calculator .id-thg-stepper button:hover,
.id-thg-calculator .id-thg-stepper button:focus-visible {
  background: #ffffff;
  box-shadow: 0 7px 18px rgba(20, 28, 45, 0.1);
  outline: none;
  transform: translateY(-1px);
}

.id-thg-calculator .id-thg-stepper input {
  width: 54px;
  height: 38px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: center;
  color: #202637 !important;
  font-size: 26px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.045em;
  -moz-appearance: textfield;
  appearance: textfield;
}

.id-thg-calculator .id-thg-stepper input::-webkit-outer-spin-button,
.id-thg-calculator .id-thg-stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.id-thg-calculator .id-thg-stepper input:focus {
  outline: none;
}

/* ---- Ergebnis ---- */
.id-thg-calculator .id-thg-result-box {
  margin: 18px 0 26px;
  padding: 26px 18px 20px;
  text-align: center;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(234, 246, 255, 0.74), rgba(255, 255, 255, 0.86));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.75), 0 14px 38px rgba(35, 108, 201, 0.07);
}

.id-thg-calculator .id-thg-result-label {
  margin-bottom: 10px;
  color: #202638 !important;
  font-size: 16px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.id-thg-calculator .id-thg-result-value {
  margin-bottom: 10px;
  font-size: clamp(42px, 8vw, 58px);
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.06em;
  background: linear-gradient(90deg, #4a3df3 0%, #2f91f4 36%, #27b8a8 64%, #53d566 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent !important;
}

/* Fallback: Browser ohne background-clip:text bekommen eine solide Markenfarbe,
   damit der Wert nie unsichtbar wird. */
@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .id-thg-calculator .id-thg-result-value {
    background: none;
    -webkit-text-fill-color: currentColor;
    color: #2f6fe4 !important;
  }
}

.id-thg-calculator .id-thg-currency {
  letter-spacing: -0.04em;
}

.id-thg-calculator .id-thg-disclaimer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #727988 !important;
  font-size: 13px;
  line-height: 1.2;
  font-weight: 600;
}

.id-thg-calculator .id-thg-info-dot {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  display: inline-grid;
  place-items: center;
  border: 2px solid rgba(114,121,136,0.45);
  border-radius: 50%;
  color: #727988 !important;
  font-size: 9px;
  font-weight: 800;
  font-style: normal;
}

/* ---- CTA-Button (kann <a> oder <button> sein) ---- */
.id-thg-calculator .id-thg-button {
  width: 100%;
  min-height: 62px;
  padding: 0 28px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(100deg, #4a34f3 0%, #358df3 43%, #5ddd64 100%);
  box-shadow: 0 14px 24px rgba(54, 126, 236, 0.22), 0 4px 10px rgba(37, 45, 73, 0.08);
  color: #ffffff !important;
  text-decoration: none !important;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 17px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.02em;
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.id-thg-calculator .id-thg-button:hover,
.id-thg-calculator .id-thg-button:focus-visible {
  color: #ffffff !important;
  filter: saturate(1.08);
  box-shadow: 0 18px 28px rgba(54, 126, 236, 0.26), 0 4px 10px rgba(37, 45, 73, 0.1);
  transform: translateY(-1px);
  outline: none;
}

/* ---- Responsive ---- */
@media (max-width: 560px) {
  .id-thg-calculator .id-thg-card {
    padding: 26px 22px 28px;
    border-radius: 16px;
  }

  .id-thg-calculator .id-thg-divider {
    margin-top: 25px;
  }

  .id-thg-calculator .id-thg-row {
    grid-template-columns: 34px minmax(0, 1fr) 136px;
    gap: 11px;
    min-height: 66px;
  }

  .id-thg-calculator .id-thg-icon,
  .id-thg-calculator .id-thg-icon svg {
    width: 27px;
    height: 27px;
  }

  .id-thg-calculator .id-thg-label {
    font-size: 14px;
  }

  .id-thg-calculator .id-thg-stepper {
    grid-template-columns: 37px 48px 37px;
    height: 44px;
  }

  .id-thg-calculator .id-thg-stepper button {
    width: 36px;
    height: 36px;
    font-size: 22px;
  }

  .id-thg-calculator .id-thg-stepper input {
    width: 48px;
    font-size: 23px;
  }

  .id-thg-calculator .id-thg-button {
    min-height: 58px;
    font-size: 15px;
    padding: 0 24px;
  }
}

@media (max-width: 420px) {
  .id-thg-calculator .id-thg-row {
    grid-template-columns: 31px minmax(0, 1fr);
    grid-template-areas:
      "icon label"
      "step step";
    padding: 13px 0;
    row-gap: 9px;
  }

  .id-thg-calculator .id-thg-icon { grid-area: icon; }
  .id-thg-calculator .id-thg-label { grid-area: label; }
  .id-thg-calculator .id-thg-stepper {
    grid-area: step;
    justify-self: stretch;
    grid-template-columns: 1fr 64px 1fr;
  }

  .id-thg-calculator .id-thg-stepper button {
    justify-self: center;
  }
}
