/**
 * First Home Scheme Calculator - calculator-specific styles
 * Ireland Calculators plugin
 *
 * Base layout, typography, inputs, buttons, result cards, and breakdowns
 * are inherited from ic-base.css via the mature shared selector group.
 * Only truly unique First Home Scheme rules live here.
 */

/* ------------------------------------------------------------------
 * Advanced settings toggle
 * ------------------------------------------------------------------ */

.ic-firsthomecalc .ic-fhs-advanced-toggle {
        cursor: pointer;
        user-select: none;
        display: flex;
        align-items: center;
        justify-content: space-between;
}

.ic-firsthomecalc .ic-fhs-chevron {
        transition: transform 0.2s;
        flex-shrink: 0;
}

.ic-firsthomecalc .ic-fhs-advanced-open .ic-fhs-chevron {
        transform: rotate(180deg);
}

/* ------------------------------------------------------------------
 * Advanced panel
 * ------------------------------------------------------------------ */

.ic-firsthomecalc .ic-fhs-advanced {
        padding-top: 0.25rem;
}


/* ------------------------------------------------------------------
 * Application type radio group
 * ------------------------------------------------------------------ */

.ic-firsthomecalc .ic-fhs-radio-group {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
}

.ic-firsthomecalc .ic-fhs-radio-option {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 46px;
        padding: 0 16px;
        border: 1px solid var(--ic-border, #E2E8F0);
        border-radius: var(--ic-radius-sm, 8px);
        background: var(--ic-surface, #FFFFFF);
        color: var(--ic-text, #0F172A);
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease, color .18s ease;
}

.ic-firsthomecalc .ic-fhs-radio-option input {
        position: absolute;
        inset: 0;
        opacity: 0;
        cursor: pointer;
}

.ic-firsthomecalc .ic-fhs-radio-option:has(input:checked) {
        border-color: var(--ic-primary, #059669);
        background: color-mix(in srgb, var(--ic-primary, #059669) 10%, #ffffff);
        box-shadow: 0 0 0 3px color-mix(in srgb, var(--ic-primary, #059669) 18%, transparent);
        color: var(--ic-primary, #059669);
}

@supports not selector(:has(*)) {
        .ic-firsthomecalc .ic-fhs-radio-option input:checked + span {
                color: var(--ic-primary, #059669);
                font-weight: 700;
        }
}

@media (max-width: 560px) {
        .ic-firsthomecalc .ic-fhs-radio-group {
                grid-template-columns: 1fr;
        }
}

/* ------------------------------------------------------------------
 * Desktop form compaction
 * ------------------------------------------------------------------ */

@media (min-width: 900px) {
        .ic-firsthomecalc .ic-inputs {
                display: grid;
                grid-template-columns: repeat(2, minmax(0, 1fr));
                column-gap: 16px;
                row-gap: 14px;
                align-content: start;
        }

        .ic-firsthomecalc .ic-inputs > .ic-section-header,
        .ic-firsthomecalc .ic-inputs > .ic-divider,
        .ic-firsthomecalc .ic-inputs > .ic-fhs-applicant-block,
        .ic-firsthomecalc .ic-inputs > .ic-fhs-advanced,
        .ic-firsthomecalc .ic-inputs > #ic-fhs-error,
        .ic-firsthomecalc .ic-inputs > .ic-actions {
                grid-column: 1 / -1;
        }

        .ic-firsthomecalc .ic-inputs > .ic-field,
        .ic-firsthomecalc .ic-inputs > [id$='-group'] {
                min-width: 0;
                margin-bottom: 0;
        }

        .ic-firsthomecalc .ic-fhs-field--full,
        .ic-firsthomecalc #ic-fhs-price-group,
        .ic-firsthomecalc #ic-fhs-build-cost-group,
        .ic-firsthomecalc #ic-fhs-mortgage-group,
        .ic-firsthomecalc #ic-fhs-htb-group,
        .ic-firsthomecalc #ic-fhs-site-equity-group,
        .ic-firsthomecalc #ic-fhs-local-authority-group,
        .ic-firsthomecalc #ic-fhs-selfbuild-advanced,
        .ic-firsthomecalc #ic-fhs-tenant-advanced {
                grid-column: 1 / -1;
        }

        .ic-firsthomecalc .ic-fhs-applicant-block,
        .ic-firsthomecalc #ic-fhs-selfbuild-advanced,
        .ic-firsthomecalc #ic-fhs-tenant-advanced {
                display: grid;
                grid-template-columns: repeat(2, minmax(0, 1fr));
                gap: 14px 16px;
                align-items: start;
        }

        .ic-firsthomecalc .ic-fhs-applicant-label {
                grid-column: 1 / -1;
                margin-bottom: 0;
        }

        .ic-firsthomecalc .ic-actions {
                margin-top: 2px;
        }
}


@media (max-width: 899px) {
        .ic-firsthomecalc .ic-inputs {
                display: flex;
                flex-direction: column;
        }
}

/* ------------------------------------------------------------------
 * Applicant blocks
 * ------------------------------------------------------------------ */

.ic-firsthomecalc .ic-fhs-applicant-block {
        display: flex;
        flex-direction: column;
        gap: var(--ic-section-gap, 14px);
}

.ic-firsthomecalc .ic-fhs-applicant-label {
        font-size: 12px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--ic-primary, #1E3A8A);
        padding: 6px 10px;
        background: var(--ic-bg-muted, #F1F5F9);
        border-radius: var(--ic-radius-sm, 8px);
}


@media (min-width: 760px) {
        .ic-firsthomecalc .ic-fhs-applicant-block {
                display: grid;
                grid-template-columns: repeat(2, minmax(0, 1fr));
                gap: 14px 16px;
                align-items: start;
        }

        .ic-firsthomecalc .ic-fhs-applicant-label {
                grid-column: 1 / -1;
                margin-bottom: 0;
        }

        .ic-firsthomecalc .ic-fhs-applicant-block .ic-field {
                min-width: 0;
                margin-bottom: 0;
        }
}

/* ------------------------------------------------------------------
 * HTB warning callout
 * ------------------------------------------------------------------ */

.ic-firsthomecalc .ic-fhs-htb-warning {
        font-size: 12px;
        color: #92400e;
        background: #fffbeb;
        border: 1px solid #fde68a;
        border-radius: var(--ic-radius-sm, 8px);
        padding: 8px 12px;
        line-height: 1.5;
}

/* ------------------------------------------------------------------
 * Service charge table
 * ------------------------------------------------------------------ */

.ic-firsthomecalc .ic-fhs-charge-table-wrap {
        margin-top: 8px;
        border: 1px solid var(--ic-border, #E2E8F0);
        border-radius: var(--ic-radius, 18px);
        overflow: hidden;
        background: var(--ic-surface, #FFFFFF);
}

.ic-firsthomecalc .ic-fhs-charge-table {
        width: 100%;
        table-layout: auto;
        border-collapse: separate;
        border-spacing: 0;
        font-size: 13px;
        margin-bottom: 0 !important;
        border: 0 !important;
        border-width: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
}

.ic-firsthomecalc .ic-fhs-charge-table th,
.ic-firsthomecalc .ic-fhs-charge-table td {
        padding: 10px 14px;
        text-align: left;
        border-bottom: 1px solid var(--ic-border, #E2E8F0);
}

.ic-firsthomecalc .ic-fhs-charge-table th + th,
.ic-firsthomecalc .ic-fhs-charge-table td + td {
        border-left: 1px solid var(--ic-border, #E2E8F0);
}

.ic-firsthomecalc .ic-fhs-charge-table th {
        font-weight: 600;
        color: var(--ic-text-muted, #64748B);
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        background: var(--ic-bg-muted, #F1F5F9);
}

.ic-firsthomecalc .ic-fhs-charge-table tbody tr:last-child td {
        border-bottom: none;
}

/* ------------------------------------------------------------------
 * Results - status, issues, and note cards
 * ------------------------------------------------------------------ */

.ic-firsthomecalc .ic-result-primary.ic-fhs-result-danger {
        background: #fef2f2 !important;
        border: 1px solid #fecaca;
        box-shadow: inset 3px 0 0 #dc2626, inset 0 0 0 1px rgba(220, 38, 38, 0.06);
}

.ic-firsthomecalc .ic-fhs-result-danger .ic-result-primary-label {
        color: #991b1b;
        opacity: 0.9;
}

.ic-firsthomecalc .ic-fhs-result-danger .ic-result-primary-value {
        color: #dc2626;
}

.ic-firsthomecalc .ic-fhs-result-danger .ic-result-primary-note {
        color: #7f1d1d;
        opacity: 0.9;
}

.ic-firsthomecalc .ic-fhs-issue-row {
        justify-content: flex-start;
        align-items: flex-start;
        gap: 14px;
}

.ic-firsthomecalc .ic-fhs-issue-icon {
        color: #dc2626;
        font-weight: 700;
        line-height: 1;
        margin-top: 3px;
        flex: 0 0 auto;
}

.ic-firsthomecalc .ic-fhs-issue-text {
        flex: 1 1 auto;
        min-width: 0;
}

.ic-firsthomecalc .ic-fhs-note-card {
        font-size: 14px;
        line-height: 1.65;
        background: #f0f9ff;
        border: 1px solid #bae6fd;
        border-radius: var(--ic-radius-sm, 8px);
        padding: 16px 18px;
        color: #0c4a6e;
        margin: 0;
        width: 100%;
}

.ic-firsthomecalc .ic-fhs-note-card + .ic-fhs-note-card {
        margin-top: 12px;
}

.ic-firsthomecalc .ic-fhs-note-card:first-of-type {
        margin-top: 0;
}

.ic-firsthomecalc .ic-fhs-note-card--warn {
        background: #fffbeb;
        border-color: #fde68a;
        color: #92400e;
}

.ic-firsthomecalc .ic-fhs-note-card strong {
        font-weight: 600;
}


/* ------------------------------------------------------------------
 * Label spacing
 * ------------------------------------------------------------------ */

.ic-firsthomecalc .ic-inputs > .ic-field > label,
.ic-firsthomecalc .ic-fhs-applicant-block .ic-field > label,
.ic-firsthomecalc #ic-fhs-selfbuild-advanced .ic-field > label,
.ic-firsthomecalc #ic-fhs-tenant-advanced .ic-field > label {
        display: block;
        min-height: 0;
        margin-bottom: 0;
}

/* ------------------------------------------------------------------
 * Redemption simulator
 * ------------------------------------------------------------------ */

.ic-firsthomecalc .ic-fhs-sim-shell {
        margin-top: 14px;
        padding-bottom: 18px;
}

.ic-firsthomecalc .ic-fhs-sim-shell > .ic-fhs-sim-intro,
.ic-firsthomecalc .ic-fhs-sim-shell > .ic-fhs-sim-controls,
.ic-firsthomecalc .ic-fhs-sim-shell > #ic-fhs-redemption-output {
        padding-left: 18px;
        padding-right: 18px;
}

.ic-firsthomecalc .ic-fhs-sim-intro {
        margin: 0;
        padding-top: 14px;
        padding-bottom: 14px;
        font-size: 14px;
        line-height: 1.7;
        color: var(--ic-text-muted, #475569);
}

.ic-firsthomecalc .ic-fhs-sim-controls {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px 16px;
        margin: 0;
        padding-bottom: 14px;
}

.ic-firsthomecalc .ic-fhs-sim-shell > #ic-fhs-redemption-output {
        display: grid;
        gap: 14px;
}

.ic-firsthomecalc .ic-fhs-sim-top-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px 16px;
        margin: 0;
}

.ic-firsthomecalc .ic-fhs-sim-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 14px;
        margin: 0;
}

.ic-firsthomecalc .ic-fhs-sim-shell .ic-breakdown {
        width: 100%;
        margin-bottom: 0;
}

.ic-firsthomecalc .ic-fhs-sim-grid > .ic-breakdown,
.ic-firsthomecalc .ic-fhs-note-card {
        width: 100%;
}

.ic-firsthomecalc .ic-fhs-sim-grid .ic-fhs-charge-table-wrap {
        width: 100%;
}

.ic-firsthomecalc .ic-fhs-sim-shell .ic-breakdown-row {
        gap: 16px;
}

.ic-firsthomecalc .ic-fhs-sim-shell .ic-breakdown-value {
        text-align: right;
}

.ic-firsthomecalc .ic-fhs-stat-card {
        border: 1px solid var(--ic-border, #E2E8F0);
        border-radius: var(--ic-radius, 18px);
        background: var(--ic-surface, #FFFFFF);
        padding: 16px 18px;
}

.ic-firsthomecalc .ic-fhs-stat-label {
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--ic-text-muted, #64748B);
        margin-bottom: 8px;
}

.ic-firsthomecalc .ic-fhs-stat-value {
        font-size: 28px;
        line-height: 1.15;
        font-weight: 700;
        color: var(--ic-heading, #0F172A);
        margin-bottom: 6px;
}

.ic-firsthomecalc .ic-fhs-stat-note {
        font-size: 13px;
        line-height: 1.55;
        color: var(--ic-text-muted, #475569);
}

.ic-firsthomecalc .ic-fhs-charge-table-wrap--tight {
        margin-top: 12px;
}

.ic-firsthomecalc .ic-fhs-charge-table-wrap--tight .ic-fhs-charge-table th,
.ic-firsthomecalc .ic-fhs-charge-table-wrap--tight .ic-fhs-charge-table td {
        padding: 8px 10px;
        font-size: 12px;
}

@media (max-width: 899px) {
        .ic-firsthomecalc .ic-fhs-sim-controls,
        .ic-firsthomecalc .ic-fhs-sim-top-grid,
        .ic-firsthomecalc .ic-fhs-sim-grid {
                grid-template-columns: 1fr;
        }

        .ic-firsthomecalc .ic-fhs-stat-value {
                font-size: 24px;
        }
}


.ic-firsthomecalc .ic-fhs-charge-table-wrap--standalone {
        margin-top: 0;
        border: 0;
        border-radius: 0;
        overflow: visible;
        background: transparent;
        box-shadow: none;
}

.ic-firsthomecalc .ic-fhs-charge-table-wrap--standalone .ic-fhs-charge-table {
        border-radius: 0;
}

/* ------------------------------------------------------------------
 * FHS lower content spacing
 * The custom FHS sections above use standalone-card margins. Force the
 * generated shared landing stack below to use the exact same rhythm.
 * ------------------------------------------------------------------ */

.ic-firsthomecalc .ic-landing-stack {
        display: block !important;
        padding: 0 0 24px !important;
        margin: 0 !important;
        gap: 0 !important;
        background: transparent !important;
}

.ic-firsthomecalc .ic-landing-stack > .ic-shared-lp-section,
.ic-firsthomecalc .ic-landing-stack > .ic-shared-lp-section--standalone {
        margin: 18px 24px !important;
}

.ic-firsthomecalc .ic-landing-stack > .ic-shared-lp-section:first-child,
.ic-firsthomecalc .ic-landing-stack > .ic-shared-lp-section--standalone:first-child {
        margin-top: 18px !important;
}

@media (max-width: 700px) {
        .ic-firsthomecalc .ic-landing-stack {
                padding-bottom: 16px !important;
        }

        .ic-firsthomecalc .ic-landing-stack > .ic-shared-lp-section,
        .ic-firsthomecalc .ic-landing-stack > .ic-shared-lp-section--standalone {
                margin: 16px !important;
        }
}

/* 3.4.51: valid landing stack wrapper + consistent standalone-card spacing */
.ic-firsthomecalc .ic-landing-stack {
        display: flex !important;
        flex-direction: column !important;
        gap: 18px !important;
        padding: 18px 24px 24px !important;
        margin: 0 !important;
        background: transparent !important;
}

.ic-firsthomecalc .ic-landing-stack > .ic-shared-lp-section {
        margin: 0 !important;
}

@media (max-width: 700px) {
        .ic-firsthomecalc .ic-landing-stack {
                gap: 16px !important;
                padding: 16px !important;
        }
}
