* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
    background: #fafafa;
    color: #333;
    line-height: 1.6;
}

/* 顶部导航 */
.top-header {
    background: #ffffff;
    color: #333;
    padding: 15px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 2px solid #d1fae5;
}

.header-container {
    width: 100%;
    max-width: 1900px;  /* 容器最大宽度上限 */
    margin: 0 auto;
    padding: 0 40px;
}

/* 汉堡菜单按钮 - 默认隐藏 */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-left: auto;
    flex-shrink: 0;
}

.mobile-menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: #10b981;
    margin: 5px 0;
    transition: all 0.3s;
    border-radius: 2px;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* 移动端侧边栏菜单 */
.mobile-sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    width: 280px;
    height: 100vh;
    background: white;
    box-shadow: 2px 0 8px rgba(0,0,0,0.15);
    z-index: 2000;
    overflow-y: auto;
    transition: left 0.3s ease;
    display: none;
}

.mobile-sidebar.show {
    left: 0;
}

.mobile-sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-sidebar-header a {
    transition: opacity 0.3s;
}

.mobile-sidebar-header a:active {
    opacity: 0.7;
}

.mobile-sidebar-header img {
    width: 40px;
    height: 40px;
}

.mobile-sidebar-header h2 {
    font-size: 20px;
    color: #10b981;
    margin: 0;
    font-weight: 700;
}

.mobile-sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-nav-item {
    border-bottom: 1px solid #f3f4f6;
    display: block;
}

.mobile-nav-item > a,
.mobile-nav-item > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    color: #333;
    text-decoration: none;
    font-size: 15px;
    transition: background 0.2s;
    cursor: pointer;
}

.mobile-nav-item > a:active,
.mobile-nav-item > div:active {
    background: #f9fafb;
}

.mobile-nav-item.expandable.active {
    background: #f3f4f6;
}

.mobile-nav-item .nav-icon {
    margin-right: 10px;
    font-size: 18px;
}

.mobile-nav-item .nav-text {
    flex: 1;
}

.mobile-nav-item .nav-arrow {
    font-size: 12px;
    transition: transform 0.3s;
}

.mobile-nav-item.expandable.active .nav-arrow {
    transform: rotate(90deg);
}

.mobile-sub-menu {
    display: flex !important;
    flex-direction: column !important;
    max-height: 0;
    overflow: hidden;
    background: #f9fafb;
    transition: max-height 0.3s ease;
    width: 100% !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    align-items: stretch !important;
}

.mobile-sub-menu.show {
    max-height: 500px;
}

.mobile-sub-menu a {
    display: block !important;
    width: 100% !important;
    padding: 12px 20px 12px 50px !important;
    color: #666 !important;
    text-decoration: none !important;
    font-size: 14px !important;
    border-bottom: 1px solid #f3f4f6 !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    float: none !important;
    clear: both !important;
    flex: none !important;
    position: static !important;
    margin: 0 !important;
    line-height: 1.4 !important;
}

.mobile-sub-menu a:last-child {
    border-bottom: none;
}

.mobile-sub-menu a:active {
    background: #f3f4f6;
}

.mobile-sidebar-divider {
    height: 8px;
    background: #f3f4f6;
    margin: 10px 0;
}

/* 遮罩层 */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    display: none;
}

.mobile-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* 响应式容器宽度 - 移动端调整 (≤1100px) */
@media (max-width: 1100px) {
    .header-container {
        padding: 0 15px;
    }
    
    .header-content {
        flex-wrap: wrap;
        gap: 0;
        justify-content: flex-start;
    }
    
    /* Logo区域在移动端 */
    .logo-area {
        flex: 1;
        min-width: 0;
    }
    
    .logo-area h1 {
        font-size: 20px;
    }
    
    #width-display {
        display: none !important; /* 移动端隐藏宽度显示 */
    }
    
    /* 显示汉堡菜单按钮 */
    .mobile-menu-toggle {
        display: block !important;
        order: 2;
    }
    
    /* 显示移动端侧边栏和遮罩层 */
    .mobile-sidebar,
    .mobile-overlay {
        display: block;
    }
    
    /* 强化移动端二级菜单纵向布局 */
    .mobile-sub-menu {
        display: block !important;
        flex-direction: column !important;
    }
    
    .mobile-sub-menu a {
        display: block !important;
        width: 100% !important;
        float: none !important;
        flex: none !important;
        position: static !important;
    }
    
    /* 导航和搜索区域 */
    .nav-and-search {
        width: 100%;
        flex-direction: column;
        gap: 0;
        order: 3; /* 放到最后 */
    }
    
    /* 顶部导航 - 移动端完全隐藏 */
    .top-nav {
        display: none !important;
    }
    
    /* 搜索框 - 独占一行并居中 */
    .search-header {
        width: 100%;
        margin-top: 15px;
        display: flex;
        justify-content: center;
    }
    
    .search-input-top {
        width: 90%;
        max-width: 400px;
    }
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 0;
}

.logo-area {
    display: flex;
    align-items: center; /* 居中对齐 */
    gap: 12px;
}

.logo-area a {
    transition: opacity 0.3s;
}

.logo-area a:hover {
    opacity: 0.8;
}

.logo-img {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    display: block;
    object-fit: contain; /* 保持图片比例 */
}

.logo-area h1 {
    font-size: 28px;
    font-weight: 700;
    color: #10b981;
    line-height: 1;
    margin: 0;
    padding: 0;
}

.nav-and-search {
    display: flex;
    align-items: center;
    gap: 30px;
}

.top-nav {
    display: flex;
    gap: 35px;
    align-items: center;
}

.nav-item {
    position: relative;
}

.nav-item > a {
    color: #666;
    text-decoration: none;
    font-size: 15px;
    padding: 10px 0;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-item > a:hover {
    color: #10b981;
}

.nav-item.has-submenu > a::after {
    content: '▼';
    font-size: 10px;
    margin-left: 4px;
}

/* 二级菜单 */
.submenu {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 8px 0;
    min-width: 160px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 1000;
}

.nav-item:hover .submenu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.submenu a {
    display: block;
    padding: 10px 20px;
    color: #666;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    white-space: nowrap;
}

.submenu a:hover {
    background: #f0fdf4;
    color: #10b981;
}

.nav-item.has-submenu > a::after {
    transition: transform 0.3s;
}

.nav-item.has-submenu:hover > a::after {
    transform: rotate(180deg);
}

.search-header {
    position: relative;
}

.search-input-top {
    width: 280px;
    padding: 10px 20px;
    border: 1px solid #d1fae5;
    border-radius: 25px;
    background: #f9fafb;
    color: #333;
    outline: none;
    font-size: 14px;
}

.search-input-top::placeholder {
    color: #999;
}

.search-input-top:focus {
    border-color: #10b981;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* 主搜索区 - 隐藏 */
.search-banner {
    display: none;
}

/* 主布局 */
.main-layout {
    display: flex;
}

/* 左侧导航 - 贴边固定 */
.left-sidebar {
    width: 150px;  /* 调窄三分之一：220px → 150px */
    background: #ffffff;
    border-right: 1px solid #f0f0f0;
    position: fixed;
    left: 0;
    top: 80px;
    bottom: 0;
    overflow-y: auto;
    z-index: 500;  /* 高于主体内容 */
}

.left-sidebar::-webkit-scrollbar {
    width: 6px;
}

.left-sidebar::-webkit-scrollbar-thumb {
    background: #d1fae5;
    border-radius: 3px;
}

.sidebar-section {
    background: white;
    padding: 0;
}

.sidebar-header {
    background: #fafafa;
    color: #666;
    padding: 10px 12px;  /* 减小内边距适应更窄宽度 */
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #f0f0f0;
}

.category-nav {
    list-style: none;
    padding: 0;
}

.category-nav > li {
    border-bottom: 1px solid #f5f5f5;
}

.category-item {
    padding: 10px 12px;  /* 减小内边距适应更窄宽度 */
    cursor: pointer;
    transition: all 0.2s;
    font-size: 12px;  /* 字体稍微缩小 */
    color: #555;
    display: flex;
    align-items: center;
    gap: 6px;  /* 缩小图标和文字间距 */
    position: relative;
}

.category-item:hover {
    background: #fafafa;
    color: #10b981;
}

.category-item.active {
    background: #f0fdf4;
    color: #10b981;
    font-weight: 500;
}

.category-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #10b981;
}

.cat-icon {
    font-size: 14px;  /* 缩小图标 */
    width: 18px;
    text-align: center;
}

.cat-icon i {
    font-size: 13px;
}

.cat-count {
    display: none;  /* 隐藏统计数字，但后端保留统计用于"查看更多"判断 */
}

/* 二级分类 */
.sub-categories {
    list-style: none;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: #fafafa;
}

.category-item.has-sub::after {
    content: '›';
    margin-left: auto;
    font-size: 18px;
    transition: transform 0.3s;
}

.category-item.has-sub.expanded::after {
    transform: rotate(90deg);
}

.category-item.has-sub.expanded + .sub-categories {
    max-height: 500px;
}

.sub-categories li {
    padding: 8px 12px 8px 32px;  /* 减小内边距适应更窄宽度 */
    font-size: 11px;  /* 字体稍微缩小 */
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sub-categories li:hover {
    background: #f0f0f0;
    color: #10b981;
    border-left-color: #10b981;
}

.sub-categories li.active {
    color: #10b981;
    font-weight: 500;
    border-left-color: #10b981;
}

/* 主内容区 */
.main-content {
    width: 100%;
    margin-left: 150px;  /* 为左侧菜单腾出空间 */
    padding: 30px 40px;
}

.content-wrapper {
    max-width: 1600px;
    margin: 0 auto;
}

/* 让所有内容板块都居中对齐 */
.content-section {
    width: 100%;
    max-width: 1900px;  /* 容器最大宽度上限 */
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 20px;
}

/* 响应式优化 - 移动端样式 (≤1100px) */
@media (max-width: 1100px) {
    .content-section {
        border-radius: 8px;
        padding: 15px;
    }
    
    .section-title-bar h3 {
        font-size: 16px;
    }
    
    .category-secondary {
        gap: 8px;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .secondary-tabs-container {
        width: 100%;
    }
    
    .secondary-tab {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .category-secondary .category-more-link {
        align-self: flex-end;
    }
}

/* 快捷分类卡片 */
.quick-cats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.quick-cat-card {
    background: white;
    border-radius: 10px;
    padding: 20px 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid #f0f0f0;
}

.quick-cat-card:hover {
    transform: translateY(-5px);
    border-color: #d1fae5;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.1);
}

.quick-cat-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.quick-cat-title {
    font-size: 14px;
    font-weight: 600;
    color: #059669;
    margin-bottom: 4px;
}

.quick-cat-desc {
    font-size: 11px;
    color: #6b7280;
}

/* 隐藏快捷分类 */
.quick-cats {
    display: none !important;
}

/* 内容板块样式 */
.content-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid #f5f5f5;
}

.section-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.section-title-bar h3 {
    font-size: 18px;
    color: #333;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title-bar h3::before {
    content: '';
    width: 4px;
    height: 18px;
    background: #10b981;
    border-radius: 2px;
}

.more-link {
    color: #10b981;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.3s;
}

.more-link:hover {
    color: #059669;
}

/* 统一卡片样式 - 所有板块共用 - 固定列数 */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);  /* 桌面端固定6列 (>1100px) */
    gap: 15px;
}

/* 移动端 - 2列 (≤1100px) */
@media (max-width: 1100px) {
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .left-sidebar {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
        padding: 20px 15px;
    }
}

.tool-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.tool-card:hover {
    transform: translateY(-3px);
    border-color: #d1fae5;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.1);
}

.tool-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 24px;
    line-height: 1;
    overflow: hidden;
}

.tool-card-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 如果图标是图片，移除背景 */
.tool-card-icon:has(img) {
    background: transparent;
}

.tool-card-content {
    flex: 1;
    min-width: 0;
}

.tool-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 6px;
    line-height: 1.4;
}

.tool-card-intro {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 分类工具 - 一级二级分类 */
.category-section {
    margin-bottom: 25px;
}

.category-primary {
    background: #fafafa;
    color: #333;
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-left: 4px solid #10b981;
}

.category-more-link {
    color: #333;
    font-size: 14px;
    font-weight: 400;
    text-decoration: none;
    transition: all 0.3s;
    margin-left: auto;
}

.category-more-link:hover {
    color: #10b981;
}

.category-secondary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.secondary-tabs-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    flex: 1;
}

.secondary-tab {
    padding: 8px 18px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
    color: #666;
    font-weight: 500;
    white-space: nowrap;
}

.secondary-tab:hover {
    border-color: #d1fae5;
    color: #10b981;
}

.secondary-tab.active {
    background: #ecfdf5;
    color: #10b981;
    border-color: #10b981;
}

