/* ZeroUserCenter - 简约黑色主题 */

* { margin: 0; padding: 0; box-sizing: border-box; }

/* 黑色主题（默认） */
:root,
[data-theme="dark"] {
    --bg: #0A0A0A;
    --surface: #141414;
    --surface-2: #1A1A1A;
    --surface-3: #1F1F1F;
    --border: #262626;
    --border-soft: #1F1F1F;
    --text: #E5E5E5;
    --text-dim: #A3A3A3;
    --text-faint: #525252;
    --qq-blue: #12B7F5;
    --qq-blue-hover: #0EA5E9;
    --green: #10B981;
    --red: #EF4444;
    --navbar-bg: rgba(10,10,10,0.85);
}

/* 白色主题 */
[data-theme="light"] {
    --bg: #FAFAFA;
    --surface: #FFFFFF;
    --surface-2: #F4F4F5;
    --surface-3: #E4E4E7;
    --border: #E5E5E5;
    --border-soft: #F0F0F0;
    --text: #1A1A1A;
    --text-dim: #525252;
    --text-faint: #A3A3A3;
    --qq-blue: #12B7F5;
    --qq-blue-hover: #0EA5E9;
    --green: #10B981;
    --red: #EF4444;
    --navbar-bg: rgba(255,255,255,0.85);
}

html, body {
    font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    position: relative;
    display: flex;
    flex-direction: column;
}
/* 背景图直接挂在 body 上，确保可见 */
body {
    background: url('../img/dg.webp') center center / cover no-repeat fixed;
}
/* 黑夜模式：全黑背景，背景图完全透明 */
[data-theme="dark"] body {
    background: #0A0A0A;
}

.container { max-width: 900px; margin: 0 auto; padding: 0 24px; }

/* ========== 导航 ========== */
.navbar {
    position: sticky; top: 0; z-index: 50;
    background: var(--navbar-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: none;
}
.nav-inner {
    max-width: 900px; margin: 0 auto; padding: 0 24px;
    height: 48px; display: flex; align-items: center; justify-content: space-between;
}
.logo {
    font-size: 13px; font-weight: 600; color: var(--text);
    text-decoration: none; letter-spacing: 0.5px;
    display: flex; align-items: center; gap: 8px;
}
.logo-icon { width: 18px; height: 18px; object-fit: contain; }
.nav-links { display: flex; align-items: center; gap: 4px; margin-right: auto; margin-left: 16px; }
.nav-link {
    font-size: 12px; color: var(--text-dim); text-decoration: none;
    padding: 5px 10px; border-radius: 7px;
    transition: all 0.15s;
    letter-spacing: 0.3px;
}
.nav-link:hover { color: var(--text); background: var(--bg-soft); }
.nav-link.is-active { color: var(--text); background: var(--bg-soft); font-weight: 500; }

/* ========== 主区域 ========== */
.login-wrap {
    display: flex; align-items: safe center; justify-content: center;
    flex: 1;
    padding: 40px 24px;
    box-sizing: border-box;
}

.card { background: transparent; border: none; border-radius: 0; box-shadow: none; }

/* ========== 登录卡片 ========== */
.login-panel {
    padding: 0;
    width: 100%;
    max-width: 320px;
    text-align: center;
    box-sizing: border-box;
}
.qq-penguin {
    width: 56px; height: 56px; margin: 0 auto 20px;
    opacity: 0.95;
    transform: translateY(-12px);
    animation: breathe 3.6s ease-in-out infinite;
}
.qq-penguin img { width: 100%; height: 100%; object-fit: contain; }
@keyframes breathe {
    0%, 100% { transform: translateY(-12px) scale(1); opacity: 0.95; }
    50%      { transform: translateY(-12px) scale(1.08); opacity: 1; }
}
.qq-btn-icon { width: 18px; height: 18px; object-fit: contain; vertical-align: middle; }
.login-panel h1 {
    font-size: 22px; font-weight: 600; margin-bottom: 8px;
    letter-spacing: 0.5px; color: var(--text);
}
.login-panel p {
    font-size: 12px; color: var(--text-faint); margin-bottom: 40px;
    letter-spacing: 0.3px;
}

/* QQ 登录按钮：固定宽度，不随屏幕自适应 */
.btn-qq {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 7px; width: 220px; padding: 12px;
    background: var(--text); color: var(--bg);
    border: none; border-radius: 10px;
    font-size: 14px; font-weight: 500;
    cursor: pointer; text-decoration: none;
    font-family: inherit; transition: opacity 0.15s, transform 0.1s;
}
.btn-qq:hover { opacity: 0.85; }
.btn-qq:active { transform: scale(0.98); }

/* ========== 登录后：用户完整卡片 ========== */
.user-card {
    background: transparent;
    border: none;
    border-radius: 0;
    width: 100%;
    max-width: 360px;
    box-shadow: none;
    box-sizing: border-box;
}

/* 卡片头：头像居中 */
.card-head {
    display: flex; flex-direction: column; align-items: center;
    padding: 0 0 22px;
}
.card-avatar {
    width: 52px; height: 52px; border-radius: 50%;
    border: 1px solid var(--border);
    object-fit: cover;
    margin-bottom: 10px;
}
.card-name {
    font-size: 15px; font-weight: 600; color: var(--text);
    letter-spacing: 0.3px;
    text-align: center;
}
.card-welcome {
    margin-top: 6px;
    height: 16px;
    font-size: 11px; color: var(--text-faint);
    letter-spacing: 0.3px;
    text-align: center;
    opacity: 1;
    transition: opacity 0.5s ease;
}
.card-welcome.fade {
    opacity: 0;
}

/* 卡片体（API Key） */
.card-body {
    padding: 18px 20px;
}

/* API Key 标题行 */
.key-title {
    margin-bottom: 10px;
    padding-left: 2px;
}
.key-title > span {
    font-size: 10px; font-weight: 500; color: var(--text-faint);
    letter-spacing: 1.2px;
    text-transform: uppercase;
}

/* 单行 key：标签 + 值 + 按钮 */
.key-row {
    display: flex; align-items: center;
    background: var(--surface-2);
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 0 4px 0 12px;
    margin-bottom: 8px;
    height: 38px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.key-row:last-child { margin-bottom: 0; }
.key-row-label {
    flex-shrink: 0;
    font-size: 11px; color: var(--text-faint);
    margin-right: 10px;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.key-row-val {
    flex: 1; min-width: 0;
    font-family: ui-monospace, "SF Mono", "Menlo", monospace;
    font-size: 11.5px; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    user-select: all;
}
.key-row-actions {
    display: flex; gap: 4px;
    flex-shrink: 0;
    padding-left: 6px;
}

/* 小按钮（复制/显示/重置） */
.btn-mini {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 3px 8px;
    font-size: 11px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    line-height: 1.4;
}
.btn-mini:hover {
    color: var(--text);
    border-color: var(--text-faint);
    background: var(--surface-3);
}
.btn-copy.copied {
    color: var(--text-dim);
    border-color: var(--border);
}
.btn-mini-danger {
    color: var(--text-faint);
    border-color: transparent;
}
.btn-mini-danger:hover {
    color: var(--text);
    border-color: var(--border);
    background: var(--surface-2);
}

/* 卡片底部（退出登录） */
.card-foot {
    padding: 0 20px 20px;
}
.btn-logout {
    display: inline-flex; align-items: center; justify-content: center;
    width: 100%; padding: 10px;
    background: transparent; color: var(--text-faint);
    border: 1px solid var(--border-soft); border-radius: 8px;
    font-size: 12px; font-weight: 500;
    cursor: pointer; text-decoration: none;
    font-family: inherit; transition: all 0.15s;
}
.btn-logout:hover {
    color: var(--text);
    border-color: var(--border);
    background: var(--surface-2);
}

/* ========== Toast ========== */
.toast-wrap {
    position: fixed; top: 64px; left: 50%; transform: translateX(-50%);
    z-index: 100; pointer-events: none;
    display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
    padding: 10px 18px; border-radius: 10px;
    font-size: 13px; line-height: 1.5;
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    animation: toastIn 0.3s ease;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    background: var(--surface);
    color: var(--text-dim);
    border: 1px solid var(--border);
}
.toast-success {
    color: var(--green);
    border-color: rgba(16,185,129,0.3);
    background: rgba(16,185,129,0.08);
}
.toast-error {
    color: var(--red);
    border-color: rgba(239,68,68,0.3);
    background: rgba(239,68,68,0.08);
}
@keyframes toastIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ========== 模态弹窗 ========== */
.modal-mask {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.modal-mask.show { opacity: 1; pointer-events: auto; }
.modal-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    width: 320px; max-width: calc(100% - 48px);
    padding: 24px 22px 20px;
    text-align: center;
    transform: scale(0.92);
    transition: transform 0.2s;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
.modal-mask.show .modal-box { transform: scale(1); }
.modal-icon {
    width: 40px; height: 40px;
    border-radius: 50%;
    margin: 0 auto 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 700;
}
.modal-icon.danger {
    background: var(--surface-2);
    color: var(--text-dim);
    border: 1px solid var(--border);
}
.modal-icon.warn {
    background: var(--surface-2);
    color: var(--text-dim);
    border: 1px solid var(--border);
}
.modal-title {
    font-size: 15px; font-weight: 600; color: var(--text);
    margin-bottom: 6px;
}
.modal-desc {
    font-size: 12px; color: var(--text-dim);
    line-height: 1.6;
    margin-bottom: 20px;
}
.modal-actions { display: flex; gap: 10px; }
.modal-btn {
    flex: 1; padding: 9px;
    border-radius: 8px;
    font-size: 13px; font-weight: 500;
    cursor: pointer; font-family: inherit;
    border: 1px solid var(--border);
    transition: all 0.15s;
}
.modal-btn-cancel { background: transparent; color: var(--text-dim); }
.modal-btn-cancel:hover { color: var(--text); border-color: var(--text-faint); }
.modal-btn-confirm { background: var(--text); color: var(--bg); border-color: var(--text); }
.modal-btn-confirm:hover { opacity: 0.85; }
.modal-icon.danger ~ .modal-actions .modal-btn-confirm,
.modal-icon.danger + * + * + .modal-actions .modal-btn-confirm,
.modal-icon.danger + .modal-title + .modal-desc + .modal-actions .modal-btn-confirm {
    background: var(--text); color: var(--bg); border-color: var(--text);
}
.modal-icon.danger + .modal-title + .modal-desc + .modal-actions .modal-btn-confirm:hover {
    opacity: 0.85;
}

/* ========== 页脚 ========== */
.footer {
    padding: 12px 0; text-align: center;
    color: var(--text-faint); font-size: 11px;
    border-top: none;
    flex-shrink: 0;
    line-height: 1.7;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
[data-theme="light"] .footer {
    background: rgba(255,255,255,0.55);
}
[data-theme="dark"] .footer {
    background: rgba(10,10,10,0.5);
}
.footer a { color: var(--text-faint); }
.footer a:hover { color: var(--text-dim); }

/* 备案号行：盾牌图标 + 文字垂直对齐 */
.footer-beian {
    margin-top: 6px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    line-height: 1;
}
.beian-icon {
    flex-shrink: 0;
    color: var(--text-faint);
    transition: color 0.15s;
}
.footer-beian:hover .beian-icon { color: var(--text-dim); }
.footer-beian a {
    color: var(--text-faint);
    text-decoration: none;
    transition: color 0.15s;
}
.footer-beian a:hover { color: var(--text-dim); }

/* ========== 主题切换按钮 ========== */
.theme-toggle {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    width: 30px; height: 30px;
    border-radius: 8px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
    padding: 0;
}
.theme-toggle:hover {
    color: var(--text);
    border-color: var(--text-faint);
    background: var(--surface-2);
}
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* ========== 加载页 ========== */
.loading-page {
    position: fixed; inset: 0;
    background: var(--bg);
    z-index: 9999;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 16px;
    opacity: 1;
    animation: lpFadeIn 0.18s ease;
}
.loading-page.fade-out { animation: lpFadeOut 0.32s ease forwards; }
@keyframes lpFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes lpFadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}
.loading-spinner {
    width: 32px; height: 32px;
    border: 2.5px solid var(--border);
    border-top-color: var(--text-faint);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.loading-text {
    font-size: 12.5px; color: var(--text-dim);
    letter-spacing: 1px;
}
.loading-text-dots::after {
    content: '';
    animation: dots 1.4s steps(4, end) infinite;
}
@keyframes dots {
    0%   { content: ''; }
    25%  { content: '.'; }
    50%  { content: '..'; }
    75%  { content: '...'; }
    100% { content: ''; }
}

/* ========== 首页内容淡入（承接加载页过渡） ========== */
.login-wrap {
    animation: contentIn 0.35s ease;
}
@keyframes contentIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ========== 旧 class 兼容（防止其他页面报错） ========== */
.user-top, .user-avatar, .user-panel h2, .user-oid,
.api-section, .api-section-head, .api-section-title, .api-section-sub,
.key-item, .key-head, .key-name, .key-actions, .key-val,
.api-footer, .btn-reset, .btn-link, .btn-link-danger, .welcome-tip,
.user-panel, .btn-out, .alert {
    /* 已用新结构替代，保留占位避免误报 */
}

@media (max-width: 640px) {
    .login-panel, .user-card { max-width: 100%; }
}
