/* ============================================================
   Max系统 管理后台 - 样式（对照原站视觉 1:1 复刻）
   ============================================================ */
:root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: #eff6ff;
    --sidebar-bg: #18181a;
    --sidebar-text: rgba(255, 255, 255, 0.72);
    --sidebar-active: #3b82f6;
    --bg: #f5f6f8;
    --card-bg: #ffffff;
    --text: #1f2937;
    --text-2: #6b7280;
    --text-3: #9ca3af;
    --border: #eceef1;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
    font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}
#app { height: 100vh; }
a { text-decoration: none; color: inherit; }

/* ---------------- 布局 ---------------- */
.admin-layout { display: flex; height: 100vh; overflow: hidden; }

/* ---------------- 侧边栏 ---------------- */
.admin-sidebar {
    width: 232px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}
.admin-sidebar::-webkit-scrollbar { width: 4px; }
.admin-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar-logo .logo-badge {
    width: 34px; height: 34px;
    border-radius: 9px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.45);
}
.sidebar-logo .logo-name {
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.sidebar-menu { padding: 10px 10px 24px; flex: 1; }
.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 2px;
    border-radius: 8px;
    color: var(--sidebar-text);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    user-select: none;
    position: relative;
}
.menu-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.menu-item.active {
    background: var(--sidebar-active);
    color: #fff;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}
.menu-item .menu-icon { width: 18px; height: 18px; flex-shrink: 0; display: inline-flex; }
.menu-item .menu-icon svg { width: 18px; height: 18px; }
.menu-item .menu-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-item .menu-arrow { font-size: 12px; opacity: 0.6; transition: transform 0.2s; }
.menu-item .menu-arrow.expanded { transform: rotate(90deg); }
.menu-sub { padding-left: 30px; }
.menu-sub .menu-item { font-size: 13px; padding: 8px 12px; }

/* ---------------- 主区域 ---------------- */
.admin-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }

.admin-topbar {
    height: 56px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
}
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.btn-refresh {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text-2);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-refresh:hover { color: var(--primary); border-color: var(--primary); }
.btn-refresh svg { width: 14px; height: 14px; }
.topbar-admin { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.topbar-admin .avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    font-weight: 600;
}
.topbar-admin .admin-name { font-size: 14px; color: var(--text); }

/* ---------------- 标签页 ---------------- */
.admin-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px 0;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    overflow-x: auto;
}
.admin-tabs::-webkit-scrollbar { display: none; }
.tab-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    background: #f8fafc;
    color: var(--text-2);
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}
.tab-item svg { width: 14px; height: 14px; }
.tab-item:hover { color: var(--primary); }
.tab-item.active {
    background: #fff;
    color: var(--primary);
    border-color: var(--border);
    position: relative;
    font-weight: 500;
}
.tab-item.active::after {
    content: '';
    position: absolute;
    left: -1px; right: -1px; top: -1px;
    height: 2px;
    background: var(--primary);
    border-radius: 2px 2px 0 0;
}
.tab-item .tab-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px; height: 16px;
    border-radius: 50%;
    font-size: 12px;
    line-height: 1;
    color: var(--text-3);
}
.tab-item .tab-close:hover { background: rgba(0,0,0,0.08); color: var(--text); }

/* ---------------- 内容区 ---------------- */
.admin-content { flex: 1; overflow-y: auto; padding: 20px; }

/* 问候横幅 */
.greeting-banner {
    background: linear-gradient(105deg, #2563eb 0%, #3b82f6 55%, #60a5fa 100%);
    border-radius: var(--radius);
    padding: 26px 30px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.25);
}
.greeting-banner::after {
    content: '';
    position: absolute;
    right: -40px; top: -60px;
    width: 220px; height: 220px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
}
.greeting-banner::before {
    content: '';
    position: absolute;
    right: 90px; bottom: -90px;
    width: 180px; height: 180px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
}
.greeting-left { display: flex; align-items: center; gap: 16px; position: relative; z-index: 1; }
.greeting-icon {
    width: 52px; height: 52px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.18);
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
}
.greeting-icon svg { width: 28px; height: 28px; }
.greeting-title { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
.greeting-sub { font-size: 13px; opacity: 0.85; margin: 0; }
.greeting-right { text-align: right; position: relative; z-index: 1; }
.greeting-time { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.greeting-date { font-size: 13px; opacity: 0.85; margin-top: 2px; }

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: transform 0.15s, box-shadow 0.15s;
    cursor: default;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(16, 24, 40, 0.1); }
.stat-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-info { min-width: 0; }
.stat-label { font-size: 12px; color: var(--text-2); margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-icon.c-blue   { background: #e8f1fe; color: #3b82f6; }
.stat-icon.c-orange { background: #fef3e2; color: #f59e0b; }
.stat-icon.c-purple { background: #f1ebfe; color: #8b5cf6; }
.stat-icon.c-green  { background: #e6f7ee; color: #16a34a; }
.stat-icon.c-teal   { background: #e3f7f5; color: #14b8a6; }
.stat-icon.c-red    { background: #feecec; color: #ef4444; }
.stat-icon.c-indigo { background: #eceffd; color: #6366f1; }
.stat-icon.c-pink   { background: #fdecf4; color: #ec4899; }
.stat-icon.c-cyan   { background: #e5f6fd; color: #06b6d4; }
.stat-icon.c-amber  { background: #fdf6e3; color: #d97706; }

/* 面板 */
.panels-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.panel {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    font-weight: 600;
}
.panel-header svg { width: 16px; height: 16px; color: var(--primary); }
.panel-body { padding: 14px 18px; min-height: 120px; }
.panel-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 88px;
    color: var(--text-3);
    font-size: 13px;
}
.mini-list .mini-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
    font-size: 13px;
}
.mini-list .mini-row:last-child { border-bottom: none; }
.mini-row .mini-main { display: flex; align-items: center; gap: 8px; color: var(--text); }
.mini-row .mini-sub { color: var(--text-3); font-size: 12px; }

/* ---------------- 通用页面 ---------------- */
.page-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
}
.page-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pagination-wrap { display: flex; justify-content: flex-end; margin-top: 14px; }

/* 状态标签 */
.status-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    line-height: 20px;
}
.status-tag::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-green { background: #e6f7ee; color: #16a34a; }
.st-gray { background: #f3f4f6; color: #6b7280; }
.st-orange { background: #fef3e2; color: #d97706; }
.st-blue { background: #e8f1fe; color: #2563eb; }
.st-red { background: #feecec; color: #dc2626; }
.st-purple { background: #f1ebfe; color: #8b5cf6; }

/* 图标库网格 */
.icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 12px;
}
.icon-cell {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 8px;
    text-align: center;
    transition: all 0.15s;
    cursor: default;
}
.icon-cell:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.icon-cell svg { width: 26px; height: 26px; color: var(--text-2); margin-bottom: 8px; }
.icon-cell .icon-name { font-size: 12px; color: var(--text-2); }
.icon-cell .icon-ops { margin-top: 8px; display: flex; justify-content: center; gap: 6px; }

/* 表格内操作 */
.table-link { color: var(--primary); font-size: 13px; cursor: pointer; margin-right: 10px; }
.table-link:hover { text-decoration: underline; }
.table-link.danger { color: var(--danger); }
.table-link.gray { color: var(--text-3); }

/* 表单 */
.form-tip { font-size: 12px; color: var(--text-3); line-height: 1.6; }
.settings-section { margin-bottom: 8px; }
.settings-section-title {
    font-size: 14px; font-weight: 600; margin: 0 0 14px;
    padding-left: 10px; border-left: 3px solid var(--primary);
}

/* 权限矩阵 */
.perm-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.perm-item { min-width: 130px; }

/* 汉堡按钮（仅移动端显示） */
.btn-menu {
    display: none;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin-right: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    flex-shrink: 0;
}
.btn-menu svg { width: 18px; height: 18px; color: var(--text-2); }

/* 遮罩（仅移动端） */
.sidebar-mask {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 900;
}

/* 响应式 */
@media (max-width: 1400px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 992px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .panels-grid { grid-template-columns: 1fr; }
}

/* ---------------- 移动端（<=768px）：侧边栏改为抽屉 ---------------- */
@media (max-width: 768px) {
    .admin-layout { display: block; height: 100vh; }
    .btn-menu { display: inline-flex; }

    .admin-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 232px;
        max-width: 78vw;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.18);
    }
    .admin-sidebar.sidebar-open { transform: translateX(0); }
    .sidebar-mask { display: block; }
    .sidebar-mask.mask-hidden { display: none; }

    .admin-main { height: 100vh; }
    .admin-topbar { padding: 0 12px; }
    .admin-content { padding: 12px; }
    .admin-tabs { overflow-x: auto; }
    .topbar-right { gap: 8px; }
    .btn-refresh span { display: none; }
    .admin-name { display: none; }
    .greeting-banner { padding: 18px 16px; }
    .greeting-right { display: none; }
    .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* ================= 动态玻璃悬浮导航 ================= */
.glass-nav {
    position: fixed;
    right: 16px;
    bottom: 96px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}
.glass-nav.dragging { opacity: 0.92; }
.glass-nav.dragging .glass-ball { transform: scale(0.92); }
.glass-ball {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: grab;
    background: linear-gradient(135deg, rgba(96,165,250,0.85), rgba(59,130,246,0.9));
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    backdrop-filter: blur(18px) saturate(180%);
    border: 1.5px solid rgba(255,255,255,0.55);
    box-shadow: 0 10px 30px rgba(37,99,235,0.35), inset 0 1px 0 rgba(255,255,255,0.5);
    transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.25s;
    animation: glassFloat 3.6s ease-in-out infinite;
}
.glass-ball svg { width: 22px; height: 22px; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.15)); }
.glass-ball:active { cursor: grabbing; }
@keyframes glassFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}
.glass-nav.dragging .glass-ball { animation: none; }
.glass-nav.expanded .glass-ball {
    transform: rotate(90deg) scale(1.05);
    animation: none;
    background: linear-gradient(135deg, rgba(59,130,246,0.95), rgba(37,99,235,0.95));
}
.glass-menu {
    margin-bottom: 12px;
    padding: 8px;
    min-width: 172px;
    border-radius: 22px;
    background: rgba(255,255,255,0.55);
    -webkit-backdrop-filter: blur(24px) saturate(200%);
    backdrop-filter: blur(24px) saturate(200%);
    border: 1.5px solid rgba(255,255,255,0.65);
    box-shadow: 0 14px 40px rgba(31,41,55,0.22), inset 0 1px 0 rgba(255,255,255,0.6);
    transform-origin: bottom right;
}
.glass-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    color: #334155;
    cursor: pointer;
    transition: background 0.18s, color 0.18s, transform 0.18s;
}
.glass-item:hover { background: rgba(59,130,246,0.12); color: #1d4ed8; transform: translateX(-2px); }
.glass-item.active { background: linear-gradient(135deg, #3b82f6, #2563eb); color: #fff; font-weight: 600; box-shadow: 0 4px 14px rgba(37,99,235,0.35); }
.glass-item.active .glass-ico { color: #fff; }
.glass-ico { display: inline-flex; color: #64748b; }
.glass-badge {
    margin-left: auto;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-style: normal;
    text-align: center;
}
.glass-pop-enter-active { transition: opacity 0.22s ease, transform 0.26s cubic-bezier(0.34,1.56,0.64,1); }
.glass-pop-leave-active { transition: opacity 0.16s ease, transform 0.16s ease; }
.glass-pop-enter, .glass-pop-leave-to { opacity: 0; transform: scale(0.7) translateY(8px); }

@media (max-width: 768px) {
    .glass-nav { bottom: 84px; right: 12px; }
    .glass-ball { width: 46px; height: 46px; }
    .glass-menu { min-width: 158px; }
}
