/* ====================================================================
   管理后台样式 - 暗紫色主题
   ==================================================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --bg: #0f0a1e;
    --bg-2: #1a1233;
    --panel: rgba(40, 28, 70, .85);
    --line: rgba(255,255,255,.08);
    --primary: #6c8cff;
    --primary-2: #8b5cff;
    --danger: #ff5c7a;
    --success: #4ade80;
    --text: #e8e6f5;
    --text-dim: #a89fc8;
}
html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
                 "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* 整体布局 */
.admin-shell { display: flex; min-height: 100vh; }

/* 侧边栏 */
.admin-side {
    width: 220px;
    flex: 0 0 220px;
    background: linear-gradient(180deg, #221748 0%, #160d2e 100%);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    padding: 18px 0;
    position: sticky;
    top: 0;
    height: 100vh;
}
.admin-logo {
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    padding: 8px 0 20px;
    color: #fff;
    background: linear-gradient(90deg, var(--primary), var(--primary-2));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.admin-nav { flex: 1; display: flex; flex-direction: column; }
.admin-nav a {
    padding: 12px 22px;
    color: var(--text-dim);
    font-size: 15px;
    border-left: 3px solid transparent;
    transition: all .18s ease;
}
.admin-nav a:hover { background: rgba(255,255,255,.04); color: #fff; }
.admin-nav a.active {
    color: #fff;
    background: rgba(108,140,255,.14);
    border-left-color: var(--primary);
}
.admin-side-foot {
    border-top: 1px solid var(--line);
    padding-top: 10px;
    display: flex; flex-direction: column;
}
.admin-side-foot a {
    padding: 10px 22px;
    color: var(--text-dim);
    font-size: 14px;
}
.admin-side-foot a:hover { color: #fff; }

/* 主区域 */
.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-top {
    height: 56px;
    display: flex; align-items: center; gap: 14px;
    padding: 0 20px;
    background: var(--bg-2);
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 10;
}
.admin-toggle {
    display: none;
    background: none; border: none; color: #fff;
    font-size: 22px; cursor: pointer;
}
.admin-top-title { font-weight: 600; }
.admin-top-user { margin-left: auto; color: var(--text-dim); }

.admin-content { padding: 22px; }

/* 卡片 */
.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 20px;
}
.card-title {
    font-size: 16px; font-weight: 600;
    margin-bottom: 14px;
    display: flex; align-items: center; gap: 8px;
}
.card-title .hint { font-size: 12px; color: var(--text-dim); font-weight: 400; }

/* 统计 */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
}
.stat-item {
    background: linear-gradient(135deg, rgba(108,140,255,.15), rgba(139,92,255,.12));
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 18px;
}
.stat-num { font-size: 30px; font-weight: 700; color: #fff; }
.stat-label { color: var(--text-dim); font-size: 14px; margin-top: 4px; }

/* 表格 */
.data-table { width: 100%; border-collapse: collapse; min-width: 600px; }
.data-table th, .data-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}
.data-table th { color: var(--text-dim); font-weight: 600; }
.data-table tr:hover td { background: rgba(255,255,255,.03); }
.table-wrap { overflow-x: auto; }

/* 表单 */
.form-row { margin-bottom: 14px; }
.form-row label {
    display: block; font-size: 14px; color: var(--text-dim); margin-bottom: 6px;
}
.form-row input, .form-row select, .form-row textarea {
    width: 100%;
    background: rgba(255,255,255,.06);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    color: #fff;
    font-size: 14px;
    outline: none;
    transition: border-color .18s ease;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
    border-color: var(--primary);
}
.form-row textarea { resize: vertical; min-height: 70px; }
.form-help { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

/* 按钮 */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: all .18s ease;
    color: #fff;
}
.btn-primary { background: linear-gradient(90deg, var(--primary), var(--primary-2)); }
.btn-primary:hover { opacity: .9; transform: translateY(-1px); }
.btn-ghost { background: rgba(255,255,255,.08); }
.btn-ghost:hover { background: rgba(255,255,255,.14); }
.btn-danger { background: var(--danger); }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }

/* 拖拽提示 */
.drag-handle {
    cursor: grab; touch-action: none; user-select: none;
    color: var(--text-dim); font-size: 18px;
}
.drag-handle:active { cursor: grabbing; }
.sorting .nav-dragging { opacity: .4; }

/* 模板选择 */
.tpl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}
.tpl-card {
    border: 2px solid var(--line);
    border-radius: 14px;
    padding: 14px;
    cursor: pointer;
    transition: all .18s ease;
    background: rgba(255,255,255,.03);
}
.tpl-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.tpl-card.active { border-color: var(--primary); background: rgba(108,140,255,.14); }
.tpl-card .tpl-thumb {
    height: 80px;
    border-radius: 8px;
    margin-bottom: 10px;
    position: relative; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,.9); font-size: 14px; font-weight: 600;
    text-shadow: 0 1px 4px rgba(0,0,0,.45);
}
.tpl-card .tpl-thumb i {
    position: absolute; display: block; width: 26px; height: 7px;
    border-radius: 5px; background: rgba(255,255,255,.45);
    bottom: 13px;
}
.tpl-card .tpl-thumb i:nth-of-type(1) { left: 18%; }
.tpl-card .tpl-thumb i:nth-of-type(2) { left: 42%; }
.tpl-card .tpl-thumb i:nth-of-type(3) { left: 66%; }
.tpl-classic { background: linear-gradient(135deg, #3659b8, #16213e); }
.tpl-card { background: linear-gradient(135deg, #356b82, #193447); }
.tpl-list { background: linear-gradient(135deg, #53636c, #222b32); }
.tpl-board { background: linear-gradient(135deg, #92763d, #3f3020); }
.tpl-neon { background: linear-gradient(135deg, #122b57, #731f73); }
.tpl-polaroid { background: linear-gradient(135deg, #a66d54, #4f3546); }
.tpl-dock { background: linear-gradient(135deg, #536b81, #202d43); }
.tpl-terminal { background: linear-gradient(135deg, #1a603f, #071b17); }
.tpl-card.active .tpl-thumb { box-shadow: inset 0 0 0 2px rgba(255,255,255,.6); }
}
.tpl-card .tpl-name { font-weight: 600; }
.tpl-card .tpl-desc { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

/* 弹窗 */
.modal-mask {
    display: none;
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(0,0,0,.6);
    backdrop-filter: blur(4px);
}
.modal-mask.show { display: block; }
.modal-box {
    display: none;
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1001;
    width: min(520px, 92vw);
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 22px;
}
.modal-box.show { display: block; }
.modal-title { font-size: 18px; font-weight: 600; margin-bottom: 16px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* 提示 */
.toast {
    position: fixed; top: 24px; left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    padding: 12px 22px;
    border-radius: 10px;
    background: rgba(40,28,70,.95);
    border: 1px solid var(--line);
    color: #fff; font-size: 14px;
    opacity: 0; transition: opacity .25s ease, top .25s ease;
    pointer-events: none;
}
.toast.show { opacity: 1; top: 34px; }
.toast.error { border-color: var(--danger); }
.toast.ok { border-color: var(--success); }

/* 响应式 */
@media (max-width: 860px) {
    .admin-side {
        position: fixed; left: -240px; top: 0;
        transition: left .25s ease; z-index: 100;
        height: 100vh;
    }
    .admin-side.open { left: 0; }
    .admin-toggle { display: inline-block; }
}
