/* ======================================================================
 *  退休年龄计算器 /tools/retirement-age
 *  依赖 home.css 全局变量 + tool-detail.css 公共类，支持黑夜模式
 * ====================================================================== */

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

.ra-layout {
    display: grid;
    grid-template-columns: 400px minmax(0, 1fr);
    gap: 20px;
    margin-bottom: 24px;
    align-items: start;
}

.ra-card {
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 22px;
}
.ra-title {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin-bottom: 18px;
}

/* ---------- 表单 ---------- */
.ra-field { margin-bottom: 20px; }
.ra-field > label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--c-text-sub);
    margin-bottom: 8px;
}
.ra-flex { display: flex; gap: 10px; }
.ra-input-wrap {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}
.ra-input {
    width: 100%;
    height: 44px;
    padding: 0 38px 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;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.ra-input:focus {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px var(--c-primary-soft);
}
.ra-select {
    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;
}
.ra-suffix {
    position: absolute;
    right: 32px;
    font-size: 13px;
    color: var(--c-text-muted);
    pointer-events: none;
}
.ra-help {
    font-size: 12px;
    line-height: 1.7;
    color: var(--c-text-muted);
    margin-top: 7px;
}
.ra-help b { color: var(--c-text-sub); }

/* 单选项 */
.ra-radio-group { display: flex; flex-direction: column; gap: 8px; }
.ra-radio {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border: 1px solid var(--c-border);
    border-radius: 12px;
    background: var(--c-surface-soft);
    font-size: 13.5px;
    font-weight: 600;
    color: var(--c-text-sub);
    cursor: pointer;
    transition: all 0.16s ease;
}
.ra-radio:hover { border-color: var(--c-primary); }
.ra-radio input {
    width: 16px;
    height: 16px;
    accent-color: var(--c-primary);
    cursor: pointer;
    flex-shrink: 0;
}
.ra-radio:has(input:checked) {
    border-color: var(--c-primary);
    background: var(--c-primary-soft);
    color: var(--c-primary);
}

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

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

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

.ra-result-head {
    display: flex;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 16px;
}
.ra-net {
    flex: 1;
    padding: 18px 20px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(0, 102, 255, 0.09), rgba(0, 212, 255, 0.07));
    border: 1px solid rgba(0, 102, 255, 0.16);
}
.ra-net-label { font-size: 12.5px; color: var(--c-text-sub); margin-bottom: 6px; }
.ra-net-num {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--c-primary);
    line-height: 1.15;
}
.ra-net-unit { font-size: 12.5px; color: var(--c-text-sub); margin-top: 7px; }
.ra-net-unit b { color: var(--c-text); font-weight: 700; }

.ra-countdown-box {
    width: 170px;
    flex-shrink: 0;
    padding: 18px 16px;
    border-radius: 14px;
    background: var(--c-surface-soft);
    border: 1px solid var(--c-border);
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.ra-countdown-label { font-size: 12px; color: var(--c-text-muted); margin-bottom: 6px; }
.ra-countdown-num {
    font-size: 17px;
    font-weight: 800;
    color: var(--c-text);
    line-height: 1.3;
    letter-spacing: -0.01em;
}
.ra-countdown-sub { font-size: 11.5px; color: var(--c-text-muted); margin-top: 6px; line-height: 1.5; }

/* 明细表 */
.ra-bill {
    list-style: none;
    border: 1px solid var(--c-border);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 14px;
}
.ra-bill li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    font-size: 13.5px;
    border-bottom: 1px solid var(--c-border);
}
.ra-bill li:last-child { border-bottom: none; }
.ra-bill .k { color: var(--c-text-sub); }
.ra-bill .v { font-weight: 700; color: var(--c-text); }
.ra-bill .v.minus { color: var(--c-accent-orange); }
.ra-bill li.total { background: var(--c-surface-soft); }
.ra-bill li.total .v { color: var(--c-primary); }

/* 高亮三格 */
.ra-highlight {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}
.ra-hl-item {
    padding: 13px 12px;
    border-radius: 12px;
    background: var(--c-surface-soft);
    border: 1px solid var(--c-border);
    text-align: center;
}
.ra-hl-num {
    font-size: 15px;
    font-weight: 800;
    color: var(--c-text);
    line-height: 1.35;
    letter-spacing: -0.01em;
}
.ra-hl-key {
    font-size: 11px;
    color: var(--c-text-muted);
    margin-top: 6px;
    line-height: 1.5;
}

.ra-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);
}

/* ---------- 对照表 ---------- */
.ra-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;
}
.ra-table-head { margin-bottom: 14px; }
.ra-table-head .ra-title { margin-bottom: 4px; }
.ra-table-scroll {
    overflow-x: auto;
    border: 1px solid var(--c-border);
    border-radius: 12px;
    -webkit-overflow-scrolling: touch;
}
.ra-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    min-width: 460px;
}
.ra-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;
}
.ra-table tbody td {
    padding: 11px 16px;
    color: var(--c-text-sub);
    border-bottom: 1px solid var(--c-border);
    white-space: nowrap;
}
.ra-table tbody tr:last-child td { border-bottom: none; }
.ra-table tbody tr:hover td { background: var(--c-surface-soft); }
.ra-table tbody td b { color: var(--c-text); font-weight: 700; }
.ra-table-card > .ra-help { margin-top: 10px; }

/* ---------- 免责 ---------- */
.ra-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;
}

/* ---------- 工具简介 ---------- */
.ra-info { margin-bottom: 26px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1000px) {
    .ra-layout { grid-template-columns: 1fr; }
    .ra-result-card { min-height: auto; }
    .ra-result-empty { min-height: 180px; }
}
@media (max-width: 620px) {
    .ra-card, .ra-table-card { padding: 18px; }
    .ra-result-head { flex-direction: column; }
    .ra-countdown-box { width: 100%; }
    .ra-net-num { font-size: 27px; }
    .ra-highlight { grid-template-columns: 1fr; }
}

/* ============ 黑夜模式 ============ */
[data-theme="dark"] .ra-input { background: rgba(255, 255, 255, 0.04); }
[data-theme="dark"] .ra-input option { background: #131c31; color: #e5e9f0; }
[data-theme="dark"] .ra-radio { background: rgba(255, 255, 255, 0.03); }
[data-theme="dark"] .ra-radio:has(input:checked) { background: rgba(59, 130, 246, 0.14); }
[data-theme="dark"] .ra-net {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.16), rgba(6, 182, 212, 0.12));
    border-color: rgba(59, 130, 246, 0.28);
}
[data-theme="dark"] .ra-note {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.32);
}
[data-theme="dark"] .ra-net-num { color: #6ea8ff; }
[data-theme="dark"] .ra-countdown-box,
[data-theme="dark"] .ra-hl-item,
[data-theme="dark"] .ra-bill li.total,
[data-theme="dark"] .ra-table thead th,
[data-theme="dark"] .ra-table tbody tr:hover td,
[data-theme="dark"] .ra-disclaim { background: rgba(255, 255, 255, 0.03); }
