/* ============================================================
   花朵玻璃导航 · 后台管理样式
   ============================================================ */
:root {
    --accent: #ff8a5c;
    --accent2: #7b6cff;
    --text: #2a2438;
    --text-dim: #7a748a;
    --line: rgba(42,36,56,.10);
    --panel: rgba(255,255,255,.62);
    --panel-solid: #fff;
    --shadow: 0 8px 30px rgba(80,60,120,.10);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    --ease: cubic-bezier(.22,1,.36,1);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); color: var(--text); background: #ece8f5; -webkit-font-smoothing: antialiased; }

/* 登录页背景由内联样式提供 */

/* ---------- 后台布局 ---------- */
.admin-body { display: flex; min-height: 100vh; }
.admin-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 234px; z-index: 60;
    display: flex; flex-direction: column;
    padding: 22px 14px;
    background: linear-gradient(180deg, rgba(18,16,30,.86), rgba(24,20,42,.92)), var(--admin-bg) center/cover no-repeat;
    border-right: 1px solid rgba(255,255,255,.14);
    color: #fff;
    transition: transform .35s var(--ease);
}
.sb-overlay { display: none; position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,.5); }
.sb-overlay.open { display: block; }
.sb-brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 22px; }
.sb-logo { font-size: 28px; color: var(--accent); }
.sb-title { font-size: 15px; font-weight: 800; color: #fff; }
.sb-sub { font-size: 11px; color: rgba(255,255,255,.6); margin-top: 2px; }
.sb-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.sb-nav a, .sb-foot a {
    display: flex; align-items: center; gap: 11px;
    padding: 11px 14px; border-radius: 12px;
    color: #e8e6f0; text-decoration: none; font-size: 13px; font-weight: 600;
    transition: background .2s, color .2s, transform .2s var(--ease);
}
.ni { font-size: 16px; width: 20px; text-align: center; }
.sb-nav a:hover, .sb-foot a:hover { background: rgba(255,255,255,.13); color: #fff; }
.sb-nav a.active { background: var(--accent); color: #fff; box-shadow: 0 6px 18px rgba(255,138,92,.35); }
.sb-foot { border-top: 1px solid rgba(255,255,255,.14); padding-top: 12px; display: flex; flex-direction: column; gap: 2px; }

.admin-main { flex: 1; margin-left: 234px; min-width: 0; position: relative; }
.admin-topbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; justify-content: space-between;
    height: 62px; padding: 0 26px;
    background: rgba(255,255,255,.55);
    -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(255,255,255,.5);
}
.sb-toggle { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text); display: none; }
.at-right { display: flex; align-items: center; gap: 18px; }
.at-user { font-size: 13px; font-weight: 600; }
.at-link { font-size: 12px; color: var(--accent); text-decoration: none; }

.password-warning {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    margin: 18px 26px 0; padding: 12px 18px;
    border-radius: 12px; font-size: 13px;
    background: rgba(255,180,80,.16); border: 1px solid rgba(255,180,80,.4); color: #8a5a00;
}
.password-warning button {
    padding: 6px 16px; border: none; border-radius: 8px; cursor: pointer;
    background: var(--accent); color: #fff; font-size: 12px;
}

.admin-content { padding: 26px; max-width: 1400px; }

/* ---------- 面板 ---------- */
.glass-panel {
    background: var(--panel);
    border: 1px solid rgba(255,255,255,.7);
    -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4);
    box-shadow: var(--shadow);
    border-radius: 18px;
}
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.page-title { font-size: 22px; font-weight: 800; }
.page-desc { font-size: 12px; color: var(--text-dim); margin-top: 5px; }
.panel { padding: 22px; }
.panel + .panel { margin-top: 18px; }
.panel-title { font-size: 15px; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 6px; justify-content: center;
    padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line);
    background: rgba(255,255,255,.7); color: var(--text);
    font-size: 13px; font-family: var(--font); cursor: pointer;
    transition: transform .2s var(--ease), background .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-1px); background: #fff; box-shadow: 0 4px 14px rgba(0,0,0,.06); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: #fff; border-color: transparent; box-shadow: 0 4px 14px rgba(255,138,92,.3); }
.btn-primary:hover { background: #ff7a48; }
.btn-danger { color: #d33; border-color: rgba(221,51,51,.25); }
.btn-sm { padding: 5px 10px; font-size: 11px; border-radius: 8px; }
.btn-group { display: flex; gap: 6px; }

/* ---------- 表单 ---------- */
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-row label { font-size: 12px; font-weight: 600; color: var(--text-dim); }
.form-row .hint { font-size: 11px; color: var(--text-faint, #a09aa8); }
input[type=text], input[type=password], input[type=number], input[type=url], select, textarea {
    width: 100%; padding: 10px 13px; border-radius: 10px;
    border: 1px solid var(--line); background: rgba(255,255,255,.8);
    color: var(--text); font-size: 13px; font-family: var(--font); outline: none;
    transition: border .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,138,92,.15); }
textarea { resize: vertical; min-height: 80px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 18px; }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input[type=range] { flex: 1; accent-color: var(--accent); }
.range-val { min-width: 46px; text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; }
.color-row { display: flex; gap: 8px; flex-wrap: wrap; }
.color-dot { width: 30px; height: 30px; border-radius: 50%; cursor: pointer; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.15); transition: transform .2s; }
.color-dot:hover { transform: scale(1.15); }
.color-dot.active { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type=color] { width: 40px; height: 34px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }
.switch { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch slider, .switch .track {
    position: absolute; inset: 0; border-radius: 999px; background: #ccc; cursor: pointer; transition: background .2s;
}
.switch input:checked + .track { background: var(--accent); }
.switch .track::before { content:''; position:absolute; width:18px; height:18px; left:3px; top:3px; border-radius:50%; background:#fff; transition:transform .2s; box-shadow:0 1px 4px rgba(0,0,0,.2); }
.switch input:checked + .track::before { transform: translateX(20px); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border-radius: 14px; border: 1px solid var(--line); }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; background: rgba(255,255,255,.5); }
.data-table th, .data-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table th { font-size: 11px; font-weight: 700; color: var(--text-dim); background: rgba(255,255,255,.6); position: sticky; top: 0; }
.data-table tbody tr { transition: background .15s; }
.data-table tbody tr:hover { background: rgba(255,255,255,.75); }
.data-table tbody tr.dragging { opacity: .4; }
.data-table tbody tr.drag-over { box-shadow: inset 0 2px 0 var(--accent); }
.drag-handle { cursor: grab; color: var(--text-dim); user-select: none; font-size: 16px; }
.t-icon { width: 26px; height: 26px; border-radius: 7px; object-fit: contain; vertical-align: middle; margin-right: 8px; background: rgba(0,0,0,.04); }
.t-emoji { font-size: 18px; margin-right: 8px; }
.t-desc { max-width: 240px; overflow: hidden; text-overflow: ellipsis; color: var(--text-dim); }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; background: rgba(123,108,255,.12); color: var(--accent2); }
.empty { text-align: center; padding: 50px 20px; color: var(--text-dim); font-size: 13px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar input[type=text] { max-width: 260px; }
.toolbar select { max-width: 180px; }

/* ---------- 数据看板 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-card { padding: 20px; border-radius: 16px; background: var(--panel); border: 1px solid rgba(255,255,255,.7); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.stat-card .label { font-size: 12px; color: var(--text-dim); }
.stat-card .value { font-size: 30px; font-weight: 800; margin-top: 8px; font-variant-numeric: tabular-nums; }
.stat-card .value.accent { color: var(--accent); }
.chart-box { height: 240px; position: relative; margin-top: 10px; }
.chart-bars { display: flex; align-items: flex-end; gap: 8px; height: 200px; padding: 0 6px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart-bar { width: 100%; max-width: 46px; border-radius: 8px 8px 0 0; background: linear-gradient(180deg, var(--accent), #ffb08a); min-height: 3px; transition: height .6s var(--ease); position: relative; }
.chart-bar:hover::after { content: attr(data-val); position: absolute; top: -22px; left: 50%; transform: translateX(-50%); font-size: 11px; background: #333; color: #fff; padding: 2px 7px; border-radius: 5px; white-space: nowrap; }
.chart-label { font-size: 10px; color: var(--text-dim); }
.rank-list { display: flex; flex-direction: column; gap: 10px; }
.rank-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,.45); }
.rank-num { width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; border-radius: 7px; background: rgba(123,108,255,.12); color: var(--accent2); font-size: 11px; font-weight: 700; flex-shrink: 0; }
.rank-item:nth-child(1) .rank-num { background: var(--accent); color: #fff; }
.rank-name { flex: 1; font-size: 13px; }
.rank-count { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* ---------- 壁纸网格 ---------- */
.wallpaper-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.wp-item { border-radius: 14px; overflow: hidden; border: 2px solid transparent; background: rgba(255,255,255,.5); box-shadow: var(--shadow); cursor: pointer; transition: transform .25s var(--ease), border-color .2s; position: relative; }
.wp-item:hover { transform: translateY(-3px); }
.wp-item.active { border-color: var(--accent); }
.wp-thumb { width: 100%; height: 130px; object-fit: cover; display: block; }
.wp-info { padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wp-name { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wp-badge { font-size: 10px; padding: 2px 7px; border-radius: 999px; background: rgba(123,108,255,.12); color: var(--accent2); flex-shrink: 0; }
.wp-active-tag { position: absolute; top: 8px; right: 8px; background: var(--accent); color: #fff; font-size: 10px; padding: 3px 9px; border-radius: 999px; }
.wp-actions { display: flex; gap: 4px; }

/* 实时预览 */
.preview-box { border-radius: 14px; overflow: hidden; border: 1px solid var(--line); position: relative; height: 260px; margin-top: 10px; background-size: cover; background-position: center; }
.preview-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: #fff; }
.preview-overlay .pt { font-size: 22px; font-weight: 800; text-shadow: 0 2px 10px rgba(0,0,0,.5); }
.preview-overlay .pb { padding: 8px 20px; border-radius: 999px; background: rgba(255,255,255,.2); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,.3); font-size: 12px; }

/* ---------- Toast / Modal ---------- */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px); padding: 11px 22px; border-radius: 12px; background: rgba(30,30,40,.92); color: #fff; font-size: 13px; z-index: 100; opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s var(--ease); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.modal-overlay { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(20,16,30,.45); backdrop-filter: blur(4px); opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s; }
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal { width: min(560px, 100%); max-height: 88vh; display: flex; flex-direction: column; background: #fff; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 16px; }
.modal-head button { background: none; border: none; font-size: 24px; color: var(--text-dim); cursor: pointer; line-height: 1; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .wallpaper-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
    .admin-sidebar { transform: translateX(-100%); }
    .admin-sidebar.open { transform: translateX(0); }
    .sb-toggle { display: block; }
    .admin-main { margin-left: 0; }
    .admin-content { padding: 16px; }
    .admin-topbar { padding: 0 16px; }
    .form-grid { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 14px; }
    .stat-card .value { font-size: 24px; }
    .wallpaper-grid { grid-template-columns: 1fr; }
    .password-warning { margin: 12px 16px 0; }
}
