/* ===== 全局变量与重置 ===== */
:root {
    --bg-primary: #07080c;
    --bg-secondary: rgba(7, 8, 12, 0.988);
    --bg-card: rgba(255, 255, 255, 0.085);
    --bg-hover: rgba(255, 255, 255, 0.06);
    --border: rgba(255, 255, 255, 0.15);
    --text-primary: #ffffff;
    --text-secondary: #c3cde8;
    --text-muted: #8b96ae;
    --accent: #5b9dfb;
    --accent-hover: #8dc0ff;
    --accent-glow: rgba(91, 157, 251, 0.34);
    --success: #34d399;
    --warn: #fbbf24;
    --danger: #f87171;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.42);
    --glass-fill: rgba(255, 255, 255, 0.055);
    --glass-line: rgba(255, 255, 255, 0.17);
}

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

.hidden { display: none !important; }

.icon { width: 18px; height: 18px; flex: none; }
h1 .icon, h2 .icon { vertical-align: -3px; margin-right: 6px; }
.nav-logo .icon { width: 20px; height: 20px; vertical-align: -4px; margin-right: 6px; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background-color: var(--bg-primary);
    background-image:
        radial-gradient(1200px 600px at 15% -10%, rgba(91, 157, 251, 0.12), transparent 60%),
        radial-gradient(1000px 500px at 100% 20%, rgba(124, 107, 255, 0.10), transparent 60%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-hover); }

/* ===== 导航栏 ===== */
.navbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.nav-logo { font-size: 20px; font-weight: 700; color: #8fb6ff; }
.nav-right { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.nav-search { display: flex; align-items: center; gap: 8px; }
.nav-search input {
    width: 180px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
}
.nav-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.nav-links { display: flex; align-items: center; gap: 16px; }
.nav-links a { color: #d7e2f6; font-size: 14px; }
.nav-links a:hover { color: var(--accent-hover); }
.nav-user { color: var(--text-secondary); font-size: 14px; }
.nav-link-btn { background: none; border: none; color: #d7e2f6; cursor: pointer; font-size: 14px; padding: 0; }
.nav-link-btn:hover { color: var(--accent); }

/* ===== 主内容 ===== */
.main-content { flex: 1; max-width: 960px; width: 100%; margin: 0 auto; padding: 24px 20px; }
.container { width: 100%; }
.page-title { font-size: 28px; margin-bottom: 20px; }

.hero { text-align: center; padding: 30px 0 10px; }
.hero h1 { font-size: 32px; font-weight: 700; margin-bottom: 8px; }
.hero-subtitle { color: var(--text-secondary); font-size: 14px; }

.section-header { margin: 28px 0 16px; }
.section-header h2 { font-size: 20px; }
.section-header .count { color: var(--text-muted); font-size: 14px; }

/* ===== 卡片 ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

/* ===== 资源包网格 ===== */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.product-card { display: block; color: var(--text-primary); overflow: hidden; padding: 0; }
.product-cover { width: 100%; aspect-ratio: 16 / 9; background: var(--bg-hover); overflow: hidden; }
.product-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-cover-empty { display: flex; align-items: center; justify-content: center; font-size: 40px; }
.product-body { padding: 14px 16px; }
.product-body h3 { font-size: 16px; margin-bottom: 6px; }
.product-desc { color: var(--text-secondary); font-size: 13px; margin-bottom: 8px; }
.product-time { color: var(--text-muted); font-size: 12px; }

/* ===== 详情 ===== */
.detail-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.detail-head h1 { font-size: 24px; }
.detail-images { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.detail-images img { max-width: 220px; max-height: 160px; border-radius: var(--radius-sm); border: 1px solid var(--border); object-fit: cover; }
.detail-content { color: var(--text-secondary); white-space: normal; }
.admin-tools { display: flex; justify-content: flex-end; }

/* ===== 表单 ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 500; }
input[type="text"], input[type="password"], input[type="number"], textarea, select {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
textarea { resize: vertical; min-height: 60px; }
.input-suffix { position: relative; }
.input-suffix input { padding-right: 76px; }
.input-suffix .suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 14px; }
.pwd-suffix input { padding-right: 52px; }
.toggle-pwd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; padding: 4px; cursor: pointer; color: var(--text-muted); display: flex; align-items: center; line-height: 0; }
.toggle-pwd:hover { color: var(--text-primary); }
.toggle-pwd .icon { width: 18px; height: 18px; }
.hint-text { color: var(--text-muted); font-size: 12px; margin-top: 6px; }
.hint-block { margin-top: 12px; color: var(--text-secondary); font-size: 13px; }
.hint-block summary { cursor: pointer; color: var(--accent); }
.hint-block ol { margin: 8px 0 0 20px; }

/* ===== 按钮 ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 20px; border: none; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.2s; font-family: inherit;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: rgba(255, 255, 255, 0.10); color: #fff; }
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 16px var(--accent-glow); }
.btn-secondary { background: var(--bg-hover); color: var(--text-primary); }
.btn-secondary:hover { background: var(--border); }
.btn-warn { background: var(--warn); color: #000; }
.btn-success { background: var(--success); color: #000; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 14px; font-size: 13px; }

/* ===== 认证页 ===== */
.auth-container { max-width: 400px; margin: 40px auto; }
.auth-card h2 { margin-bottom: 20px; font-size: 24px; }
.auth-link { text-align: center; margin-top: 16px; font-size: 13px; color: var(--text-secondary); }
.auth-tip { color: var(--text-secondary); font-size: 14px; margin-bottom: 16px; }

/* ===== 滑块验证码 ===== */
.captcha-wrap { user-select: none; -webkit-user-select: none; margin: 10px 0; width: 100%; max-width: 300px; }
.captcha-bg { position: relative; width: 100%; max-width: 300px; aspect-ratio: 2 / 1; border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-primary); margin-bottom: 10px; }
.captcha-bg img.bg-img { width: 100%; height: 100%; display: block; object-fit: cover; }
.captcha-piece { position: absolute; top: 0; left: 0; pointer-events: none; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); z-index: 2; }
.slider-track { position: relative; width: 100%; max-width: 300px; height: 40px; background: var(--bg-primary); border: 1px solid var(--border); border-radius: 20px; overflow: hidden; touch-action: none; }
.slider-fill { position: absolute; top: 0; left: 0; height: 100%; background: linear-gradient(90deg, rgba(91,140,255,0.3), rgba(124,107,255,0.3)); width: 0; }
.slider-text { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--text-muted); pointer-events: none; }
.slider-btn { position: absolute; top: 0; left: 0; width: 40px; height: 40px; background: rgba(255, 255, 255, 0.10); border-radius: 50%; cursor: grab; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 14px; box-shadow: 0 2px 8px rgba(0,0,0,0.3); z-index: 2; }
.slider-btn:active { cursor: grabbing; }
.slider-track.success .slider-fill { background: rgba(52,211,153,0.3); }
.slider-track.success .slider-btn { background: var(--success); }
.slider-track.fail .slider-fill { background: rgba(248,113,113,0.3); }
.slider-track.fail .slider-btn { background: var(--danger); }
.slider-track.locked { cursor: not-allowed; }
.captcha-refresh { display: inline-block; margin-top: 6px; color: var(--text-muted); font-size: 12px; cursor: pointer; }
.captcha-status { margin-top: 6px; font-size: 12px; min-height: 16px; }
.captcha-status.ok { color: var(--success); }
.captcha-status.err { color: var(--danger); }
.captcha-loading { color: var(--text-muted); font-size: 13px; padding: 20px 0; text-align: center; }

/* ===== 弹窗 ===== */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.78); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-content { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; max-width: 400px; width: 90%; }
.modal-content h3 { margin-bottom: 8px; }
.modal-content p { color: var(--text-secondary); font-size: 13px; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

/* ===== 加载动画 ===== */
.loading-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15,17,23,0.85); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 2000; }
.loading-overlay p { color: var(--text-secondary); margin-top: 16px; font-size: 14px; }
.spinner { width: 48px; height: 48px; border: 4px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Toast ===== */
.toast { position: fixed; top: 80px; left: 50%; transform: translateX(-50%); padding: 12px 24px; border-radius: var(--radius-sm); font-size: 14px; z-index: 3000; box-shadow: 0 8px 32px rgba(0,0,0,0.4); animation: slideDown 0.3s ease; max-width: 90%; }
.toast.success { background: var(--success); color: #000; }
.toast.error { background: var(--danger); color: #fff; }
.toast.info { background: var(--accent); color: #fff; }
@keyframes slideDown { from { opacity: 0; transform: translate(-50%, -12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ===== 结果块 ===== */
.redeem-result { margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13px; }
.redeem-result.ok { background: rgba(52,211,153,0.12); border: 1px solid rgba(52,211,153,0.35); color: var(--success); }
.redeem-result.err { background: rgba(248,113,113,0.12); border: 1px solid rgba(248,113,113,0.35); color: var(--danger); }

/* ===== 后台表格 ===== */
.admin-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13px; }
.admin-table th, .admin-table td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; }
.admin-table th { color: var(--text-muted); font-weight: 500; }
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge-super { background: linear-gradient(135deg, var(--warn), #f59e0b); color: #000; }
.badge-admin { background: rgba(91,157,251,0.25); color: var(--accent-hover); }
.badge-user { background: var(--bg-hover); color: var(--text-muted); }
.search-form { display: flex; gap: 8px; margin: 10px 0; }
.search-form input { flex: 1; }

/* ===== 上传预览 ===== */
.file-preview { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.file-preview img { width: 90px; height: 70px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); }

/* ===== 空状态 / 提示 ===== */
.empty-state { text-align: center; padding: 40px 0; color: var(--text-muted); }
.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; }
.flash-success { background: rgba(52,211,153,0.12); color: var(--success); }
.flash-error { background: rgba(248,113,113,0.12); color: var(--danger); }

/* ===== 页脚 ===== */
.footer { padding: 24px 20px; text-align: center; color: #9db2d6; font-size: 13px; }
.footer a { color: #9db2d6; }
.footer a:hover { color: var(--accent-hover); }

/* ===== 响应式 ===== */
@media (max-width: 640px) {
    .nav-container { padding: 10px 16px; }
    .nav-search input { width: 130px; }
    .product-grid { grid-template-columns: 1fr; }
    .detail-head { flex-direction: column; }
    .admin-table { font-size: 12px; }
}
