/* =======================================================================
   Rent Tax Credit Calculator Ireland — calculator-specific layout only
   Output UI uses shared ic-base.css result micro-components where possible.
   ======================================================================= */

.ic-renttaxcreditcalc {
    max-width: 1180px !important;
    margin: 0 auto;
}

.ic-renttaxcreditcalc .ic-rtc-form-shell {
    padding: var(--ic-padding);
    background: var(--ic-surface);
    display: flex;
    flex-direction: column;
    gap: var(--ic-section-gap);
}

.ic-renttaxcreditcalc .ic-field-row { display: grid; gap: 14px; }
.ic-renttaxcreditcalc .ic-rtc-row--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ic-renttaxcreditcalc .ic-rtc-row--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ---- Section header with right-aligned hint ---- */
.ic-renttaxcreditcalc .ic-rtc-section-header--backdated {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin-bottom: -2px;
}
.ic-renttaxcreditcalc .ic-rtc-section-hint {
    font-size: 12px;
    color: var(--ic-text-muted);
    line-height: 1.5;
    flex: 1 1 320px;
}
.ic-renttaxcreditcalc .ic-rtc-section-hint strong { color: var(--ic-text); font-weight: 600; }

/* ---- Backdated year pills (4-up) ---- */
.ic-renttaxcreditcalc .ic-rtc-backdated-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}
.ic-renttaxcreditcalc .ic-rtc-year-pill {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 12px 8px;
    border: 1.5px solid var(--ic-input-border);
    border-radius: var(--ic-radius-sm);
    background: var(--ic-input-bg);
    cursor: pointer;
    transition: border-color .15s, background .15s, box-shadow .15s;
    user-select: none;
}
.ic-renttaxcreditcalc .ic-rtc-year-pill:hover {
    border-color: var(--ic-input-hover-border);
    background: var(--ic-input-hover-bg);
}
.ic-renttaxcreditcalc .ic-rtc-year-pill input[type="checkbox"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    margin: 0;
    cursor: pointer;
}
.ic-renttaxcreditcalc .ic-rtc-year-pill-label {
    font-family: var(--ic-font-display);
    font-size: 16px;
    font-weight: 700;
    color: var(--ic-text);
    line-height: 1.1;
}
.ic-renttaxcreditcalc .ic-rtc-year-pill-cap {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--ic-text-light);
}
.ic-renttaxcreditcalc .ic-rtc-year-pill:has(input[type="checkbox"]:checked) {
    border-color: var(--ic-primary);
    background: var(--ic-primary-light);
    box-shadow: 0 1px 4px rgba(30,58,138,.12);
}
.ic-renttaxcreditcalc .ic-rtc-year-pill:has(input[type="checkbox"]:checked) .ic-rtc-year-pill-label {
    color: var(--ic-primary);
}
.ic-renttaxcreditcalc .ic-rtc-year-pill:has(input[type="checkbox"]:checked) .ic-rtc-year-pill-cap {
    color: var(--ic-primary);
    opacity: .8;
}
.ic-renttaxcreditcalc .ic-rtc-year-pill--disabled {
    opacity: .35;
    cursor: not-allowed;
}
.ic-renttaxcreditcalc .ic-rtc-year-pill--disabled input[type="checkbox"] {
    cursor: not-allowed;
}

/* ---- Action row (matches Redundancy / Loan pattern: wide calc + compact reset) ---- */
.ic-renttaxcreditcalc .ic-rtc-field-row--actions-main { display: block !important; }
.ic-renttaxcreditcalc .ic-rtc-actions-main {
    display: flex !important;
    align-items: stretch;
    gap: 10px;
    width: 100%;
    margin: 0 !important;
}
.ic-renttaxcreditcalc .ic-rtc-actions-main .ic-calc-btn {
    flex: 1 1 auto;
    min-height: var(--ic-input-height);
    height: var(--ic-input-height);
    margin: 0;
}
.ic-renttaxcreditcalc .ic-rtc-actions-main .ic-reset-btn {
    flex: 0 0 auto;
    min-height: var(--ic-input-height);
    height: var(--ic-input-height);
    margin: 0;
    padding-left: 18px;
    padding-right: 18px;
}

/* ---- Advanced toggle + panel ---- */
.ic-renttaxcreditcalc .ic-rtc-advanced-toggle-wrap { margin-top: 2px; }
.ic-renttaxcreditcalc .ic-advanced-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--ic-primary);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.ic-renttaxcreditcalc .ic-advanced-toggle svg { transition: transform .18s ease; }
.ic-renttaxcreditcalc .ic-advanced-toggle.is-open svg { transform: rotate(180deg); }
.ic-renttaxcreditcalc .ic-rtc-advanced-panel {
    margin-top: -4px;
    padding: 16px;
    border: 1px solid var(--ic-border);
    border-radius: var(--ic-radius);
    background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(245,249,247,.98));
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.ic-renttaxcreditcalc .ic-rtc-advanced-panel--hidden { display: none; }

/* ---- Conditional sub-fields ---- */
.ic-renttaxcreditcalc .ic-rtc-conditional-wrap > .ic-rtc-conditional[hidden] { display: none; }
.ic-renttaxcreditcalc .ic-rtc-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--ic-text);
    cursor: pointer;
}
.ic-renttaxcreditcalc .ic-rtc-checkbox-label input[type="checkbox"] {
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: var(--ic-primary);
}

/* ---- Inline note inside advanced panel ---- */
.ic-renttaxcreditcalc .ic-inline-note {
    margin-top: 0;
    padding: 12px 14px;
    border: 1px solid var(--ic-border);
    border-left: 3px solid var(--ic-primary);
    border-radius: var(--ic-radius-sm);
    background: var(--ic-muted, var(--ic-bg-muted));
    color: var(--ic-text-muted);
    font-size: 13px;
    line-height: 1.5;
}
.ic-renttaxcreditcalc .ic-inline-note strong { color: var(--ic-text); }

/* ---- Results separator (matches Redundancy stacked layout) ---- */
.ic-renttaxcreditcalc .ic-rtc-results {
    border-left: 0 !important;
    border-top: 1px solid var(--ic-border);
    min-height: 320px;
}
.ic-renttaxcreditcalc .ic-results-empty { min-height: 280px; }

.ic-renttaxcreditcalc .ic-rtc-result-wrap {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.ic-renttaxcreditcalc .ic-rtc-hero { margin: 0 0 14px; }
.ic-renttaxcreditcalc .ic-rtc-hero--not-eligible { background: var(--ic-warn); }

/* ---- Year-by-year table ---- */
.ic-renttaxcreditcalc .ic-rtc-year-table-wrap { margin-bottom: 14px; }
.ic-renttaxcreditcalc .ic-rtc-year-table {
    border-bottom: 1px solid var(--ic-border);
}
.ic-renttaxcreditcalc .ic-rtc-year-row {
    display: grid;
    grid-template-columns: 1.4fr .9fr 1.1fr 1fr 1.1fr 1.4fr;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    border-bottom: 1px solid var(--ic-border);
    font-size: 13px;
}
.ic-renttaxcreditcalc .ic-rtc-year-row:last-child { border-bottom: 0; }
.ic-renttaxcreditcalc .ic-rtc-year-row--header {
    background: var(--ic-bg-muted);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--ic-text-muted);
}
/* Per-column alignment shared by header + body rows */
.ic-renttaxcreditcalc .ic-rtc-year-row > span:nth-child(1) { text-align: left; }
.ic-renttaxcreditcalc .ic-rtc-year-row > span:nth-child(2),
.ic-renttaxcreditcalc .ic-rtc-year-row > span:nth-child(3),
.ic-renttaxcreditcalc .ic-rtc-year-row > span:nth-child(4),
.ic-renttaxcreditcalc .ic-rtc-year-row > span:nth-child(5) {
    text-align: right;
}
.ic-renttaxcreditcalc .ic-rtc-year-row > span:nth-child(6) { text-align: right; }
/* Body data cells get monospace-ish numeric font */
.ic-renttaxcreditcalc .ic-rtc-year-row:not(.ic-rtc-year-row--header) > span:nth-child(2),
.ic-renttaxcreditcalc .ic-rtc-year-row:not(.ic-rtc-year-row--header) > span:nth-child(3),
.ic-renttaxcreditcalc .ic-rtc-year-row:not(.ic-rtc-year-row--header) > span:nth-child(4),
.ic-renttaxcreditcalc .ic-rtc-year-row:not(.ic-rtc-year-row--header) > span:nth-child(5) {
    font-family: var(--ic-font-display);
    color: var(--ic-text);
}
/* Status column: pill aligned under header, vertically centred, breathing space */
.ic-renttaxcreditcalc .ic-rtc-year-row > span:nth-child(6) {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-left: 8px;
    min-width: 0;
}
.ic-renttaxcreditcalc .ic-rtc-year-row > span:nth-child(6) .ic-status-pill {
    padding: 5px 12px;
    white-space: nowrap;
}
.ic-renttaxcreditcalc .ic-rtc-year-cell-label {
    font-weight: 600;
    color: var(--ic-text);
}
.ic-renttaxcreditcalc .ic-rtc-year-cell-credit {
    font-weight: 700;
    color: var(--ic-primary);
}

/* ---- Eligibility check rows ---- */
.ic-renttaxcreditcalc .ic-rtc-check-row { align-items: center; gap: 18px; }
.ic-renttaxcreditcalc .ic-rtc-check-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.ic-renttaxcreditcalc .ic-rtc-check-text strong {
    font-size: 13px;
    font-weight: 600;
    color: var(--ic-text);
}
.ic-renttaxcreditcalc .ic-rtc-check-text small {
    font-size: 12px;
    line-height: 1.4;
    color: var(--ic-text-muted);
}

/* ---- Warnings ---- */
.ic-renttaxcreditcalc .ic-rtc-warning {
    margin: 0 0 14px;
    padding: 14px 16px;
    border: 1px solid rgba(217,119,6,.22);
    border-left: 3px solid var(--ic-warn);
    border-radius: var(--ic-radius);
    background: rgba(217,119,6,.07);
    color: #92400e;
    font-size: 13px;
    line-height: 1.5;
}
.ic-renttaxcreditcalc .ic-rtc-warning strong { display: block; margin-bottom: 6px; font-weight: 600; }
.ic-renttaxcreditcalc .ic-rtc-warning ul { margin: 0; padding-left: 18px; }
.ic-renttaxcreditcalc .ic-rtc-warning li { margin: 4px 0; }
.ic-renttaxcreditcalc .ic-rtc-warning--soft {
    background: rgba(30,58,138,.04);
    border-color: rgba(30,58,138,.18);
    border-left-color: var(--ic-primary);
    color: var(--ic-text-muted);
}

/* ---- Claim steps (two-column on desktop) ---- */
.ic-renttaxcreditcalc .ic-rtc-claim-block { margin-bottom: 14px; }
.ic-renttaxcreditcalc .ic-rtc-claim-routes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}
.ic-renttaxcreditcalc .ic-rtc-claim-route {
    padding: 16px 18px;
    border-right: 1px solid var(--ic-border);
}
.ic-renttaxcreditcalc .ic-rtc-claim-route:last-child { border-right: 0; }
.ic-renttaxcreditcalc .ic-rtc-claim-route-title {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--ic-primary);
    margin-bottom: 8px;
}
.ic-renttaxcreditcalc .ic-rtc-claim-route ol {
    margin: 0;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.ic-renttaxcreditcalc .ic-rtc-claim-route li {
    font-size: 13px;
    color: var(--ic-text-muted);
    line-height: 1.5;
}
.ic-renttaxcreditcalc .ic-rtc-claim-route li strong { color: var(--ic-text); }
.ic-renttaxcreditcalc .ic-rtc-claim-route li em { font-style: normal; color: var(--ic-primary); font-weight: 600; }

/* ---- Note grid override: 2 cards per row on desktop/tablet ---- */
.ic-renttaxcreditcalc .ic-note-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.ic-renttaxcreditcalc .ic-note-card { display: flex; flex-direction: column; }

/* ---- Stagger ---- */
.ic-renttaxcreditcalc .ic-stagger > * {
    opacity: 0;
    animation: ic-baseFadeIn .25s ease-out forwards;
}
.ic-renttaxcreditcalc .ic-stagger > *:nth-child(1) { animation-delay: 0ms; }
.ic-renttaxcreditcalc .ic-stagger > *:nth-child(2) { animation-delay: 45ms; }
.ic-renttaxcreditcalc .ic-stagger > *:nth-child(3) { animation-delay: 90ms; }
.ic-renttaxcreditcalc .ic-stagger > *:nth-child(4) { animation-delay: 135ms; }
.ic-renttaxcreditcalc .ic-stagger > *:nth-child(5) { animation-delay: 180ms; }
.ic-renttaxcreditcalc .ic-stagger > *:nth-child(6) { animation-delay: 225ms; }
.ic-renttaxcreditcalc .ic-stagger > *:nth-child(7) { animation-delay: 270ms; }
.ic-renttaxcreditcalc .ic-stagger > *:nth-child(8) { animation-delay: 315ms; }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    .ic-renttaxcreditcalc .ic-rtc-row--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ic-renttaxcreditcalc .ic-rtc-year-row {
        grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr 1.3fr;
        font-size: 12px;
    }
}

@media (max-width: 767px) {
    .ic-renttaxcreditcalc .ic-rtc-form-shell { padding: 20px 16px; }
    .ic-renttaxcreditcalc .ic-rtc-row--3,
    .ic-renttaxcreditcalc .ic-rtc-row--2 { grid-template-columns: 1fr; }
    .ic-renttaxcreditcalc .ic-rtc-backdated-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ic-renttaxcreditcalc .ic-rtc-claim-routes { grid-template-columns: 1fr; }
    .ic-renttaxcreditcalc .ic-rtc-claim-route { border-right: 0; border-bottom: 1px solid var(--ic-border); }
    .ic-renttaxcreditcalc .ic-rtc-claim-route:last-child { border-bottom: 0; }
    .ic-renttaxcreditcalc .ic-rtc-check-row { align-items: flex-start; }
    .ic-renttaxcreditcalc .ic-note-grid { grid-template-columns: 1fr; }
    .ic-renttaxcreditcalc .ic-rtc-year-row {
        grid-template-columns: 1fr 1fr;
        gap: 4px 12px;
        padding: 12px 16px;
    }
    .ic-renttaxcreditcalc .ic-rtc-year-row--header { display: none; }
    .ic-renttaxcreditcalc .ic-rtc-year-row > span {
        font-size: 12px;
    }
    .ic-renttaxcreditcalc .ic-rtc-year-row > span:not(:first-child):not(:last-child)::before {
        content: attr(data-label);
    }
    .ic-renttaxcreditcalc .ic-rtc-year-cell-label {
        grid-column: 1 / -1;
        font-size: 13px;
        margin-bottom: 4px;
        padding-bottom: 4px;
        border-bottom: 1px solid var(--ic-border);
    }
}

@media (max-width: 520px) {
    .ic-renttaxcreditcalc .ic-rtc-actions-main { flex-direction: column; }
    .ic-renttaxcreditcalc .ic-rtc-actions-main .ic-calc-btn,
    .ic-renttaxcreditcalc .ic-rtc-actions-main .ic-reset-btn {
        width: 100% !important;
        flex: none;
    }
}
