/* IE Immobilien-Rechner - UI 2027 (nach Mockup "Immobilienanalyse-Dashboard mit Szenarien")
   Reines Praesentations-Layer, wird nach calculator.css geladen. */

#ie-rechner {
    --ie-primary: #e30613;
    --ie-primary-dark: #b8000f;
    --ie-primary-light: rgba(227,6,19,.07);
    --ie-accent: #e30613;
    --ie-accent-light: rgba(227,6,19,.08);
    --ie-ink: #0f172a;
    --ie-line: #e6e9ee;
    --ie-soft: #f6f7f9;
    --ie-radius: 14px;
    --ie-shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px rgba(15,23,42,.06);
    color: var(--ie-ink);
}

/* ---------- Moduswahl ---------- */
#ie-rechner .ie-mode-select__title { font-size: 28px; letter-spacing: -.02em; }
#ie-rechner .ie-mode-select__grid { gap: 18px; }
#ie-rechner .ie-mode-card {
    align-items: flex-start; text-align: left; padding: 26px 24px 22px;
    border: 1px solid var(--ie-line); border-radius: 18px; box-shadow: var(--ie-shadow);
    position: relative; overflow: hidden;
}
#ie-rechner .ie-mode-card::before {
    content: ""; position: absolute; left: 0; top: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, #e30613, #ff5a64); opacity: 0; transition: opacity .2s;
}
#ie-rechner .ie-mode-card:hover { border-color: rgba(227,6,19,.35); box-shadow: 0 14px 34px rgba(227,6,19,.12); transform: translateY(-3px); }
#ie-rechner .ie-mode-card:hover::before { opacity: 1; }
#ie-rechner .ie-mode-card__icon {
    width: 52px; height: 52px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center;
    background: var(--ie-primary-light); font-size: 26px;
}
#ie-rechner .ie-mode-card__badge { background: var(--ie-primary-light); color: #b00510; }

/* ---------- Karten-Rahmen, Eingaben ---------- */
#ie-rechner .ie-rechner__main { --gap: 28px; }
#ie-rechner .ie-btn--primary { background: var(--ie-primary); border-color: var(--ie-primary); border-radius: 10px; font-weight: 700; }
#ie-rechner .ie-btn--primary:hover { background: var(--ie-primary-dark); border-color: var(--ie-primary-dark); }
#ie-rechner .ie-btn--outline, #ie-rechner .ie-btn--secondary { border-radius: 10px; }
#ie-rechner input[type=text], #ie-rechner input[type=number], #ie-rechner select {
    border-radius: 10px;
}
#ie-rechner input:focus, #ie-rechner select:focus {
    outline: none; border-color: var(--ie-primary); box-shadow: 0 0 0 3px rgba(227,6,19,.14);
}
#ie-rechner .ie-step__title { font-size: 22px; letter-spacing: -.01em; }

/* ---------- Schritt-Navigation (Sidebar) ---------- */
#ie-rechner .ie-rechner__steps-nav { border: 0; }
#ie-rechner .ie-step-btn {
    border: 0; margin: 0; border-radius: 12px; padding: 11px 12px; gap: 12px; text-align: left; width: 100%;
    background: transparent; color: #475569;
}
#ie-rechner .ie-step-btn:hover { background: var(--ie-soft); color: var(--ie-ink); }
#ie-rechner .ie-step-btn--active { background: var(--ie-primary-light); color: var(--ie-primary); }
#ie-rechner .ie-step-btn--completed { color: #0f766e; }
#ie-rechner .ie-step-btn__num {
    width: 28px; height: 28px; flex: none; background: #e8ebf0; color: #475569;
}
#ie-rechner .ie-step-btn--active .ie-step-btn__num { background: var(--ie-primary); color: #fff; }
#ie-rechner .ie-step-btn--completed .ie-step-btn__num { background: #0f766e; color: #fff; }
#ie-rechner .ie-step-btn__ico { display: none; }
#ie-rechner .ie-step-btn__ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#ie-rechner .ie-step-btn__text { display: flex; flex-direction: column; min-width: 0; }
#ie-rechner .ie-step-btn__label { font-weight: 700; font-size: 14px; line-height: 1.25; }
#ie-rechner .ie-step-btn__sub { font-size: 11.5px; font-weight: 500; color: #7a8696; line-height: 1.3; }
#ie-rechner .ie-step-btn--active .ie-step-btn__sub { color: rgba(227,6,19,.75); }

/* Objektkarte */
#ie-rechner .ie-side-card {
    margin-top: 14px; padding: 16px; border-radius: 14px; background: var(--ie-ink); color: #fff;
}
#ie-rechner .ie-side-card__kicker { display: block; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: #ff7a82; font-weight: 700; margin-bottom: 4px; }
#ie-rechner .ie-side-card__title { display: block; font-size: 15px; line-height: 1.3; word-break: break-word; }
#ie-rechner .ie-side-card__meta { display: block; font-size: 12px; color: #aab4c3; margin: 2px 0 12px; }
#ie-rechner .ie-side-card__stats { margin: 0; display: grid; gap: 8px; }
#ie-rechner .ie-side-card__stats > div { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; border-top: 1px solid rgba(255,255,255,.1); padding-top: 8px; }
#ie-rechner .ie-side-card__stats dt { font-size: 12px; color: #aab4c3; margin: 0; }
#ie-rechner .ie-side-card__stats dd { margin: 0; font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
#ie-rechner .ie-side-card .ie-pos { color: #4ade80; }
#ie-rechner .ie-side-card .ie-neg { color: #ff7a82; }

/* ---------- Ergebnis: KPI-Karten ---------- */
#ie-rechner .ie-kpi-grid { grid-template-columns: repeat(4, 1fr); gap: 12px; }
#ie-rechner .ie-kpi {
    text-align: left; padding: 14px 16px; border: 1px solid var(--ie-line); border-radius: 14px;
    box-shadow: var(--ie-shadow); position: relative;
}
#ie-rechner .ie-kpi:nth-child(4), #ie-rechner .ie-kpi:nth-child(6),
#ie-rechner .ie-kpi:nth-child(1), #ie-rechner .ie-kpi:nth-child(2) { order: 0; }
#ie-rechner .ie-kpi:nth-child(4) { order: -4; }   /* Eigenkapitalrendite */
#ie-rechner .ie-kpi:nth-child(6) { order: -3; }   /* Cashflow nach Steuern */
#ie-rechner .ie-kpi:nth-child(1) { order: -2; }   /* Brutto */
#ie-rechner .ie-kpi:nth-child(2) { order: -1; }   /* Netto */
#ie-rechner .ie-kpi:nth-child(-n+6):nth-child(4),
#ie-rechner .ie-kpi:nth-child(6),
#ie-rechner .ie-kpi:nth-child(1),
#ie-rechner .ie-kpi:nth-child(2) { padding: 18px 18px 16px; }
#ie-rechner .ie-kpi:nth-child(4) .ie-kpi__value,
#ie-rechner .ie-kpi:nth-child(6) .ie-kpi__value,
#ie-rechner .ie-kpi:nth-child(1) .ie-kpi__value,
#ie-rechner .ie-kpi:nth-child(2) .ie-kpi__value { font-size: 26px; letter-spacing: -.02em; }
#ie-rechner .ie-kpi__label { font-size: 12px; font-weight: 600; color: #64748b; margin-bottom: 6px; }
#ie-rechner .ie-kpi__value { font-size: 18px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
#ie-rechner .ie-kpi__rating { border-radius: 999px; padding: 3px 9px; font-size: 10px; }

/* Aktionsleiste Ergebnis */
#ie-rechner .ie-results-actions { gap: 8px; align-items: center; }

/* ---------- Tabs ---------- */
#ie-rechner .ie-tabs { border-bottom: 1px solid var(--ie-line); gap: 2px; }
#ie-rechner .ie-tab {
    border-radius: 10px 10px 0 0; font-weight: 600; padding: 11px 16px; color: #64748b;
}
#ie-rechner .ie-tab:hover { color: var(--ie-ink); }
#ie-rechner .ie-tab--active { color: var(--ie-primary); border-bottom: 2px solid var(--ie-primary); }
#ie-rechner .ie-tab[data-tab="scenarios"]::after {
    content: "NEU"; margin-left: 6px; font-size: 9px; font-weight: 800; letter-spacing: .06em;
    background: var(--ie-primary); color: #fff; padding: 2px 5px; border-radius: 4px; vertical-align: 2px;
}

/* ---------- Tabellen ---------- */
#ie-rechner .ie-table { font-variant-numeric: tabular-nums; }
#ie-rechner .ie-table th { background: var(--ie-soft); border-bottom: 1px solid var(--ie-line); }
#ie-rechner .ie-table td { padding: 9px 10px; }
#ie-rechner .ie-table .ie-num { text-align: right; }
#ie-rechner .ie-pos { color: #15803d; font-weight: 700; }
#ie-rechner .ie-neg { color: #dc2626; font-weight: 700; }

/* ---------- Szenarien ---------- */
.ie-scn__head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 18px; }
.ie-scn__title { margin: 0 0 4px; font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.ie-scn__lead { margin: 0; font-size: 13.5px; color: #64748b; max-width: 56ch; line-height: 1.5; }
.ie-scn__presets { display: inline-flex; background: var(--ie-soft); border: 1px solid var(--ie-line); border-radius: 999px; padding: 4px; gap: 2px; }
.ie-scn__chip { border: 0; background: transparent; padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; color: #475569; cursor: pointer; min-height: 36px; }
.ie-scn__chip--on { background: #fff; color: var(--ie-primary); box-shadow: 0 1px 4px rgba(15,23,42,.12); }
.ie-scn__grid { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 22px; align-items: start; }
.ie-scn__sliders { background: #fff; border: 1px solid var(--ie-line); border-radius: 14px; padding: 18px; box-shadow: var(--ie-shadow); display: grid; gap: 18px; }
.ie-scn__row { display: grid; grid-template-columns: 1fr auto; gap: 8px 10px; align-items: center; }
.ie-scn__row label { font-size: 13.5px; font-weight: 700; }
.ie-scn__row output { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; background: var(--ie-soft); border-radius: 8px; padding: 3px 9px; min-width: 74px; text-align: center; }
.ie-scn__row--changed output { background: var(--ie-primary-light); color: var(--ie-primary); }
.ie-scn__row input[type=range] { grid-column: 1 / -1; width: 100%; margin: 0; height: 28px; -webkit-appearance: none; appearance: none; background: transparent; --p: 50%; }
.ie-scn__row input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 6px; background: linear-gradient(90deg, #e30613 var(--p), #e3e7ed var(--p)); }
.ie-scn__row input[type=range]::-moz-range-track { height: 6px; border-radius: 6px; background: #e3e7ed; }
.ie-scn__row input[type=range]::-moz-range-progress { height: 6px; border-radius: 6px; background: #e30613; }
.ie-scn__row input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 3px solid #e30613; margin-top: -9px; box-shadow: 0 2px 6px rgba(15,23,42,.25); }
.ie-scn__row input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid #e30613; box-shadow: 0 2px 6px rgba(15,23,42,.25); }
.ie-scn__reset { width: 100%; justify-content: center; }
.ie-scn__cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.ie-scn__card { background: #fff; border: 1px solid var(--ie-line); border-radius: 14px; padding: 14px; box-shadow: var(--ie-shadow); display: flex; flex-direction: column; gap: 3px; }
.ie-scn__card-l { font-size: 11.5px; color: #64748b; font-weight: 600; }
.ie-scn__card-v { font-size: 20px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ie-scn__card-d { font-size: 12px; font-weight: 700; color: #64748b; }
.ie-scn__table { margin-bottom: 18px; }
.ie-scn__bars { background: #fff; border: 1px solid var(--ie-line); border-radius: 14px; padding: 16px 18px; }
.ie-scn__bars-t { margin: 0 0 12px; font-size: 13.5px; font-weight: 800; }
.ie-scn__bar-row { display: grid; grid-template-columns: 170px 1fr 84px; gap: 10px; align-items: center; font-size: 12.5px; padding: 5px 0; }
.ie-scn__bar-row em { font-style: normal; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.ie-scn__bar-track { background: var(--ie-soft); border-radius: 6px; height: 10px; overflow: hidden; }
.ie-scn__bar { height: 100%; border-radius: 6px; }
.ie-scn__bar--neg { background: #e30613; }
.ie-scn__bar--pos { background: #16a34a; }
.ie-scn__note { font-size: 12px; color: #64748b; margin: 12px 2px 0; line-height: 1.5; }

/* ---------- Desktop: App-Layout mit Sidebar ---------- */
@media (min-width: 1024px) {
    #ie-rechner .ie-rechner__main {
        display: grid; grid-template-columns: 250px minmax(0, 1fr); column-gap: 32px; row-gap: 0; align-items: start;
    }
    #ie-rechner .ie-rechner__header { display: contents; }
    #ie-rechner .ie-rechner__header > * { grid-column: 2; }
    #ie-rechner .ie-rechner__steps-nav {
        grid-column: 1; grid-row: 1 / span 30; position: sticky; top: 110px; align-self: start;
        flex-direction: column; gap: 4px; padding: 14px; background: #fff; border: 1px solid var(--ie-line);
        border-radius: 18px; box-shadow: var(--ie-shadow);
    }
    #ie-rechner .ie-step-btn__ico { display: none; }
    #ie-rechner .ie-rechner__body, #ie-rechner .ie-rechner__footer, #ie-rechner #ie-dashboard { grid-column: 2; }
    #ie-rechner .ie-rechner__body { min-width: 0; }
    #ie-rechner .ie-rechner__footer { background: transparent; border: 0; padding: 18px 0 0; }
    #ie-rechner .ie-progress { display: none; }
    #ie-rechner .ie-footer__buttons { display: flex; justify-content: space-between; gap: 12px; }
    #ie-rechner .ie-rechner__title { font-size: 26px; letter-spacing: -.02em; }
}

/* ---------- Tablet & Mobile ---------- */
@media (max-width: 1023px) {
    #ie-rechner .ie-rechner__steps-nav {
        display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; background: #fff; padding: 8px;
        border: 1px solid var(--ie-line); border-radius: 16px; box-shadow: var(--ie-shadow);
        position: sticky; top: 8px; z-index: 20; margin-bottom: 8px;
    }
    #ie-rechner .ie-step-btn { flex-direction: column; justify-content: center; gap: 4px; padding: 8px 4px; text-align: center; min-height: 56px; }
    #ie-rechner .ie-step-btn__text { align-items: center; }
    #ie-rechner .ie-step-btn__sub { display: none; }
    #ie-rechner .ie-step-btn__label { font-size: 11.5px; }
    #ie-rechner .ie-side-card { display: none; }
    #ie-rechner .ie-scn__grid { grid-template-columns: 1fr; }
    #ie-rechner .ie-kpi-grid, .ie-scn__cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 767px) {
    #ie-rechner .ie-mode-select__title { font-size: 24px; }
    #ie-rechner .ie-kpi:nth-child(4) .ie-kpi__value,
    #ie-rechner .ie-kpi:nth-child(6) .ie-kpi__value,
    #ie-rechner .ie-kpi:nth-child(1) .ie-kpi__value,
    #ie-rechner .ie-kpi:nth-child(2) .ie-kpi__value { font-size: 21px; }
    #ie-rechner .ie-rechner__footer {
        position: sticky; bottom: 0; z-index: 25; margin: 18px -12px 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
        background: rgba(255,255,255,.96); backdrop-filter: blur(8px); border: 0; border-top: 1px solid var(--ie-line); border-radius: 0;
        box-shadow: 0 -6px 20px rgba(15,23,42,.08);
    }
    #ie-rechner .ie-progress { display: none; }
    #ie-rechner .ie-footer__buttons { display: flex; gap: 10px; }
    #ie-rechner .ie-footer__buttons .ie-btn { flex: 1; justify-content: center; min-height: 48px; font-size: 15px; }
    #ie-rechner .ie-tabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
    #ie-rechner .ie-tab { white-space: nowrap; min-height: 44px; }
    .ie-scn__bar-row { grid-template-columns: 1fr 70px; }
    .ie-scn__bar-row span { grid-column: 1 / -1; font-weight: 600; }
    .ie-scn__presets { width: 100%; }
    .ie-scn__chip { flex: 1; }
    .ie-scn__sliders { padding: 16px; }
    #ie-rechner .ie-results-actions .ie-btn { flex: 1 1 calc(50% - 8px); justify-content: center; min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
    #ie-rechner * { transition: none !important; animation: none !important; }
}

/* Mobil: weniger doppelter Innenabstand (Seitencard + Rechner) */
@media (max-width: 767px) {
    .ie27 article.ie27-pagebody:has(#ie-rechner) { padding: 12px 6px !important; border-radius: 16px; }
    #ie-rechner .ie-form-section { padding: 16px 14px; }
}
