/* ============================================================
   apple-style.css — Apple HIG compliant design system
   
   Design Principles (Apple Human Interface Guidelines):
   • Clarity — Clear hierarchy, every element has purpose
   • Deference — UI supports, not competes with, content
   • Depth — Layered shadows, translucent surfaces
   • Consistency — Predictable interactions, unified language
   
   IMPORTANT: DO NOT rename class selectors.
   Existing PHP pages (index.php, lan_vpn.php, cloud_disk.php,
   courseware.php, login.php, user_center.php, etc.) reference
   these class names.
   ============================================================ */

/* ============================================================
   1. DESIGN TOKENS — Colors, Typography, Spacing, Radius
   ============================================================ */

:root {
    /* Color — Apple System Colors (Light) */
    --system-blue:        #007AFF;
    --system-green:       #34C759;
    --system-indigo:      #5856D6;
    --system-orange:      #FF9500;
    --system-pink:        #FF2D55;
    --system-purple:      #AF52DE;
    --system-red:         #FF3B30;
    --system-teal:        #5AC8FA;
    --system-yellow:      #FFCC00;
    --system-gray:        #8E8E93;
    --system-gray2:       #AEAEB2;
    --system-gray3:       #C7C7CC;
    --system-gray4:       #D1D1D6;
    --system-gray5:       #E5E5EA;
    --system-gray6:       #F2F2F7;

    /* Semantic colors */
    --label-primary:      #000000;
    --label-secondary:    rgba(60, 60, 67, 0.60);
    --label-tertiary:     rgba(60, 60, 67, 0.30);
    --label-quaternary:   rgba(60, 60, 67, 0.18);
    --bg-primary:         #FFFFFF;
    --bg-secondary:        #F2F2F7;   /* grouped list background */
    --bg-tertiary:        #FFFFFF;    /* cards on grouped list */
    --separator-color:    rgba(60, 60, 67, 0.18);
    --separator-opaque:   #C6C6C8;
    --fill-primary:       rgba(120, 120, 128, 0.20);
    --fill-secondary:     rgba(120, 120, 128, 0.16);
    --fill-tertiary:      rgba(120, 120, 128, 0.12);

    /* Brand/primary accent — kept distinct from system-blue */
    --primary-color:      #007AFF;
    --primary-dark:       #0051D5;
    --primary-light:      #64B5FF;
    --primary-alpha:      rgba(0, 122, 255, 0.12);
    --secondary-color:    #5856D6;   /* Apple indigo — 与 primary 搭配用于渐变 */

    /* Status colors (success/warning/error) */
    --success-color:      #34C759;
    --warning-color:      #FF9500;
    --error-color:        #FF3B30;

    /* Typography — SF Pro stack (Apple's font) */
    --font-system: -apple-system, BlinkMacSystemFont, "SF Pro Display",
                   "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-mono:   "SF Mono", ui-monospace, Menlo, Consolas, monospace;

    /* Text size — Apple size scale */
    --text-large-title: 34px;
    --text-title1:      28px;
    --text-title2:      22px;
    --text-title3:      20px;
    --text-headline:    17px;    /* bold body */
    --text-body:        17px;    /* default */
    --text-callout:     16px;
    --text-subhead:     15px;
    --text-footnote:    13px;
    --text-caption1:    12px;
    --text-caption2:    11px;

    /* Spacing — 8pt grid */
    --space-xs:  4px;
    --space-sm:  8px;
    --space-md:  12px;
    --space-lg:  16px;
    --space-xl:  20px;
    --space-2xl: 32px;
    --space-3xl: 48px;

    /* Radius — Concentric (inner smaller than outer) */
    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 20px;
    --radius-full: 9999px;

    /* Shadow — Apple layered subtlety */
    --shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.04),
                  0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md:  0 2px 4px rgba(0, 0, 0, 0.04),
                  0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg:  0 4px 8px rgba(0, 0, 0, 0.06),
                  0 12px 24px rgba(0, 0, 0, 0.08);
    --shadow-xl:  0 8px 16px rgba(0, 0, 0, 0.08),
                  0 24px 48px rgba(0, 0, 0, 0.10);

    /* Motion — Apple standard easing */
    --ease-default: cubic-bezier(0.25, 0.1, 0.25, 1);
    --ease-in:      cubic-bezier(0.42, 0, 1, 1);
    --ease-out:     cubic-bezier(0, 0, 0.58, 1);
    --ease-spring:  cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --transition-fast:   0.15s var(--ease-default);
    --transition-normal: 0.25s var(--ease-default);
    --transition-slow:   0.4s  var(--ease-default);
}

/* Dark mode — Apple System Colors (Dark) */
@media (prefers-color-scheme: dark) {
    :root {
        --label-primary:    #FFFFFF;
        --label-secondary:  rgba(235, 235, 245, 0.60);
        --label-tertiary:   rgba(235, 235, 245, 0.30);
        --label-quaternary: rgba(235, 235, 245, 0.18);
        --bg-primary:       #000000;
        --bg-secondary:     #1C1C1E;
        --bg-tertiary:      #2C2C2E;
        --separator-color:  rgba(84, 84, 88, 0.60);
        --separator-opaque: #38383A;
        --fill-primary:     rgba(120, 120, 128, 0.36);
        --fill-secondary:   rgba(120, 120, 128, 0.32);
        --fill-tertiary:    rgba(120, 120, 128, 0.24);
        --primary-alpha:    rgba(10, 132, 255, 0.20);
        --system-blue:      #0A84FF;
    }
}

/* ============================================================
   2. RESET & BASE — html, body, typography
   ============================================================ */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font-system);
    color: var(--label-primary);
    /* Apple-style clean white background — replaces purple gradient */
    background: var(--bg-secondary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    line-height: 1.5;
    min-height: 100vh;
    /* 为滚动条预留固定空间，避免 tab 切换时因滚动条出现/消失导致页面水平跳动 */
    scrollbar-gutter: stable;
}

@media (prefers-color-scheme: dark) {
    body { background: #000000; }
    
    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="url"],
    input[type="number"],
    input[type="file"],
    textarea,
    select {
        background: #2C2C2E;
        border-color: rgba(84, 84, 88, 0.60);
        color: #FFFFFF;
    }
    
    input[type="text"]:focus,
    input[type="password"]:focus,
    input[type="email"]:focus,
    input[type="url"]:focus,
    input[type="number"]:focus,
    textarea:focus,
    select:focus {
        border-color: #0A84FF;
        box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.25);
    }
    
    ::placeholder {
        color: rgba(235, 235, 245, 0.40);
    }
    
    /* Search box dark mode */
    .search-box {
        background: #2C2C2E !important;
        border-color: rgba(84, 84, 88, 0.60) !important;
    }
    
    .search-box input {
        background: transparent !important;
        color: #FFFFFF !important;
    }
    
    .search-box input::placeholder {
        color: rgba(235, 235, 245, 0.40) !important;
    }
    
    /* Button secondary dark mode */
    .btn-secondary {
        background: rgba(10, 132, 255, 0.2) !important;
        color: #0A84FF !important;
    }
    
    .btn-secondary:hover {
        background: rgba(10, 132, 255, 0.3) !important;
    }
    
    /* Badge dark mode */
    .badge-primary { background: rgba(10, 132, 255, 0.2); color: #0A84FF; }
    .badge-success { background: rgba(52, 199, 89, 0.2); color: #30D158; }
    .badge-warning { background: rgba(255, 149, 0, 0.2); color: #FF9F0A; }
    .badge-danger  { background: rgba(255, 59, 48, 0.2); color: #FF453A; }
    
    /* Hamburger menu dark mode */
    .hamburger-menu {
        background: rgba(28, 28, 30, 0.96) !important;
        border-color: rgba(255, 255, 255, 0.08) !important;
    }
    
    .hamburger-menu span {
        background: #F5F5F7 !important;
    }
}

a {
    color: var(--system-blue);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
    text-decoration: none;
}

img { max-width: 100%; }

/* Page entry animation */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   3. LAYOUT — App container, sidebar, main content
   ============================================================ */

.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Main content area — shifted to avoid fixed sidebar */
.main-content {
    flex: 1;
    margin-left: 240px;
    min-height: 100vh;
    padding: var(--space-xl) var(--space-lg);
    box-sizing: border-box;
    animation: fadeInUp 0.5s var(--ease-default);
}

@media (prefers-reduced-motion: reduce) {
    .main-content { animation: none; }
}

/* Secondary content area used by some pages (e.g. view pages) */
.page-content {
    margin-left: 240px;
    min-height: 100vh;
    padding: var(--space-xl) var(--space-lg);
    box-sizing: border-box;
}

/* ============================================================
   4. SIDEBAR — Primary navigation
   ============================================================ */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    border-right: 1px solid var(--separator-color);
    z-index: 9999;  /* 确保在最顶层 */
    transition: left var(--transition-normal);
}

@media (prefers-color-scheme: dark) {
    .sidebar {
        background: #1C1C1E;
        border-right-color: rgba(255,255,255,0.08);
    }
}

/* Sidebar header — app title */
.sidebar-header {
    padding: var(--space-xl) var(--space-lg);
    border-bottom: 1px solid var(--separator-color);
}

.sidebar-header h2 {
    margin: 0;
    font-size: var(--text-title3);
    font-weight: 700;
    color: var(--label-primary);
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.sidebar-header h2 i {
    color: var(--system-blue);
    font-size: 22px;
}

/* Navigation list */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-sm) 0;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Nav link — Apple grouped-list style (enhanced) */
.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin: 2px var(--space-sm);
    padding: 10px 14px;
    color: var(--label-primary);
    text-decoration: none;
    border-radius: var(--radius-lg);
    font-size: var(--text-callout);
    font-weight: 600;
    letter-spacing: -0.01em;
    transition: background-color var(--transition-fast),
                color var(--transition-fast),
                transform var(--transition-fast),
                box-shadow var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
    border: 1px solid transparent;
    position: relative;
}

.nav-link i {
    width: 22px;
    font-size: 16px;
    text-align: center;
    color: var(--system-blue);
    transition: transform var(--transition-fast),
                color var(--transition-fast);
}

.nav-link:hover {
    background: var(--system-gray6);
    color: var(--label-primary);
    border-color: var(--separator-color);
    transform: none;
}

.nav-link:hover i {
    transform: scale(1.08);
    color: var(--primary-dark);
}

.nav-link:active {
    transform: scale(0.98);
    background: var(--system-gray5);
}

/* Active/current page highlight (enhanced) */
.nav-link.is-current {
    background: var(--primary-alpha);
    color: var(--system-blue);
    border-color: transparent;
    box-shadow: 0 0 0 1px rgba(0, 122, 255, 0.2),
                0 1px 2px rgba(0, 122, 255, 0.08);
    font-weight: 700;
}

.nav-link.is-current i {
    color: var(--system-blue);
    transform: scale(1.05);
}

.nav-link.is-current::before {
    content: '';
    position: absolute;
    left: 8px;
    width: 4px;
    height: 18px;
    background: var(--system-blue);
    border-radius: 2px;
}

.nav-link {
    position: relative;
    overflow: hidden;
}

/* 悬停下划线动画（全站统一，替代原先仅 index.php 局部的紫色条）。
   仅在非当前项上触发，避免与 .is-current 的左侧蓝色竖条冲突。 */
.nav-link:not(.is-current)::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #6366f1, #a855f7);
    transition: width 0.3s ease;
    pointer-events: none;
}

.nav-link:not(.is-current):hover::before {
    width: 100%;
}

/* 二级菜单的分组按钮（更多工具 / 管理）与一级菜单保持一致：悬停同样出现紫色渐变条。
   按钮的 position/overflow 见下方「侧边栏样式隔离」之后的同名规则（要压过那里的 position:static）。 */
.sidebar .nav-group-toggle::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #6366f1, #a855f7);
    transition: width 0.3s ease;
    pointer-events: none;
}

.sidebar .nav-group-toggle:hover::before {
    width: 100%;
}

/* ============================================================
   Sidebar group (二级菜单)
   ============================================================ */
.nav-group {
    margin: 2px var(--space-sm);
}

.nav-group-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    width: 100%;
    padding: 10px 14px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    color: var(--label-primary);
    font-size: var(--text-callout);
    font-weight: 600;
    letter-spacing: -0.01em;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: background-color var(--transition-fast),
                color var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.nav-group-toggle:hover {
    background: var(--system-gray6);
    color: var(--label-primary);
    border-color: var(--separator-color);
}

.nav-group-toggle:active {
    background: var(--system-gray5);
}

.nav-group-toggle i:not(.nav-group-arrow) {
    width: 22px;
    font-size: 16px;
    text-align: center;
    color: var(--system-blue);
    transition: transform var(--transition-fast), color var(--transition-fast);
}

.nav-group-toggle:hover i:not(.nav-group-arrow) {
    transform: scale(1.08);
    color: var(--primary-dark);
}

.nav-group-toggle .nav-group-arrow {
    margin-left: auto;
    width: 16px;
    font-size: 12px;
    color: var(--tertiary-label, #86868b);
    transition: transform var(--transition-fast);
}

.nav-group.open .nav-group-toggle .nav-group-arrow {
    transform: rotate(180deg);
}

.nav-group-items {
    list-style: none;
    margin: 2px 0 6px;
    padding: 0 0 0 12px;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height var(--transition-normal) ease,
                opacity var(--transition-normal) ease;
}

.nav-group.open .nav-group-items {
    max-height: 600px;
    opacity: 1;
}

/* 二级子项相对分组按钮再缩进，形成清晰的层级差。 */
.nav-group-items .nav-link {
    margin: 2px 0;
    padding: 8px 14px 8px 12px;
    font-size: var(--text-subheadline, 15px);
}

.nav-group-items .nav-link i {
    width: 20px;
    font-size: 15px;
}

/* ============================================================
   Sidebar isolation (侧边栏样式隔离)
   各页面内嵌 <style> 中的全局标签规则（如 button、a）会污染侧边栏：
   例如 upload.php 的 button{box-shadow;margin-top;gradient} 会把阴影/间距/渐变带进侧边栏。
   这里显式归一关键属性，确保任何页面都无法影响侧边栏的观感。
   ============================================================ */
.sidebar button,
.sidebar .nav-group-toggle {
    box-shadow: none;
    margin: 2px var(--space-sm);
    margin-top: 2px;
    position: static;
    text-align: left;
    font-family: inherit;
}

/* 分组按钮需要自己作为渐变条的定位基准，并裁掉圆角外的溢出。
   注意：必须写在上面这条隔离规则之后——两者选择器优先级相同，靠顺序取胜。
   同时清零左右外边距：外层 .sidebar .nav-group(li) 已经缩进了 var(--space-sm)，
   若按钮再缩一次会变成两层缩进，导致「更多工具」比一级菜单偏右、对不齐。 */
.sidebar .nav-group-toggle {
    position: relative;
    overflow: hidden;
    margin-left: 0;
    margin-right: 0;
}

.sidebar a.nav-link {
    box-shadow: none;
}

/* 避免页面级全局 a/button 的 transition 覆盖掉侧边栏自身的过渡 */
.sidebar .nav-link,
.sidebar .nav-group-toggle {
    transition: background-color var(--transition-fast),
                color var(--transition-fast),
                transform var(--transition-fast),
                box-shadow var(--transition-fast);
}

/* 恢复侧边栏间距：部分页面（如 user_center / upload）内嵌 * { margin:0; padding:0 }
   会把侧边栏的 .nav-link/.nav-group 的间距清零。这里显式恢复，保证各页面一致。 */
.sidebar .nav-link {
    margin: 2px var(--space-sm);
    padding: 10px 14px;
}

.sidebar .nav-group {
    margin: 2px var(--space-sm);
}

/* 二级子项整体右移：子项图标落在分组按钮图标右侧约 14px，拉开两级层级。
   注意选择器要压过下面 .sidebar .sidebar-nav ul{padding:0}——它优先级 (0,2,1)，
   所以必须写成 .sidebar .sidebar-nav .nav-group-items (0,3,0)。 */
.sidebar .sidebar-nav .nav-group-items {
    padding-left: 24px;
}

.sidebar .nav-group-items .nav-link {
    margin: 2px 0;
    padding: 8px 14px 8px 12px;
}

.sidebar .sidebar-nav ul {
    padding: 0;
    margin: 0;
}

@media (prefers-color-scheme: dark) {
    .nav-link { color: #F5F5F7; }
    .nav-link i { color: #0A84FF; }
    .nav-link:hover { background: #2C2C2E; border-color: rgba(255, 255, 255, 0.08); }
    .nav-link:active { background: #3A3A3C; }
    .nav-link.is-current {
        background: rgba(10, 132, 255, 0.18);
        color: #0A84FF;
        box-shadow: 0 0 0 1px rgba(10, 132, 255, 0.3),
                    0 1px 2px rgba(0, 0, 0, 0.2);
    }
    .nav-link.is-current::before { background: #0A84FF; }
    .nav-link.is-current i { color: #0A84FF; }

    .nav-group-toggle { color: #F5F5F7; }
    .nav-group-toggle:hover { background: #2C2C2E; border-color: rgba(255, 255, 255, 0.08); }
    .nav-group-toggle:active { background: #3A3A3C; }
    .nav-group-toggle .nav-group-arrow { color: rgba(235, 235, 245, 0.4); }

    /* Dark playlist modal */
    .gp-playlist-modal { background: rgba(0, 0, 0, 0.65); }
    .gp-pl-modal-content {
        background: #1C1C1E; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08),
                    0 20px 60px rgba(0, 0, 0, 0.5); }
    .gp-pl-modal-header {
        background: linear-gradient(180deg, rgba(10, 132, 255, 0.08) 0%, transparent 100%);
        border-bottom-color: rgba(255, 255, 255, 0.08);
    }
    .gp-pl-modal-header h3 span { background: #2C2C2E; color: rgba(235, 235, 245, 0.6); }
    .gp-panel-header-actions button {
        background: #2C2C2E; color: rgba(235, 235, 245, 0.6); }
    .gp-panel-header-actions button:hover { background: #3A3A3C; color: #fff; }
    .gp-panel-header-actions #gpRepeatBtn.active { background: rgba(10, 132, 255, 0.2); color: #0A84FF; }
    .gp-panel-header-actions .modal-close:hover { background: #FF453A; }

    .gp-pl-item:hover { background: #2C2C2E; }
    .gp-pl-item--current {
        background: rgba(10, 132, 255, 0.18);
        border-color: rgba(10, 132, 255, 0.3);
    }
    .gp-pl-item--current:hover { background: rgba(10, 132, 255, 0.25); }
    .gp-pl-item--over { background: #3A3A3C; }
    .gp-pl-num { color: rgba(235, 235, 245, 0.4); }
    .gp-pl-item--current .gp-pl-num { color: #0A84FF; }
    .gp-pl-name { color: #F5F5F7; }
    .gp-pl-item--current .gp-pl-name { color: #0A84FF; }
    .gp-pl-actions button:hover { background: rgba(255, 255, 255, 0.08); color: #F5F5F7; }
    .gp-pl-actions .gp-pl-play:hover { background: rgba(10, 132, 255, 0.2); color: #0A84FF; }
    .gp-pl-actions .gp-pl-del:hover { background: rgba(255, 69, 58, 0.2); color: #FF453A; }

    .gp-pl-empty i { color: rgba(235, 235, 245, 0.3); }
    .gp-pl-empty p { color: #F5F5F7; }
    .gp-pl-empty .gp-pl-hint { color: rgba(235, 235, 245, 0.5); }

    /* Dark sidebar music player */
    .sidebar-music-player {
        background: #1C1C1E;
        border-top-color: rgba(255, 255, 255, 0.08);
    }
    .smp-song {
        background: #2C2C2E;
        border-color: rgba(255, 255, 255, 0.08);
    }
    .smp-song:hover {
        background: #3A3A3C;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    }
    .smp-name { color: #F5F5F7; }
    .smp-arrow { color: rgba(235, 235, 245, 0.5); }
    .smp-song:hover .smp-arrow { color: #0A84FF; }
    .smp-btn {
        background: #2C2C2E;
        color: rgba(235, 235, 245, 0.6);
        border-color: rgba(255, 255, 255, 0.08);
    }
    .smp-btn:hover {
        background: #3A3A3C;
        color: #F5F5F7;
        border-color: rgba(255, 255, 255, 0.15);
    }
    .smp-time { color: rgba(235, 235, 245, 0.4); }
    .smp-slider { background: #3A3A3C; }
    .smp-slider::-webkit-slider-thumb {
        background: #0A84FF;
        border-color: #1C1C1E;
    }
    .smp-slider::-moz-range-thumb {
        background: #0A84FF;
        border-color: #1C1C1E;
    }

    /* Mobile dark mode player - moved after general mobile styles for proper priority */

    /* Dark modal */
    .modal { background: rgba(0, 0, 0, 0.6); }
    .modal-content {
        background: #1C1C1E;
        box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08),
                    0 20px 50px rgba(0, 0, 0, 0.4),
                    0 50px 120px rgba(0, 0, 0, 0.5);
    }
}

/* Logout / login pinned at bottom */
.logout-item,
.login-item {
    margin-top: auto;
    border-top: 1px solid var(--separator-color);
    padding-top: var(--space-sm);
    margin-left: 0;
    margin-right: 0;
}

/* User/admin info footer chip */
.admin-info-sidebar,
.user-info-sidebar {
    padding: var(--space-lg);
    border-top: 1px solid var(--separator-color);
    font-size: var(--text-footnote);
    color: var(--label-secondary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.admin-info-sidebar i { color: var(--system-orange); }
.user-info-sidebar i  { color: var(--system-blue); }

/* Sidebar resizer */
.sidebar-resizer {
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    cursor: ew-resize;
    user-select: none;
    transition: background-color var(--transition-fast);
}

.sidebar-resizer:hover {
    background: var(--system-blue);
    opacity: 0.5;
}

/* ============================================================
   5. HAMBURGER MENU + OVERLAY (Mobile)
   ============================================================ */

.hamburger-menu {
    display: none;
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0;
    background: var(--bg-primary);
    border: 1px solid var(--separator-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    -webkit-tap-highlight-color: transparent;
    transition: transform var(--transition-fast),
                box-shadow var(--transition-fast);
}

.hamburger-menu:hover {
    box-shadow: var(--shadow-md);
}

.hamburger-menu:active {
    transform: scale(0.95);
}

.hamburger-menu span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--label-primary);
    border-radius: 1px;
    transition: transform var(--transition-fast), opacity var(--transition-fast);
}

/* Open state: X shape */
.hamburger-menu.open span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.hamburger-menu.open span:nth-child(2) { opacity: 0; }
.hamburger-menu.open span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

/* 移动端工具栏 */
.mobile-toolbar {
    display: none;
    position: fixed;
    top: 12px;
    right: 12px;
    gap: 8px;
    z-index: 9999;
    align-items: center;
}

.mobile-scan-btn {
    display: none;
    width: 40px;
    height: 40px;
    background: var(--system-blue);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #fff;
    transition: transform var(--transition-fast),
                box-shadow var(--transition-fast),
                background var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.mobile-scan-btn:hover {
    background: var(--system-blue);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.4);
    color: #fff;
}

.mobile-scan-btn:active {
    transform: scale(0.9);
    box-shadow: 0 2px 6px rgba(0, 122, 255, 0.3);
}

.mobile-scan-btn i {
    font-size: 17px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 9998;  /* 确保在内容之上，汉堡菜单之下 */
    opacity: 0;
    transition: opacity var(--transition-normal);
}

/* ============================================================
   6. CONTAINER / CARD
   ============================================================ */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-lg);
    box-sizing: border-box;
    width: 100%;
}

/* Primary card container — Apple sheet style */
.card-container {
    max-width: 820px;
    margin: 0 auto;
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--separator-color);
    animation: fadeInUp 0.5s var(--ease-default);
}

@media (prefers-color-scheme: dark) {
    .card-container {
        background: #1C1C1E;
        border-color: rgba(255,255,255,0.06);
    }
}

/* Glass variant — subtle frosted look on desktop only */
@supports (backdrop-filter: blur(20px)) {
    @media (min-width: 769px) {
        .container.glass {
            background: rgba(255, 255, 255, 0.72);
            backdrop-filter: saturate(180%) blur(20px);
            -webkit-backdrop-filter: saturate(180%) blur(20px);
            border: 1px solid rgba(255, 255, 255, 0.6);
            border-radius: var(--radius-xl);
            box-shadow: var(--shadow-sm);
        }
    }
}

/* ============================================================
   7. HEADINGS — Clear visual hierarchy
   ============================================================ */

h1, h2, h3, h4, h5, h6 {
    color: var(--label-primary);
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0 0 var(--space-lg) 0;
    line-height: 1.25;
}

h1 {
    font-size: var(--text-title1);
    margin-bottom: var(--space-xl);
}

h2 {
    font-size: var(--text-title2);
}

h3 {
    font-size: var(--text-title3);
}

/* Section title with subtle bottom separator (Apple-style) */
.section-title {
    font-size: var(--text-headline);
    font-weight: 600;
    color: var(--label-primary);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--separator-color);
    margin-bottom: var(--space-lg);
}

/* Gradient text accent — Apple-style promotional text */
.gradient-text {
    background: linear-gradient(135deg, #007AFF 0%, #5856D6 50%, #AF52DE 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

/* ============================================================
   8. BUTTONS — Pill shape, clear primary/secondary/success/danger
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 10px 20px;
    min-height: 40px;   /* HIG: minimum 40pt */
    border: none;
    border-radius: var(--radius-full);  /* pill shape */
    font-family: inherit;
    font-size: var(--text-subhead);
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: background-color var(--transition-fast),
                transform var(--transition-fast),
                box-shadow var(--transition-fast),
                opacity var(--transition-fast);
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.97);
}

.btn[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Primary — Filled blue (standard iOS button) */
.btn-primary {
    background: var(--system-blue);
    color: #FFFFFF;
    box-shadow: 0 1px 2px rgba(0, 122, 255, 0.25);
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: #FFFFFF;
    box-shadow: 0 2px 6px rgba(0, 122, 255, 0.35);
}

/* Secondary — Translucent blue background (iOS secondary) */
.btn-secondary {
    background: var(--primary-alpha);
    color: var(--system-blue);
    font-weight: 600;
}

.btn-secondary:hover {
    background: rgba(0, 122, 255, 0.20);
    color: var(--system-blue);
}

/* Success / Green (Go button) */
.btn-success {
    background: var(--system-green);
    color: #FFFFFF;
}

.btn-success:hover {
    background: #28A745;
    color: #FFFFFF;
}

/* Danger / Red */
.btn-danger {
    background: var(--system-red);
    color: #FFFFFF;
}

.btn-danger:hover {
    background: #D70015;
    color: #FFFFFF;
}

/* Ghost / minimal */
.btn-ghost {
    background: transparent;
    color: var(--system-blue);
    padding: 8px 14px;
}

.btn-ghost:hover { background: var(--primary-alpha); }

/* Button group */
.btn-group {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin-top: var(--space-xl);
}

/* ============================================================
   9. FORM INPUTS — Clean, rounded, focus ring
   ============================================================ */

.form-group {
    margin-bottom: var(--space-xl);
}

label {
    display: block;
    margin-bottom: var(--space-sm);
    font-size: var(--text-footnote);
    font-weight: 600;
    color: var(--label-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="number"],
input[type="file"],
textarea,
select {
    width: 100%;
    padding: 12px 16px;
    font-family: inherit;
    font-size: var(--text-body);
    color: var(--label-primary);
    background: var(--bg-primary);
    border: 1px solid var(--separator-color);
    border-radius: var(--radius-lg);
    transition: border-color var(--transition-fast),
                box-shadow var(--transition-fast),
                background-color var(--transition-fast);
    -webkit-appearance: none;
    appearance: none;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--system-blue);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.15);
}

textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

/* File upload drop zone style */
.form-control-file {
    padding: var(--space-xl);
    border: 2px dashed var(--separator-color);
    border-radius: var(--radius-xl);
    background: var(--bg-primary);
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition-fast),
                background-color var(--transition-fast);
}

.form-control-file:hover {
    border-color: var(--system-blue);
    background: var(--primary-alpha);
}

/* ============================================================
   10. ALERTS / MESSAGES
   ============================================================ */

.alert {
    padding: var(--space-lg) var(--space-xl);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-lg);
    font-size: var(--text-subhead);
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.alert::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 20px;
    flex-shrink: 0;
}

.alert-success {
    background: rgba(52, 199, 89, 0.12);
    color: var(--system-green);
    border: 1px solid rgba(52, 199, 89, 0.25);
}
.alert-success::before { content: "\f058"; }  /* fa-circle-check */

.alert-info {
    background: var(--primary-alpha);
    color: var(--system-blue);
    border: 1px solid rgba(0, 122, 255, 0.25);
}
.alert-info::before { content: "\f05a"; }  /* fa-circle-info */

.alert-error {
    background: rgba(255, 59, 48, 0.12);
    color: var(--system-red);
    border: 1px solid rgba(255, 59, 48, 0.25);
}
.alert-error::before { content: "\f06a"; }

/* ============================================================
   11. LIST GROUPS — Apple grouped-list style
   ============================================================ */

.list-group {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    overflow: hidden;
    border: 1px solid var(--separator-color);
    box-shadow: var(--shadow-sm);
}

.list-group-item {
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid var(--separator-color);
    font-size: var(--text-body);
    color: var(--label-primary);
    transition: background-color var(--transition-fast);
}

.list-group-item:last-child { border-bottom: none; }
.list-group-item:hover    { background: var(--system-gray6); }

/* ============================================================
   12. CARD COMPONENT
   ============================================================ */

.card,
.courseware-card,
.album-card,
.media-card {
    background: var(--bg-primary);
    border: 1px solid var(--separator-color);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-normal),
                box-shadow var(--transition-normal);
    overflow: hidden;
}

.courseware-card:hover,
.album-card:hover,
.media-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ============================================================
   13. TAG / BADGE / CHIP
   ============================================================ */

.tag,
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: var(--text-footnote);
    font-weight: 600;
    background: var(--system-gray6);
    color: var(--label-secondary);
    transition: transform var(--transition-fast);
}

.tag:hover { transform: scale(1.05); }

.badge-primary { background: var(--primary-alpha); color: var(--system-blue); }
.badge-success { background: rgba(52, 199, 89, 0.15); color: var(--system-green); }
.badge-warning { background: rgba(255, 149, 0, 0.15); color: var(--system-orange); }
.badge-danger  { background: rgba(255, 59, 48, 0.15); color: var(--system-red); }

/* ============================================================
   14. TAB / SEGMENTED CONTROL — Apple segmented control
   ============================================================ */

.segmented-control {
    display: inline-flex;
    background: var(--system-gray6);
    border-radius: var(--radius-lg);
    padding: 2px;
    gap: 0;
}

.segmented-control button,
.segmented-control .segment {
    flex: 1;
    padding: 6px 16px;
    border: none;
    background: transparent;
    color: var(--label-secondary);
    font-family: inherit;
    font-size: var(--text-subhead);
    font-weight: 500;
    border-radius: calc(var(--radius-lg) - 2px);
    cursor: pointer;
    transition: background-color var(--transition-fast),
                color var(--transition-fast),
                box-shadow var(--transition-fast);
}

.segmented-control .segment.is-active,
.segmented-control button[aria-selected="true"] {
    background: #FFFFFF;
    color: var(--label-primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

@media (prefers-color-scheme: dark) {
    .segmented-control { background: #2C2C2E; }
    .segmented-control .segment.is-active { background: #1C1C1E; }
}

/* ============================================================
   15. ANIMATION UTILITIES
   ============================================================ */

.hover-lift {
    transition: transform var(--transition-normal),
                box-shadow var(--transition-normal);
}
.hover-lift:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.scroll-reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity var(--transition-slow), transform var(--transition-slow);
}
.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Respect reduced-motion preference (accessibility) */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   16. LOADING / PROGRESS (Apple spinner)
   ============================================================ */

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0, 122, 255, 0.25);
    border-top-color: var(--system-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* ============================================================
   17. MODAL DIALOG
   ============================================================ */

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(10px) saturate(1.2);
    -webkit-backdrop-filter: blur(10px) saturate(1.2);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s var(--ease-default);
}

.modal.is-open { display: flex; }

.modal-content {
    max-width: 92%;
    max-height: 88%;
    background: var(--bg-primary);
    border-radius: var(--radius-2xl);
    overflow: auto;
    padding: var(--space-2xl);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04),
                0 20px 50px rgba(0, 0, 0, 0.15),
                0 50px 120px rgba(0, 0, 0, 0.25);
    animation: fadeInUp 0.3s var(--ease-default);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ============================================================
   18. SIDEBAR MUSIC PLAYER (Sidebar inline mini player)
   — Kept functionally identical, visually HIG-clean
   ============================================================ */

.sidebar-music-player {
    padding: var(--space-lg);
    border-top: 1px solid var(--separator-color);
    background: var(--bg-secondary);
    font-family: inherit;
    animation: fadeInUp 0.3s var(--ease-default);
}

.smp-song {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    transition: all 0.2s var(--ease-default);
    cursor: pointer;
    background: var(--system-gray6);
    border: 1px solid var(--separator-color);
}
.smp-song:hover {
    background: var(--system-gray5);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.smp-icon {
    color: var(--system-blue);
    font-size: 14px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.smp-name {
    font-size: var(--text-callout);
    color: var(--label-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    font-weight: 500;
}

/* 迷你播放器的展开箭头 - 明显提示可点击 */
.smp-arrow {
    color: var(--label-tertiary);
    font-size: 10px;
    opacity: 0.7;
    transition: all 0.2s var(--ease-default);
    flex-shrink: 0;
}
.smp-song:hover .smp-arrow {
    color: var(--system-blue);
    opacity: 1;
    transform: translateX(2px);
}

/* 侧边栏底部的迷你播放器整体样式优化 */
.sidebar-music-player .smp-song::before {
    content: "♫";
    font-size: 11px;
    color: var(--system-blue);
    margin-right: 2px;
    flex-shrink: 0;
    animation: gp-fade-pulse 2s ease-in-out infinite;
}

@keyframes gp-fade-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* 侧边栏底部的播放列表提示文字 */
.sidebar-music-player .smp-song .smp-arrow::after {
    content: "列表";
    font-size: 10px;
    margin-left: 4px;
    color: var(--label-tertiary);
}

.smp-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.smp-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--separator-color);
    background: var(--bg-primary);
    color: var(--label-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.15s;
}

.smp-btn:hover {
    background: var(--system-gray6);
    color: var(--label-primary);
    border-color: var(--label-tertiary);
}

.smp-play {
    width: 40px;
    height: 40px;
    font-size: 14px;
    background: var(--primary-alpha);
    color: var(--system-blue);
    border-color: transparent;
    transition: all 0.2s var(--ease-default);
}
.smp-play:hover { background: rgba(0, 122, 255, 0.20); color: var(--system-blue); }

/* 缓冲/加载指示器 */
.smp-loading {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    color: var(--system-blue);
    font-size: 14px;
    flex-shrink: 0;
}

/* 等待继续播放的脉冲提示（autoplay 被拦截时） */
.smp-play.gp-pending {
    animation: gp-pulse 1.4s ease-in-out infinite;
    background: rgba(255, 204, 0, 0.15);
    color: #b58900;
    box-shadow: 0 0 0 0 rgba(255, 204, 0, 0.4);
}
.smp-play.gp-pending:hover {
    background: rgba(255, 204, 0, 0.25);
    color: #8a6d00;
}

@keyframes gp-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(255, 204, 0, 0.5); transform: scale(1); }
    50%  { box-shadow: 0 0 0 8px rgba(255, 204, 0, 0.05); transform: scale(1.05); }
    100% { box-shadow: 0 0 0 0 rgba(255, 204, 0, 0); transform: scale(1); }
}

.smp-progress {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.smp-time {
    font-size: 11px;
    color: var(--label-tertiary);
    font-family: var(--font-mono);
    min-width: 32px;
    flex-shrink: 0;
}

.smp-slider {
    flex: 1;
    height: 3px;
    border-radius: 2px;
    background: var(--fill-primary);
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    cursor: pointer;
}

.smp-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--system-blue);
    border: 2px solid #FFFFFF;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}

/* ============================================================
   GLOBAL TOAST — 添加到播放列表等操作的提示
   ============================================================ */
.gp-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px) scale(0.95);
    padding: 14px 28px;
    background: #1d1d1f;
    color: #f5f5f7;
    border-radius: 980px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15),
                0 10px 30px rgba(0, 0, 0, 0.2),
                0 0 0 1px rgba(0, 0, 0, 0.05);
    z-index: 2147483647;
    opacity: 0;
    transition: opacity 0.2s cubic-bezier(0.25, 0.1, 0.25, 1),
                transform 0.25s cubic-bezier(0.25, 0.1, 0.25, 1);
    pointer-events: none;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: calc(100vw - 40px);
    overflow: hidden;
    text-overflow: ellipsis;
}

.gp-toast::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 14px;
    flex-shrink: 0;
}

.gp-toast--show {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
}

.gp-toast--success {
    background: #1d1d1f;
    color: #f5f5f7;
}
.gp-toast--success::before {
    content: "\f058";
    color: var(--system-green);
}

.gp-toast--error {
    background: #1d1d1f;
}
.gp-toast--error::before {
    content: "\f057";
    color: var(--system-red);
}

.gp-toast--info {
    background: #1d1d1f;
}
.gp-toast--info::before {
    content: "\f05a";
    color: var(--system-blue);
}

/* 添加到播放队列按钮样式 - 蓝色渐变醒目按钮 */
.action-btn-play,
.gp-play-btn,
.play-btn {
    background: linear-gradient(135deg, var(--system-blue) 0%, #0a84ff 50%, #5f5fff 100%) !important;
    color: #ffffff !important;
    border: 1px solid rgba(0, 122, 255, 0.3) !important;
    transition: all 0.25s cubic-bezier(0.25, 0.1, 0.25, 1) !important;
    box-shadow: 0 1px 3px rgba(0, 122, 255, 0.2),
                0 2px 6px rgba(0, 122, 255, 0.1);
}

.action-btn-play:hover,
.gp-play-btn:hover,
.play-btn:hover {
    background: linear-gradient(135deg, #0077ff 0%, #0a84ff 50%, #6b6fff 100%) !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 122, 255, 0.3),
                0 4px 12px rgba(0, 122, 255, 0.2);
}

.action-btn-play:active,
.play-btn:active {
    transform: translateY(0);
}

.action-btn-play i {
    color: #ffffff !important;
}

/* 迷你播放器播放按钮特殊样式 */
.smp-play {
    font-weight: 600;
    transition: all 0.2s var(--ease-default);
}

.smp-play:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.25);
}

/* 深色模式下 toast 和播放按钮的微调 */
@media (prefers-color-scheme: dark) {
    .gp-toast {
        background: #2c2c2e;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3),
                    0 10px 30px rgba(0, 0, 0, 0.5),
                    0 0 0 1px rgba(255, 255, 255, 0.06);
    }
    .gp-toast--success { background: #2c2c2e; }
    .gp-toast--error { background: #2c2c2e; }
    .gp-toast--info { background: #2c2c2e; }

    /* 深色模式下播放按钮保持蓝色渐变 */
    .action-btn-play,
    .gp-play-btn,
    .play-btn {
        border-color: rgba(10, 132, 255, 0.5) !important;
    }

    .action-btn-play:hover,
    .gp-play-btn:hover,
    .play-btn:hover {
        box-shadow: 0 2px 8px rgba(10, 132, 255, 0.4),
                    0 4px 16px rgba(10, 132, 255, 0.3);
    }
}

.smp-slider::-moz-range-thumb {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--system-blue);
    border: 2px solid #FFFFFF;
    cursor: pointer;
}

/* ============================================================
   19. GLOBAL PLAYLIST MODAL — Elevated music panel
   ============================================================ */

.gp-playlist-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(14px) saturate(1.4);
    -webkit-backdrop-filter: blur(14px) saturate(1.4);
    z-index: 2147483647;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s var(--ease-default);
    overscroll-behavior: contain;
    touch-action: none;
}

.gp-playlist-modal[style*="display: flex"] {
    display: flex !important;
}

/* 关闭动画：遮罩淡出 + 内容向下位移缩小 */
.gp-playlist-modal.is-closing {
    animation: fadeOut 0.25s var(--ease-default) forwards;
}

.gp-playlist-modal.is-closing .gp-pl-modal-content {
    animation: fadeOutDown 0.25s var(--ease-default) forwards;
}

@keyframes fadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

@keyframes fadeOutDown {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to   { opacity: 0; transform: translateY(14px) scale(0.96); }
}

@media (prefers-reduced-motion: reduce) {
    .gp-playlist-modal.is-closing,
    .gp-playlist-modal.is-closing .gp-pl-modal-content {
        animation: none;
    }
}

.gp-pl-modal-content {
    width: 440px;
    max-width: 92%;
    max-height: 72vh;
    height: auto;
    background: var(--bg-primary);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06),
                0 10px 30px rgba(0, 0, 0, 0.15),
                0 40px 80px rgba(0, 0, 0, 0.25);
    animation: fadeInUp 0.3s var(--ease-default);
    position: relative;
    overscroll-behavior: contain;
}

/* Header */
.gp-pl-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--separator-color);
    background: linear-gradient(180deg, rgba(0, 122, 255, 0.04) 0%, transparent 100%);
}

.gp-pl-modal-header h3 {
    margin: 0;
    font-size: 19px;
    font-weight: 700;
    color: var(--label-primary);
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.gp-pl-modal-header h3 i {
    color: var(--system-blue);
    font-size: 18px;
}

.gp-pl-modal-header h3 span {
    font-size: 13px;
    font-weight: 500;
    color: var(--label-secondary);
    background: var(--system-gray6);
    padding: 4px 10px;
    border-radius: 8px;
    margin-left: 4px;
}

.gp-panel-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.gp-panel-header-actions button {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: none;
    background: var(--system-gray6);
    color: var(--label-secondary);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s var(--ease-default);
}

.gp-panel-header-actions button:hover {
    background: var(--system-gray5);
    color: var(--label-primary);
    transform: scale(1.05);
}

.gp-panel-header-actions button:active {
    transform: scale(0.96);
}

.gp-panel-header-actions #gpRepeatBtn.active {
    background: var(--primary-alpha);
    color: var(--system-blue);
}

.gp-panel-header-actions .modal-close {
    font-size: 18px;
    font-weight: 400;
    line-height: 1;
    background: transparent;
}

.gp-panel-header-actions .modal-close:hover {
    background: var(--system-red);
    color: #fff;
}

/* Playlist list */
.gp-playlist-list {
    flex: 1;
    max-height: 52vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
}

.gp-playlist-list::-webkit-scrollbar {
    width: 8px;
}

.gp-playlist-list::-webkit-scrollbar-track {
    background: transparent;
}

.gp-playlist-list::-webkit-scrollbar-thumb {
    background: var(--fill-tertiary);
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.gp-playlist-list::-webkit-scrollbar-thumb:hover {
    background: var(--fill-secondary);
    background-clip: padding-box;
}

.gp-pl-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    cursor: pointer;
    margin-bottom: 4px;
    transition: all 0.15s var(--ease-default);
    border: 1px solid transparent;
}

.gp-pl-item:last-child {
    margin-bottom: 0;
}

.gp-pl-item:hover {
    background: var(--system-gray6);
    transform: translateX(2px);
}

.gp-pl-item--current {
    background: var(--primary-alpha);
    border-color: rgba(0, 122, 255, 0.2);
}

.gp-pl-item--current:hover {
    background: rgba(0, 122, 255, 0.18);
}

.gp-pl-item--dragging {
    opacity: 0.5;
    transform: scale(0.98);
}

.gp-pl-item--over {
    background: var(--system-gray5);
    border-color: var(--system-blue);
}

.gp-pl-num {
    font-size: 13px;
    font-weight: 600;
    color: var(--label-tertiary);
    min-width: 20px;
    font-family: var(--font-mono);
}

.gp-pl-item--current .gp-pl-num {
    color: var(--system-blue);
}

.gp-pl-name {
    flex: 1;
    font-size: 15px;
    font-weight: 500;
    color: var(--label-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
}

.gp-pl-item--current .gp-pl-name {
    font-weight: 700;
    color: var(--system-blue);
}

.gp-pl-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0.6;
    transition: opacity 0.15s var(--ease-default);
}

.gp-pl-item:hover .gp-pl-actions {
    opacity: 1;
}

.gp-pl-item--current .gp-pl-actions {
    opacity: 1;
}

.gp-pl-actions button {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--label-secondary);
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.1s var(--ease-default);
}

.gp-pl-actions button:hover {
    background: rgba(0, 0, 0, 0.08);
    color: var(--label-primary);
}

.gp-pl-actions .gp-pl-play:hover {
    background: var(--primary-alpha);
    color: var(--system-blue);
}

.gp-pl-actions .gp-pl-del:hover {
    background: rgba(255, 59, 48, 0.12);
    color: var(--system-red);
}

/* Empty state */
.gp-pl-empty {
    text-align: center;
    padding: 60px 24px;
    color: var(--label-secondary);
}

.gp-pl-empty i {
    font-size: 48px;
    color: var(--label-tertiary);
    margin-bottom: 16px;
    display: block;
}

.gp-pl-empty p {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--label-primary);
}

.gp-pl-empty .gp-pl-hint {
    font-size: 13px;
    font-weight: 400;
    color: var(--label-secondary);
    margin-top: 6px;
}

/* ============================================================
   20. RESPONSIVE — Tablet, Mobile
   ============================================================ */

/* Tablet: narrow sidebar, slightly smaller main padding */
@media (min-width: 769px) and (max-width: 1100px) {
    .sidebar { width: 200px; }
    .main-content,
    .page-content { margin-left: 200px; padding: var(--space-lg); }
    .container { padding: var(--space-md); }
}

/* Mobile: sidebar becomes slide-over, full width content */
@media (max-width: 768px) {
    .mobile-toolbar { display: flex; }
    .hamburger-menu { display: flex; }
    .mobile-scan-btn { display: flex; }

    .app-container { flex-direction: column; }

    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        border-right: 1px solid var(--separator-color);
        box-shadow: var(--shadow-xl);
        transition: left var(--transition-normal);
    }

    .sidebar.open { left: 0; }

    .sidebar-overlay.show {
        display: block;
        opacity: 1;
    }

    .main-content {
        margin-left: 0;
        padding: 72px var(--space-md) var(--space-xl);
        width: 100%;
    }

    .page-content {
        margin-left: 0;
        padding: 72px var(--space-md) var(--space-xl);
    }

    .container { padding: 0; max-width: 100%; }

    .container.glass {
        background: transparent;
        border: none;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .card-container {
        padding: var(--space-lg);
        border-radius: var(--radius-xl);
    }

    h1 { font-size: var(--text-title2); }
    h2 { font-size: var(--text-title3); }

    .btn {
        width: 100%;
        min-height: 48px; /* larger touch target on mobile */
        font-size: var(--text-body);
    }

    .btn-group { flex-direction: column; }

    /* Mobile floating player */
    .sidebar-music-player {
        position: fixed;
        bottom: var(--space-lg);
        right: var(--space-lg);
        left: auto;
        z-index: 201;
        background: rgba(255,255,255,0.96);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-radius: 50px;
        padding: 0;
        border: 1px solid var(--separator-color);
        box-shadow: var(--shadow-md);
        width: 48px;
        height: 48px;
        align-items: center;
        justify-content: center;
        display: flex;
        overflow: hidden;
    }
    .sidebar-music-player::before {
        content: "\f001"; font-family: "Font Awesome 6 Free"; font-weight: 900;
        font-size: 18px; color: var(--system-blue);
    }
    .sidebar-music-player.smp-playing::before { animation: pulse 1.5s ease-in-out infinite; }
    .sidebar-music-player .smp-song,
    .sidebar-music-player .smp-controls,
    .sidebar-music-player .smp-progress { display: none; }

    .sidebar-music-player.smp-expanded {
        width: min(360px, calc(100vw - 32px));
        height: auto;
        border-radius: var(--radius-xl);
        padding: var(--space-lg);
        display: block;
    }
    .sidebar-music-player.smp-expanded::before { display: none; }
    .sidebar-music-player.smp-expanded .smp-song,
    .sidebar-music-player.smp-expanded .smp-controls,
    .sidebar-music-player.smp-expanded .smp-progress { display: flex; }

    /* Mobile playlist modal */
    .gp-pl-modal-content {
        width: 100%;
        max-width: calc(100vw - 32px);
        max-height: calc(100vh - 32px);
        border-radius: 16px;
    }

    .gp-pl-modal-header {
        padding: 16px 18px;
    }

    .gp-pl-modal-header h3 {
        font-size: 17px;
    }

    .gp-pl-modal-header h3 span {
        font-size: 12px;
        padding: 3px 8px;
    }

    .gp-panel-header-actions button {
        width: 36px;
        height: 36px;
    }

    .gp-pl-item {
        padding: 12px 14px;
    }

    .gp-pl-name {
        font-size: 14px;
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.5; }
}

/* ============================================================
   20. HERO SECTION — Used on homepage / landing
   ============================================================ */

.hero-section {
    background: var(--bg-primary);
    border-radius: var(--radius-2xl);
    padding: var(--space-3xl) var(--space-2xl);
    margin-bottom: var(--space-2xl);
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--separator-color);
    animation: fadeInUp 0.6s var(--ease-default);
}

.hero-title {
    font-size: var(--text-large-title);
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #007AFF 0%, #5856D6 50%, #AF52DE 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    margin-bottom: var(--space-lg);
    line-height: 1.1;
}

.hero-subtitle {
    font-size: var(--text-headline);
    color: var(--label-secondary);
    margin-bottom: var(--space-xl);
    font-weight: 400;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 768px) {
    .hero-section {
        padding: var(--space-2xl) var(--space-lg);
        border-radius: var(--radius-xl);
        margin: 0 0 var(--space-xl) 0;
    }
    .hero-title { font-size: var(--text-title1); }
    .hero-subtitle { font-size: var(--text-subhead); }
}

/* ============================================================
   21. FEATURE GRID — Homepage feature cards
   ============================================================ */

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-2xl);
}

.feature-card {
    background: var(--bg-primary);
    border: 1px solid var(--separator-color);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl) var(--space-xl);
    text-align: center;
    transition: transform var(--transition-normal),
                box-shadow var(--transition-normal);
}

.feature-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.feature-card i {
    font-size: 36px;
    color: var(--system-blue);
    margin-bottom: var(--space-md);
    display: block;
}

.feature-card h3 {
    font-size: var(--text-headline);
    margin-bottom: var(--space-sm);
}

.feature-card p {
    color: var(--label-secondary);
    font-size: var(--text-subhead);
    margin: 0;
}

/* ============================================================
   22. STATISTICS CHIPS — Numbers with labels
   ============================================================ */

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--space-lg);
    margin-top: var(--space-xl);
}

.stat-card {
    background: var(--bg-primary);
    border: 1px solid var(--separator-color);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    text-align: center;
}

.stat-number {
    font-size: var(--text-title1);
    font-weight: 700;
    color: var(--system-blue);
    letter-spacing: -0.02em;
    display: block;
    margin-bottom: 2px;
}

.stat-label {
    font-size: var(--text-footnote);
    color: var(--label-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ============================================================
   23. UTILITY — Helpful utility classes
   ============================================================ */

.apple-shadow  { box-shadow: var(--shadow-sm); }
.apple-shadow:hover { box-shadow: var(--shadow-md); }

.muted { color: var(--label-secondary); }
.text-small { font-size: var(--text-footnote); }
.mt-0 { margin-top: 0; }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-0 { margin-bottom: 0; }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.full-width { width: 100%; }
.rounded { border-radius: var(--radius-xl); }

/* ============================================================
   24. COURSEWARE-SPECIFIC — Used by courseware.php
   ============================================================ */

.courseware-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-lg);
}

.courseware-card {
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.courseware-card .card-body {
    padding: var(--space-sm) 0 0;
}

.courseware-card h3 {
    font-size: var(--text-headline);
    margin-bottom: var(--space-xs);
}

.courseware-card .card-meta {
    font-size: var(--text-footnote);
    color: var(--label-secondary);
    margin-bottom: var(--space-md);
}

.courseware-card .card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-top: auto;
}

.courseware-card .card-tags .tag {
    font-size: var(--text-caption2);
    padding: 3px 8px;
}

/* ============================================================
   25. CLOUD DISK — File list style (used with cloud_disk.css)
   ============================================================ */

.file-list {
    background: var(--bg-primary);
    border: 1px solid var(--separator-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.file-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid var(--separator-color);
    transition: background-color var(--transition-fast);
}

.file-item:last-child { border-bottom: none; }
.file-item:hover { background: var(--system-gray6); }

.file-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--primary-alpha);
    color: var(--system-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.file-info { flex: 1; min-width: 0; }
.file-name {
    font-size: var(--text-body);
    font-weight: 600;
    color: var(--label-primary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.file-meta {
    font-size: var(--text-footnote);
    color: var(--label-tertiary);
}

.file-actions {
    display: flex;
    gap: var(--space-xs);
    flex-shrink: 0;
}

/* ============================================================
   26. VPN PAGE (lan_vpn.php) style supplements
   ============================================================ */

.vpn-room-card {
    background: var(--bg-primary);
    border: 1px solid var(--separator-color);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-normal),
                transform var(--transition-normal);
}

.vpn-room-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.vpn-room-card.is-running {
    border-color: rgba(52, 199, 89, 0.35);
    box-shadow: 0 0 0 1px rgba(52, 199, 89, 0.15), var(--shadow-md);
}

.vpn-room-card h3 {
    font-size: var(--text-headline);
    margin-bottom: var(--space-sm);
}

.vpn-room-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-footnote);
    font-weight: 600;
    color: var(--label-secondary);
}
.vpn-room-status::before {
    content: "";
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--system-gray);
}
.vpn-room-card.is-running .vpn-room-status {
    color: var(--system-green);
}
.vpn-room-card.is-running .vpn-room-status::before {
    background: var(--system-green);
    box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.15);
}

/* ============================================================
   27. HIG VISUAL ENHANCEMENT — Apple-style polish pass
   (Purely visual; no class renames, no functional change)
   ============================================================ */

/* ————— Body typography polish ————— */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "kern", "liga";
}

/* Numbers use tabular (equal-width) digits for alignment in stats,
   file sizes, peer counts, etc. */
.stat-number,
.smp-time,
.file-meta {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* ————— Cards: more layered, less flat ————— */
.card,
.courseware-card,
.album-card,
.media-card,
.feature-card,
.stat-card,
.vpn-room-card,
.card-container {
    /* Soft highlight on top edge → iOS-like layered surface */
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.02),
        0 1px 2px rgba(0, 0, 0, 0.04),
        0 6px 16px -8px rgba(0, 0, 0, 0.08);
    transition:
        transform 0.22s cubic-bezier(0.25, 0.1, 0.25, 1),
        box-shadow 0.22s cubic-bezier(0.25, 0.1, 0.25, 1),
        border-color 0.22s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.card:hover,
.courseware-card:hover,
.album-card:hover,
.media-card:hover,
.feature-card:hover,
.vpn-room-card:hover {
    transform: translateY(-2px);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.03),
        0 2px 6px rgba(0, 0, 0, 0.05),
        0 16px 32px -12px rgba(0, 0, 0, 0.12);
}

/* ————— Buttons: tactile feedback ————— */
.btn {
    /* Use a soft top-highlight gradient to mimic macOS/iOS push buttons */
    font-weight: 600;
    letter-spacing: 0.01em;
    -webkit-font-smoothing: antialiased;
    transition:
        transform 0.14s cubic-bezier(0.2, 0, 0.2, 1),
        box-shadow 0.14s cubic-bezier(0.2, 0, 0.2, 1),
        background-color 0.14s ease,
        color 0.14s ease,
        opacity 0.14s ease;
}

.btn-primary {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.25),
        0 1px 2px rgba(0, 122, 255, 0.25),
        0 4px 12px -2px rgba(0, 122, 255, 0.35);
}

.btn-primary:hover {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.25),
        0 2px 6px rgba(0, 122, 255, 0.35),
        0 8px 20px -4px rgba(0, 122, 255, 0.45);
}

.btn-success {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.25),
        0 1px 2px rgba(52, 199, 89, 0.25),
        0 4px 12px -2px rgba(52, 199, 89, 0.35);
}

.btn-danger {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.25),
        0 1px 2px rgba(255, 59, 48, 0.25),
        0 4px 12px -2px rgba(255, 59, 48, 0.35);
}

/* Button press (scale down slightly, like iOS tap) */
.btn:active {
    transform: scale(0.97);
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.08),
        0 1px 2px rgba(0, 0, 0, 0.06);
}

/* ————— Focus: unified Apple-style focus ring across focusable ————— */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.segment:focus-visible,
.nav-link:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.25);
}

/* ————— Form inputs: softer, rounded-12, filled style on hover ————— */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="number"],
input[type="file"],
textarea,
select {
    transition:
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        background-color 0.18s ease;
}

input[type="text"]:hover,
input[type="password"]:hover,
input[type="email"]:hover,
input[type="url"]:hover,
input[type="number"]:hover,
input[type="file"]:hover,
textarea:hover,
select:hover {
    border-color: rgba(60, 60, 67, 0.28);
}

/* Placeholder: softer, per Apple's muted secondary color */
::placeholder {
    color: rgba(60, 60, 67, 0.35);
    opacity: 1;
}

/* ————— Segmented control polish ————— */
.segmented-control {
    box-shadow:
        inset 0 0 0 1px rgba(0, 0, 0, 0.04),
        0 1px 2px rgba(0, 0, 0, 0.03);
}

/* ————— Links: subtle underlines that animate in ————— */
a {
    position: relative;
}

/* ————— Tag / badge: soft filled look ————— */
.tag,
.badge {
    -webkit-font-smoothing: antialiased;
}

/* ————— Tables: Apple-style grouped table (for audit/list pages) ————— */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-primary, #ffffff);
    border-radius: var(--radius-xl, 16px);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--separator-color, rgba(60,60,67,0.18));
    font-size: var(--text-body, 15px);
}

thead th {
    text-align: left;
    padding: 14px 18px;
    font-size: var(--text-footnote, 13px);
    font-weight: 600;
    color: var(--label-secondary, rgba(60,60,67,0.60));
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--bg-secondary, #f2f2f7);
    border-bottom: 1px solid var(--separator-color, rgba(60,60,67,0.18));
}

tbody td {
    padding: 14px 18px;
    color: var(--label-primary, #000);
    border-bottom: 1px solid rgba(60, 60, 67, 0.08);
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover { background: var(--system-gray6, #f2f2f7); }

/* ————— Scrollbars: thinner, macOS-like ————— */
@supports (scrollbar-width: thin) {
    * {
        scrollbar-width: thin;
        scrollbar-color: rgba(0, 0, 0, 0.20) transparent;
    }
}

*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.18);
    border-radius: 999px;
}
*::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.30); }
*::-webkit-scrollbar-track { background: transparent; }

/* ————— Responsive tweaks: small tablet + tighter hero ————— */
@media (min-width: 769px) and (max-width: 1100px) {
    .hero-section {
        padding: var(--space-2xl) var(--space-xl);
    }
    .hero-title { font-size: var(--text-title1); }
    .card-container { padding: var(--space-xl); }
}

@media (max-width: 480px) {
    .hero-section { padding: var(--space-xl) var(--space-lg); }
    .hero-title { font-size: var(--text-title2); }
    .stat-number { font-size: var(--text-title2); }
    .feature-grid { grid-template-columns: 1fr; }
    .courseware-grid { grid-template-columns: 1fr; gap: var(--space-md); }
}

/* ————— Dark mode refinement ————— */
@media (prefers-color-scheme: dark) {
    body { background: #000000; color: #f5f5f7; }

    .card,
    .courseware-card,
    .album-card,
    .media-card,
    .feature-card,
    .stat-card,
    .vpn-room-card,
    .card-container,
    .file-list,
    .list-group {
        background: #1c1c1e;
        border-color: rgba(255, 255, 255, 0.06);
        box-shadow:
            0 0 0 1px rgba(255, 255, 255, 0.03),
            0 1px 2px rgba(0, 0, 0, 0.35),
            0 10px 24px -10px rgba(0, 0, 0, 0.6);
    }

    .nav-link:hover { background: #2c2c2e; }
    tbody tr:hover { background: #2c2c2e; }
    thead th { background: #1c1c1e; color: rgba(235,235,245,0.6); }

    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="url"],
    input[type="number"],
    textarea,
    select {
        background: #1c1c1e;
        color: #f5f5f7;
        border-color: rgba(255, 255, 255, 0.12);
    }

    *::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.20); }
}

/* ————— Mobile dark mode player ————— */
@media (prefers-color-scheme: dark) and (max-width: 768px) {
    .sidebar-music-player {
        background: rgba(28,28,30,0.96) !important;
        border-color: rgba(255,255,255,0.08) !important;
    }
    .sidebar-music-player::before {
        color: #0A84FF !important;
    }
    .sidebar-music-player.smp-expanded {
        background: rgba(28,28,30,0.96) !important;
        border-color: rgba(255,255,255,0.08) !important;
    }
    .sidebar-music-player.smp-expanded .smp-song {
        background: #2C2C2E !important;
        border-color: rgba(255,255,255,0.08) !important;
    }
    .sidebar-music-player.smp-expanded .smp-name {
        color: #F5F5F7 !important;
    }
    .sidebar-music-player.smp-expanded .smp-btn {
        background: #2C2C2E !important;
        color: rgba(235,235,245,0.6) !important;
        border-color: rgba(255,255,255,0.08) !important;
    }
    .sidebar-music-player.smp-expanded .smp-btn:hover {
        background: #3A3A3C !important;
        color: #F5F5F7 !important;
    }
    .sidebar-music-player.smp-expanded .smp-time {
        color: rgba(235,235,245,0.4) !important;
    }
    .sidebar-music-player.smp-expanded .smp-slider {
        background: #3A3A3C !important;
    }
}

/* ============================================================
   END
   ============================================================ */

/* ============================================================
   暗色模式补丁 — 修复遗漏的白色背景和文字颜色
   ============================================================ */
@media (prefers-color-scheme: dark) {
    /* Glass 效果暗色适配 */
    .container.glass {
        background: rgba(28, 28, 30, 0.72) !important;
        border: 1px solid rgba(255, 255, 255, 0.08) !important;
    }

    /* 移动端浮动播放器（非768px媒体查询内的情况） */
    .sidebar-music-player {
        background: rgba(28, 28, 30, 0.96) !important;
        border-color: rgba(255, 255, 255, 0.08) !important;
    }

    /* 分段控件激活态 */
    .segmented-control .segment.is-active,
    .segmented-control button[aria-selected="true"] {
        background: #1C1C1E !important;
        color: #FFFFFF !important;
    }

    /* 滑块拇指 */
    .smp-slider::-moz-range-thumb {
        border: 2px solid #FFFFFF;
    }

    /* 表格 */
    table { background: transparent; }
    thead th {
        background: #1C1C1E !important;
        color: rgba(235, 235, 245, 0.6) !important;
        border-bottom-color: rgba(255, 255, 255, 0.08) !important;
    }
    tbody tr {
        border-bottom-color: rgba(255, 255, 255, 0.06) !important;
    }
    tbody tr:hover {
        background: rgba(255, 255, 255, 0.04) !important;
    }
    td { color: var(--label-primary); }

    /* 模态框 */
    .modal-content {
        background: #1C1C1E !important;
        color: #F5F5F7 !important;
        border: 1px solid rgba(255, 255, 255, 0.08) !important;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5) !important;
    }
    .modal-header {
        border-bottom-color: rgba(255, 255, 255, 0.08) !important;
    }
    .modal-footer {
        border-top-color: rgba(255, 255, 255, 0.08) !important;
    }

    /* 通用卡片/容器兜底 */
    .card,
    .courseware-card,
    .album-card,
    .media-card,
    .feature-card,
    .stat-card,
    .vpn-room-card,
    .file-list,
    .list-group,
    .upload-area,
    .cloud-header,
    .cloud-toolbar,
    .cloud-content {
        background: #1C1C1E !important;
        border-color: rgba(255, 255, 255, 0.06) !important;
        color: #F5F5F7 !important;
    }

    /* 上传区域 */
    .upload-area {
        border: 2px dashed rgba(255, 255, 255, 0.15) !important;
        background: rgba(28, 28, 30, 0.5) !important;
    }
    .upload-area:hover {
        border-color: #0A84FF !important;
        background: rgba(10, 132, 255, 0.08) !important;
    }

    /* 空状态 */
    .empty-state {
        background: #1C1C1E !important;
        border-color: rgba(255, 255, 255, 0.06) !important;
        color: rgba(235, 235, 245, 0.4) !important;
    }

    /* 分页 */
    .page-btn,
    .pagination a,
    .pagination span {
        background: #1C1C1E !important;
        border-color: rgba(255, 255, 255, 0.08) !important;
        color: rgba(235, 235, 245, 0.6) !important;
    }
    .page-btn:hover,
    .pagination a:hover {
        background: #2C2C2E !important;
        color: #0A84FF !important;
    }
    .page-btn.active,
    .pagination .current {
        background: #0A84FF !important;
        color: #FFFFFF !important;
        border-color: #0A84FF !important;
    }

    /* 下拉菜单 */
    .dropdown-menu {
        background: #1C1C1E !important;
        border: 1px solid rgba(255, 255, 255, 0.08) !important;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5) !important;
    }
    .dropdown-item {
        color: #F5F5F7 !important;
    }
    .dropdown-item:hover {
        background: #2C2C2E !important;
    }

    /* 标签/徽章 */
    .badge {
        background: #2C2C2E !important;
        color: rgba(235, 235, 245, 0.8) !important;
    }

    /* 代码块 */
    pre, code {
        background: #1C1C1E !important;
        color: #F5F5F7 !important;
        border: 1px solid rgba(255, 255, 255, 0.06) !important;
    }

    /* 提示框 */
    .alert {
        background: #1C1C1E !important;
        border: 1px solid rgba(255, 255, 255, 0.08) !important;
        color: #F5F5F7 !important;
    }
    .alert-info {
        background: rgba(10, 132, 255, 0.12) !important;
        border-color: rgba(10, 132, 255, 0.3) !important;
        color: #64D2FF !important;
    }
    .alert-warning {
        background: rgba(255, 159, 10, 0.12) !important;
        border-color: rgba(255, 159, 10, 0.3) !important;
        color: #FFD60A !important;
    }
    .alert-success {
        background: rgba(48, 209, 88, 0.12) !important;
        border-color: rgba(48, 209, 88, 0.3) !important;
        color: #30D158 !important;
    }
    .alert-error {
        background: rgba(255, 69, 58, 0.12) !important;
        border-color: rgba(255, 69, 58, 0.3) !important;
        color: #FF453A !important;
    }

    /* 课件PPT容器 */
    .ppt-container {
        background: #1C1C1E !important;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5) !important;
    }

    /* 房间卡片 */
    .vpn-room-card {
        background: #1C1C1E !important;
        border-color: rgba(255, 255, 255, 0.06) !important;
    }
    .vpn-room-card:hover {
        background: #2C2C2E !important;
    }

    /* 上下文菜单 */
    .context-menu {
        background: #1C1C1E !important;
        border: 1px solid rgba(255, 255, 255, 0.06) !important;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5) !important;
    }

    /* Tooltip */
    .tooltip {
        background: #2C2C2E !important;
        color: #F5F5F7 !important;
    }

    /* 链接颜色 */
    a { color: #0A84FF; }
    a:hover { color: #64D2FF; }

    /* 硬编码文字颜色修复 */
    .cloud-title,
    .file-name,
    .section-title,
    h1, h2, h3, h4, h5, h6 {
        color: #F5F5F7 !important;
    }
    .file-meta,
    .storage-text,
    .text-secondary,
    .text-muted {
        color: rgba(235, 235, 245, 0.6) !important;
    }
}
