/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f7fa;
    color: #424242;
    line-height: 1.6;
}

.container {
    display: flex;
    min-height: 100vh;
}

/* 左侧侧边栏样式 - 导航网站风格 */
.sidebar {
    width: 200px;
    background-color: #ffffff;
    color: #424242;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.08);
    border-right: 1px solid #e8eaf6;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed {
    width: 60px;
    box-shadow: none;
    border-right: none;
    background-color: transparent;
}

.sidebar.collapsed::before {
    content: '';
    display: block;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: transparent;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 12px;
    background: linear-gradient(135deg, #4f46e5 0%, #818cf8 100%);
    border-bottom: 1px solid #4f46e5;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2);
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
}

.sidebar-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: white;
}

.toggle-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%; /* 统一为圆形 */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.toggle-btn:active {
    transform: scale(0.95);
}

.toggle-icon {
    display: inline-block;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1rem;
    font-weight: bold;
}

.sidebar.collapsed .toggle-icon {
    transform: rotate(180deg);
}



/* 导航菜单样式 */
.sidebar-nav {
    flex: 1;
    overflow-y: scroll;
    overflow-x: hidden;
    padding-bottom: 16px;
    display: block;
    position: relative;
    z-index: 1;
    max-height: calc(100vh - 120px);
}

.sidebar-nav ul {
    list-style: none;
    padding: 4px 0;
}

.nav-item {
    margin: 0;
    transition: all 0.2s ease;
}

.nav-item a {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    color: #424242;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-weight: 500;
    font-size: 0.85rem;
    position: relative;
}

.nav-item a:hover {
    background-color: #f0f4f8;
    color: #3989d1;
}

.nav-item.active a {
    background-color: #e8f5fd;
    color: #3989d1;
    border-left: 4px solid #1976d2;
}

/* 导航图标样式 */
.nav-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    margin-right: 8px;
    color: #666;
    transition: color 0.2s ease;
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon {
    color: #1976d2;
}

/* 折叠时的样式调整 */
.sidebar.collapsed .sidebar-header {
    padding: 0;
    height: auto;
    background: none; /* 完全移除背景，包括渐变 */
    border-bottom: none;
    position: absolute;
    left: 10px;
    top: 80px;
    box-shadow: none; /* 移除阴影 */
    border: none; /* 确保没有边框 */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.sidebar.collapsed .toggle-btn {
    display: flex;
    position: static;
    background-color: rgba(25, 118, 210, 0.8);
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.2);
    width: 40px;
    height: 40px;
    padding: 8px;
    font-size: 1.1rem;
    border-radius: 50%;
    z-index: 1001;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.8;
    border: none;
    outline: none;
    overflow: hidden;
}

.sidebar.collapsed .toggle-btn:hover {
    background-color: rgba(25, 118, 210, 1);
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(25, 118, 210, 0.4);
    border-radius: 50%; /* 确保悬浮时仍然是圆形 */
}

.sidebar.collapsed .sidebar-header h2 {
    display: none;
}

.sidebar.collapsed .nav-text {
    display: none;
}

.sidebar.collapsed .nav-icon {
    display: none;
}

.sidebar.collapsed .nav-item a {
    display: none;
}

.sidebar.collapsed .sidebar-nav {
    display: none;
}

/* 主内容区域样式 */
.main-content {
    flex: 1;
    padding: 24px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: #f5f7fa;
    margin-left: 200px; /* 与侧边栏宽度一致 */
}

/* 当侧边栏折叠时，调整主内容区域的左侧边距 */
.container.collapsed .main-content {
    margin-left: 0; /* 折叠时不占用主内容区域空间 */
}

/* 页面标题样式 */
.page-title {
    font-size: 1.75rem;
    color: #1a1a2e;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e8eaf6;
    font-weight: 600;
    text-align: center;
    letter-spacing: 0.5px;
}

/* 词语类别样式 */
.word-categories {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.category {
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
    border: 1px solid #e8eaf6;
    display: flex;
    align-items: stretch;
    /* 固定大小，适配四字格式 */
    width: 100%;
    min-height: 80px;
}

.category:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.category-title {
    background: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 100%);
    color: #be185d;
    font-size: 1.1rem;
    font-weight: 600;
    border-bottom: none;
    position: relative;
    overflow: hidden;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    width: 200px;
    flex-shrink: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 16px;
}

/* 第二种颜色 - 淡蓝色 */
.word-categories .category:nth-child(7n+2) .category-title {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    color: #1d4ed8;
}

/* 第三种颜色 - 淡绿色 */
.word-categories .category:nth-child(7n+3) .category-title {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    color: #15803d;
}

/* 第四种颜色 - 淡黄色 */
.word-categories .category:nth-child(7n+4) .category-title {
    background: linear-gradient(135deg, #fefce8 0%, #fef3c7 100%);
    color: #ca8a04;
}

/* 第五种颜色 - 淡紫色 */
.word-categories .category:nth-child(7n+5) .category-title {
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
    color: #9333ea;
}

/* 第六种颜色 - 淡橙色 */
.word-categories .category:nth-child(7n+6) .category-title {
    background: linear-gradient(135deg, #fff7ed 0%, #fed7aa 100%);
    color: #ea580c;
}

/* 第七种颜色 - 淡青色 */
.word-categories .category:nth-child(7n+7) .category-title {
    background: linear-gradient(135deg, #ecfeff 0%, #cffafe 100%);
    color: #0891b2;
}



/* 移除重复的.category-title定义，避免覆盖彩虹色背景 */

/* 移除具体类别颜色定义，让nth-of-type彩虹色正确显示 */

.category-content {
    padding: 16px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
    min-height: 100%;
    align-content: flex-start;
    align-items: flex-start;
}

/* 词语标签样式 - Flutter芯片风格 */
.word {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
    color: #475569;
    border-radius: 20px;
    font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: 1px solid #e2e8f0;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.word::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.word:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #818cf8 100%);
    color: white;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.3);
    border-color: #4f46e5;
}

.word:hover::before {
    left: 100%;
}

/* 词语选中样式 */
.word.selected {
    background: linear-gradient(135deg, #4f46e5 0%, #818cf8 100%);
    color: white;
    border-color: #4f46e5;
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.3);
}

/* 手机端汉堡菜单按钮 */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1001;
    width: 44px;
    height: 44px;
    background: #4f46e5;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 12px rgba(79, 70, 229, 0.3);
    transition: all 0.3s ease;
}

.mobile-menu-btn span {
    width: 20px;
    height: 2px;
    background: white;
    border-radius: 1px;
    transition: all 0.3s ease;
}

.mobile-menu-btn:hover {
    background: #4338ca;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.4);
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* 响应式设计 - 平板和手机适配 */
@media (max-width: 768px) {
    /* 手机端隐藏桌面端折叠按钮 */
    .toggle-btn {
        display: none !important;
    }
    
    /* 修复容器布局 */
    .container {
        flex-direction: row; /* 保持水平布局，容器本身不改变方向 */
    }
    
    /* 显示汉堡菜单按钮 */
    .mobile-menu-btn {
        display: flex;
    }
    
    /* 左侧导航栏移动端优化 */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 1000;
        width: 280px; /* 增大宽度，更适合手机 */
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.3);
        background-color: #ffffff;
        border-right: 1px solid #e8eaf6;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar.collapsed {
        transform: translateX(-100%);
        width: 280px;
    }
    
    /* 移动端导航头部优化 */
    .sidebar-header {
        padding: 16px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .sidebar-header h2 {
        font-size: 1.1rem;
        font-weight: 600;
        margin: 0;
    }
    
    /* 移动端导航项优化 */
    .nav-item a {
        padding: 14px 18px;
        font-size: 0.95rem;
        border-radius: 8px;
        margin: 4px 8px;
    }
    
    .nav-icon {
        width: 28px;
        height: 28px;
        font-size: 1.1rem;
        margin-right: 12px;
    }

    /* 右侧主内容区域移动端优化 */
    .main-content {
        padding: 16px;
        margin-left: 0; /* 移动端不占导航栏空间 */
        width: 100%;
        min-height: 100vh;
        background-color: #f5f7fa;
        position: relative;
        z-index: 100; /* 确保在侧边栏之上 */
    }
    
    /* 词语分类网格移动端优化 */
    .word-categories {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }
    
    /* 分类卡片移动端优化 */
    .category {
        background: white;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        margin-bottom: 16px;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        min-height: 80px;
    }
    
    /* 标题样式移动端优化 */
    .category-title {
        width: 100%;
        min-height: 64px;
        padding: 16px 20px;
        font-size: 1rem;
        font-weight: 600;
        color: white;
        /* 保持颜色循环效果 */
        border-radius: 12px 12px 0 0;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        flex-shrink: 0;
        overflow: visible;
        box-sizing: border-box;
    }
    
    /* 内容区域移动端优化 */
    .category-content {
        padding: 16px 20px;
        border-radius: 0 0 12px 12px;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        flex: 1;
        min-height: 100%;
        align-content: flex-start;
        align-items: flex-start;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* 词语项移动端优化 */
    .category-content .word {
        padding: 10px 12px;
        font-size: 0.9rem;
        margin: 3px;
        border-radius: 6px;
        background: #f8f9fa;
        border: 1px solid #e9ecef;
        transition: all 0.2s ease;
        color: #495057;
        display: inline-block;
        vertical-align: top;
    }
    
    .category-content .word:hover {
        background: #e3f2fd;
        border-color: #2196f3;
        transform: translateY(-1px);
    }
    
    /* 页面标题移动端优化 */
    .page-title {
        font-size: 1.6rem;
        font-weight: 600;
        margin-bottom: 20px;
        text-align: center;
        color: #2c3e50;
    }
    
    /* 手机端导航覆盖层 */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 999;
        display: none;
        backdrop-filter: blur(2px);
    }
    
    .sidebar-overlay.show {
        display: block;
    }
}

@media (max-width: 480px) {
    /* 更小屏幕的优化 */
    .main-content {
        padding: 12px;
    }
    
    .word-categories {
        gap: 14px;
    }
    
    .category {
        border-radius: 10px;
        margin-bottom: 14px;
        box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
        display: flex;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        min-height: 70px;
    }

    .category-title {
        padding: 12px 16px;
        font-size: 0.95rem;
        min-height: 56px;
        border-radius: 10px 10px 0 0;
        font-weight: 600;
        flex-shrink: 0;
        overflow: visible;
    }

    .category-content {
        padding: 12px 16px;
        border-radius: 0 0 10px 10px;
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        flex: 1;
        min-height: 100%;
        align-content: flex-start;
        align-items: flex-start;
        width: 100%;
        box-sizing: border-box;
    }

    .category-content .word {
        padding: 8px 10px;
        font-size: 0.85rem;
        margin: 2px;
        border-radius: 4px;
        background: #f8f9fa;
        border: 1px solid #e9ecef;
        color: #495057;
        display: inline-block;
        vertical-align: top;
    }
    
    .page-title {
        font-size: 1.4rem;
        margin-bottom: 18px;
        text-align: center;
        font-weight: 600;
    }
    
    /* 超小屏幕导航栏优化 */
    .sidebar {
        width: 260px; /* 稍微减小宽度 */
    }
    
    .sidebar-header {
        padding: 14px;
    }
    
    .sidebar-header h2 {
        font-size: 1rem;
    }
    
    .nav-item a {
        padding: 12px 16px;
        font-size: 0.9rem;
        margin: 3px 6px;
    }
    
    .nav-icon {
        width: 24px;
        height: 24px;
        font-size: 1rem;
        margin-right: 10px;
    }
    
    /* 移动端汉堡按钮更小屏幕优化 */
    .mobile-menu-btn {
        width: 40px;
        height: 40px;
        top: 12px;
        left: 12px;
    }
    
    .mobile-menu-btn span {
        width: 18px;
        height: 2px;
    }
}

/* 底部备案信息样式 */
.footer {
    background-color: transparent;
    border-top: none;
    padding: 16px 20px;
    text-align: center;
    font-size: 13px;
    color: #999999;
    margin-top: 24px;
}

.footer p {
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

.footer a {
    color: #666666;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer a:hover {
    color: #4f46e5;
    text-decoration: underline;
}

/* 移动端备案信息样式 */
@media (max-width: 768px) {
    .footer {
        padding: 12px 16px;
        font-size: 12px;
    }
}