/* ======================================================================
 *  养老金计算器 /tools/pension-calc
 *  依赖 home.css 全局变量 + tool-detail.css 公共类，支持黑夜模式
 * ====================================================================== */

/* 隐藏态兜底：避免 [hidden] 被组件自身的 display:flex 规则覆盖而常显 */
[hidden] { display: none !important; }

.pn-layout {
    display: grid;
    grid-template-columns: 400px minmax(0, 1fr);
    gap: 20px;
    margin-bottom: 24px;
    align-items: start;
}
.pn-card {
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 22px;
}
.pn-title {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin-bottom: 18px;
}

/* ---------- 表单 ---------- */
.pn-field { margin-bottom: 18px; }
.pn-field > label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--c-text-sub);
    margin-bottom: 8px;
}
.pn-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.pn-input {
    width: 100%;
    height: 44px;
    padding: 0 46px 0 14px;
    font-size: 14px;
    font-family: inherit;
    color: var(--c-text);
    background: var(--c-surface-soft);
    border: 1px solid var(--c-border);
    border-radius: 12px;
    outline: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
    -moz-appearance: textfield;
}
.pn-input::-webkit-outer-spin-button,
.pn-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pn-input:focus {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px var(--c-primary-soft);
}
.pn-input--pre { padding-left: 34px; }
.pn-select {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    padding-right: 38px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a93a8' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}
.pn-prefix {
    position: absolute;
    left: 14px;
    font-size: 13px;
    color: var(--c-text-muted);
    pointer-events: none;
}
.pn-suffix {
    position: absolute;
    right: 14px;
    font-size: 13px;
    color: var(--c-text-muted);
    pointer-events: none;
}
/* select 的下拉箭头固定在右侧 14px 处，后缀需要左移让位，否则文字压住箭头 */
.pn-select + .pn-suffix { right: 34px; }
.pn-help {
    font-size: 12px;
    line-height: 1.7;
    color: var(--c-text-muted);
    margin-top: 7px;
}
.pn-help b { color: var(--c-text-sub); }

/* 快捷指数 */
.pn-quick-row {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
}
.pn-quick {
    flex: 1;
    min-width: 52px;
    padding: 7px 6px;
    font-size: 12px;
    font-weight: 700;
    font-family: inherit;
    color: var(--c-text-sub);
    background: var(--c-surface-soft);
    border: 1px solid var(--c-border);
    border-radius: 9px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.pn-quick:hover {
    color: var(--c-primary);
    border-color: var(--c-primary);
    background: var(--c-primary-soft);
}
.pn-quick--inline {
    display: inline-block;
    flex: none;
    width: auto;
    margin-top: 8px;
    padding: 6px 12px;
}

.btn-block { width: 100%; margin-top: 8px; }

/* ---------- 结果区 ---------- */
.pn-result-card { min-height: 320px; }
.pn-result-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 300px;
    text-align: center;
    color: var(--c-text-muted);
    font-size: 13.5px;
    line-height: 1.8;
}
.pn-result-empty .emoji { font-size: 46px; opacity: 0.75; }

.pn-result-body { animation: pnFade 0.28s ease; }
@keyframes pnFade {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.pn-hero {
    padding: 22px 24px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(0, 200, 150, 0.10), rgba(0, 102, 255, 0.08));
    border: 1px solid rgba(0, 200, 150, 0.22);
    margin-bottom: 14px;
}
.pn-hero-label { font-size: 12.5px; color: var(--c-text-sub); margin-bottom: 6px; }
.pn-hero-num {
    display: flex;
    align-items: baseline;
    gap: 4px;
    color: var(--c-accent-green);
    line-height: 1.1;
}
.pn-hero-num .cur { font-size: 20px; font-weight: 700; }
.pn-hero-num b {
    font-size: 40px;
    font-weight: 800;
    letter-spacing: -0.035em;
}
.pn-hero-sub { font-size: 12.5px; color: var(--c-text-sub); margin-top: 8px; }

.pn-split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}
.pn-split-item {
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--c-surface-soft);
    border: 1px solid var(--c-border);
}
.pn-split-num {
    font-size: 18px;
    font-weight: 800;
    color: var(--c-text);
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}
.pn-split-key { font-size: 11.5px; color: var(--c-text-muted); }

.pn-bill {
    list-style: none;
    border: 1px solid var(--c-border);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 14px;
}
.pn-bill li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    font-size: 13.5px;
    border-bottom: 1px solid var(--c-border);
}
.pn-bill li:last-child { border-bottom: none; }
.pn-bill .k { color: var(--c-text-sub); flex-shrink: 0; }
.pn-bill .v { font-weight: 700; color: var(--c-text); text-align: right; }
.pn-bill li.total { background: var(--c-surface-soft); }
.pn-bill li.total .v { color: var(--c-accent-green); }

.pn-formula {
    font-size: 12.5px;
    line-height: 2;
    color: var(--c-text-sub);
    padding: 13px 15px;
    border-radius: 12px;
    background: var(--c-surface-soft);
    border: 1px solid var(--c-border);
    margin-bottom: 12px;
    word-break: break-word;
}
.pn-formula b { color: var(--c-text); }
.pn-formula .hl { color: var(--c-accent-green); font-weight: 700; }

.pn-note {
    font-size: 12.5px;
    line-height: 1.75;
    color: var(--c-text-sub);
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--c-primary-soft);
    border: 1px dashed rgba(0, 102, 255, 0.28);
}

/* ---------- 对比表 ---------- */
.pn-table-card {
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 22px;
    margin-bottom: 20px;
}
.pn-table-head { margin-bottom: 14px; }
.pn-table-head .pn-title { margin-bottom: 4px; }
.pn-table-scroll {
    overflow-x: auto;
    border: 1px solid var(--c-border);
    border-radius: 12px;
    -webkit-overflow-scrolling: touch;
}
.pn-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    min-width: 460px;
}
.pn-table thead th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--c-text-sub);
    background: var(--c-surface-soft);
    border-bottom: 1px solid var(--c-border);
    white-space: nowrap;
}
.pn-table tbody td {
    padding: 11px 16px;
    color: var(--c-text-sub);
    border-bottom: 1px solid var(--c-border);
    white-space: nowrap;
}
.pn-table tbody tr:last-child td { border-bottom: none; }
.pn-table tbody td b { color: var(--c-text); font-weight: 700; }
.pn-table tbody tr.is-current td { background: var(--c-primary-soft); }
.pn-table tbody tr.is-current td b { color: var(--c-primary); }
.pn-table-card > .pn-help { margin-top: 10px; }

/* ---------- 免责 / 简介 ---------- */
.pn-disclaim {
    font-size: 12px;
    line-height: 1.85;
    color: var(--c-text-muted);
    background: var(--c-surface-soft);
    border: 1px solid var(--c-border);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 26px;
}
.pn-info { margin-bottom: 26px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1000px) {
    .pn-layout { grid-template-columns: 1fr; }
    .pn-result-card { min-height: auto; }
    .pn-result-empty { min-height: 180px; }
}
@media (max-width: 620px) {
    .pn-card, .pn-table-card { padding: 18px; }
    .pn-hero-num b { font-size: 32px; }
    .pn-split { grid-template-columns: 1fr; }
    .pn-bill li { flex-direction: column; align-items: flex-start; gap: 4px; }
    .pn-bill .v { text-align: left; }
}

/* ============ 黑夜模式 ============ */
[data-theme="dark"] .pn-input { background: rgba(255, 255, 255, 0.04); }
[data-theme="dark"] .pn-input option { background: #131c31; color: #e5e9f0; }
[data-theme="dark"] .pn-quick { background: rgba(255, 255, 255, 0.03); }
[data-theme="dark"] .pn-quick:hover { background: rgba(59, 130, 246, 0.14); }
[data-theme="dark"] .pn-hero {
    background: linear-gradient(135deg, rgba(0, 200, 150, 0.14), rgba(59, 130, 246, 0.12));
    border-color: rgba(0, 200, 150, 0.28);
}
[data-theme="dark"] .pn-hero-num { color: #34d399; }
[data-theme="dark"] .pn-formula .hl { color: #34d399; }
[data-theme="dark"] .pn-bill li.total .v { color: #34d399; }
[data-theme="dark"] .pn-note {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.32);
}
[data-theme="dark"] .pn-split-item,
[data-theme="dark"] .pn-formula,
[data-theme="dark"] .pn-bill li.total,
[data-theme="dark"] .pn-table thead th,
[data-theme="dark"] .pn-disclaim { background: rgba(255, 255, 255, 0.03); }
[data-theme="dark"] .pn-table tbody tr.is-current td { background: rgba(59, 130, 246, 0.16); }
