/*
  Trøndelag Kraft styling for NorgesprisCalculatorBlock, linked from the block view only on TK.
  TK pages don't load main.css, so the shared rules from _norgespris-calculator-block.scss are repeated here.
  TK's site CSS has no custom properties: plain values only.
*/

.norgespris-calculator .norgespris-calculator__form {
    display: grid;
    gap: 1rem;
    max-width: 600px;
    margin: 1rem auto;
    background: #e3fffc;
    padding: 1.5rem;
    border-radius: 1.5rem;
}

.norgespris-calculator .norgespris-calculator__form * {
    font-family: "Museo Sans", Times, serif;
}

.norgespris-calculator .norgespris-calculator__form label {
    font-weight: bold;
}

.norgespris-calculator .norgespris-calculator__form input[type="number"],
.norgespris-calculator .norgespris-calculator__form select {
    padding: 0.75rem;
    font-size: 1rem;
    font-weight: 300;
    border: 0;
    border-radius: 0.5rem;
    background-color: white;
    color: #003735;
    cursor: pointer;
}

.norgespris-calculator .norgespris-calculator__form input[type="number"] {
    -moz-appearance: textfield;
}

.norgespris-calculator .norgespris-calculator__form input[type="number"]::-webkit-inner-spin-button,
.norgespris-calculator .norgespris-calculator__form input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.norgespris-calculator .norgespris-calculator__form select {
    -webkit-appearance: none;
    appearance: none;
    padding-right: 2.75rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M6.6195 8.489L0 1.8695L1.8755 0L6.6195 4.769L11.3635 0L13.239 1.8695L6.6195 8.489Z' fill='%23003735'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 14px 9px;
}

.norgespris-calculator .norgespris-calculator__form button {
    padding: 0.75rem;
    font-weight: 500;
    font-size: 1rem;
    background-color: #fff200;
    color: black;
    border: 2px solid #fff200;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.3s ease-in-out;
}

.norgespris-calculator .norgespris-calculator__form button:hover {
    background-color: transparent;
    color: #003735;
}

.norgespris-calculator .norgespris-calculator__form button:disabled,
.norgespris-calculator .norgespris-calculator__form button:disabled:hover,
.norgespris-calculator .norgespris-calculator__form button[aria-disabled="true"],
.norgespris-calculator .norgespris-calculator__form button[aria-disabled="true"]:hover {
    opacity: 0.6;
    cursor: default;
    background-color: #fff200;
    color: black;
}

/* Field validation message, shown on submit under the field. */
.norgespris-calculator .norgespris-calculator__error {
    margin: -0.5rem 0 0;
    font-size: 0.875rem;
    color: #a20f01;
}

.norgespris-calculator .norgespris-calculator__error[hidden] {
    display: none;
}

.norgespris-calculator .norgespris-calculator__form [aria-invalid="true"] {
    box-shadow: inset 0 0 0 2px #a20f01;
}

.norgespris-calculator .norgespris-calculator__type {
    border: 0;
    padding: 0;
    margin: 0;
    background: transparent;
}

.norgespris-calculator .norgespris-calculator__type label {
    display: inline-flex;
    align-items: center;
    font-size: 1rem;
    font-weight: 400;
    margin-right: 1.5rem;
    color: #003735;
    cursor: pointer;
}

.norgespris-calculator .norgespris-calculator__type input {
    width: 1.125rem;
    height: 1.125rem;
    padding: 0;
    margin: 0 0.5rem 0 0;
    accent-color: #003735;
}

.norgespris-calculator .norgespris-calculator__sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.norgespris-calculator .norgespris-calculator__help {
    font-size: 1rem;
}

.norgespris-calculator .norgespris-calculator__basis {
    font-size: 0.75rem;
    text-align: center;
    font-family: "Museo Sans", Times, serif;
    max-width: 600px;
    margin: 1rem auto;
}

.norgespris-calculator .norgespris-calculator__basis p {
    font-size: inherit;
}

.norgespris-calculator .norgespris-calculator__result {
    margin: 3.5rem auto;
    font-size: 1.2rem;
    font-weight: 500;
    text-align: center;
    border: 0.625rem solid #7AE8E2;
    background: white;
    padding: 27px;
    max-width: 600px;
}

.norgespris-calculator .norgespris-calculator__result[hidden] {
    display: none;
}

.norgespris-calculator .norgespris-calculator__result p {
    margin: 0 0 0.75rem;
}

.norgespris-calculator .norgespris-calculator__amount {
    white-space: nowrap;
    font-weight: 700;
}

.norgespris-calculator .norgespris-calculator__savings {
    font-weight: 700;
}

.norgespris-calculator .norgespris-calculator__result .norgespris-calculator__small {
    font-size: 0.8125rem;
    font-weight: 300;
    line-height: 1.35;
    color: #003735;
    margin: 0.5rem 0 0;
}

/*
  The chosen area's recommendation card, under the result box. A copy of the NorgesprisBlock card rules
  (Views/Shared/NorgesprisBlock/_norgespris-block.scss): keep the two in step.
*/
.norgespris-calculator .norgespris-calculator__recommendation {
    max-width: 600px;
    margin: -1.75rem auto 0;
}

.norgespris-calculator .norgespris-calculator__recommendation[hidden] {
    display: none;
}

.norgespris-calculator .norgespris-block--recommended {
    --np-background: #EDF7EF;
    --np-selected: #DDEFE0;
    --np-status: #006111;
    --np-label-text: #F6FFEF;
}

.norgespris-calculator .norgespris-block--consider {
    --np-background: #FCF3E1;
    --np-selected: #FAE7C6;
    --np-status: #814C00;
    --np-label-text: #FFFFFF;
}

.norgespris-calculator .norgespris-block--not-recommended {
    --np-background: #FBF1F1;
    --np-selected: #F8E4E5;
    --np-status: #A20F01;
    --np-label-text: #FFFBFF;
}

.norgespris-calculator .norgespris-block__area {
    background: var(--np-background);
    border: 0;
    border-radius: 10px;
    padding: 16px;
    color: #242625;
}

.norgespris-calculator .norgespris-block__area[hidden] {
    display: none;
}

.norgespris-calculator .norgespris-block__area:not(.is-selected) {
    min-height: 82px;
}

.norgespris-calculator .norgespris-block__area.is-selected {
    box-shadow: inset 0 0 0 2px var(--np-status);
    background: var(--np-selected);
}

.norgespris-calculator .norgespris-block__area h3 {
    color: #242625;
    margin: 0;
    font-size: 18px;
    font-weight: 500;
    line-height: 24px;
}

.norgespris-calculator .norgespris-block__area button {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    width: 100%;
    padding: 0 32px 0 0;
    border: 0;
    border-radius: 2px;
    background: none;
    color: inherit;
    font: inherit;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}

.norgespris-calculator .norgespris-block__area button:focus-visible {
    outline: 3px solid #471500;
    outline-offset: 5px;
}

.norgespris-calculator .norgespris-block__badge {
    display: inline-block;
    background: var(--np-status);
    color: var(--np-label-text);
    padding: 0 5px;
    border-radius: 3px;
    font-size: 16px;
    font-weight: 500;
    line-height: 22px;
}

.norgespris-calculator .norgespris-block__area [hidden] {
    display: none !important;
}

.norgespris-calculator .norgespris-block__area p {
    color: #242625;
    margin: 0 0 16px;
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
}

.norgespris-calculator .norgespris-block__chevron {
    position: absolute;
    right: 0;
    bottom: 5px;
    width: 14px;
    height: 9px;
    pointer-events: none;
}

.norgespris-calculator .norgespris-block__area button[aria-expanded="true"] .norgespris-block__chevron {
    transform: rotate(180deg);
}

/* Focus ring round the whole card: on the toggle button it overlapped the text under it. Browsers without :has keep the button's ring above. */
@supports selector(:has(*)) {
    .norgespris-calculator .norgespris-block__area button:focus-visible {
        outline: none;
    }

    .norgespris-calculator .norgespris-block__area:has(button:focus-visible) {
        outline: 3px solid #471500;
        outline-offset: 3px;
    }
}

@media (min-width: 768px) and (hover: hover) {
    .norgespris-calculator .norgespris-block__area:hover {
        background: var(--np-selected);
        box-shadow: inset 0 0 0 2px var(--np-status);
    }
}
