/**
 * FHA Loan Calculator Styles
 * @package Zipper
 */

.fhalc-hidden,
.fhalc-waiting[hidden] {
    display: none !important;
}

#fhalcCalculator {
    padding: 16px;
}

.fhalc-intro,
.fhalc-section,
.fhalc-input-group,
.fhalc-summary-grid,
.fhalc-breakdown-list,
.fhalc-breakdown-row,
.fhalc-breakdown-head,
.fhalc-rule-grid,
.fhalc-tip-list,
.fhalc-assumption-box,
.fhalc-actions,
.fhalc-waiting,
.fhalc-waiting-copy,
.fhalc-result-hero,
.fhalc-insight-list,
.fhalc-table-wrap {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.fhalc-intro {
    gap: 6px;
    margin-bottom: 12px;
}

.fhalc-lead {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    color: #5f5a56;
}

.fhalc-mode-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 8px;
}

.fhalc-mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 32px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid #e8e4dc;
    background: #faf9f7;
    color: #5f5a56;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
}

.fhalc-mode-badge i {
    color: #8a6500;
}

.fhalc-mode-badge.is-accent {
    border-color: #eadfb8;
    background: linear-gradient(135deg, #fffaf0 0%, #f8f0d8 100%);
    color: #7a5d18;
    box-shadow: 0 3px 8px rgba(212, 175, 55, 0.10);
}

.fhalc-mode-badge.is-accent i {
    color: #d4af37;
}

#fhalcCalculator .tool-layout-split {
    grid-template-columns: 352px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}

#fhalcCalculator .tool-layout-input,
#fhalcResultCol {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.fhalc-section {
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 4px rgba(45, 42, 38, 0.06);
    transition: box-shadow 0.2s ease;
}

.fhalc-section:hover {
    box-shadow: 0 2px 8px rgba(45, 42, 38, 0.10);
}

.fhalc-input-section {
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.fhalc-section-title,
.fhalc-assumption-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: #2d2a26;
}

.fhalc-section-title i,
.fhalc-assumption-title i,
.fhalc-waiting-icon i {
    color: #d4af37;
}

.fhalc-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.fhalc-section-meta {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: #f7f1e1;
    color: #8a6500;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.fhalc-input-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.fhalc-input-label {
    font-size: 12px;
    font-weight: 600;
    color: #5f5a56;
}

.fhalc-inline-input {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.fhalc-money-input,
.fhalc-number-input,
.fhalc-select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #e8e4dc;
    border-radius: 8px;
    background: #fff;
    color: #2d2a26;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.fhalc-money-input {
    text-align: right;
    font-weight: 600;
}

.fhalc-number-input {
    text-align: center;
    font-weight: 600;
}

.fhalc-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%235f5a56' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 34px;
}

.fhalc-money-input:hover,
.fhalc-number-input:hover,
.fhalc-select:hover {
    border-color: #d4c67a;
}

.fhalc-money-input:focus,
.fhalc-number-input:focus,
.fhalc-select:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.fhalc-unit-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 6px 10px;
    border: 1px solid #e8e4dc;
    border-radius: 10px;
    background: #faf9f7;
    color: #5f5a56;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.fhalc-money-note,
.fhalc-input-hint {
    font-size: 12px;
    line-height: 1.45;
    color: #7a756d;
}

.fhalc-money-note {
    color: #b8860b;
}

.fhalc-quick-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.fhalc-quick-btn {
    border: 1px solid #e8e4dc;
    background: #fff;
    color: #5f5a56;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fhalc-quick-btn:hover,
.fhalc-quick-btn:focus-visible {
    outline: none;
    border-color: #d4af37;
    background: rgba(212, 175, 55, 0.12);
    color: #8a6500;
}

.fhalc-toggle-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.fhalc-toggle-card {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    column-gap: 10px;
    row-gap: 2px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid #e8e4dc;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fhalc-toggle-card input {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid #c9c2b4;
    background: #fff;
    margin: 0;
    box-sizing: border-box;
    position: relative;
}

.fhalc-toggle-card input:checked {
    border-color: #d4af37;
}

.fhalc-toggle-card input:checked::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: #d4af37;
}

.fhalc-toggle-card.is-active,
.fhalc-toggle-card:hover {
    border-color: #d4af37;
    background: rgba(212, 175, 55, 0.08);
}

.fhalc-toggle-name {
    font-size: 13px;
    font-weight: 700;
    color: #2d2a26;
}

.fhalc-toggle-desc {
    grid-column: 2;
    font-size: 11px;
    color: #7a756d;
    line-height: 1.45;
}

.fhalc-assumption-box {
    padding: 12px;
    border-radius: 10px;
    background: #faf9f7;
    border: 1px solid #efe7d4;
}

.fhalc-assumption-list,
.fhalc-tip-list,
.fhalc-insight-list {
    margin: 0;
    padding-left: 18px;
    color: #5f5a56;
    font-size: 12px;
    line-height: 1.6;
}

.fhalc-actions {
    gap: 8px;
}

.fhalc-tip-section,
.fhalc-scenario-section {
    gap: 10px;
}

.fhalc-waiting {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid #eadfb8;
    background: linear-gradient(135deg, #fffaf0 0%, #faf6ec 100%);
}

.fhalc-waiting-icon {
    font-size: 22px;
    line-height: 1;
}

.fhalc-waiting-copy strong,
.fhalc-waiting-copy p {
    margin: 0;
}

.fhalc-waiting-copy p {
    font-size: 12px;
    line-height: 1.5;
    color: #7a756d;
}

.fhalc-top-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 12px;
}

.fhalc-result-hero {
    min-height: 100%;
    justify-content: center;
    border-radius: 16px;
    padding: 18px;
    background: linear-gradient(135deg, #fdfbf5 0%, #faf6ec 100%);
    border: 1px solid #eadfb8;
    box-shadow: 0 8px 18px rgba(212, 175, 55, 0.12);
}

.fhalc-badge {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    min-height: 28px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.fhalc-badge.is-neutral {
    background: rgba(212, 175, 55, 0.14);
    color: #8a6500;
}

.fhalc-badge.is-ok {
    background: rgba(70, 180, 80, 0.14);
    color: #2d7a35;
}

.fhalc-badge.is-warn {
    background: rgba(220, 50, 50, 0.12);
    color: #b33030;
}

.fhalc-hero-label {
    font-size: 13px;
    font-weight: 700;
    color: #7a5d18;
}

.fhalc-hero-value {
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #1f1c17;
}

.fhalc-hero-sub {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    color: #5f5a56;
}

.fhalc-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.fhalc-summary-card,
.fhalc-rule-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid #e8e4dc;
    background: #fff;
    box-shadow: 0 1px 4px rgba(45, 42, 38, 0.05);
}

.fhalc-summary-label,
.fhalc-rule-label {
    font-size: 11px;
    font-weight: 700;
    color: #7a756d;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.fhalc-summary-value,
.fhalc-rule-value {
    font-size: 20px;
    font-weight: 800;
    color: #2d2a26;
    letter-spacing: -0.02em;
    word-break: break-word;
}

.fhalc-rule-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.fhalc-rule-sub {
    font-size: 11px;
    line-height: 1.5;
    color: #7a756d;
}

.fhalc-breakdown-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    color: #2d2a26;
}

.fhalc-breakdown-track {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: #f1ece3;
    overflow: hidden;
}

.fhalc-breakdown-fill {
    display: block;
    height: 100%;
    width: 0%;
    border-radius: inherit;
}

.fhalc-breakdown-fill.is-primary {
    background: linear-gradient(90deg, #d4af37 0%, #c3921b 100%);
}

.fhalc-breakdown-fill.is-mip {
    background: linear-gradient(90deg, #8a6500 0%, #b8860b 100%);
}

.fhalc-breakdown-fill.is-tax {
    background: linear-gradient(90deg, #6b7a90 0%, #8aa0bf 100%);
}

.fhalc-breakdown-fill.is-insurance {
    background: linear-gradient(90deg, #4f9f70 0%, #78b891 100%);
}

.fhalc-breakdown-fill.is-hoa {
    background: linear-gradient(90deg, #926fb2 0%, #b69ad0 100%);
}

.fhalc-table-wrap {
    max-width: 100%;
    overflow-x: auto;
}

.fhalc-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    font-size: 12px;
}

.fhalc-table th,
.fhalc-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee7db;
    text-align: right;
    vertical-align: middle;
    white-space: nowrap;
}

.fhalc-table th:first-child,
.fhalc-table td:first-child,
.fhalc-table th:last-child,
.fhalc-table td:last-child {
    text-align: left;
}

.fhalc-table thead th {
    background: #faf7f2;
    color: #5f5a56;
    font-weight: 700;
}

.fhalc-table tbody tr.is-current {
    background: rgba(212, 175, 55, 0.08);
}

.fhalc-table tbody tr.is-over-limit {
    background: rgba(220, 50, 50, 0.04);
}

.fhalc-table-empty {
    text-align: center !important;
    color: #7a756d;
}

.fhalc-scenario-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 26px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    background: #faf9f7;
    color: #5f5a56;
    border: 1px solid #e8e4dc;
}

.fhalc-scenario-tag.is-current {
    background: rgba(212, 175, 55, 0.14);
    color: #8a6500;
    border-color: #e3d39a;
}

.fhalc-status-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.fhalc-status-chip.is-ok {
    background: rgba(70, 180, 80, 0.12);
    color: #2d7a35;
}

.fhalc-status-chip.is-warn {
    background: rgba(220, 50, 50, 0.10);
    color: #b33030;
}

@media (max-width: 900px) {
    #fhalcCalculator .tool-layout-split {
        grid-template-columns: 1fr;
    }

    .fhalc-top-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    #fhalcCalculator {
        padding: 14px 12px 16px;
    }

    .fhalc-section,
    .fhalc-result-hero {
        padding: 14px;
    }

    .fhalc-input-row,
    .fhalc-summary-grid,
    .fhalc-rule-grid {
        grid-template-columns: 1fr;
    }

    .fhalc-hero-value {
        font-size: 28px;
    }

    .fhalc-table {
        min-width: 680px;
    }
}

@media (max-width: 480px) {
    .tool-section,
    .tool-layout-split,
    .tool-layout-input,
    .tool-layout-result {
        max-width: 100%;
        overflow-x: hidden;
    }

    .fhalc-mode-badge,
    .fhalc-quick-btn,
    .fhalc-section-meta,
    .fhalc-status-chip,
    .fhalc-scenario-tag,
    .fhalc-table,
    .fhalc-money-note,
    .fhalc-input-hint,
    .fhalc-tip-list,
    .fhalc-assumption-list,
    .fhalc-insight-list {
        font-size: 11px;
    }

    .fhalc-money-input,
    .fhalc-number-input,
    .fhalc-select,
    .fhalc-unit-chip {
        min-height: 36px;
        padding: 8px 10px;
        font-size: 13px;
    }

    .fhalc-hero-value,
    .fhalc-summary-value,
    .fhalc-rule-value {
        font-size: 24px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .fhalc-section,
    .fhalc-money-input,
    .fhalc-number-input,
    .fhalc-select,
    .fhalc-quick-btn,
    .fhalc-toggle-card {
        transition: none !important;
    }
}
