/**
 * 文件名称：finance-tools.css
 * 作者：wangkai
 * 创作时间：2026-11-26
 * 文件说明：理财常用公式页面样式，统一卡片网格布局，覆盖 Bootstrap 默认样式
 */

.fin-page {
    --fin-primary: #2563eb;
    --fin-primary-dark: #1d4ed8;
    --fin-text: #1e293b;
    --fin-muted: #64748b;
    --fin-border: #e2e8f0;
    --fin-bg: #f8fafc;
    max-width: 1200px;
    margin: 0 auto 48px;
    padding: 0 4px;
    color: var(--fin-text);
    font-size: 15px;
}

/* ---------- 顶部 ---------- */
.fin-hero {
    margin: 24px 0 22px;
    padding: 28px;
    border-radius: 18px;
    background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
    border: 1px solid #dbeafe;
}

.fin-title {
    margin: 0 0 8px;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: .5px;
}

.fin-sub {
    margin: 0;
    color: var(--fin-muted);
    font-size: 14px;
}

/* ---------- 网格 ---------- */
.fin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 20px;
}

/* ---------- 卡片 ---------- */
.fin-card {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid var(--fin-border);
    border-radius: 18px;
    padding: 22px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .04);
}

.fin-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--fin-border);
}

.fin-card__title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    white-space: nowrap;
}

.fin-card__formula {
    font-size: 12px;
    color: var(--fin-muted);
    text-align: right;
    line-height: 1.5;
}

/* ---------- 表单 ---------- */
.fin-field {
    margin-bottom: 14px;
    flex: 1;
    min-width: 0;
}

.fin-field-row {
    display: flex;
    gap: 14px;
}

.fin-field label {
    display: block;
    margin-bottom: 7px;
    font-size: 13px;
    font-weight: 600;
    color: var(--fin-muted);
}

.fin-input {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    font-size: 15px;
    color: var(--fin-text);
    background: var(--fin-bg);
    border: 1px solid var(--fin-border);
    border-radius: 10px;
    outline: none;
    transition: border-color .2s, box-shadow .2s, background .2s;
}

/* 覆盖 Bootstrap 对 form-control/select 的默认高度 */
.fin-page select.fin-input {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8.5 1.5 4h9L6 8.5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.fin-input:focus {
    background: #ffffff;
    border-color: var(--fin-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.fin-input.invalid {
    border-color: #f87171;
    background: #fef2f2;
}

.fin-chinese {
    margin-top: 6px;
    font-size: 12px;
    color: var(--fin-muted);
    min-height: 16px;
    transition: opacity .3s;
}

.fin-chinese.fade-in {
    opacity: .4;
}

.fin-error {
    display: none;
    margin-top: 5px;
    font-size: 12px;
    color: #dc2626;
}

.fin-error.show {
    display: block;
}

/* ---------- 按钮 ---------- */
.fin-btn {
    width: 100%;
    height: 44px;
    margin-top: 4px;
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
    background: var(--fin-primary);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(37, 99, 235, .2);
    transition: background .2s, transform .1s;
}

.fin-btn:hover {
    background: var(--fin-primary-dark);
}

.fin-btn:active {
    transform: translateY(1px);
}

/* ---------- 结果 ---------- */
.fin-result {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
    border: 1px solid #dbeafe;
    border-radius: 12px;
}

.fin-result__label {
    font-size: 14px;
    font-weight: 600;
    color: #334155;
}

.fin-result__value {
    font-size: 20px;
    font-weight: 700;
    color: var(--fin-primary-dark);
    font-variant-numeric: tabular-nums;
    word-break: break-all;
}

.fin-copy {
    margin-left: auto;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--fin-primary);
    background: #ffffff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    cursor: pointer;
    transition: background .2s;
}

.fin-copy:hover {
    background: #eff6ff;
}

.fin-copy.copy-success {
    color: #15803d;
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.fin-copy.copy-fail {
    color: #b91c1c;
    border-color: #fecaca;
    background: #fef2f2;
}

/* ---------- 计算过程 ---------- */
.process-toggle {
    margin-top: 12px;
    font-size: 13px;
    color: var(--fin-primary);
    cursor: pointer;
    user-select: none;
}

.process-toggle:hover {
    text-decoration: underline;
}

.process-detail {
    margin-top: 10px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px dashed var(--fin-border);
    border-radius: 10px;
    max-height: 340px;
    overflow: auto;
}

.process-detail pre {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.7;
    color: #475569;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: Menlo, Consolas, "Courier New", monospace;
}

/* ---------- 还款计划表 ---------- */
.fin-schedule {
    margin-top: 16px;
    overflow-x: auto;
    border: 1px solid var(--fin-border);
    border-radius: 12px;
}

.fin-table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    font-size: 13px;
}

.fin-table th,
.fin-table td {
    padding: 9px 12px;
    text-align: right;
    border-bottom: 1px solid var(--fin-border);
    white-space: nowrap;
}

.fin-table th:first-child,
.fin-table td:first-child {
    text-align: center;
}

.fin-table th {
    background: #f8fafc;
    color: var(--fin-muted);
    font-weight: 600;
}

.fin-table tbody tr:last-child td {
    border-bottom: none;
}

.fin-table tbody tr:hover td {
    background: #f8fafc;
}

.fin-table tr.table-info td {
    background: #eff6ff;
    font-weight: 700;
    color: var(--fin-primary-dark);
}

/* 分页 */
.schedule-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 14px;
    border-top: 1px solid var(--fin-border);
    font-size: 13px;
    color: var(--fin-muted);
}

.pagination-buttons,
.page-jump {
    display: flex;
    align-items: center;
    gap: 8px;
}

.schedule-pagination button {
    height: 30px;
    padding: 0 12px;
    font-size: 12px;
    color: var(--fin-primary);
    background: #ffffff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    cursor: pointer;
}

.schedule-pagination button:disabled {
    color: #cbd5e1;
    border-color: var(--fin-border);
    cursor: not-allowed;
}

.schedule-pagination .page-input {
    width: 64px;
    height: 30px;
    padding: 0 8px;
    font-size: 12px;
    border: 1px solid var(--fin-border);
    border-radius: 8px;
    outline: none;
}

.schedule-pagination .page-numbers {
    font-weight: 600;
    color: #334155;
}

/* ---------- 多行结果列表 ---------- */
.fin-result-list {
    margin-top: 16px;
    padding: 4px 14px;
    background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
    border: 1px solid #dbeafe;
    border-radius: 12px;
}

.fin-result-list .fin-result {
    margin: 0;
    padding: 10px 0;
    background: none;
    border: none;
    border-bottom: 1px dashed #dbeafe;
    border-radius: 0;
}

.fin-result-list .fin-result:last-child {
    border-bottom: none;
}

.fin-result-list .fin-result__value {
    font-size: 17px;
}

/* ---------- 底部说明 ---------- */
.fin-note {
    margin: 18px 0 0;
    color: var(--fin-muted);
    font-size: 13px;
    line-height: 1.7;
}

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
    .fin-hero {
        padding: 20px;
    }

    .fin-card {
        padding: 18px;
    }

    .fin-grid {
        grid-template-columns: 1fr;
    }

    .fin-field-row {
        flex-direction: column;
        gap: 0;
    }

    .fin-card__head {
        flex-direction: column;
        align-items: flex-start;
    }

    .fin-card__formula {
        text-align: left;
    }

    .fin-result__value {
        font-size: 18px;
    }
}
