/* ============================================
   现代化毛玻璃效果通用样式
   Version: 1.0
   适用于所有页面的统一设计系统
============================================ */

/* 设计系统变量 */
:root {
    /* 颜色系统 - 优化透明度提高可读性 */
    --primary-color: rgba(66, 133, 244, 0.85);
    --primary-light: rgba(232, 240, 254, 0.25);
    --secondary-color: rgba(95, 99, 104, 0.8);
    --background-color: rgba(248, 249, 250, 0.05);
    --surface-color: rgba(255, 255, 255, 0.82);
    --surface-color-solid: rgba(255, 255, 255, 0.95);
    --text-primary: rgba(32, 33, 36, 0.98);
    --text-secondary: rgba(95, 99, 104, 0.9);
    
    /* 模糊系统 - 降低模糊度保持背景清晰 */
    --blur-card: 8px;
    --blur-button: 10px;
    --blur-sidebar: 15px;
    --blur-background: 2px;
    
    /* 间距系统 */
    --spacing-xs: 8px;
    --spacing-sm: 16px;
    --spacing-md: 24px;
    --spacing-lg: 32px;
    --spacing-xl: 48px;
    
    /* 圆角系统 */
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;
    
    /* 阴影系统 */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.15);
    
    /* 过渡动画 */
    --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 暗色主题 */
[data-theme="dark"] {
    --primary-color: rgba(138, 180, 248, 0.85);
    --primary-light: rgba(26, 42, 76, 0.25);
    --secondary-color: rgba(154, 160, 166, 0.8);
    --background-color: rgba(18, 18, 18, 0.05);
    --surface-color: rgba(30, 30, 30, 0.85);
    --surface-color-solid: rgba(30, 30, 30, 0.95);
    --text-primary: rgba(232, 234, 237, 0.98);
    --text-secondary: rgba(154, 160, 166, 0.9);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.3);
}

/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 基础页面样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', 'Noto Sans SC', sans-serif;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    font-weight: 400;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   API背景图片系统
============================================ */
#background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -3;
    overflow: hidden;
}

#api-background {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.9) saturate(1.05);
    transition: opacity 0.8s ease;
    opacity: 0;
}

#api-background.loaded {
    opacity: 1;
}

.background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, 
        rgba(66, 133, 244, 0.03) 0%, 
        rgba(138, 180, 248, 0.03) 50%,
        rgba(255, 255, 255, 0.02) 100%);
    z-index: -2;
    backdrop-filter: blur(var(--blur-background));
    -webkit-backdrop-filter: blur(var(--blur-background));
}

/* ============================================
   控制按钮系统
============================================ */
/* 返回旧版按钮 */
.legacy-button {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1002;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(var(--blur-button));
    -webkit-backdrop-filter: blur(var(--blur-button));
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-full);
    padding: 10px 20px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-normal);
    box-shadow: var(--shadow-md);
}

.legacy-button:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* 侧边栏切换按钮 */
.sidebar-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(var(--blur-button));
    -webkit-backdrop-filter: blur(var(--blur-button));
    border: 1px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    z-index: 1002;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-normal);
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
    font-weight: 600;
}

.sidebar-toggle:hover {
    transform: scale(1.1) rotate(90deg);
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--primary-color);
}

/* 主题切换按钮 */
.theme-toggle {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(var(--blur-button));
    -webkit-backdrop-filter: blur(var(--blur-button));
    color: var(--primary-color);
    border: 1px solid rgba(255, 255, 255, 0.3);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-normal);
    position: fixed;
    top: 85px;
    right: 20px;
    z-index: 1002;
    box-shadow: var(--shadow-md);
    font-weight: 600;
}

.theme-toggle:hover {
    transform: rotate(25deg) scale(1.08);
    background: rgba(255, 255, 255, 0.95);
    color: white;
    background-color: var(--primary-color);
}

/* ============================================
   侧边栏系统
============================================ */
.sidebar {
    position: fixed;
    left: -300px;
    top: 0;
    width: 280px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(var(--blur-sidebar));
    -webkit-backdrop-filter: blur(var(--blur-sidebar));
    border-right: 1px solid rgba(255, 255, 255, 0.25);
    z-index: 1001;
    transition: var(--transition-normal);
    padding: 24px 0;
    display: flex;
    flex-direction: column;
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.1);
}

.sidebar.open {
    left: 0;
}

.sidebar-header {
    padding: 0 24px 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    margin-bottom: 16px;
    text-align: center;
}

.sidebar-header img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 16px;
    border: 2px solid rgba(66, 133, 244, 0.3);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transition: var(--transition-normal);
}

.sidebar-header img:hover {
    transform: scale(1.05);
    border-color: var(--primary-color);
}

.sidebar-header h2 {
    color: var(--text-primary);
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px;
}

.sidebar-menu ul {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 4px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: var(--transition-normal);
    font-size: 0.95rem;
    font-weight: 500;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid transparent;
}

.sidebar-menu a:hover, .sidebar-menu a.active {
    background: rgba(66, 133, 244, 0.1);
    color: var(--primary-color);
    border-color: rgba(66, 133, 244, 0.2);
    transform: translateX(5px);
}

.sidebar-menu i {
    margin-right: 12px;
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

/* ============================================
   主内容区系统
============================================ */
.content-wrapper {
    margin-left: 0;
    transition: var(--transition-normal);
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.content-wrapper.sidebar-open {
    margin-left: 0;
}

.main-content {
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

/* ============================================
   通用卡片系统
============================================ */
.card {
    background: var(--surface-color);
    backdrop-filter: blur(var(--blur-card));
    -webkit-backdrop-filter: blur(var(--blur-card));
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.35);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    transition: var(--transition-normal);
    box-shadow: var(--shadow-md);
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.9);
}

.section-title {
    color: var(--text-primary);
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: 0.3px;
}

.section-title i {
    color: var(--primary-color);
}

/* ============================================
   通用按钮系统
============================================ */
.btn {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(var(--blur-button));
    -webkit-backdrop-filter: blur(var(--blur-button));
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-full);
    padding: 10px 20px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-normal);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-2px);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border-color: rgba(255, 255, 255, 0.4);
}

.btn-primary:hover {
    background: rgba(66, 133, 244, 0.95);
}

/* ============================================
   通用输入框系统
============================================ */
.input {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: var(--transition-normal);
    width: 100%;
}

.input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
}

/* ============================================
   网格系统
============================================ */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-sm);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-sm);
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-sm);
}

.grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-sm);
}

/* ============================================
   动画效果
============================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.card, .sidebar, .sidebar-toggle, .theme-toggle, .legacy-button {
    animation: fadeIn 0.5s ease-out;
}

/* ============================================
   滚动条样式
============================================ */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(66, 133, 244, 0.3);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(66, 133, 244, 0.5);
}

/* ============================================
   响应式设计
============================================ */
@media (min-width: 768px) {
    .sidebar {
        left: 0;
    }
    
    .sidebar-toggle {
        display: none;
    }
    
    .content-wrapper {
        margin-left: 280px;
        padding: 30px;
    }
    
    .main-content {
        max-width: 900px;
    }
}

@media (max-width: 767px) {
    .content-wrapper {
        padding-top: 80px;
    }
    
    .legacy-button {
        top: 80px;
        right: 20px;
    }
    
    .theme-toggle {
        top: 80px;
        right: 90px;
    }
    
    .card {
        padding: var(--spacing-sm);
    }
}

@media (max-width: 480px) {
    .sidebar-header img {
        width: 70px;
        height: 70px;
    }
    
    .section-title {
        font-size: 1.15rem;
    }
    
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* 文本阴影增强可读性 */
.section-title,
.card h1, .card h2, .card h3,
.activity-content p,
.quick-access-item span {
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] .section-title,
[data-theme="dark"] .card h1,
[data-theme="dark"] .card h2,
[data-theme="dark"] .card h3,
[data-theme="dark"] .activity-content p,
[data-theme="dark"] .quick-access-item span {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}