/* 
    RKW Zuschussrechner Styles
*/

/* General Wrapper */
#rkw-zuschuss-container {
    max-width: 900px;
    margin: 40px auto;
    background: #ffffff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    font-family: 'Palanquin', sans-serif;
    color: #505050;
}

#rkw-zuschuss-container * {
    box-sizing: border-box;
}

/* Base Headings */
h3.rkw-section-title {
    font-size: 18px;
    font-weight: 700;
    color: #333333;
    border-left: 4px solid #d63f11;
    padding-left: 10px;
    margin-bottom: 20px;
    text-transform: uppercase;
}

h4.rkw-label-uppercase {
    font-size: 12px;
    font-weight: 700;
    color: #505050;
    text-transform: uppercase;
    margin: 0 0 8px 0;
    letter-spacing: 0.5px;
}

/* Auswahlbereich */
.rkw-section {
    margin-bottom: 40px;
    padding-bottom: 40px;
    border-bottom: 1px solid #e6e6e6;
}

/* Dropdown Styles */
.rkw-select-wrapper {
    position: relative;
    margin-bottom: 20px;
}

select#rkw-programm-select {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    font-weight: 600;
    color: #333333;
    border: 1px solid #acacac;
    border-radius: 6px;
    appearance: none;
    -webkit-appearance: none;
    background-color: white;
    font-family: 'Palanquin', sans-serif;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

select#rkw-programm-select:focus {
    outline: none;
    border-color: #d63f11;
    box-shadow: 0 0 0 2px rgba(214, 63, 17, 0.1);
}

.rkw-select-arrow {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #505050;
    pointer-events: none;
}

/* Info Link (Themenseite) */
.rkw-info-link-container {
    margin-bottom: 30px;
    font-size: 14px;
    color: #505050;
}

.rkw-info-link-container a {
    color: #333333;
    font-weight: 700;
    text-decoration: underline;
    transition: color 0.2s;
}

.rkw-info-link-container a:hover {
    color: #d63f11;
}

/* Slider Section */
.rkw-slider-grid {
    display: flex;
    justify-content: space-between;
    gap: 40px;
}

.rkw-slider-col {
    flex: 1;
}

.rkw-slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    /* Allow wrapping for hints */
}

.rkw-slider-title {
    font-size: 16px;
    font-weight: 700;
    color: #333333;
    /* Dark Highlight */
    display: flex;
    align-items: center;
}

.rkw-slider-hint {
    font-size: 12px;
    font-weight: 400;
    color: #acacac;
    margin-left: 5px;
}

/* New Founder Hint Badge */
.rkw-founder-hint {
    display: none;
    /* Toggled by JS */
    background-color: #fef0eb;
    color: #d63f11;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 50px;
    border: 1px solid #fbd8ce;
    text-transform: uppercase;
    line-height: 1.2;
    margin-left: 10px;
    white-space: nowrap;
}

.rkw-slider-value {
    font-size: 18px;
    font-weight: 700;
    color: #d63f11;
    /* Orange */
}

/* Range Input Customization */
input[type=range].rkw-range {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e6e6e6;
    /* Default if JS is inactive */
    cursor: pointer;
}

/* FIX: Prevent external scripts/frameworks from showing debug values below the slider */
input[type=range].rkw-range+* {
    display: none !important;
}

output {
    display: none !important;
}

/* Track */
input[type=range].rkw-range::-webkit-slider-runnable-track {
    width: 100%;
    height: 8px;
    background: transparent;
    /* Changed to transparent so JS background shows */
    border-radius: 4px;
}

/* Thumb */
input[type=range].rkw-range::-webkit-slider-thumb {
    height: 24px;
    width: 24px;
    border-radius: 4px;
    /* Slight rounding for square look */
    background: #d63f11;
    /* RKW Orange */
    border: 3px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    margin-top: -8px;
    /* (TrackHeight/2) - (ThumbHeight/2) -> 4 - 12 = -8 */
    -webkit-appearance: none;
}

/* Result Area Grid */
.rkw-result-container {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    background-color: #f8f8f8;
    /* Grau hinterlegt */
    padding: 30px;
    border-radius: 8px;
    border: 1px solid #e6e6e6;
}

/* Chart Area (Left) - Kleiner */
.rkw-chart-wrapper {
    flex: 0.8;
    /* War 1 -> 20% kleiner */
    min-width: 250px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-right: 1px solid #e6e6e6;
    padding-right: 20px;
}

.rkw-donut-chart-container {
    position: relative;
    width: 200px;
    height: 200px;
    margin-bottom: 20px;
}

.rkw-donut-svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.rkw-donut-segment {
    stroke-width: 25;
}

.rkw-stroke-orange {
    stroke: #d63f11;
}

.rkw-stroke-grey {
    stroke: #e6e6e6;
}

.rkw-donut-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.rkw-center-big {
    font-size: 24px;
    font-weight: 800;
    color: #333333;
    line-height: 1;
}

.rkw-center-small {
    font-size: 11px;
    font-weight: 700;
    color: #505050;
    margin-top: 4px;
}

/* Legend */
.rkw-chart-legend {
    display: flex;
    gap: 20px;
}

.rkw-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.rkw-legend-rect {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.rkw-bg-orange {
    background-color: #d63f11;
}

.rkw-bg-grey {
    background-color: #e6e6e6;
}

.rkw-legend-label {
    font-weight: 700;
    display: block;
    color: #333333;
}

.rkw-legend-val {
    color: #505050;
}

/* Table Wrapper (Right) - Größer */
.rkw-table-wrapper {
    flex: 2;
    /* War 1.5 -> mehr Platz */
    min-width: 320px;
}

table.rkw-result-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
    /* Schriftgröße erhöht */
}

table.rkw-result-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #acacac;
    padding: 8px 0;
    border-bottom: 1px solid #e6e6e6;
}

table.rkw-result-table td {
    padding: 12px 0;
    vertical-align: middle;
    border-bottom: 1px solid #ffffff;
}

.col-pos {
    width: 40%;
    font-weight: 600;
    color: #333333;
}

.col-calc {
    width: 35%;
    color: #acacac;
    font-size: 13px;
}

.col-sum {
    width: 25%;
    text-align: right;
    color: #333333;
    font-weight: 600;
}

/* Result Rows Improvements */
.row-total-netto td {
    padding-top: 16px;
    padding-bottom: 16px;
    padding-left: 10px;
    padding-right: 10px;
    border-top: 2px solid #acacac;
    border-bottom: 1px solid #acacac;
    background-color: #ffffff;
    /* Light Slate */
    color: #333333;
}

.row-zuschuss td {
    padding-top: 16px;
    padding-bottom: 16px;
    padding-left: 10px;
    padding-right: 10px;
    background-color: #fef0eb;
    /* Light Orange */
    color: #d63f11;
    /* Darker Orange text */
    border-bottom: 1px solid #fbd8ce;
}

.row-eigen td {
    padding-top: 16px;
    padding-bottom: 16px;
    padding-left: 10px;
    padding-right: 10px;
    background-color: #e6e6e6;
    /* Darker Slate for Eigenanteil */
    font-size: 16px;
    font-weight: 700;
    color: #333333;
    border-bottom: none;
    border-radius: 0 0 4px 4px;
    /* Rounded bottom corners for last row look */
}

/* Remove default padding from cells in these rows to use new padding */
.row-total-netto td,
.row-zuschuss td,
.row-eigen td {
    vertical-align: middle;
}

/* Ensure first/last cells have rounded corners if we want a boxed look per row? No, table is full width.
   But let's add slight left/right padding to first/last cells. */
.rkw-result-table td:first-child {
    padding-left: 10px;
}

.rkw-result-table td:last-child {
    padding-right: 10px;
}

.highlight-row {
    /* Removed old style favoring specific row styles above */
}

/* Tax Note Box (Blue) */
.rkw-tax-box {
    margin-top: 40px;
    background-color: #e6e6e6;
    border-left: 5px solid #d63f11;
    padding: 20px;
    border-radius: 6px;
}

.rkw-tax-title {
    color: #333333;
    font-weight: 800;
    margin: 0 0 8px 0;
    font-size: 15px;
    text-transform: uppercase;
}

.rkw-tax-text {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #333333;
}


/* Mobile Responsive */
@media (max-width: 768px) {
    .rkw-slider-grid {
        flex-direction: column;
        gap: 30px;
    }

    .rkw-result-container {
        flex-direction: column;
        padding: 10px;
        /* Reduced padding to prevent overflow */
        width: 100%;
        box-sizing: border-box;
    }

    .rkw-chart-wrapper {
        order: 2;
        border-right: none;
        border-top: 1px solid #e6e6e6;
        padding-top: 30px;
        padding-right: 0;
        margin-top: 20px;
        width: 100%;
        /* Ensure full width */
    }

    .rkw-table-wrapper {
        order: 1;
        width: 100%;
        min-width: 0 !important;
        /* Critical override */
        overflow-x: hidden;
        /* Hide scroll to force fit */
        display: block;
    }

    /* Optimize Table for Mobile */
    table.rkw-result-table {
        table-layout: fixed;
        /* Force column widths strict */
        width: 100%;
        min-width: 0;
    }

    .col-pos {
        width: 25%;
        font-size: 12px;
        overflow-wrap: break-word;
        hyphens: auto;
        line-height: 1.2;
        padding-right: 2px;
    }

    .col-calc {
        width: 40%;
        font-size: 10px !important;
        text-align: right;
        padding-right: 2px;
        white-space: normal;
        line-height: 1.2;
    }

    .col-sum {
        width: 35%;
        font-size: 13px;
        text-align: right;
        white-space: nowrap;
        /* Keep money on one line if possible */
        overflow: hidden;
        /* Crop if absolutely necessary, better than overflow */
        text-overflow: ellipsis;
    }

    /* Adjust padding in colored rows for mobile */
    .row-total-netto td,
    .row-zuschuss td,
    .row-eigen td {
        padding: 8px 2px;
        /* Very tight padding */
        font-size: 12px;
    }

    /* Specific overrides for calc in rows */
    .row-total-netto .col-calc,
    .row-zuschuss .col-calc,
    .row-eigen .col-calc {
        font-size: 9px !important;
        /* Even smaller in colored rows if needed */
    }
}