/* -------------------------------------------------------------------------
   HBCF Premium Calculator - page layout
   Ported from the new UI design (hbcf-calculator.html inline <style>).
   Relative url('images/...') paths resolve against this file's folder.
   ------------------------------------------------------------------------- */

#hbcf-calculator {
    max-width: var(--ref-content-max-width-01);
    margin: 40px auto;
    padding: var(--sys-content-padding);
    box-sizing: border-box;
    text-align: left;
}

#hbcf-calculator--tool {
    display: grid;
    box-sizing: border-box;
    grid-template-columns: minmax(0, 1fr);
    border: var(--sys-border-width-sm) solid var(--sys-color-border-default);
    border-radius: var(--sys-border-radius-md);
}

#hbcf-calculator--tool form {
    padding: var(--sys-responsive-padding-lg);
    gap: var(--sys-responsive-padding-md);
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
    border-bottom-right-radius: 0;
    border-bottom-left-radius: 0;
}

#hbcf-calculator--tool #hbcf-calculator__outcome {
    border-top: var(--sys-border-width-sm) solid var(--sys-color-border-default);
    border-left: none;
    padding: var(--sys-responsive-padding-lg);
    transition: var(--sys-transition-smooth-curve);
}

#hbcf-calculator--tool #hbcf-calculator__outcome > div {
    display: flex;
    flex-direction: column;
    gap: var(--sys-responsive-padding-md);
}

#hbcf-calculator--tool #hbcf-calculator__outcome--actions {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
}

#hbcf-calculator--tool #hbcf-calculator__outcome--actions #hbcf-calculator__restart {
    margin-left: -24px;
}

#hbcf-calculator__outcome-blank--instruction:before {
    content: "Enter a few basic details above to instantly see your HBCF premium estimate.";
}

#hbcf-calculator__notes {
    margin-top: var(--sys-responsive-padding-md);
    text-wrap: unset;
}

.result__table {
    display: flex;
    flex-direction: column;
    gap: var(--sys-responsive-padding-sm);
}

/* ----- Loading state ----- */

/* Disabled button styling (e.g. while a calculation is running). Uses the
   design-system disabled tokens since `.button` doesn't style :disabled. */
#hbcf-calculator .button:disabled,
#hbcf-calculator .button[disabled] {
    background: var(--sys-color-interactive-disabled);
    border-color: var(--sys-color-interactive-disabled);
    color: var(--sys-color-on-interactive-disabled);
    cursor: not-allowed;
    box-shadow: none;
}

/* Spinner inside the "Calculate Premium" button while a calculation runs. */
.button__spinner {
    display: inline-block;
    width: var(--sys-icon-size-md);
    height: var(--sys-icon-size-md);
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: hbcf-spin 0.7s linear infinite;
}

/* Larger spinner shown in the outcome panel while waiting for the result. */
#hbcf-calculator__outcome-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--sys-responsive-padding-sm);
    min-height: 8rem;
    text-align: center;
}

.outcome-spinner {
    display: inline-block;
    width: var(--sys-icon-size-xl);
    height: var(--sys-icon-size-xl);
    border: 3px solid var(--sys-color-border-default);
    border-top-color: var(--sys-color-interactive-default);
    border-radius: 50%;
    animation: hbcf-spin 0.7s linear infinite;
}

@keyframes hbcf-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .button__spinner,
    .outcome-spinner {
        animation-duration: 1.6s;
    }
}

#list--types-of-cover {
    list-style: none;
}

#list--types-of-cover li:nth-child(1) { --comp-list-icon: url('images/icons/H01.svg'); }
#list--types-of-cover li:nth-child(2) { --comp-list-icon: url('images/icons/H02.svg'); }
#list--types-of-cover li:nth-child(3) { --comp-list-icon: url('images/icons/H03.svg'); }
#list--types-of-cover li:nth-child(4) { --comp-list-icon: url('images/icons/H04.svg'); }
#list--types-of-cover li:nth-child(5) { --comp-list-icon: url('images/icons/H05.svg'); }
#list--types-of-cover li button { margin-top: -8px; }

/* Keep paragraph styling consistent with the new design inside the calculator
   (overrides site.css `p { font-family: 'Gotham Medium'; text-align: justify }`). */
#hbcf-calculator p,
#hbcf-calculator label,
#hbcf-calculator span,
#hbcf-calculator strong {
    font-family: var(--ref-font-family), 'Noto Sans', Arial, sans-serif;
}

#hbcf-calculator p {
    text-align: left;
}

/* Validation messages styled like the design's inline field alerts. */
#hbcf-calculator .validation-message {
    color: var(--sys-color-status-error-main);
    font-size: var(--sys-font-size-caption);
    margin-top: calc(var(--sys-spacing-xxs) * -1);
}

/* The source design draws a stray red line via hr.divider::before (looks like a
   debug artifact). Neutralised so dividers render as the intended thin grey line. */
#hbcf-calculator hr.divider::before {
    background: transparent;
}

@media (min-width: 48rem) {

    #hbcf-calculator--tool form {
        border-top-left-radius: inherit !important;
        border-top-right-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
        border-bottom-left-radius: inherit !important;
    }

    #hbcf-calculator__outcome-blank--instruction:before {
        content: "Enter a few basic details on the left to instantly see your HBCF premium estimate." !important;
    }

    #hbcf-calculator--tool {
        grid-template-columns: minmax(0, 1.5fr) minmax(0, 2fr);
        border-top: none;
        border-left: var(--sys-border-width-sm) solid var(--sys-color-border-default);
    }
}

@media (min-width: 64rem) {

    #hbcf-calculator--tool {
        grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    }

    #hbcf-calculator--tool #hbcf-calculator__outcome {
        padding: var(--sys-spacing-xxxl) !important;
    }
}
