/* ==========================================================================
   IAB-Rechner — CSS
   Designed for sb-wp.de (Open Sans / Raleway, blue accent, angular style)
   ========================================================================== */

.iab-rechner {
  --iab-primary: #0069a5;
  --iab-primary-hover: #1a80b6;
  --iab-primary-light: #e8f4fa;
  --iab-primary-dark: #004d7a;
  --iab-text: #3b4251;
  --iab-muted: #666666;
  --iab-border: #d2d2d2;
  --iab-radius: 2px;
  --iab-input-height: 40px;
  --iab-negative: #c0392b;
  --iab-positive: #0069a5;
  --iab-bg: #ffffff;
  --iab-bg-page: #f5f5f5;
  --iab-highlight: #e67e22;

  font-family: "Open Sans", Arial, Helvetica, sans-serif;
  color: var(--iab-text);
  line-height: 1.6;
  max-width: 820px;
  margin: 40px auto;
  padding: 0 20px;
  box-sizing: border-box;
}

/* Override Avada / theme heading color inside our component */
.iab-rechner h2,
.iab-rechner h3,
.iab-rechner h4 {
  color: inherit;
  margin: 0;
}

/* White headings on dark backgrounds need !important to beat Avada specificity */
.iab-rechner .iab-rechner__title,
.iab-rechner .iab-rechner__table-title {
  color: #fff !important;
}

.iab-rechner *, .iab-rechner *::before, .iab-rechner *::after {
  box-sizing: border-box;
}

/* Header */
.iab-rechner__header {
  background: var(--iab-primary-dark);
  color: #fff;
  padding: 28px 32px;
  border-radius: var(--iab-radius);
}

.iab-rechner__title {
  font-family: Raleway, Arial, Helvetica, sans-serif;
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 4px;
  color: #fff;
}

.iab-rechner__subtitle {
  font-size: 14px;
  margin: 0;
  opacity: 0.85;
  color: #fff;
}

/* Intro */
.iab-rechner__intro {
  background: var(--iab-bg);
  border-left: 3px solid var(--iab-primary);
  padding: 16px 20px;
  margin: 20px 0;
  font-size: 14px;
  color: var(--iab-muted);
}

.iab-rechner__intro p { margin: 0; }

/* Form */
.iab-rechner__form {
  background: var(--iab-bg);
  padding: 24px;
  border: 1px solid var(--iab-border);
  border-radius: var(--iab-radius);
}

.iab-rechner__fieldset {
  border: none;
  padding: 0;
  margin: 0 0 24px;
}

.iab-rechner__legend {
  font-family: Raleway, Arial, Helvetica, sans-serif;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--iab-muted);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--iab-border);
  width: 100%;
}

.iab-rechner__row {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
}

.iab-rechner__field {
  flex: 1;
  min-width: 0;
}

.iab-rechner__field--wide {
  flex: 1.5;
}

.iab-rechner__label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--iab-text);
  margin-bottom: 6px;
}

.iab-rechner__input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.iab-rechner__input {
  width: 100%;
  height: var(--iab-input-height);
  border: 1px solid var(--iab-border);
  border-radius: var(--iab-radius);
  padding: 0 36px 0 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--iab-text);
  background: #fff;
  transition: border-color 0.15s;
}

.iab-rechner__input:focus {
  outline: none;
  border-color: var(--iab-primary);
  box-shadow: 0 0 0 2px rgba(0, 105, 165, 0.15);
}

.iab-rechner__input--error {
  border-color: var(--iab-negative) !important;
  box-shadow: 0 0 0 2px rgba(192, 57, 43, 0.15) !important;
}

.iab-rechner__unit {
  position: absolute;
  right: 12px;
  color: var(--iab-muted);
  font-size: 14px;
  pointer-events: none;
}

.iab-rechner__select {
  width: 100%;
  height: var(--iab-input-height);
  border: 1px solid var(--iab-border);
  border-radius: var(--iab-radius);
  padding: 0 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--iab-text);
  background: #fff;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.iab-rechner__select:focus {
  outline: none;
  border-color: var(--iab-primary);
}

.iab-rechner__hint {
  display: block;
  font-size: 12px;
  color: var(--iab-muted);
  margin-top: 4px;
}

/* Details / Erweiterte Optionen */
.iab-rechner__details {
  margin-top: 24px;
}

.iab-rechner__summary {
  font-size: 13px;
  color: var(--iab-primary);
  cursor: pointer;
  font-weight: 600;
  user-select: none;
}

.iab-rechner__summary:hover {
  color: var(--iab-primary-hover);
}

.iab-rechner__details-body {
  margin-top: 12px;
}

/* Range slider */
.iab-rechner__slider-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.iab-rechner__slider-value {
  font-family: Raleway, Arial, Helvetica, sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--iab-primary);
}

.iab-rechner__range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, var(--iab-primary) var(--pct, 50%), var(--iab-border) var(--pct, 50%));
  outline: none;
  cursor: pointer;
}

.iab-rechner__range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--iab-primary);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  cursor: pointer;
}

.iab-rechner__range::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--iab-primary);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  cursor: pointer;
}

.iab-rechner__slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--iab-muted);
  margin-top: 4px;
}

/* Button */
.iab-rechner__btn {
  display: inline-block;
  background: var(--iab-primary);
  color: #fff;
  border: none;
  border-radius: var(--iab-radius);
  padding: 12px 28px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
  width: 100%;
  text-align: center;
}

.iab-rechner__btn:hover {
  background: var(--iab-primary-hover);
}

.iab-rechner__btn--outline {
  background: transparent;
  color: var(--iab-primary);
  border: 2px solid var(--iab-primary);
}

.iab-rechner__btn--outline:hover {
  background: var(--iab-primary-light);
  color: var(--iab-primary);
}

/* ========================================================================
   RESULTS
   ======================================================================== */

.iab-rechner__results {
  margin-top: 28px;
}

/* Hero */
.iab-rechner__hero {
  background: var(--iab-primary);
  color: #fff;
  text-align: center;
  padding: 28px 24px;
  border-radius: var(--iab-radius);
  margin-bottom: 20px;
}

.iab-rechner__hero-label {
  font-size: 13px;
  opacity: 0.85;
}

.iab-rechner__hero-value {
  font-family: Raleway, Arial, Helvetica, sans-serif;
  font-size: 36px;
  font-weight: 700;
  margin: 6px 0;
}

.iab-rechner__hero-context {
  font-size: 13px;
  opacity: 0.75;
}

/* Ampel */
.iab-rechner__ampel {
  background: var(--iab-bg);
  border: 1px solid var(--iab-border);
  border-radius: var(--iab-radius);
  padding: 24px;
  margin-bottom: 20px;
}

.iab-rechner__ampel-title {
  font-family: Raleway, Arial, Helvetica, sans-serif;
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 16px;
}

.iab-rechner__ampel-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  font-size: 14px;
}

.iab-rechner__ampel-label { font-weight: 600; }
.iab-rechner__ampel-value { font-weight: 700; }

.iab-rechner__bar {
  height: 24px;
  border-radius: var(--iab-radius);
  margin-bottom: 16px;
  transition: width 0.5s ease;
}

.iab-rechner__bar--red { background: var(--iab-negative); }
.iab-rechner__bar--green { background: var(--iab-positive); }

.iab-rechner__ampel-note {
  font-size: 13px;
  color: var(--iab-muted);
  background: var(--iab-primary-light);
  padding: 12px 16px;
  border-radius: var(--iab-radius);
  margin-top: 8px;
}

/* KPIs */
.iab-rechner__kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.iab-rechner__kpi {
  background: var(--iab-bg);
  border: 1px solid var(--iab-border);
  border-radius: var(--iab-radius);
  padding: 16px;
  text-align: center;
}

.iab-rechner__kpi--highlight {
  background: var(--iab-primary);
  border-color: var(--iab-primary);
  color: #fff;
}

.iab-rechner__kpi-value {
  display: block;
  font-family: Raleway, Arial, Helvetica, sans-serif;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.iab-rechner__kpi--highlight .iab-rechner__kpi-value { color: #fff; }

.iab-rechner__kpi-label {
  font-size: 12px;
  color: var(--iab-muted);
}

.iab-rechner__kpi--highlight .iab-rechner__kpi-label {
  color: rgba(255,255,255,0.8);
}

/* Facts */
.iab-rechner__facts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.iab-rechner__fact {
  background: var(--iab-bg);
  border: 1px solid var(--iab-border);
  border-radius: var(--iab-radius);
  padding: 16px;
  text-align: center;
}

.iab-rechner__fact-label {
  display: block;
  font-size: 12px;
  color: var(--iab-muted);
  margin-bottom: 4px;
}

.iab-rechner__fact-value {
  display: block;
  font-family: Raleway, Arial, Helvetica, sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--iab-primary);
}

/* Table */
.iab-rechner__table-wrap {
  background: var(--iab-bg);
  border: 1px solid var(--iab-border);
  border-radius: var(--iab-radius);
  overflow: hidden;
  margin-bottom: 20px;
}

.iab-rechner__table-title {
  font-family: Raleway, Arial, Helvetica, sans-serif;
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  padding: 16px 20px;
  background: var(--iab-primary-dark);
  color: #fff;
}

.iab-rechner__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.iab-rechner__table th {
  text-align: right;
  padding: 10px 16px;
  font-weight: 600;
  border-bottom: 2px solid var(--iab-border);
  background: var(--iab-primary);
  color: #fff;
  font-size: 12px;
}

.iab-rechner__table th:first-child { text-align: left; }

.iab-rechner__table td {
  padding: 8px 16px;
  border-bottom: 1px solid #eee;
}

.iab-rechner__table-num { text-align: right; white-space: nowrap; }

.iab-rechner__table-bold { font-weight: 700; }

.iab-rechner__table-diff { color: var(--iab-positive); }

.iab-rechner__table-highlight {
  background: var(--iab-primary-light);
}

.iab-rechner__table-highlight td {
  font-weight: 700;
  border-bottom: none;
}

/* Chart */
.iab-rechner__chart-wrap {
  background: var(--iab-bg);
  border: 1px solid var(--iab-border);
  border-radius: var(--iab-radius);
  padding: 20px;
  margin-bottom: 20px;
}

.iab-rechner__chart-title {
  font-family: Raleway, Arial, Helvetica, sans-serif;
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 16px;
}

.iab-rechner__chart {
  width: 100%;
  display: block;
}

.iab-rechner__chart-legend {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 12px;
  font-size: 12px;
  color: var(--iab-muted);
}

.iab-rechner__legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.iab-rechner__legend-item::before {
  content: '';
  width: 14px;
  height: 14px;
  border-radius: 2px;
  display: inline-block;
}

.iab-rechner__legend-item--area::before { background: var(--iab-primary); }
.iab-rechner__legend-item--line::before { background: var(--iab-negative); }
.iab-rechner__legend-item--marker::before { background: var(--iab-highlight); }

/* Tip */
.iab-rechner__tip {
  background: #fef9e7;
  border-left: 4px solid var(--iab-highlight);
  padding: 14px 18px;
  font-size: 13px;
  margin-bottom: 20px;
  color: var(--iab-text);
}

/* Breakdown */
.iab-rechner__breakdown {
  background: var(--iab-bg);
  border: 1px solid var(--iab-border);
  border-radius: var(--iab-radius);
  margin-bottom: 20px;
}

.iab-rechner__breakdown-toggle {
  padding: 14px 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--iab-primary);
  user-select: none;
}

.iab-rechner__breakdown-body {
  padding: 0 20px 16px;
}

.iab-rechner__breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.iab-rechner__breakdown-table td {
  padding: 5px 0;
  border-bottom: 1px solid #f0f0f0;
}

.iab-rechner__breakdown-table td:last-child {
  text-align: right;
  white-space: nowrap;
}

/* Disclaimer */
.iab-rechner__disclaimer {
  background: #f9f9f9;
  border: 1px solid var(--iab-border);
  border-radius: var(--iab-radius);
  padding: 14px 18px;
  font-size: 12px;
  color: var(--iab-muted);
  margin-bottom: 20px;
}

/* Actions */
.iab-rechner__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

/* ========================================================================
   RESPONSIVE
   ======================================================================== */

@media (max-width: 640px) {
  .iab-rechner {
    padding: 0 12px;
    margin: 20px auto;
  }

  .iab-rechner__header { padding: 20px; }
  .iab-rechner__form { padding: 16px; }

  .iab-rechner__row {
    flex-direction: column;
    gap: 12px;
  }

  .iab-rechner__kpis {
    grid-template-columns: 1fr;
  }

  .iab-rechner__facts {
    grid-template-columns: 1fr;
  }

  .iab-rechner__actions {
    grid-template-columns: 1fr;
  }

  .iab-rechner__hero-value {
    font-size: 28px;
  }

  .iab-rechner__table {
    font-size: 12px;
  }

  .iab-rechner__table th,
  .iab-rechner__table td {
    padding: 6px 8px;
  }
}

/* ========================================================================
   PRINT
   ======================================================================== */

@media print {
  .iab-rechner__form,
  .iab-rechner__actions { display: none !important; }

  .iab-rechner__results { margin-top: 0; }
  .iab-rechner { max-width: 100%; padding: 0; }

  .iab-rechner__hero {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .iab-rechner__bar {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .iab-rechner__kpi--highlight {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
