/**
 * 设置中心 / 支付密码页样式（settings.html + pay-password.html 共用）
 * 适配暗色模式（颜色全部走 common.css 主题变量）与移动端 / PC 双端
 */

/* ---------- 顶栏 ---------- */
.st-topbar {
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    position: sticky;
    top: 0;
    z-index: 50;
}
.st-topbar-inner {
    max-width: 640px;
    margin: 0 auto;
    height: 50px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 8px;
}
.st-back {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    color: var(--c-text);
    font-size: 15px;
    border-radius: 50%;
}
.st-back:active { background: var(--c-bg-2); }
.st-title {
    flex: 1;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--c-text);
    text-align: center;
}
.st-topbar-placeholder { width: 32px; }

.st-wrap {
    max-width: 640px;
    margin: 0 auto;
    padding: 14px 14px 40px;
}

/* ---------- 设置中心列表 ---------- */
.st-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 14px;
}
.st-section-title {
    margin: 4px 2px 8px;
    font-size: 12px;
    color: var(--c-text-3);
}
.st-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 14px;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--c-border);
    text-align: left;
    cursor: pointer;
    color: var(--c-text);
    transition: background .15s;
}
.st-item:last-child { border-bottom: 0; }
.st-item:active { background: var(--c-bg-2); }
.st-item-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
    background: rgba(79, 70, 229, .12);
    color: #4f46e5;
}
html[data-theme="dark"] .st-item-icon { background: rgba(129, 140, 248, .16); color: #a5b4fc; }
.st-item-main { flex: 1; min-width: 0; }
.st-item-name { display: block; font-size: 14px; font-weight: 500; }
.st-item-desc { display: block; margin-top: 2px; font-size: 12px; color: var(--c-text-3); }
.st-item-side { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.st-item-state {
    font-size: 12px;
    color: var(--c-text-3);
}
.st-item-state.on { color: #059669; }
html[data-theme="dark"] .st-item-state.on { color: #34d399; }
.st-item-state.off { color: #d97706; }
html[data-theme="dark"] .st-item-state.off { color: #fbbf24; }
.st-item .fa-chevron-right { font-size: 12px; color: var(--c-text-3); }

/* ---------- 支付密码表单 ---------- */
.st-notice {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    background: var(--c-bg-2);
    border-radius: 12px;
    padding: 11px 12px;
    margin-bottom: 14px;
    font-size: 12px;
    line-height: 1.6;
    color: var(--c-text-2);
}
.st-notice i { margin-top: 2px; color: #0891b2; }
html[data-theme="dark"] .st-notice i { color: #22d3ee; }

.st-group { margin-bottom: 18px; }
.st-label {
    display: block;
    margin: 0 2px 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--c-text-2);
}

/* 6 位分格密码输入（隐藏输入框覆盖在格子上，兼容移动端数字键盘） */
.pw-boxes {
    position: relative;
    display: flex;
    gap: 8px;
    width: 100%;
    cursor: text;
}
.pw-cell {
    flex: 1;
    height: 52px;
    border: 1.5px solid var(--c-border);
    border-radius: 12px;
    background: var(--c-surface);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    color: var(--c-text);
    transition: border-color .15s, box-shadow .15s;
}
.pw-cell.filled::after {
    content: '';
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--c-text);
}
.pw-boxes.focus .pw-cell.active {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(24, 144, 255, .12);
}
.pw-boxes.focus .pw-cell.active::after {
    animation: pw-blink 1s steps(2) infinite;
}
.pw-boxes.focus .pw-cell.active:not(.filled)::after {
    width: 2px; height: 22px; border-radius: 2px;
    background: var(--c-primary);
}
@keyframes pw-blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }
.pw-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    border: 0;
    padding: 0;
    margin: 0;
    font-size: 16px;
    background: transparent;
    color: transparent;
    caret-color: transparent;
    outline: none;
}
/* 密码错误抖动 */
.pw-boxes.shake .pw-cell { border-color: #ef4444; animation: pw-shake .4s; }
@keyframes pw-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

/* ---------- 提交按钮 ---------- */
.st-btn {
    width: 100%;
    height: 46px;
    border: 0;
    border-radius: 12px;
    background: var(--c-primary);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s, transform .1s;
}
.st-btn:active { transform: scale(.98); }
.st-btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- 成功态 ---------- */
.st-done {
    padding: 40px 0 10px;
    text-align: center;
}
.st-done-icon {
    width: 64px; height: 64px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: rgba(5, 150, 105, .12);
    color: #059669;
    display: flex; align-items: center; justify-content: center;
    font-size: 30px;
}
html[data-theme="dark"] .st-done-icon { background: rgba(52, 211, 153, .16); color: #34d399; }
.st-done-title { font-size: 16px; font-weight: 600; color: var(--c-text); }
.st-done-tip { margin-top: 6px; font-size: 13px; color: var(--c-text-3); }

/* ---------- PC 端适配 ---------- */
@media (min-width: 768px) {
    .st-topbar-inner { height: 56px; }
    .st-wrap { padding-top: 24px; }
    .st-item { padding: 15px 16px; }
    .st-item:hover { background: var(--c-bg-2); }
    .st-item-icon { width: 40px; height: 40px; }
    .pw-cell { height: 56px; }
    /* PC 端限制输入组宽度，避免格子过度拉伸 */
    .pw-boxes { max-width: 420px; margin-left: auto; margin-right: auto; }
    .st-btn { max-width: 320px; margin: 0 auto; display: block; }
}
