/*
 * Calculator portlet-only styles that must not depend on the Plone Resource
 * Registry. Keep selectors scoped to .portletCalculator.
 */

/* Energy navigation: Strom Bezug / Strom Einspeisung / Gas. */
.portletCalculator #energytype {
    display: flex;
    flex-flow: row nowrap;
    align-items: stretch;
    width: 100%;
    margin: 0;
    padding: 0;
    clear: both;
    overflow: visible;
}

.portletCalculator #energytype > span {
    float: none;
    display: flex;
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    margin: 0 0 0 -1px;
    padding: 0;
}

.portletCalculator #energytype > span:first-child {
    margin-left: 0;
}

.portletCalculator #energytype > span > label {
    box-sizing: border-box;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 68px;
    min-height: 68px;
    margin: 0;
    padding: 0;
    border: 1px solid #c8c8c8;
    background: #fff;
    cursor: pointer;
    line-height: 0;
    overflow: visible;
}

.portletCalculator #energytype > span > label:hover,
.portletCalculator #energytype > span > label:focus {
    background: #fff;
}

.portletCalculator #energytype .energytype-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin: 0;
    padding: 0;
    line-height: 0;
}

.portletCalculator #energytype .energytype-icon svg {
    display: block;
    width: 38px;
    height: 38px;
    margin: 0;
    fill: currentColor;
    stroke: currentColor;
}

/*
 * The Diazo theme still contains legacy selectors such as
 *   .portletCalculator #energytype span label.power
 * which are more specific than a plain ".power" selector. Target the three
 * concrete switch IDs here so the portlet-local stylesheet wins without
 * !important and without changing the global theme.
 */
.portletCalculator #energytype > span > #powerswitch.power,
.portletCalculator #energytype > span > #powerswitch.power:hover,
.portletCalculator #energytype > span > #powerswitch.power:focus {
    background: #fff;
    color: #a90025;
}

.portletCalculator #energytype > span > #feedinswitch.feedin,
.portletCalculator #energytype > span > #feedinswitch.feedin:hover,
.portletCalculator #energytype > span > #feedinswitch.feedin:focus {
    background: #fff;
    color: #2476b7;
}

.portletCalculator #energytype > span > #gasswitch.gas,
.portletCalculator #energytype > span > #gasswitch.gas:hover,
.portletCalculator #energytype > span > #gasswitch.gas:focus {
    background: #fff;
    color: #d8bf00;
}

.portletCalculator #energytype > span > label.selected-energytype {
    z-index: 2;
    border-color: currentColor;
    background: #fff;
}

.portletCalculator #energytype > span > label.selected-energytype:after {
    content: "";
    position: absolute;
    left: 50%;
    top: 100%;
    width: 0;
    height: 0;
    margin: 0 0 0 -9px;
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-top: 9px solid currentColor;
    pointer-events: none;
    z-index: 3;
}

.portletCalculator #energytype-active-caption {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 40px;
    min-height: 40px;
    margin: 9px 0 18px;
    padding: 0 10px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
}

.portletCalculator #energytype-active-caption.power {
    background: #a90025;
    color: #fff;
}

.portletCalculator #energytype-active-caption.feedin {
    background: #2476b7;
    color: #fff;
}

.portletCalculator #energytype-active-caption.gas {
    background: #f2df3a;
    color: #2f2b00;
}

/* Consumption input mode: keep all three choices in one compact row. */
.portletCalculator #formfield-form-widgets-consumptionInputMode .consumption-input-tabs {
    box-sizing: border-box;
    display: flex;
    flex-flow: row nowrap;
    align-items: stretch;
    width: 100%;
    margin: 0;
    padding: 0;
}

.portletCalculator #formfield-form-widgets-consumptionInputMode .consumption-input-tab {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 0;
    width: 0;
    min-width: 0;
    min-height: 34px;
    margin: 0;
    padding: 5px 3px;
    border: 1px solid #9a9a9a;
    border-radius: 0;
    background: #f4f4f4;
    color: #444;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.1;
    text-align: center;
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
    cursor: pointer;
}

.portletCalculator #formfield-form-widgets-consumptionInputMode .consumption-input-tab[data-value="HOUSEHOLD_SIZE"] {
    flex-grow: 1.35;
}

.portletCalculator #formfield-form-widgets-consumptionInputMode .consumption-input-tab + .consumption-input-tab {
    border-left: 0;
}

.portletCalculator #formfield-form-widgets-consumptionInputMode .consumption-input-tab.active {
    background: #d8d8d8;
    color: #333;
}

/* Keep the persons field title and its help text on separate lines. */
.portletCalculator #formfield-form-widgets-persons > label,
.portletCalculator #formfield-form-widgets-persons .formHelp {
    display: block;
}

.portletCalculator #formfield-form-widgets-persons .formHelp {
    margin: 2px 0 0;
    line-height: 1.25;
}

/* Result header: calculation inputs and tariff choice form one compact unit. */
.econtrol-result-header {
    box-sizing: border-box;
    display: flex;
    align-items: stretch;
    gap: 18px;
    width: 100%;
    margin: 0 0 24px;
    clear: both;
}

.econtrol-result-header #ihreDaten {
    box-sizing: border-box;
    flex: 1 1 70%;
    float: none;
    width: auto;
    margin: 0;
}

.econtrol-result-header .econtrol-result-model-switch {
    flex: 0 0 30%;
    min-width: 230px;
    margin: 0;
}

/* Result tariff filter: all available tariff groups are shown by default. */
.econtrol-result-model-switch {
    box-sizing: border-box;
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    clear: both;
}

.econtrol-result-model-switch-title {
    display: block;
    margin: 0 0 9px;
    color: #333;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}

.econtrol-tariff-filter-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.econtrol-tariff-filter-option {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    min-height: 42px;
    margin: 0;
    padding: 8px 11px;
    border: 1px solid #c8c8c8;
    border-radius: 3px;
    background: #fff;
    color: #333;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.25;
    cursor: pointer;
}

.econtrol-tariff-filter-option:hover,
.econtrol-tariff-filter-option:focus-within {
    border-color: #8b8b8b;
    background: #f8f8f8;
}

.econtrol-tariff-filter-option.active {
    border-color: #a90025;
}

.econtrol-tariff-filter-option input[type="checkbox"] {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    margin: 0 9px 0 0;
    accent-color: #a90025;
}

/* Combined power result: responsive tariff cards.  The legacy Bootstrap
 * column widths are neutralised locally so card contents never have to squeeze
 * into an unreadable third of the result area. */
#calculatorResult #products.econtrol-multi-tariff-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 22px 18px;
    align-items: stretch;
    width: 100%;
}

#calculatorResult #products.econtrol-multi-tariff-results > .product {
    box-sizing: border-box;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    float: none;
    width: auto;
    min-width: 0;
    padding: 0;
}

#calculatorResult #products.econtrol-multi-tariff-results .productSummary {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    min-width: 0;
    min-height: 188px;
    padding: 18px 14px 14px;
}

#calculatorResult #products.econtrol-multi-tariff-results .productTitle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: auto;
    min-height: 58px;
    margin: 0 0 8px;
    text-align: center;
}

#calculatorResult #products.econtrol-multi-tariff-results .productTitle h2 {
    width: 100%;
    margin: 0;
    font-size: 25px;
    line-height: 1.08;
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
    hyphens: none;
}

#calculatorResult #products.econtrol-multi-tariff-results .tariff-type-label {
    display: block;
    margin: 7px 0 0;
    color: #555;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
}

#calculatorResult #products.econtrol-multi-tariff-results .item {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    text-align: center;
}

#calculatorResult #products.econtrol-multi-tariff-results .item .sum,
#calculatorResult #products.econtrol-multi-tariff-results .econtroldata {
    box-sizing: border-box;
    display: block;
    float: none;
    width: 100%;
    padding-left: 2px;
    padding-right: 2px;
    text-align: center;
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
}

#calculatorResult #products.econtrol-multi-tariff-results .item .sum.total {
    margin: 2px 0 5px;
    font-size: 30px !important;
    line-height: 1.05;
}

#calculatorResult #products.econtrol-multi-tariff-results .item .sum:not(.total) {
    font-size: 14px !important;
    line-height: 1.25;
}

#calculatorResult #products.econtrol-multi-tariff-results .econtroldata {
    margin-top: 6px;
    font-size: 11px;
    line-height: 1.2;
}

#calculatorResult #products.econtrol-multi-tariff-results > .product > .plone-btn-wrapper {
    box-sizing: border-box;
    width: 50%;
    min-width: 0;
    padding: 0;
}

#calculatorResult #products.econtrol-multi-tariff-results > .product > .plone-btn-wrapper .plone-btn {
    box-sizing: border-box;
    width: calc(100% - 4px);
    min-width: 0;
    margin: 6px 2px 0;
    padding: 9px 5px;
    font-size: 14px;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
}

#calculatorResult #products.econtrol-multi-tariff-results > .product > .details {
    width: 100%;
}

@media (max-width: 940px) {
    #calculatorResult #products.econtrol-multi-tariff-results {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    }
}

@media (max-width: 620px) {
    #calculatorResult #products.econtrol-multi-tariff-results {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 360px) {
    #calculatorResult #products.econtrol-multi-tariff-results > .product > .plone-btn-wrapper {
        width: 100%;
    }
}

/* Ergebnis: tatsächlich verwendete Eingaben kompakt und ohne Wortbruch zusammenfassen. */
#calculatorResult #ihreDaten {
    min-width: 0;
}

#calculatorResult #ihreDaten .econtrol-calculation-context {
    margin: -2px 0 16px;
    font-weight: 600;
    text-align: center;
}

#calculatorResult #ihreDaten .econtrol-input-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 22px;
    row-gap: 14px;
    align-items: start;
    justify-items: stretch;
}

#calculatorResult #ihreDaten .econtrol-input-summary-item {
    box-sizing: border-box;
    float: none;
    width: auto;
    min-width: 0;
    margin: 0;
    padding: 0;
    text-align: center;
    word-break: normal;
    overflow-wrap: normal;
}

#calculatorResult #ihreDaten .econtrol-input-summary-item label,
#calculatorResult #ihreDaten .econtrol-input-summary-item > div {
    display: block;
    max-width: 100%;
    margin: 0;
    word-break: normal;
    overflow-wrap: normal;
    hyphens: none;
}

#calculatorResult #ihreDaten .econtrol-input-summary-item label {
    margin-bottom: 3px;
    white-space: nowrap;
}

#calculatorResult #ihreDaten .econtrol-input-summary-item > div {
    line-height: 1.25;
}


/* At medium content widths use two summary columns before the whole header stacks. */
@media (max-width: 1050px) and (min-width: 768px) {
    #calculatorResult #ihreDaten .econtrol-input-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .econtrol-result-header {
        gap: 14px;
    }

    .econtrol-result-header .econtrol-result-model-switch {
        flex-basis: 32%;
        min-width: 220px;
    }
}

/* On narrow screens the summary stays readable and the tariff cards move below it. */
@media (max-width: 767px) {
    .econtrol-result-header {
        display: block;
    }

    .econtrol-result-header #ihreDaten,
    .econtrol-result-header .econtrol-result-model-switch {
        width: 100%;
        min-width: 0;
    }

    .econtrol-result-header #ihreDaten {
        margin-bottom: 16px;
    }

    .econtrol-result-header .econtrol-result-model-switch {
        margin-bottom: 0;
    }

    #calculatorResult #ihreDaten .econtrol-input-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 12px;
        row-gap: 12px;
    }

    #calculatorResult #ihreDaten .econtrol-input-summary-item label {
        white-space: normal;
    }

    .econtrol-result-model-switch button {
        min-height: 62px;
    }
}

@media (max-width: 479px) {
    #calculatorResult #ihreDaten .econtrol-input-summary {
        grid-template-columns: 1fr;
    }
}


/* Conditional feed-in fields are required only while Strom Einspeisung is active. */
.portletCalculator .econtrol-required-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-left: 5px;
    border-radius: 50%;
    background: #b4002b;
    vertical-align: middle;
}


/* Calculate is available only when all visible required fields are complete. */
.portletCalculator #form-buttons-calculate:disabled,
.portletCalculator #form-buttons-calculate[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
}


/* Tarifdetail-Summen wie im E-Control-Vergleich: rot, aber nicht fett. */
.product-detail-wrapper .detail-summary {
    color: #a51b25;
    font-weight: normal !important;
}

/* pat-plone-modal may move detail content outside the original .product node. */
.product-detail-wrapper .indent {
    padding-left: 30px;
}


/* Standalone feed-in result: keep product name and tariff type visually separate. */
#calculatorResult .feed-in-product .feed-in-product-summary {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    min-height: 184px;
    padding: 18px 16px 14px;
}

#calculatorResult .feed-in-product .productTitle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: auto;
    min-height: 58px;
    margin: 0 0 10px;
    text-align: center;
}

#calculatorResult .feed-in-product .productTitle h2 {
    display: block;
    width: 100%;
    margin: 0;
    line-height: 1.1;
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
}

#calculatorResult .feed-in-product .tariff-type-label {
    display: block;
    width: 100%;
    margin: 7px 0 0;
    color: #555;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
}

#calculatorResult .feed-in-product .feed-in-product-summary .item,
#calculatorResult .feed-in-product .feed-in-product-summary .sum,
#calculatorResult .feed-in-product .feed-in-product-summary .econtroldata {
    box-sizing: border-box;
    float: none;
    width: 100%;
    text-align: center;
}

#calculatorResult .feed-in-product .feed-in-product-summary .sum.total {
    margin-top: 2px;
    font-size: 30px !important;
    line-height: 1.05;
}


/* Feed-in cards use Bootstrap column classes inside the summary. Force the
 * amount and explanatory text onto full-width centred rows. */
#calculatorResult .feed-in-product .feed-in-product-summary .item {
    display: block;
}

#calculatorResult .feed-in-product .feed-in-product-summary .sum,
#calculatorResult .feed-in-product .feed-in-product-summary .econtroldata {
    display: block;
    margin-left: 0;
    margin-right: 0;
    padding-left: 2px;
    padding-right: 2px;
}

.product-detail-wrapper .feed-in-annual-total {
    font-weight: 600;
}
