/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 顶部搜索栏 */
.header {
    background-color: #2c5aa0;
    padding: 10px 15px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

    .header.hidden {
        transform: translateY(-100%);
    }

.logo-section {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo {
    width: 30px;
    height: 30px;
    background-color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    font-weight: bold;
    color: #2c5aa0;
    font-size: 16px;
}

.site-name {
    color: white;
    font-size: 18px;
    font-weight: bold;
}

.search-bar {
    background-color: white;
    border-radius: 20px;
    padding: 8px 15px;
    display: flex;
    align-items: center;
}

.search-icon {
    color: #999;
    margin-right: 8px;
    font-size: 16px;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
}

/* 搜索弹窗 */
.search-popup {
    position: fixed;
    top: -100%;
    left: 0;
    right: 0;
    background-color: white;
    z-index: 1002;
    transition: top 0.3s ease;
    max-height: 80vh;
    overflow-y: auto;
}

.search-popup.show {
    top: 0;
}

.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    z-index: 1001;
}

.search-overlay.show {
    opacity: 1;
    visibility: visible;
}

.search-header {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background-color: #2c5aa0;
}

.search-bar {
    flex: 1;
    background-color: white;
    border-radius: 20px;
    padding: 8px 15px;
    display: flex;
    align-items: center;
    margin-right: 10px;
}

.search-icon {
    color: #999;
    margin-right: 8px;
    font-size: 16px;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
}

.clear-button {
    color: #999;
    font-size: 16px;
    cursor: pointer;
    display: none;
}

.clear-button.show {
    display: block;
}

.cancel-button {
    color: white;
    font-size: 16px;
    cursor: pointer;
}

/* 历史搜索 */
.search-history,
.hot-search {
    padding: 15px;
}

.history-header,
.hot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 14px;
    color: #999;
}

.clear-history {
    font-size: 13px;
    cursor: pointer;
}

.history-tags,
.hot-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.history-tag {
    padding: 6px 14px;
    background-color: #f5f5f5;
    border-radius: 16px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
}

.hot-tag {
    display: flex;
    align-items: center;
    padding: 6px 14px;
    background-color: #f5f5f5;
    border-radius: 16px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
}

.hot-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 9px;
    background-color: #999;
    color: white;
    font-size: 11px;
    margin-right: 6px;
}

.hot-rank-1 {
    background-color: #ff4d4f;
}

.hot-rank-2 {
    background-color: #ff7a45;
}

.hot-rank-3 {
    background-color: #ffa940;
}

/* 点击反馈效果 */
.history-tag:active,
.hot-tag:active,
.clear-history:active {
    opacity: 0.7;
}

/* 分类筛选栏 */
.category-filter {
    background-color: white;
    padding: 12px 0;
    margin-top: 0;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    position: fixed;
    top: 50px;
    left: 0;
    right: 0;
    z-index: 999;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.category-filter::-webkit-scrollbar {
    display: none;
}

.category-filter ul {
    display: flex;
    padding: 0 15px;
}

.category-filter li {
    list-style: none;
    margin-right: 20px;
    font-size: 14px;
    padding: 5px 0;
    position: relative;
}

.category-filter li.active {
    color: #2c5aa0;
    font-weight: 500;
}

.category-filter li.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #2c5aa0;
    border-radius: 1px;
}

/* 排序筛选栏 */
.sort-filter {
    background-color: white;
    margin-top: 102px;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: #666;
    position: fixed;
    top: 102px;
    left: 0;
    right: 0;
    z-index: 998;
    border-bottom: 1px solid #f0f0f0;
}

.sort-item {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.sort-item i {
    margin-left: 2px;
    font-style: normal;
    opacity: 0.5;
}

.sort-item.active {
    color: #2c5aa0;
}

.sort-item.active i {
    opacity: 1;
}

/* 课程列表容器 */
.course-list {
    padding: 160px 15px 80px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

/* 课程卡片 */
.course-card {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.course-card:active {
    transform: scale(0.98);
}

.course-content {
    position: relative;
}

.course-image {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.course-info {
    padding: 10px;
}

.course-title {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 8px;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.course-meta {
    font-size: 12px;
    color: #999;
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.course-meta i {
    margin-right: 3px;
    font-style: normal;
}

.course-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.course-price {
    font-size: 14px;
    font-weight: bold;
    color: #ff4d4f;
}

.course-rating {
    font-size: 12px;
    color: #ffa940;
    display: flex;
    align-items: center;
}

.course-rating i {
    font-style: normal;
    margin-left: 2px;
}

/* 筛选弹窗 */
.filter-popup {
    position: fixed;
    bottom: -100%;
    left: 0;
    right: 0;
    background-color: white;
    border-radius: 12px 12px 0 0;
    z-index: 1000;
    transition: bottom 0.3s ease;
}

.filter-popup.show {
    bottom: 0;
}

.filter-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    z-index: 999;
}

.filter-overlay.show {
    opacity: 1;
    visibility: visible;
}

.filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.filter-title {
    font-size: 16px;
    font-weight: 500;
}

.filter-close {
    font-size: 16px;
    color: #999;
    cursor: pointer;
}

.filter-content {
    padding: 15px;
}

.filter-section {
    margin-bottom: 20px;
}

.filter-section-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 10px;
    color: #333;
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-option {
    padding: 6px 14px;
    border: 1px solid #ddd;
    border-radius: 16px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
}

.filter-option.active {
    background-color: #2c5aa0;
    color: white;
    border-color: #2c5aa0;
}

.filter-actions {
    padding: 15px;
    display: flex;
    gap: 10px;
    border-top: 1px solid #f0f0f0;
}

.filter-btn {
    flex: 1;
    padding: 10px;
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
    cursor: pointer;
}

.filter-btn.reset {
    background-color: #f5f5f5;
    color: #666;
}

.filter-btn.apply {
    background-color: #2c5aa0;
    color: white;
}

/* 底部导航栏 */
.nav-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    background-color: white;
    display: flex;
    border-top: 1px solid #f0f0f0;
    z-index: 999;
}

.nav-bottom a {
    text-decoration: none;
    color: inherit;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 12px;
}

.nav-item.active {
    color: #2c5aa0;
}

.nav-icon {
    font-size: 18px;
    margin-bottom: 2px;
}

.nav-text {
    font-size: 12px;
}

/* 加载动画 */
.loading {
    padding: 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

/* 响应式调整 */
@media (max-width: 360px) {
    .course-list {
        gap: 10px;
    }
}

@media (min-width: 768px) {
    .course-list {
        grid-template-columns: repeat(4, 1fr);
    }
}