/* ============================================================
   新版 · 用户中心统一样式表 (user.css)
   浅蓝体系：主色 #0ea5e9 (sky-500) / 辅助 #7dd3fc / 中性 slate
   替代原 Tailwind CDN，纯本地 CSS，加载更快，移动端自适应。
   ============================================================ */

:root {
    --primary: #0ea5e9;            /* 浅蓝 sky-500 */
    --primary-dark: #0284c7;       /* sky-600 */
    --primary-light: #e0f2fe;      /* sky-100 */
    --accent: #7dd3fc;             /* sky-300 */
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --text-dark: #0f172a;
    --text-normal: #334155;
    --text-light: #64748b;
    --text-faint: #94a3b8;
    --border: #e2e8f0;
    --bg: #f1f5f9;
    --card: #ffffff;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow-md: 0 4px 14px rgba(15, 23, 42, .08);
    --shadow-lg: 0 16px 40px rgba(15, 23, 42, .12);
    --radius: 16px;
    --radius-sm: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { width: 100%; overflow-x: hidden; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text-normal);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    font-size: 14px;
}

a { color: var(--primary); text-decoration: none; }

/* ---------- 布局 ---------- */
.dashboard-container { display: flex; min-height: 100vh; width: 100%; }
.main-content-wrapper { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow-x: hidden; }
.content-area { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 1.25rem; -webkit-overflow-scrolling: touch; }

/* ---------- 顶部导航 ---------- */
.topbar {
    height: 60px;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1.1rem; position: sticky; top: 0; z-index: 40;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-title { font-size: 1rem; font-weight: 700; color: var(--text-dark); }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.icon-btn {
    width: 38px; height: 38px; border: none; background: transparent;
    border-radius: 10px; color: var(--primary); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .2s;
}
.icon-btn:hover { background: var(--primary-light); }
.icon-btn svg { width: 19px; height: 19px; }

.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--primary);
    color: #fff; font-weight: 700; font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    object-fit: cover; flex-shrink: 0;
}
/* QQ头像图片（img 元素）统一显示大小 */
img.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    object-fit: cover; display: block; flex-shrink: 0;
    border: 1px solid var(--border);
}

/* ---------- 侧边栏（桌面） ---------- */
.sidebar {
    width: 240px; background: var(--card);
    border-right: 1px solid var(--border);
    display: none; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
}
@media (min-width: 769px) { .sidebar { display: flex; } }
.sidebar-brand {
    padding: 1.3rem 1.4rem 1rem; font-size: 1.05rem; font-weight: 700;
    color: var(--text-dark); display: flex; align-items: center; gap: 10px;
}
.sidebar-brand svg { width: 20px; height: 20px; color: var(--primary); }
.sidebar-user {
    margin: .6rem 1rem 1rem; padding: .9rem 1rem;
    background: #f8fafc; border-radius: var(--radius-sm);
    display: flex; align-items: center; gap: 10px;
}
.sidebar-user .meta { min-width: 0; }
.sidebar-user .name { font-size: .88rem; font-weight: 600; color: var(--text-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .email { font-size: .75rem; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-nav { flex: 1; padding: .4rem .8rem; overflow-y: auto; }
.sidebar-nav .nav-group { margin-bottom: .4rem; }
.sidebar-nav .nav-title { font-size: .68rem; font-weight: 600; color: var(--text-faint); text-transform: uppercase; letter-spacing: .08em; padding: .8rem .7rem .35rem; }
.nav-link-item {
    display: flex; align-items: center; gap: 11px;
    padding: .62rem .75rem; border-radius: 10px;
    color: var(--text-normal); font-size: .9rem; font-weight: 500;
    transition: all .18s;
}
.nav-link-item:hover { background: var(--primary-light); color: var(--primary); }
.nav-link-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-link-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-foot { padding: .9rem 1rem; border-top: 1px solid var(--border); }

/* ---------- 移动端侧边栏 ---------- */
.mobile-sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; width: 260px; z-index: 60;
    background: var(--card); transform: translateX(-100%);
    transition: transform .3s ease; display: flex; flex-direction: column;
    box-shadow: 0 0 40px rgba(15, 23, 42, .18);
}
.mobile-sidebar.open { transform: translateX(0); }
.mobile-sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.1rem; border-bottom: 1px solid var(--border); }
.sidebar-overlay {
    position: fixed; inset: 0; background: rgba(15, 23, 42, .5);
    z-index: 55; opacity: 0; visibility: hidden; transition: all .25s;
}
.sidebar-overlay.active { opacity: 1; visibility: visible; }
@media (min-width: 769px) { .mobile-sidebar, .sidebar-overlay, .mobile-menu-btn { display: none !important; } }

/* ---------- 卡片 ---------- */
.card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
    padding: 1.4rem; margin-bottom: 1.1rem;
}
.card-title { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; font-weight: 700; color: var(--text-dark); margin-bottom: 1.1rem; }
.card-title .t-icon {
    width: 34px; height: 34px; border-radius: 9px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--primary); color: #fff;
}
.card-title .t-icon svg { width: 17px; height: 17px; }
.card-title .t-icon.blue { background: var(--primary); }
.card-title .t-icon.yellow { background: #d97706; }
.card-title .t-icon.green { background: var(--success); }
/* ---------- 统计卡片 ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.2rem; }
.stat-card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); padding: 1.1rem;
    display: flex; align-items: center; gap: 12px; transition: all .25s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-icon {
    width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-icon.orange { background: #ffedd5; color: #ea580c; }
.stat-icon.green { background: #d1fae5; color: #059669; }
.stat-icon.blue { background: #e0f2fe; color: #0284c7; }
.stat-icon.cyan { background: #cffafe; color: #0891b2; }
.stat-icon.sky { background: #e0f2fe; color: #0284c7; }
.stat-label { font-size: .78rem; color: var(--text-light); margin-bottom: 2px; }
.stat-value { font-size: 1.35rem; font-weight: 800; color: var(--text-dark); line-height: 1.15; font-variant-numeric: tabular-nums; }

/* ---------- 表单 ---------- */
.form-group { margin-bottom: 1.05rem; }
.form-label { display: block; font-size: .88rem; font-weight: 600; color: var(--text-normal); margin-bottom: .45rem; }
.form-label-row { display: flex; justify-content: space-between; align-items: baseline; }
.form-input {
    width: 100%; padding: .68rem .85rem;
    background: #f8fafc; border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: .95rem;
    color: var(--text-dark); font-family: inherit;
    transition: all .2s;
}
.form-input:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px var(--primary-light); }
.form-input::placeholder { color: var(--text-faint); }
.form-hint { font-size: .78rem; color: var(--text-faint); margin-top: .35rem; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: .68rem 1.4rem; border-radius: var(--radius-sm);
    font-size: .92rem; font-weight: 600; font-family: inherit;
    border: none; cursor: pointer; transition: all .2s;
    background: #f1f5f9; color: var(--text-normal);
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 3px 10px rgba(14, 165, 233, .25); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger-outline { background: transparent; color: var(--danger); border: 1px solid #fecaca; }
.btn-danger-outline:hover { background: #fef2f2; }
.btn-block { width: 100%; }

/* ---------- 表格 ---------- */
.table-container { overflow-x: auto; width: 100%; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .8rem .9rem; text-align: left; border-bottom: 1px solid var(--border); }
th { font-size: .75rem; font-weight: 600; color: var(--text-light); text-transform: uppercase; letter-spacing: .04em; background: #f8fafc; white-space: nowrap; }
td { font-size: .88rem; color: var(--text-normal); }
tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }
td code, .key-text {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .82rem; background: #f1f5f9; border: 1px solid var(--border);
    border-radius: 6px; padding: .18rem .5rem; word-break: break-all;
}

/* ---------- 徽章 ---------- */
.badge {
    display: inline-block; padding: .22rem .7rem; border-radius: 100px;
    font-size: .74rem; font-weight: 600; white-space: nowrap;
}
.badge-green { background: #d1fae5; color: #065f46; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-blue { background: #bae6fd; color: #075985; }
.badge-yellow { background: #fef3c7; color: #92400e; }

/* ---------- 提示条 ---------- */
.alert {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: .85rem 1rem; border-radius: var(--radius-sm);
    margin-bottom: 1rem; font-size: .9rem;
    animation: fadeIn .4s ease;
}
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #e0f2fe; color: #075985; border: 1px solid #bae6fd; }
.alert .close-btn { background: none; border: none; font-size: 1.15rem; cursor: pointer; color: inherit; opacity: .6; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- 页面标题 ---------- */
.page-heading { text-align: center; margin-bottom: 1.4rem; }
.page-heading h1 { font-size: 1.45rem; font-weight: 800; color: var(--text-dark); margin-bottom: .3rem; }
.page-heading p { font-size: .9rem; color: var(--text-light); }

/* ---------- 公告 ---------- */
.notice-box { background: #e0f2fe; border: 1px solid #bae6fd; border-radius: var(--radius-sm); padding: 1rem 1.15rem; margin-bottom: 1.2rem; }
.notice-box .notice-title { display: flex; align-items: center; gap: 8px; font-weight: 700; color: #075985; font-size: .92rem; margin-bottom: .4rem; }
.notice-box .notice-title svg { width: 16px; height: 16px; }
.notice-box .notice-content { color: #075985; font-size: .86rem; white-space: pre-wrap; }

/* ---------- 输入组（卡密兑换） ---------- */
.input-group { display: flex; gap: .6rem; }
@media (max-width: 480px) { .input-group { flex-direction: column; } .input-group .btn { width: 100%; } }

/* ---------- 面包屑 ---------- */
.crumb {
    display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
    font-size: 12.5px; color: var(--text-faint); margin-bottom: 1.1rem;
}
.crumb a { color: var(--text-light); text-decoration: none; transition: color .15s; }
.crumb a:hover { color: var(--primary); }
.crumb .crumb-sep { color: #cbd5e1; }
.crumb .crumb-cur { color: var(--text-normal); font-weight: 600; }

/* ---------- 工具类 ---------- */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.mt-2 { margin-top: .5rem; } .mt-3 { margin-top: .75rem; } .mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: .5rem; } .mb-3 { margin-bottom: .75rem; } .mb-4 { margin-bottom: 1rem; }
.text-sm { font-size: .85rem; }
.text-xs { font-size: .78rem; }
.text-lg { font-size: 1.1rem; }
.font-bold { font-weight: 700; }
.text-muted { color: var(--text-light); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-center { text-align: center; }
.max-w { max-width: 860px; margin-left: auto; margin-right: auto; }
.max-w-sm { max-width: 640px; margin-left: auto; margin-right: auto; }
.hidden { display: none; }
.break-all { word-break: break-all; }

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .content-area { padding: 1rem; }
    .card { padding: 1.1rem; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: .55rem; }
    .stat-card { padding: .9rem; }
    .stat-value { font-size: 1.15rem; }
    .stat-icon { width: 36px; height: 36px; }
    .page-heading h1 { font-size: 1.25rem; }
}
