/* 首页样式 */

/* 主内容布局 */
.main-content {
    display: flex;
    flex-direction: row;
    gap: 30px;
    align-items: flex-start;
    min-height: calc(100vh - 200px);
    margin-top: 20px;
}

/* 分类导航侧边栏 */
.category-sidebar {
    flex-shrink: 0;
    width: 200px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 0;
    position: sticky;
    top: 120px;
    align-self: flex-start;
    margin-top: 0;
    overflow: hidden;
}

/* 分类标题栏（可点击） */
.category-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background-color: #fff;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    user-select: none;
}

.category-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.category-toggle-icon {
    font-size: 12px;
    color: #999;
    transition: transform 0.3s ease;
}

.category-toggle-icon.expanded {
    transform: rotate(180deg);
}

/* 分类内容区域 */
.category-content {
    padding: 20px;
}

.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-list li {
    margin-bottom: 8px;
}

.category-item {
    display: block;
    padding: 1px 12px;
    text-decoration: none;
    color: #666;
    font-size: 14px;
    border-radius: 4px;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    border-right: 3px solid transparent;
}

.category-item:hover {
    background-color: #f5f5f5;
    color: #333;
    border-color: #ff9d00;
}

.category-item.active {
    background-color: #f5f5f5;
    color: #ff9d00;
    font-weight: 600;
   
}

/* 主要内容区域 */
.content-area {
    flex-grow: 1;
    min-width: 0;
    padding-top: 0;
}

.content-area h1 {
    margin: 0 0 20px 0;
    font-size: 24px;
    font-weight: 600;
    color: #333;
    text-align: left;
    width: 100%;
}

/* 搜索栏样式 */
.search-container {
    margin: 30px 0;
}

.search-box {
    display: flex;
    gap: 10px;
    max-width: 800px;
    margin: 0 auto;
    /* 强制约束在一行，禁止换行 */
    flex-wrap: nowrap;
}

.search-input-container {
    flex-grow: 15;
    flex-shrink: 1;
    flex-basis: 0;
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
}

.search-input {
    flex-grow: 1;
    width: 100%;
    padding: 12px 40px 12px 24px;
    border: 2px solid #ddd;
    border-radius: 25px;
    font-size: 16px;
    height: 48px;
    line-height: 24px;
    transition: border-color 0.3s;
}

.search-input:focus {
    border-color: #ff9d00;
    outline: none;
}

/* 搜索框清空按钮 */
.search-clear-btn {
    position: absolute;
    right: 8px;
    width: 28px;
    height: 28px;
    border: none;
    background: #f0f0f0;
    color: #999;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.search-clear-btn:hover {
    background: #e0e0e0;
    color: #666;
}

.search-input:not(:placeholder-shown) + .search-clear-btn {
    display: flex;
}

.search-btn {
    flex-grow: 1;
    flex-shrink: 0;
    flex-basis: 0;
    padding: 12px 28px;
    font-size: 16px;
    white-space: nowrap;
    background: linear-gradient(135deg, #ff9d00, #ff8800);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(255, 157, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: fit-content;
}

.search-btn:hover {
    background: linear-gradient(135deg, #ff8800, #ff7700);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 157, 0, 0.4);
}

.search-btn:active {
    transform: translateY(0);
}

/* 视频网格布局 */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

/* 视频卡片样式 */
.video-card {
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

.video-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* 视频缩略图 */
.video-thumbnail {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    overflow: hidden;
    background-color: #f0f0f0;
}

.video-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-card:hover .video-thumbnail img {
    transform: scale(1.05);
    transition: transform 0.3s;
}

/* 视频覆盖层 */
.video-overlay {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

/* 视频信息 */
.video-info {
    padding: 12px;
}

.video-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: #333;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #999;
}

.video-author {
    color: #666;
}

/* 加载更多按钮样式 */
.load-more-container {
    text-align: center;
    margin-top: 40px;
}

.load-more-btn {
    padding: 12px 36px;
    font-size: 16px;
}

/* 首页响应式设计 */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
        gap: 20px;
    }

    .category-sidebar {
        width: 100%;
        position: static;
        margin-bottom: 20px;
    }

    /* 在移动端显示折叠标题栏 */
    .category-header {
        display: flex;
    }

    /* 分类内容默认折叠状态 */
    .category-content {
        max-height: 0;
        padding: 0 20px;
        overflow: hidden;
        transition: max-height 0.3s ease, padding 0.3s ease;
    }

    /* 展开状态 */
    .category-content.expanded {
        max-height: 500px;
        padding: 20px;
        overflow-y: auto;
    }

    .category-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .category-item {
        text-align: center;
        border-left: none;
        border-bottom: 2px solid transparent;
        padding: 8px 4px;
        font-size: 13px;
    }

    .category-item.active {
        border-left: none;
        border-bottom-color: #ff9d00;
    }

    .search-box {
        flex-direction: row;
        flex-wrap: nowrap;
    }

    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }

    .video-title {
        font-size: 13px;
    }

    .video-meta {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .category-list {
        grid-template-columns: repeat(2, 1fr);
    }

    .video-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .video-info {
        padding: 8px;
    }

    .video-title {
        font-size: 12px;
    }

    .video-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}
