/* --- 动态主题变量 (Light / Dark) --- */
:root {
    --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.8);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --text-main: #2d3748;
    --text-light: #718096;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --card-bg: rgba(255, 255, 255, 0.9);
    --radius-lg: 20px;
    --radius-md: 12px;
}

/* 黑暗模式覆盖变量 */
:root.dark-mode {
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --glass-bg: rgba(30, 41, 59, 0.75);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --text-main: #f8fafc;
    --text-light: #cbd5e1;
    --accent: #818cf8;
    --accent-hover: #6366f1;
    --card-bg: rgba(15, 23, 42, 0.8);
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-gradient); color: var(--text-main);
    min-height: 100vh; position: relative; overflow-x: hidden;
    transition: background 0.4s ease, color 0.4s ease;
}

/* --- 拟态氛围 --- */
.bg-shape { position: fixed; border-radius: 50%; filter: blur(80px); z-index: -1; }
.shape-1 { width: 40vw; height: 40vw; background: rgba(99, 102, 241, 0.25); top: -10%; left: -10%; }
.shape-2 { width: 50vw; height: 50vw; background: rgba(236, 72, 153, 0.15); bottom: -15%; right: -10%; }

.app-wrapper { max-width: 1400px; margin: 0 auto; padding: 20px; display: flex; flex-direction: column; gap: 20px; min-height: 100vh; }

/* --- 顶部导航 --- */
.glass-header {
    background: var(--glass-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border); border-radius: var(--radius-lg); box-shadow: var(--glass-shadow);
    display: flex; justify-content: space-between; align-items: center; padding: 15px 30px; transition: all 0.4s;
}
.logo { display: flex; align-items: center; gap: 10px; font-size: 1.2rem; font-weight: 800; color: var(--accent); }
.header-actions { display: flex; align-items: center; gap: 15px; }

.icon-btn {
    background: transparent; border: none; font-size: 1.5rem; cursor: pointer;
    transition: transform 0.3s; padding: 5px; border-radius: 50%;
}
.icon-btn:hover { transform: rotate(20deg) scale(1.1); }

.btn-float {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; border: none; cursor: pointer;
    padding: 10px 20px; border-radius: 30px; font-weight: bold; font-size: 1rem;
    box-shadow: 0 4px 15px rgba(118, 75, 162, 0.3); transition: all 0.3s ease;
}
.btn-float:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(118, 75, 162, 0.5); }

/* --- 核心布局 --- */
.main-layout { display: flex; gap: 20px; flex: 1; align-items: stretch; }

/* --- 左侧边栏 --- */
.glass-sidebar {
    background: var(--glass-bg); backdrop-filter: blur(12px); border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg); box-shadow: var(--glass-shadow);
    width: 280px; padding: 25px 20px; flex-shrink: 0; transition: all 0.4s;
}
.glass-sidebar h3 { font-size: 1rem; color: var(--text-light); margin-bottom: 15px; padding-left: 10px; }
.nav-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.nav-list a {
    display: block; padding: 12px 15px; color: var(--text-main); text-decoration: none;
    border-radius: var(--radius-md); font-weight: 500; transition: all 0.3s ease;
}
.nav-list a:hover { background: rgba(128,128,128,0.1); transform: translateX(5px); }
.nav-list a.active { background: var(--accent); color: white; box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3); }

/* --- 右侧内容区 --- */
.glass-content {
    background: var(--glass-bg); backdrop-filter: blur(12px); border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg); box-shadow: var(--glass-shadow);
    flex: 1; padding: 40px; overflow-y: auto; transition: all 0.4s;
}

/* --- 底部附页 --- */
.glass-footer {
    background: var(--glass-bg); backdrop-filter: blur(12px); border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg); box-shadow: var(--glass-shadow);
    padding: 20px; text-align: center; transition: all 0.4s;
}
.glass-footer h3 { font-size: 1rem; color: var(--text-light); margin-bottom: 15px; }
.footer-nav { list-style: none; display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; }
.footer-nav a {
    color: var(--text-main); text-decoration: none; padding: 8px 16px; border-radius: 20px;
    background: rgba(128,128,128,0.1); transition: all 0.3s; cursor: pointer;
}
.footer-nav a:hover { background: var(--accent); color: white; transform: translateY(-3px); }

/* --- 弹窗 Modal 样式 --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.4); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    display: flex; justify-content: center; align-items: center; z-index: 1000;
    opacity: 0; visibility: hidden; transition: all 0.3s ease;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-content {
    background: var(--glass-bg); backdrop-filter: blur(20px); border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg); padding: 30px; width: 90%; max-width: 900px;
    max-height: 85vh; overflow-y: auto; position: relative;
    transform: translateY(30px); transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.modal-overlay.active .modal-content { transform: translateY(0); }
.modal-title { color: var(--text-main); margin-bottom: 20px; font-size: 1.5rem; text-align: center; }
.modal-close {
    position: absolute; top: 15px; right: 20px; background: none; border: none;
    font-size: 2rem; color: var(--text-light); cursor: pointer; transition: color 0.3s;
}
.modal-close:hover { color: #ef4444; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 15px; }
.float-card {
    background: var(--card-bg); border: 1px solid var(--glass-border); border-radius: var(--radius-md);
    padding: 20px; text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 8px;
    transition: all 0.3s;
}
.float-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.1); border-color: var(--accent); }
.float-card h4 { color: var(--accent); font-size: 1.1rem; }
.float-card p { font-size: 0.9rem; color: var(--text-light); line-height: 1.4; }

/* =========================================
   📱 移动端响应式适配 (手机/平板)
   ========================================= */
@media (max-width: 768px) {
    .app-wrapper { padding: 10px; gap: 10px; }
    .glass-header { padding: 12px 15px; flex-direction: row; }
    .logo h1 { font-size: 1.1rem; }
    .btn-float { padding: 8px 12px; font-size: 0.9rem; }
    
    .main-layout { flex-direction: column; }
    /* 侧边栏变身为横向滚动的胶囊菜单 */
    .glass-sidebar { width: 100%; padding: 15px; overflow: hidden; }
    .nav-list { flex-direction: row; overflow-x: auto; padding-bottom: 5px; gap: 10px; }
    .nav-list::-webkit-scrollbar { display: none; /* 隐藏滚动条 */ }
    .nav-list a { white-space: nowrap; padding: 10px 20px; border-radius: 30px; background: rgba(128,128,128,0.1); }
    .nav-list a:hover { transform: none; }
    
    .glass-content { padding: 20px 15px; }
    .modal-content { padding: 20px; width: 95%; }
}

/* ==========================================
   🌟 全局滚动条美化 (Mac 悬浮风格 - 完美边缘缩进版)
   ========================================== */
::-webkit-scrollbar {
    width: 6px;  /* 保持 6px 的精致宽度，紧贴右侧边缘 */
    height: 6px;
}

/* 👇 核心魔法换位：直接让“轨道”上下缩进，滚动条就永远滑不到最角落了！ */
::-webkit-scrollbar-track {
    background: transparent;
    margin-top: 15px;    /* 距离容器顶部的安全距离，避开弹窗上圆角 */
    margin-bottom: 15px; /* 距离容器底部的安全距离，避开弹窗下圆角 */
}

::-webkit-scrollbar-thumb {
    background-color: rgba(156, 163, 175, 0.5);
    border-radius: 10px; /* 圆角完美回归！没有任何 Bug！ */
}

::-webkit-scrollbar-thumb:hover {
    background-color: rgba(156, 163, 175, 0.8);
}

/* 黑暗模式下的滚动条自动变色 */
:root.dark-mode ::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.25);
}

:root.dark-mode ::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.45);
}