/* ============================================= */
/*       FINALES PREMIUM-CSS FÜR ROI-RECHNER     */
/* ============================================= */

/* DEBUGGING */
*,
*::before,
*::after {
    box-sizing: border-box;
}
/* --- 1. Grundlegende Seiten-Stile --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f8f9fc; /* Heller, moderner Hintergrund */
    padding: 2rem;
    color: #343a40;
}

/* --- 2. Haupt-Layout: Das Zwei-Spalten-Grid --- */
.roi-rechner-grid {
    display: grid;
    /* By default, we have a single column that takes up the full width. */
    grid-template-columns: 1fr; 
    gap: 25px; /* A smaller gap for mobile is better */
    width: 100%; /* Make it take the full available width */
    max-width: 1400px; /* But don't let it get wider than 1400px on desktops */
    margin: auto;
}

/* --- 3. Spalten-Styling --- */
.rechner-spalte-links,
.rechner-spalte-rechts {
    background-color: #ffffff;
    padding: 30px;
    border-radius: 20px; /* Weicher */
    box-shadow: 0 8px 30px rgba(0, 8, 42, 0.07); /* Weicherer, definierter Schatten */
    border: 1px solid #eef2ff;
    transition: box-shadow 0.4s ease; /* Übergang für die Animation */
}

/* NEU: Klasse für die Update-Animation */
.rechner-spalte-rechts.flash-update {
    box-shadow: 0 8px 40px rgba(63, 81, 181, 0.25);
}

/* --- 4. Allgemeine Typografie und Titel --- */
.rechner-spalte-links h3,
.rechner-spalte-rechts h3 {
    font-size: 1.6rem;
    margin-top: 0;
    margin-bottom: 30px;
    border-bottom: 1px solid #f1f3f5;
    padding-bottom: 15px;
    /* VERBESSERT: Moderner Farbverlauf für Titel */
    background: linear-gradient(90deg, #1a237e 0%, #3f51b5 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-fill-color: transparent;
}

/* --- 5. Eingabe-Elemente --- */
.rechner-inputs { margin-bottom: 30px; }
.rechner-schritt { margin-bottom: 30px; }
.rechner-schritt label { display: block; font-weight: 500; color: #495057; margin-bottom: 12px; }
.slider-container, .input-container { display: flex; align-items: center; gap: 15px; }
input[type="range"] { flex-grow: 1; cursor: pointer; -webkit-appearance: none; appearance: none; height: 8px; background: #dee2e6; border-radius: 5px; outline: none; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; background: #3f51b5; cursor: pointer; border-radius: 50%; }
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; background: #3f51b5; cursor: pointer; border-radius: 50%; border: none; }
input[type="number"] { padding: 10px; border-radius: 8px; border: 1px solid #ced4da; width: 100px; font-size: 1rem; font-weight: 500; text-align: center; }
.wert-box { font-weight: bold; background-color: #eef2ff; color: #3f51b5; padding: 10px 14px; border-radius: 8px; min-width: 80px; text-align: center; font-size: 1rem; }
.radio-group { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.radio-group label { position: relative; display: flex; flex-direction: column; align-items: center; padding: 15px; border: 2px solid #e9ecef; border-radius: 12px; cursor: pointer; transition: all 0.2s ease-in-out; text-align: center; font-weight: 500; margin-bottom: 0; }
.radio-group input[type="radio"] { display: none; }
.radio-group label:has(input:checked) { border-color: #3f51b5; background-color: #eef2ff; color: #1a237e; box-shadow: 0 4px 10px rgba(63, 81, 181, 0.1); transform: translateY(-2px); }
.radio-group label:not(:has(input:checked)):hover { border-color: #adb5bd; }
.radio-group strong { font-size: 1.1rem; }
/* Styling für den neuen Kurztext */
.radio-beschreibung {
    display: block;
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 5px;
    line-height: 1.4;
}

/* Styling für den (?) Tooltip-Trigger */
.tooltip-trigger {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 22px;
    height: 22px;
    background-color: #adb5bd;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: help; /* Ändert den Mauszeiger zu einem Fragezeichen */
    transition: background-color 0.2s;
}

.tooltip-trigger:hover {
    background-color: #3f51b5; /* Akzentfarbe beim Hover */
}

/* Styling für die versteckte Tooltip-Box */
.tooltip-content {
    position: absolute; /* Wird per JS positioniert */
    background-color: #212529; /* Dunkler Hintergrund */
    color: #f8f9fa; /* Heller Text */
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    max-width: 320px;
    z-index: 100; /* Stellt sicher, dass es über allem liegt */
    font-size: 0.9rem;
    line-height: 1.6;
    
    /* Standardmäßig versteckt und für Animation vorbereitet */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

/* Wird per JS hinzugefügt, um den Tooltip anzuzeigen */
.tooltip-content.visible {
    opacity: 1;
    visibility: visible;
}

.tooltip-content h4 {
    margin: 0 0 10px 0;
    color: #ffffff;
    font-size: 1rem;
    border-bottom: 1px solid #495057;
    padding-bottom: 8px;
}

.tooltip-content p {
    margin: 0 0 5px 0;
}
.tooltip-content p:last-child {
    margin-bottom: 0;
}
.zeit-analyse { background-color: #f8f9fa; border: 1px solid #dee2e6; border-radius: 12px; padding: 20px; font-size: 0.95rem; line-height: 1.6; }
.zeit-analyse h4 { margin: 0 0 15px 0; color: #1a237e; font-size: 1.1rem; }
.zeit-analyse p { margin: 0 0 10px 0; }
.zeit-analyse p:last-child { margin-bottom: 0; }
.zeit-analyse ul { padding-left: 20px; margin-bottom: 10px; }
.zeit-analyse .einsparung { color: #4CAF50; font-weight: 500; }

/* --- 6. Rechte Spalte: Ergebnisse & Diagramme --- */
.chart-container { position: relative; height: 280px; width: 100%; margin-bottom: 15px; }

/* NEU: Styling für die benutzerdefinierte HTML-Legende */
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin-top: -10px;
    margin-bottom: 40px;
    padding: 0;
    list-style: none;
}
.chart-legend li {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    color: #6c757d;
}
.chart-legend .legend-color-box {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    margin-right: 8px;
}

/* Styling für das benutzerdefinierten Tooltip */
.chart-tooltip {
    opacity: 0;
    position: absolute;
    background: rgba(26, 35, 126, 0.95); /* Dunkelblau, fast blickdicht */
    color: white;
    border-radius: 8px;
    padding: 12px 15px;
    pointer-events: none;
    transition: opacity 0.2s ease;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    min-width: 220px;
    z-index: 10;
}
.chart-tooltip h4 {
    margin: 0 0 8px 0;
    font-size: 1rem;
    font-weight: bold;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 5px;
    color: white; /* Explizit setzen, um Vererbungsprobleme zu vermeiden */
    background: none; /* Explizit setzen */
    -webkit-text-fill-color: white; /* Explizit setzen */
}
.chart-tooltip table { width: 100%; border-spacing: 0; }
.chart-tooltip td { padding: 4px 0; }
.chart-tooltip .legend-color-box { width: 10px; height: 10px; border-radius: 2px; margin-right: 10px; display: inline-block; vertical-align: middle; }
.chart-tooltip .value { text-align: right; font-weight: bold; padding-left: 15px; }
.chart-tooltip .total td {
    font-weight: bold;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
}

/* Bestehende Stile für Ergebnis-Boxen etc. */
.ergebnis-vergleich { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 30px; margin-bottom: 30px; }
.prozess-box { padding: 25px; border: 1px solid #e9ecef; border-radius: 12px; background-color: #f8f9fa; text-align: center; }
.prozess-box.pruefexpress { border-left: 5px solid #4CAF50; background-color: #ffffff; box-shadow: 0 4px 12px rgba(0,0,0,0.04); }
.kosten-wert { font-size: 2.2rem; font-weight: 700; margin: 10px 0; color: #1a237e; }
.rechenweg { font-size: 0.85rem; color: #6c757d; margin-top: 10px; min-height: 2.5em; }
.ersparnis-highlight { display: flex; align-items: center; justify-content: center; gap: 25px; margin: 40px 0; padding: 25px; border-radius: 16px; border: 1px solid transparent; transition: background-color 0.3s, border-color 0.3s; }
.ersparnis-icon { font-size: 3rem; font-weight: 300; }
.ersparnis-text { text-align: left; }
.ersparnis-label { display: block; font-size: 1rem; font-weight: 500; opacity: 0.8; margin-bottom: 5px; }
.ersparnis-wert { font-size: 2.5rem; font-weight: 700; margin: 0; line-height: 1.1; }
.ersparnis-highlight.status-gewinn { background-color: #f0f9f2; border-color: #a5d6a7; color: #1e4620; }
.ersparnis-highlight.status-verlust { background-color: #fff0f0; border-color: #ef9a9a; color: #b71c1c; }
.roi-zeit-box { display: flex; align-items: center; gap: 20px; background-color: #eef2ff; border: 1px solid #c5cae9; border-left: 5px solid #3f51b5; padding: 25px; margin: 40px 0; border-radius: 12px; }
.roi-zeit-box .icon { font-size: 2.5rem; opacity: 0.7; }
.roi-zeit-box h4 { margin: 0 0 8px 0; color: #3f51b5; font-size: 1.1rem; background: none; -webkit-text-fill-color: #3f51b5; }
#roi-beschreibung { font-size: 1rem; line-height: 1.5; margin: 0; }

/* --- 7. Responsivität --- */
@media (max-width: 1200px) {
    .roi-rechner-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .radio-group { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    body { padding: 1rem; }
    .rechner-spalte-links, .rechner-spalte-rechts { padding: 20px 15px; }
    .ergebnis-vergleich { grid-template-columns: 1fr; }
    .kosten-wert { font-size: 1.8rem; }
    .rechner-aktionen { flex-direction: column; }
}
@media (min-width: 1024px) {
    .roi-rechner-grid {
        /* Switch to the two-column layout */
        grid-template-columns: 1fr 1.6fr;
        gap: 40px; /* Restore the larger gap for desktops */
    }
}

/* ===== IFRAME HEIGHT MESSAGING ===== */
body.is-embedded {
    background-color: transparent; /* Make background transparent */
}