/* Amortisation plan (scripts/loan-amortization.js): the "Plani i amortizimit" link on the loan cards, and the plan
   in the details modal with its PDF and Excel exports. */

/* ── Card links: "Shiko detajet" and "Plani i amortizimit" side by side ── */

/* Consumer and student loan rows (loans.js): the links share the row's last column, one under the other. */
.dep-result-links {
    justify-self: end;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

/* Mortgage cards (loans.js). */
.hp-loan__result-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 20px;
}

/* Diaspora rows (diaspora.js): the two buttons share the row's last column. */
.dep-row__links {
    justify-self: end;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

@media (max-width: 1080px) {
    .dep-row__links {
        grid-column: 1 / -1;
        flex-direction: row;
        flex-wrap: wrap;
    }
}

@media (max-width: 700px) {
    .dep-result-links {
        grid-column: 1 / -1;
        justify-self: start;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px 20px;
    }

    .dep-row__links {
        justify-self: start;
    }
}

/* The table needs more room than the details: the panel widens while the plan is shown. */
.dep-modal__panel.loan-amort-panel,
.hp-modal__panel.loan-amort-panel {
    max-width: 1040px;
}

.loan-amort {
    gap: 20px;
}

.loan-amort__top {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.loan-amort__heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
}

.loan-amort__exports {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.loan-amort__export {
    padding: 8px 16px;
    border: 1.5px solid var(--color-brand);
    border-radius: 999px;
    background: transparent;
    color: var(--color-brand);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

    .loan-amort__export:hover,
    .loan-amort__export:focus-visible {
        background: var(--color-brand);
        color: #ffffff;
    }

.loan-amort__title {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--color-brand);
}

.loan-amort__inputs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 24px;
    margin: 0;
    font-size: 14px;
    color: rgba(87, 28, 42, 0.85);
}

    .loan-amort__inputs strong {
        font-weight: 600;
        color: var(--color-brand);
    }

.loan-amort__desc,
.loan-amort__warning {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: rgba(87, 28, 42, 0.85);
}

.loan-amort__warning {
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(87, 28, 42, 0.06);
}

.loan-amort__results {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.loan-amort__result {
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(87, 28, 42, 0.05);
}

.loan-amort__result-label,
.loan-amort__result-note {
    margin: 0;
    font-size: 12px;
    color: rgba(87, 28, 42, 0.7);
}

.loan-amort__result-value {
    margin: 4px 0 2px;
    font-size: 17px;
    font-weight: 600;
    color: var(--color-brand);
    overflow-wrap: anywhere;
}

/* The table scrolls on its own, so its header stays in view. */
.loan-amort__table-wrap {
    flex: 0 0 auto;
    max-height: 55vh;
    overflow: auto;
    border: 1px solid rgba(87, 28, 42, 0.12);
    border-radius: 12px;
}

.loan-amort__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
    color: #111111;
}

    .loan-amort__table th,
    .loan-amort__table td {
        padding: 7px 10px;
        text-align: right;
        white-space: nowrap;
    }

        .loan-amort__table th:nth-child(-n+3),
        .loan-amort__table td:nth-child(-n+3) {
            text-align: left;
        }

    .loan-amort__table thead th {
        position: sticky;
        top: 0;
        z-index: 1;
        background: #f6eff1;
        font-weight: 600;
        color: var(--color-brand);
    }

    .loan-amort__table tbody tr + tr td {
        border-top: 1px solid rgba(87, 28, 42, 0.06);
    }

    .loan-amort__table tbody tr.loan-amort__row--year-start td {
        border-top: 1px solid rgba(87, 28, 42, 0.22);
    }

    .loan-amort__table tbody tr.loan-amort__row--recalc td {
        background: rgba(87, 28, 42, 0.05);
        font-weight: 600;
    }

.loan-amort__phase {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11.5px;
    background: rgba(87, 28, 42, 0.08);
    color: var(--color-brand);
}

.loan-amort__row--variable .loan-amort__phase {
    background: #f3e3c3;
    color: #6b4a12;
}

.loan-amort__row--fixedKept .loan-amort__phase {
    background: #e4ebf3;
    color: #2c4766;
}

@media (max-width: 760px) {
    .loan-amort__results {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .loan-amort__table-wrap {
        max-height: 60vh;
    }
}
