/* ========================================
   可视化教学平台 - 样式文件
   白色为主，蓝色点缀，简洁现代风格
   ======================================== */

/* CSS 变量 */
:root {
    --primary-color: #3b82f6;
    --primary-dark: #1d4ed8;
    --primary-light: #60a5fa;
    --primary-bg: #eff6ff;
    
    /* 默认学科颜色（莫兰迪蓝） */
    --subject-color: #6b8cae;
    --subject-dark: #4a6d8c;
    --subject-light: #8fadc8;
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    
    --bg-white: #ffffff;
    --bg-light: #f8fafc;
    --bg-gray: #f1f5f9;
    
    --border-color: #e2e8f0;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    --transition: all 0.3s ease;
}

/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", 
                 "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", 
                 Helvetica, Arial, sans-serif;
    background: var(--bg-white);
    color: var(--text-primary);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* ========================================
   导航栏
   ======================================== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid transparent;
    transition: var(--transition);
}

.navbar.scrolled {
    border-bottom-color: var(--border-color);
    box-shadow: var(--shadow-sm);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.nav-logo i {
    font-size: 1.5rem;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 0.25rem;
    flex-wrap: wrap;
    overflow: visible;
}

.nav-link {
    padding: 0.5rem 0.6rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
    font-size: 0.9rem;
}

.nav-link:hover {
    color: var(--subject-color, var(--primary-color));
    background: rgba(107, 140, 174, 0.1);
}

.nav-link.active {
    color: var(--subject-color, var(--primary-color));
    background: rgba(107, 140, 174, 0.15);
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
}

/* 用户菜单 */
.user-menu {
    position: relative;
    margin-left: 1rem;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--primary-bg);
    border: none;
    border-radius: var(--radius-md);
    color: var(--primary-color);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.user-btn:hover {
    background: var(--primary-color);
    color: white;
}

.user-btn i {
    font-size: 1rem;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
    z-index: 1002;
}

.user-menu:hover .user-dropdown,
.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.user-dropdown-header .username {
    font-weight: 600;
    color: var(--text-primary);
}

.user-dropdown-header .expire-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.user-dropdown-header .expire-info.warning {
    color: #f59e0b;
}

.user-dropdown-header .expire-info.expired {
    color: #ef4444;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    transition: var(--transition);
    cursor: pointer;
}

.user-dropdown-item:hover {
    background: var(--bg-light);
    color: var(--primary-color);
}

.user-dropdown-item i {
    width: 16px;
    text-align: center;
}

.user-dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.25rem 0;
}

.login-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    background: var(--primary-color);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.login-btn:hover {
    background: var(--primary-dark);
}

/* ========================================
   主横幅区域
   ======================================== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 100px 2rem 60px;
    background: linear-gradient(135deg, var(--bg-white) 0%, var(--primary-bg) 100%);
    overflow: hidden;
}

.hero-content {
    flex: 1;
    max-width: 600px;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.hero-title .highlight {
    color: var(--primary-color);
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    line-height: 1.8;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.hero-image {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-graphic {
    position: relative;
    width: 400px;
    height: 400px;
}

.circle {
    position: absolute;
    border-radius: 50%;
    border: 3px solid var(--primary-light);
    animation: float 6s ease-in-out infinite;
}

.circle-1 {
    width: 300px;
    height: 300px;
    top: 50px;
    left: 50px;
    opacity: 0.3;
}

.circle-2 {
    width: 200px;
    height: 200px;
    top: 100px;
    left: 100px;
    border-color: var(--primary-color);
    opacity: 0.5;
    animation-delay: -2s;
}

.circle-3 {
    width: 100px;
    height: 100px;
    top: 150px;
    left: 150px;
    background: var(--primary-bg);
    border-color: var(--primary-color);
    animation-delay: -4s;
}

.math-symbol {
    position: absolute;
    font-size: 4rem;
    font-weight: 300;
    color: var(--primary-color);
    opacity: 0.6;
    animation: float 4s ease-in-out infinite;
}

.math-symbol { top: 20px; right: 50px; }
.symbol-2 { top: 200px; right: 20px; animation-delay: -1s; font-size: 3rem; }
.symbol-3 { bottom: 50px; left: 80px; animation-delay: -2s; font-size: 2.5rem; }

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

/* ========================================
   按钮样式
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-bg);
}

.btn-white {
    background: white;
    color: var(--primary-color);
}

.btn-white:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ========================================
   区块标题
   ======================================== */
.section-title {
    font-size: 2.25rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.section-title.text-left {
    text-align: left;
}

.section-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 3rem;
}

/* ========================================
   学科卡片区域
   ======================================== */
.subjects {
    padding: 6rem 0;
    background: var(--bg-white);
}

.subject-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}

.subject-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.subject-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-light);
}

.card-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    color: white;
    font-size: 1.5rem;
}

.subject-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.subject-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.card-arrow {
    position: absolute;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-bg);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.subject-card:hover .card-arrow {
    background: var(--primary-color);
    color: white;
    transform: translateX(5px);
}

/* ========================================
   关于GeoGebra
   ======================================== */
.about {
    padding: 6rem 0;
    background: var(--bg-light);
}

.about-content {
    display: flex;
    gap: 4rem;
    align-items: center;
}

.about-text {
    flex: 1;
}

.about-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.8;
}

.feature-list {
    list-style: none;
    margin-bottom: 2rem;
}

.feature-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.feature-list i {
    color: var(--primary-color);
    margin-top: 0.25rem;
}

.about-image {
    flex: 1;
    max-width: 100%;
}

.browser-mockup {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    max-width: 100%;
}

.browser-header {
    background: var(--bg-gray);
    padding: 0.75rem 1rem;
    display: flex;
    gap: 0.5rem;
}

.browser-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e2e8f0;
    flex-shrink: 0;
}

.browser-dot:nth-child(1) { background: #ef4444; }
.browser-dot:nth-child(2) { background: #f59e0b; }
.browser-dot:nth-child(3) { background: #22c55e; }

.browser-content {
    padding: 1.5rem;
}

.ggb-preview {
    position: relative;
    height: 200px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.axis {
    position: absolute;
    background: var(--text-light);
}

.axis-x {
    width: 100%;
    height: 2px;
    top: 50%;
}

.axis-y {
    width: 2px;
    height: 100%;
    left: 50%;
}

.function-curve {
    position: absolute;
    width: 100%;
    height: 100%;
}

.point {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--primary-color);
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: var(--shadow-md);
}

.point-1 { top: 30%; left: 30%; }
.point-2 { top: 60%; left: 70%; }

/* ========================================
   特性介绍
   ======================================== */
.features {
    padding: 6rem 0;
    background: var(--bg-white);
}

.feature-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.feature-card {
    text-align: center;
    padding: 1.5rem 1rem;
    background: var(--bg-light);
    border-radius: var(--radius-lg);
    transition: var(--transition);
}

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

.feature-card .feature-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem;
    background: var(--primary-bg);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 1.5rem;
}

.feature-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ========================================
   使用统计
   ======================================== */
.stats {
    padding: 4rem 0;
    background: var(--primary-bg);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    text-align: center;
}

.stat-item {
    padding: 1rem;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.stat-label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
}

/* ========================================
   CTA区域
   ======================================== */
.cta {
    padding: 5rem 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    text-align: center;
    color: white;
}

.cta h2 {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.cta p {
    opacity: 0.9;
    margin-bottom: 2rem;
}

/* ========================================
   页脚
   ======================================== */
.footer {
    background: var(--text-primary);
    color: var(--text-light);
    padding: 4rem 0 0;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 3rem;
    padding-bottom: 3rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    margin-bottom: 1rem;
}

.footer-brand p {
    color: var(--text-light);
}

.footer-links h4 {
    color: white;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.footer-links ul {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: var(--text-light);
    transition: var(--transition);
}

.footer-links a:hover {
    color: white;
}

.footer-bottom {
    padding: 1.5rem 0;
    text-align: center;
    font-size: 0.9rem;
}

/* ========================================
   响应式设计
   ======================================== */
@media (max-width: 1024px) {
    .hero {
        flex-direction: column;
        text-align: center;
        padding-top: 120px;
    }

    .hero-content {
        max-width: 100%;
    }

    .hero-buttons {
        justify-content: center;
    }

    .hero-graphic {
        width: 300px;
        height: 300px;
        margin-top: 2rem;
    }

    .about-content {
        flex-direction: column;
        gap: 2rem;
    }
    
    .about-image {
        width: 100%;
        max-width: 450px;
        margin: 0 auto;
    }
    
    .browser-content {
        padding: 1rem;
    }
    
    .ggb-preview {
        height: 180px;
    }
    
    .feature-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .section-title.text-left {
        text-align: center;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

/* 中等屏幕：显示缩短的导航 */
@media (max-width: 1100px) {
    .nav-link {
        padding: 0.5rem 0.4rem;
        font-size: 0.8rem;
    }
    
    .nav-logo span {
        font-size: 1rem;
    }
}

/* 平板/手机：显示汉堡菜单 */
@media (max-width: 900px) {
    .nav-container {
        position: relative;
    }
    
    /* 隐藏原导航菜单 */
    .nav-menu {
        display: none !important;
    }

    .nav-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border-radius: var(--radius-md);
        z-index: 1101;
        order: 2;
    }
    
    .nav-toggle:hover {
        background: var(--primary-bg);
    }
    
    /* 用户菜单在汉堡菜单左边 */
    #user-menu-container {
        order: 1;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* 关于区域优化 */
    .about {
        padding: 4rem 0;
    }
    
    .about-description {
        font-size: 1rem;
    }
    
    .feature-list li {
        font-size: 0.95rem;
    }
    
    /* 页脚手机优化 */
    .footer-content {
        gap: 2rem;
    }
    
    .footer-links ul {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem 1rem;
        justify-content: center;
    }
    
    .footer-bottom {
        font-size: 0.8rem;
    }
}

/* ========================================
   移动端下拉导航菜单
   ======================================== */
.mobile-dropdown-menu {
    display: none;
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    z-index: 1100;
    padding: 1rem;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mobile-dropdown-menu.show {
    display: block;
}

.mobile-menu-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.mobile-menu-row:last-child {
    border-bottom: none;
}

.mobile-menu-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1rem;
    background: var(--bg-light);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
    flex: 1 1 auto;
    min-width: 80px;
    max-width: 150px;
    text-align: center;
}

.mobile-menu-item:hover {
    background: var(--primary-bg);
    color: var(--primary-color);
}

.mobile-menu-item.active {
    background: var(--primary-color);
    color: white;
}

.mobile-menu-item i {
    font-size: 0.85rem;
}

/* 遮罩层 */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1099;
}

.mobile-menu-overlay.show {
    display: block;
}

@media (max-width: 768px) {
    .mobile-dropdown-menu {
        top: 60px;
        padding: 0.75rem;
    }
    
    .mobile-menu-overlay {
        top: 60px;
    }
    
    .mobile-menu-item {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
        min-width: 70px;
    }
    
    /* 关于区域 - 窄屏优化 */
    .about {
        padding: 3rem 0;
    }
    
    .about-content {
        gap: 1.5rem;
    }
    
    .about-image {
        max-width: 100%;
    }
    
    .browser-mockup {
        border-radius: var(--radius-md);
    }
    
    .browser-header {
        padding: 0.5rem 0.75rem;
    }
    
    .browser-dot {
        width: 10px;
        height: 10px;
    }
    
    .browser-content {
        padding: 0.75rem;
    }
    
    .ggb-preview {
        height: 150px;
    }
    
    .section-title {
        font-size: 1.75rem;
    }
    
    /* 特性卡片 - 2列布局 */
    .feature-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .feature-card {
        padding: 1rem 0.75rem;
    }
    
    .feature-card .feature-icon {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
        margin-bottom: 0.75rem;
    }
    
    .feature-card h3 {
        font-size: 0.95rem;
    }
    
    .feature-card p {
        font-size: 0.8rem;
    }
    
    /* 统计区域优化 */
    .stats {
        padding: 2.5rem 0;
    }
    
    .stats-grid {
        gap: 1rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .stat-label {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .mobile-menu-item {
        flex: 1 1 calc(33% - 0.5rem);
        min-width: 60px;
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    .mobile-menu-item i {
        display: none;
    }
    
    /* 关于区域 - 超窄屏优化 */
    .about {
        padding: 2rem 0;
    }
    
    .container {
        padding: 0 1rem;
    }
    
    .about-description {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }
    
    .feature-list li {
        font-size: 0.85rem;
        margin-bottom: 0.75rem;
    }
    
    .browser-content {
        padding: 0.5rem;
    }
    
    .ggb-preview {
        height: 120px;
    }
    
    /* 特性卡片 - 超窄屏优化 */
    .features {
        padding: 3rem 0;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .section-subtitle {
        font-size: 0.9rem;
        margin-bottom: 2rem;
    }
    
    .feature-cards {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    
    .feature-card {
        padding: 0.75rem 0.5rem;
    }
    
    .feature-card .feature-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .feature-card h3 {
        font-size: 0.85rem;
        margin-bottom: 0.25rem;
    }
    
    .feature-card p {
        font-size: 0.75rem;
        line-height: 1.4;
    }
    
    /* 统计区域 */
    .stats {
        padding: 2rem 0;
    }
    
    .stat-number {
        font-size: 1.75rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
    
    /* CTA区域 */
    .cta {
        padding: 3rem 0;
    }
    
    .cta h2 {
        font-size: 1.5rem;
    }
}

@media (max-width: 768px) {
    .nav-container {
        padding: 0 1rem;
        height: 60px;
    }
    
    .nav-menu {
        top: 60px;
        width: 100%;
    }
    
    .nav-logo i {
        font-size: 1.25rem;
    }
    
    .nav-logo span {
        font-size: 0.95rem;
    }
}

/* 已在上方480px媒体查询中处理 */

/* ========================================
   课件页面样式
   ======================================== */
.page-header {
    background: var(--subject-dark, var(--primary-dark));
    color: white;
    padding: 70px 2rem 0.4rem;
    text-align: center;
}

.page-header h1 {
    font-size: 1.3rem;
    margin-bottom: 0.1rem;
}

.page-header p {
    opacity: 0.9;
    font-size: 0.75rem;
    margin: 0;
}

.course-layout {
    display: flex;
    height: calc(100vh - 115px); /* navbar 70px + page-header约45px */
    max-height: calc(100vh - 115px);
    overflow: hidden;
}

/* 课程页面禁止body滚动 */
body.course-page {
    overflow: hidden;
    height: 100vh;
}

body.course-page .navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
}

/* 左侧边栏 */
.sidebar {
    width: 320px;
    min-width: 320px;
    background: var(--bg-light);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sidebar-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: white;
    flex-shrink: 0;
}

.sidebar-header h2 {
    font-size: 1.1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* 搜索框 */
.search-box {
    padding: 1rem;
    background: white;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper i {
    position: absolute;
    left: 12px;
    color: var(--text-light);
}

.search-input {
    width: 100%;
    padding: 0.6rem 0.75rem 0.6rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.search-input::placeholder {
    color: var(--text-light);
}

.catalog-nav {
    padding: 0.75rem;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
}

/* 年级分组 */
.grade-group {
    margin-bottom: 0.5rem;
}

.grade-header {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 0.25rem;
}

.grade-header:hover {
    border-color: var(--primary-light);
}

.grade-header.expanded {
    background: var(--primary-bg);
    border-color: var(--primary-light);
}

.grade-icon {
    font-size: 1.2rem;
    margin-right: 0.75rem;
}

.grade-name {
    flex: 1;
    font-weight: 600;
    color: var(--text-primary);
}

.grade-toggle {
    color: var(--text-light);
    font-size: 0.75rem;
    transition: transform 0.3s ease;
}

.grade-header.expanded .grade-toggle {
    transform: rotate(90deg);
}

/* 章节列表 */
.chapter-list {
    display: none;
    padding-left: 0.25rem;
    margin-top: 0.25rem;
}

.chapter-list.show {
    display: block;
}

.chapter-item {
    margin-bottom: 0.15rem;
}

/* 深层嵌套目录样式优化 - 减少缩进 */
.ggb-list .chapter-item {
    margin-left: 0 !important;
}

.ggb-list .ggb-list {
    padding-left: 6px;
    margin-left: 0;
    border-left: 1px solid #e0e0e0;
}

/* 限制最大缩进深度 - 深层级减少缩进 */
.ggb-list .ggb-list .ggb-list {
    padding-left: 4px;
}

.ggb-list .ggb-list .ggb-list .ggb-list {
    padding-left: 2px;
}

.ggb-list .ggb-list .ggb-list .ggb-list .ggb-list {
    padding-left: 2px;
}

.chapter-header {
    display: flex;
    align-items: center;
    padding: 0.4rem 0.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-size: 0.82rem;
    min-height: 28px;
    overflow: hidden;
    gap: 0.3rem;
}

.chapter-header span:not(.chapter-toggle):not(.chapter-icon) {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.chapter-icon {
    font-size: 0.75rem;
    flex-shrink: 0;
}

.chapter-header:hover {
    background: white;
    color: var(--text-primary);
}

.chapter-header.expanded {
    background: white;
    color: var(--primary-color);
}

.chapter-icon {
    margin-right: 0.4rem;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.chapter-toggle {
    margin-left: auto;
    font-size: 0.7rem;
    transition: transform 0.3s ease;
}

.chapter-header.expanded .chapter-toggle {
    transform: rotate(90deg);
}

/* 课件列表 */
.ggb-list {
    display: none;
    padding-left: 0.35rem;
    margin-top: 0.15rem;
    margin-left: 0;
}

.ggb-list.show {
    display: block;
}

.ggb-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-size: 0.85rem;
}

.ggb-item:hover {
    background: white;
    color: var(--text-primary);
}

.ggb-item.active {
    background: var(--primary-color);
    color: white;
}

.ggb-item-icon {
    margin-right: 0.5rem;
}

/* 右侧内容区 - 必须限制高度，让子元素能正确布局 */
.content-area {
    flex: 1;
    padding: 1rem;
    background: var(--bg-white);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    max-height: 100%; /* 限制最大高度 */
}

/* 欢迎面板 */
.welcome-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 3rem;
}

.welcome-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
}

.welcome-panel h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.welcome-panel > p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.welcome-features {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.welcome-feature {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--bg-light);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
}

/* GGB 展示面板 */
.ggb-panel {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;  /* 关键：允许flex子元素收缩 */
    max-height: 100%;
}

.ggb-header {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--subject-color, var(--primary-color)) 0%, var(--subject-dark, var(--primary-dark)) 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.ggb-header-left h3 {
    font-size: 1.1rem;
    margin-bottom: 0.15rem;
}

.ggb-path {
    font-size: 0.8rem;
    opacity: 0.85;
}

.ggb-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* 缩放控制 */
.ggb-zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 0.75rem;
    padding: 0.25rem;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
}

.zoom-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-sm);
    color: white;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}

.zoom-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.zoom-btn:active {
    transform: scale(0.95);
}

.zoom-scale {
    min-width: 50px;
    text-align: center;
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0 0.5rem;
}

/* 全屏按钮和下载按钮 */
.fullscreen-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.fullscreen-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

#download-btn {
    background: rgba(34, 197, 94, 0.3);
    border-color: rgba(34, 197, 94, 0.5);
}

#download-btn:hover {
    background: rgba(34, 197, 94, 0.5);
}

/* 蓝色框：独立的展示区 */
.ggb-display-area {
    flex: 1;
    position: relative;
    background: var(--bg-light);
    overflow: hidden;
    min-height: 0;
    min-width: 0;
    /* 尺寸由JS动态计算 */
}

/* 红色框：独立的GGB展示窗口 */
.ggb-display-window {
    position: absolute;
    top: 0;
    left: 0;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    /* 位置和尺寸完全由JS控制 */
}

/* GGB容器 */
.ggb-container {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
    /* 尺寸完全由JS控制 */
}

.ggb-tips {
    padding: 0.5rem 1.5rem;
    background: var(--primary-bg);
    color: var(--primary-dark);
    font-size: 0.8rem;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

/* 全屏模式 - GGB展示窗口全屏 */
.ggb-panel.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    border-radius: 0;
    margin: 0;
    background: #1a1a2e;
}

.ggb-panel.fullscreen .ggb-header {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, var(--subject-color, var(--primary-color)) 0%, var(--subject-dark, var(--primary-dark)) 100%);
    opacity: 0.95;
}

.ggb-panel.fullscreen .ggb-display-area {
    background: #1a1a2e;
}

.ggb-panel.fullscreen .ggb-display-window {
    border-radius: 0;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.ggb-panel.fullscreen .ggb-tips {
    display: none;
}

/* 加载状态 */
.loading {
    color: var(--text-secondary);
    text-align: center;
    padding: 2rem;
}

/* 错误消息 */
.error-message {
    color: #dc2626;
    background: #fef2f2;
    border: 1px solid #fecaca;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    text-align: center;
}

/* 空状态 */
.empty-state {
    color: var(--text-light);
    font-size: 0.8rem;
    padding: 0.3rem 0.5rem;
    font-style: italic;
}

/* 深层级目录样式 */
.chapter-item[data-level="0"] > .chapter-header {
    font-weight: 500;
    color: var(--text-primary);
}

.chapter-item[data-level="1"] > .chapter-header {
    font-size: 0.82rem;
}

.chapter-item[data-level="2"] > .chapter-header {
    font-size: 0.8rem;
    padding: 0.35rem 0.4rem;
    min-height: 26px;
}

.chapter-item[data-level="3"] > .chapter-header,
.chapter-item[data-level="4"] > .chapter-header,
.chapter-item[data-level="5"] > .chapter-header {
    font-size: 0.78rem;
    padding: 0.3rem 0.35rem;
    min-height: 24px;
}

/* 确保所有章节头都可点击 */
.chapter-header {
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    position: relative;
    z-index: 1;
}

/* 点击区域扩展 */
.chapter-header::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -4px;
    right: -4px;
    bottom: -2px;
    z-index: -1;
}

/* 空目录样式 - 仍可点击展开 */
.chapter-header.empty {
    color: var(--text-light);
    cursor: pointer;
}

.chapter-header.empty:hover {
    background: rgba(0,0,0,0.02);
}

/* 章节图标缩小深层级 */
.chapter-item[data-level="3"] .chapter-icon,
.chapter-item[data-level="4"] .chapter-icon,
.chapter-item[data-level="5"] .chapter-icon {
    font-size: 0.7rem;
}

/* 响应式课件页面 */
@media (max-width: 1024px) {
    .sidebar {
        width: 280px;
        min-width: 280px;
    }
}

/* ========================================
   目录切换按钮
   ======================================== */
.sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1001;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.2rem;
}

.sidebar-toggle:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.sidebar-toggle:active {
    transform: scale(0.95);
}

/* 目录内的切换按钮（显示在目录头部） */
.sidebar-header-toggle {
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--primary-bg);
    color: var(--primary-color);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
}

.sidebar-header-toggle:hover {
    background: var(--primary-color);
    color: white;
}

.sidebar-header-toggle i {
    font-size: 0.9rem;
}

/* 平板端优化 - 目录从左侧滑出 */
@media (max-width: 900px) {
    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        left: 20px;
        right: auto;
    }
    
    .sidebar-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .sidebar-header-toggle {
        display: flex;
    }
    
    .course-layout {
        position: relative;
    }
    
    /* 目录从左侧滑出 */
    .sidebar {
        position: fixed;
        left: 0;
        right: auto;
        top: 115px;
        bottom: 0;
        width: 300px;
        min-width: 300px;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: var(--shadow-xl);
    }
    
    .sidebar.visible {
        transform: translateX(0);
    }
    
    .sidebar.hidden {
        transform: translateX(-100%);
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 115px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    
    .sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }
    
    .content-area {
        padding: 1rem;
        margin-left: 0;
        width: 100%;
    }
    
    /* 用户菜单响应式 */
    #user-menu-container {
        margin-left: auto;
        margin-right: 0.5rem;
    }
    
    .user-btn span {
        display: none;
    }
    
    .user-btn {
        padding: 0.5rem;
    }
    
    .user-dropdown {
        right: 0;
        left: auto;
        min-width: 220px;
    }
}

@media (max-width: 768px) {
    .nav-container {
        height: 60px;
        padding: 0 1rem;
    }
    
    .nav-menu {
        top: 60px;
    }
    
    .course-layout {
        height: calc(100vh - 100px); /* 减少的高度 */
        max-height: calc(100vh - 100px);
    }

    .sidebar {
        width: 85%;
        max-width: 300px;
        top: 75px;
    }
    
    .sidebar-overlay {
        top: 75px;
    }
    
    .page-header {
        padding: 62px 1rem 0.3rem;
    }
    
    .page-header h1 {
        font-size: 1.15rem;
    }
    
    .page-header p {
        font-size: 0.7rem;
    }

    .content-area {
        padding: 0.75rem;
        flex: 1;
        height: 100%;
    }
    
    .search-box {
        padding: 0.75rem;
    }
    
    .sidebar-toggle {
        bottom: 15px;
        left: 15px;
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
    
    /* GGB面板手机优化 */
    .ggb-panel {
        border-radius: var(--radius-md);
    }
    
    .ggb-header {
        padding: 0.5rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .ggb-header-left h3 {
        font-size: 0.95rem;
    }
    
    .ggb-path {
        font-size: 0.7rem;
    }
    
    .fullscreen-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .fullscreen-btn span {
        display: none;
    }
    
    .ggb-tips {
        padding: 0.4rem 0.75rem;
        font-size: 0.7rem;
    }
    
    .ggb-wrapper {
        padding: 0.25rem;
    }
    
    /* 欢迎面板手机优化 */
    .welcome-panel {
        padding: 1.5rem;
    }
    
    .welcome-icon {
        font-size: 3rem;
        margin-bottom: 1rem;
    }
    
    .welcome-panel h2 {
        font-size: 1.2rem;
    }
    
    .welcome-features {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .welcome-feature {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
}

/* 超小屏幕优化 */
@media (max-width: 480px) {
    .nav-container {
        padding: 0 1rem;
        height: 60px;
    }
    
    .nav-logo span {
        display: none;
    }
    
    .page-header {
        padding: 60px 1rem 0.25rem;
    }
    
    .page-header h1 {
        font-size: 1rem;
    }
    
    .page-header p {
        font-size: 0.65rem;
    }
    
    .course-layout {
        height: calc(100vh - 95px); /* 减少的高度 */
        max-height: calc(100vh - 95px);
    }
    
    .sidebar {
        top: 70px;
    }
    
    .sidebar-overlay {
        top: 70px;
    }
    
    .content-area {
        padding: 0.5rem;
    }
}

/* ========================================
   登录/用户认证相关样式
   ======================================== */
.nav-auth {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 20px;
}

.btn-login {
    padding: 8px 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white !important;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    border: none;
    cursor: pointer;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-logout {
    padding: 6px 14px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-logout:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.user-greeting {
    color: var(--text-secondary);
    font-size: 14px;
}

/* 用户信息在导航栏中的样式 */
#nav-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 20px;
}

/* 移动端隐藏登录按钮区域 */
@media (max-width: 768px) {
    .nav-auth {
        position: absolute;
        top: 70px;
        right: 0;
        background: white;
        padding: 12px 20px;
        border-radius: 0 0 0 var(--radius-md);
        box-shadow: var(--shadow-md);
        display: none;
    }
    
    .nav-menu.active + .nav-auth,
    .nav-auth.show {
        display: flex;
    }
}

/* ========================================
   浏览模式切换区域
   ======================================== */
.view-mode-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.view-mode-section .mode-label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.view-mode-toggle {
    display: flex;
    align-items: center;
    gap: 0;
    flex-shrink: 0;
}

.mode-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 14px;
    height: 32px;
    border: 1px solid var(--subject-color, var(--primary-color));
    background: white;
    color: var(--subject-color, var(--primary-color));
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}

.mode-btn:first-child {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    border-right: none;
}

.mode-btn:last-child {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.mode-btn i {
    font-size: 0.9rem;
}

.mode-btn:hover {
    background: rgba(59, 130, 246, 0.1);
}

.mode-btn.active {
    background: var(--subject-color, var(--primary-color));
    color: white;
}

/* ========================================
   缩略图浏览模式
   ======================================== */
/* 缩略图网格容器 - 自动填充，最多5列 */
.thumbnail-grid {
    display: grid;
    /* 卡片最小260px，但最多5列（使用max确保宽屏时每列至少占1/5） */
    grid-template-columns: repeat(auto-fill, minmax(max(260px, calc((100% - 64px) / 5)), 1fr));
    /* 行高自动计算 */
    grid-auto-rows: var(--thumb-row-height, 260px);
    gap: 16px;
    padding: 16px;
    overflow-y: auto;
    flex: 1;
    align-content: start;
}

/* 单个缩略图卡片 - 高度自适应填满网格单元格 */
.thumbnail-card {
    position: relative;
    background: white;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    /* 高度100%填满grid单元格 */
    height: 100%;
    min-height: 200px;
    max-height: 350px;
}

.thumbnail-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

/* 缩略图预览区域 - 自动填充剩余空间显示GGB内容 */
.thumbnail-preview {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 150px;
    background: var(--bg-light);
    overflow: hidden;
}

.thumbnail-preview .ggb-mini-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.thumbnail-preview .ggb-mini-container {
    transform-origin: center center;
    pointer-events: none; /* 预览时禁用交互 */
}

/* 缩略图GGB容器 - JS动态计算缩放 */
.ggb-thumb-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none; /* 禁用交互 */
    overflow: visible;
}

/* GGB applet禁用交互 */
.ggb-thumb-container > article,
.ggb-thumb-container > div {
    pointer-events: none !important;
}

/* 缩略图加载动画 */
.thumbnail-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--bg-light);
    color: var(--text-light);
    font-size: 0.8rem;
    z-index: 5;
}

.thumbnail-loading i {
    font-size: 1.5rem;
    color: var(--primary-light);
}

/* 静态占位符样式（备用） */
.thumbnail-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #f0f4f8 0%, #e2e8f0 100%);
    color: var(--text-light);
}

.thumbnail-placeholder i {
    font-size: 2.5rem;
    color: var(--primary-light);
}

.thumbnail-placeholder .file-num {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    opacity: 0.6;
}

.thumbnail-preview .loading-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-light);
    font-size: 0.85rem;
}

.thumbnail-preview .loading-placeholder i {
    font-size: 2rem;
    color: var(--primary-light);
    animation: pulse 1.5s infinite;
}

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

/* 缩略图信息区域 - 始终显示在底部 */
.thumbnail-info {
    padding: 6px 10px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-white);
    flex-shrink: 0;
    height: 50px; /* 固定高度：200-150=50 */
    min-height: 50px;
    max-height: 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.thumbnail-info h4 {
    font-size: 0.82rem;
    color: var(--text-primary);
    margin: 0 0 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.thumbnail-info p {
    font-size: 0.7rem;
    color: var(--text-light);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

/* 点击查看遮罩 */
.thumbnail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(59, 130, 246, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    opacity: 0;
}

.thumbnail-card:hover .thumbnail-overlay {
    background: rgba(59, 130, 246, 0.15);
    opacity: 1;
}

.thumbnail-overlay span {
    background: var(--primary-color);
    color: white;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    transform: translateY(10px);
    transition: var(--transition);
}

.thumbnail-card:hover .thumbnail-overlay span {
    transform: translateY(0);
}

/* 缩略图分页控制 - 固定在内容区底部 */
.thumbnail-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.98);
    border-top: 1px solid var(--border-color);
    height: 52px;
    min-height: 52px;
    flex-shrink: 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

/* 页码容器 */
.pagination-pages {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 页码按钮 */
.page-num {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.85rem;
    font-weight: 500;
}

.page-num:hover:not(:disabled) {
    border-color: var(--subject-color, var(--primary-color));
    color: var(--subject-color, var(--primary-color));
    background: var(--primary-bg);
}

.page-num.active {
    background: var(--subject-color, var(--primary-color));
    border-color: var(--subject-color, var(--primary-color));
    color: white;
    cursor: default;
}

/* 省略号 */
.page-ellipsis {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    color: var(--text-light);
    font-size: 0.9rem;
    user-select: none;
}

/* 文件夹点击样式 */
.folder-item {
    cursor: pointer;
}

.folder-item .chapter-header.folder-clickable {
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.folder-item .chapter-header.folder-clickable:hover {
    background: var(--primary-bg);
    color: var(--primary-color);
}

.folder-item.active .chapter-header.folder-clickable {
    background: var(--primary-color);
    color: white;
}

.pagination-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 2px solid var(--subject-color, var(--primary-color));
    background: white;
    color: var(--subject-color, var(--primary-color));
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: bold;
    flex-shrink: 0;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--subject-color, var(--primary-color));
    color: white;
    transform: scale(1.05);
}

.pagination-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    border-color: var(--border-color);
    color: var(--text-muted);
}

.pagination-info {
    font-size: 0.9rem;
    color: var(--text-primary);
    padding: 0 8px;
    font-weight: 500;
    white-space: nowrap;
}

.pagination-info strong {
    color: var(--subject-color, var(--primary-color));
    font-weight: 700;
}

/* 缩略图模式下的目录样式 */
.catalog-nav.thumbnail-mode .ggb-item {
    display: none !important;
}

.catalog-nav.thumbnail-mode .ggb-list {
    padding-left: 0.25rem;
}

/* 文件夹点击样式 */
.folder-item {
    cursor: pointer;
}

.folder-item .chapter-header.folder-clickable {
    background: var(--primary-bg);
    border: 1px solid var(--primary-light);
    border-radius: var(--radius-sm);
    margin: 2px 0;
    padding: 8px 10px;
}

.folder-item .chapter-header.folder-clickable:hover {
    background: var(--primary-color);
    color: white;
}

.folder-item .chapter-header.folder-clickable:hover .chapter-icon {
    color: white;
}

.folder-item.active .chapter-header.folder-clickable {
    background: var(--primary-color);
    color: white;
}

/* 缩略图面板（显示在content-area中）- 必须撑满可用空间 */
.thumbnail-panel {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    max-height: 100%; /* 限制最大高度 */
    background: var(--bg-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.thumbnail-panel.active {
    display: flex;
}

/* 缩略图网格 - 可滚动区域，自动填充，最多5列 */
.thumbnail-panel .thumbnail-grid {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    background: var(--bg-light);
    /* 使用grid布局，卡片最小260px，但最多5列 */
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(max(260px, calc((100% - 64px) / 5)), 1fr));
    /* 行高自动计算 */
    grid-auto-rows: var(--thumb-row-height, 260px);
    gap: 16px;
    padding: 16px;
    align-content: start;
}

/* 当只有欢迎面板时，居中显示 */
.thumbnail-panel .thumbnail-grid:has(.thumbnail-welcome) {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 分页区域 - 固定在面板底部，绝对不能溢出 */
.thumbnail-panel .thumbnail-pagination {
    flex-shrink: 0;
    z-index: 20;
    border-top: 1px solid var(--border-color);
    background: white;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

/* 缩略图头部 - 使用学科主题色 */
.thumbnail-header {
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--subject-color, var(--primary-color)) 0%, var(--subject-dark, var(--primary-dark)) 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.thumbnail-header h3 {
    font-size: 1rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.thumbnail-header h3 i {
    opacity: 0.8;
}

.thumbnail-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
}

/* 空状态提示 - 居中显示 */
.thumbnail-empty {
    grid-column: 1 / -1; /* 占据所有列 */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    height: 100%;
    color: var(--text-secondary);
    padding: 40px;
    text-align: center;
    background: var(--bg-light);
}

.thumbnail-empty i {
    font-size: 5rem;
    color: var(--primary-light);
    margin-bottom: 24px;
    opacity: 0.6;
}

.thumbnail-empty p {
    font-size: 1.1rem;
    line-height: 1.8;
    max-width: 300px;
}

/* 缩略图欢迎面板 - 带学科图标，完全居中 */
.thumbnail-welcome {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100%;
    padding: 40px;
    text-align: center;
    background: var(--bg-light);
}

/* 当只有欢迎面板时，让grid居中显示 */
.thumbnail-grid:has(.thumbnail-welcome:only-child) {
    display: flex;
    align-items: center;
    justify-content: center;
}

.thumbnail-welcome-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    line-height: 1;
}

.thumbnail-welcome h2 {
    font-size: 1.4rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.thumbnail-welcome > p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

.thumbnail-welcome-features {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.thumbnail-welcome-features span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: white;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.thumbnail-welcome-features span i {
    color: var(--subject-color, var(--primary-color));
}

.thumbnail-invite,
.welcome-invite {
    margin-top: 1.5rem;
    text-align: center;
}

@media (max-width: 768px) {
    .thumbnail-welcome {
        padding: 20px;
        min-height: 300px;
    }
    
    .thumbnail-welcome h2 {
        font-size: 1.2rem;
    }
    
    .thumbnail-welcome-features {
        flex-direction: column;
        gap: 0.75rem;
    }
}

/* 返回缩略图按钮 */
.back-to-thumbnail-btn {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    margin-right: 8px;
}

.back-to-thumbnail-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.back-to-thumbnail-btn.show {
    display: inline-flex;
}

/* 响应式缩略图 */
@media (max-width: 768px) {
    .thumbnail-grid {
        /* 平板：卡片最小260px */
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 12px;
        padding: 12px;
    }
    
    .thumbnail-panel .thumbnail-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 12px;
        padding: 12px;
    }
    
    .thumbnail-card {
        min-height: 180px;
        max-height: 300px;
    }
    
    .thumbnail-info {
        height: 50px;
        min-height: 50px;
        padding: 5px 8px;
    }
    
    .thumbnail-info h4 {
        font-size: 0.75rem;
    }
    
    .mode-btn {
        padding: 5px 10px;
        height: 28px;
        font-size: 0.7rem;
    }
    
    .mode-btn i {
        font-size: 0.8rem;
    }
    
    .mode-btn span {
        display: none;
    }
    
    .pagination-btn {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }
    
    .page-num {
        min-width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .thumbnail-grid {
        /* 手机：卡片最小220px */
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 10px;
        padding: 10px;
    }
    
    .thumbnail-panel .thumbnail-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 10px;
        padding: 10px;
    }
    
    .thumbnail-card {
        min-height: 160px;
        max-height: 280px;
    }
    
    .thumbnail-info {
        height: 45px;
        min-height: 45px;
        padding: 4px 6px;
    }
    
    .thumbnail-info h4 {
        font-size: 0.7rem;
    }
    
    .thumbnail-info p {
        font-size: 0.6rem;
    }
    
    .back-to-thumbnail-btn span {
        display: none;
    }
    
    .thumbnail-pagination {
        padding: 6px 10px;
        height: 48px;
        min-height: 48px;
        gap: 4px;
    }
    
    .pagination-btn {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }
    
    .page-num {
        min-width: 26px;
        height: 26px;
        padding: 0 4px;
        font-size: 0.75rem;
    }
    
    .page-ellipsis {
        width: 16px;
        font-size: 0.8rem;
    }
    
    .pagination-pages {
        gap: 2px;
    }
}

/* ========================================
   学科主题颜色
   ======================================== */
/* ========================================
   莫兰迪色系 - 各学科主题色
   ======================================== */

/* 小学数学 - 莫兰迪绿 */
.subject-primary-math {
    --subject-color: #7fa87f;
    --subject-dark: #5c8a5c;
    --subject-light: #a3c4a3;
}

/* 初中数学 - 莫兰迪蓝 */
.subject-junior-math {
    --subject-color: #6b8cae;
    --subject-dark: #4a6d8c;
    --subject-light: #8fadc8;
}

/* 高中数学 - 莫兰迪紫 */
.subject-senior-math {
    --subject-color: #9585a8;
    --subject-dark: #7a6b8f;
    --subject-light: #b5a8c4;
}

/* 初中物理 - 莫兰迪橙 */
.subject-junior-physics {
    --subject-color: #c9a86c;
    --subject-dark: #a68a4f;
    --subject-light: #dfc99a;
}

/* 高中物理 - 莫兰迪红/砖红 */
.subject-senior-physics {
    --subject-color: #b87b7b;
    --subject-dark: #996060;
    --subject-light: #d4a3a3;
}

/* 化学 - 莫兰迪青 */
.subject-chemistry {
    --subject-color: #6a9fa8;
    --subject-dark: #4d838c;
    --subject-light: #8fc1c9;
}

/* 地理 - 莫兰迪棕/大地色 */
.subject-geography {
    --subject-color: #9c8b7a;
    --subject-dark: #7d6e5f;
    --subject-light: #bfb0a0;
}
