* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* ========== 顶部标题栏 ========== */
.header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 16px 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 { 
    font-size: 20px; 
    font-weight: 600; 
    margin: 0;
}

.header .subtitle { 
    font-size: 16px; 
    opacity: 0.9; 
    font-weight: 400; 
}

.header-plane {
    color: #5dade2;
    margin-right: 6px;
    font-size: 22px;
    transform: rotate(-15deg);
    display: inline-block;
    animation: planeBob 3s ease-in-out infinite;
}

@keyframes planeBob {
    0%, 100% { transform: rotate(-15deg) translateY(0); }
    50% { transform: rotate(-10deg) translateY(-3px); }
}

/* 返回首页按钮 */
.btn-back {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-2px);
}

.btn-back i {
    font-size: 10px;
}

.header-title {
    text-align: center;
    flex: 1;
    margin: 0 10px;
}

.header-right {
    min-width: 60px;
    text-align: right;
}

.header-subtitle {
    font-size: 12px;
    opacity: 0.85;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
}

@media (max-width: 768px) {
    .header {
        padding: 12px 14px;
    }
    
    .header h1 {
        font-size: 16px;
    }
    
    .header-plane {
        font-size: 18px;
        margin-right: 4px;
    }
    
    .btn-back {
        font-size: 10px;
        padding: 3px 6px;
        gap: 2px;
    }
    
    .btn-back i {
        font-size: 9px;
    }
    
    .header-subtitle {
        font-size: 11px;
    }
    
    .header-title {
        margin: 0 6px;
    }
}

/* ========== 工具栏 ========== */
.toolbar {
    max-width: 1400px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    position: sticky;
    top: 56px;
    z-index: 99;
    background: #f5f7fa;
    border-bottom: 1px solid #e0e6ed;
}

/* 分类下拉按钮 */
.category-dropdown {
    position: relative;
    flex-shrink: 0;
}

.category-btn {
    background: white;
    border: 1px solid #e0e6ed;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 15px;
    font-weight: 500;
    color: #1e3c72;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    transition: all 0.2s;
}

.category-btn:hover {
    border-color: #2a5298;
    box-shadow: 0 4px 12px rgba(42, 82, 152, 0.15);
}

.category-btn .arrow {
    font-size: 12px;
    transition: transform 0.2s;
}

.category-btn.open .arrow {
    transform: rotate(180deg);
}

/* 下拉菜单 */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: white;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    min-width: 220px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    padding: 6px 0;
}

.dropdown-menu.show { display: block; }

.dropdown-item {
    padding: 10px 20px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.15s;
}

.dropdown-item:hover { background: #f0f4f8; }

.dropdown-item.active {
    background: #e8f0fe;
    color: #2a5298;
    font-weight: 500;
}

.dropdown-divider {
    height: 1px;
    background: #f0f0f0;
    margin: 4px 0;
}

/* 搜索框 */
.search-box {
    position: relative;
    flex-shrink: 0;
    width: 260px;
}

.search-box input {
    width: 100%;
    padding: 10px 15px 10px 40px;
    border: 1px solid #e0e6ed;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    transition: all 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: #2a5298;
    box-shadow: 0 4px 12px rgba(42, 82, 152, 0.15);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: #999;
}

/* ========== 课程数量 ========== */
.course-count {
    max-width: 1400px;
    margin: 0 auto 15px;
    padding: 0 20px;
    font-size: 13px;
    color: #888;
}

/* ========== 课程卡片网格 ========== */
.course-grid {
    max-width: 1400px;
    margin: 0 auto 40px;
    padding: 0 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.course-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: all 0.3s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.course-card:hover { 
    transform: translateY(-3px); 
    box-shadow: 0 8px 20px rgba(0,0,0,0.1); 
}

.course-card:active { transform: translateY(-1px); }

/* 课程封面 */
.course-cover {
    aspect-ratio: 16/9;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.course-cover img {
    display: block;
    width: 100%;
    height: 100%;
    -webkit-object-fit: cover;
    object-fit: cover;
    object-position: center center;
    position: absolute;
    top: 0;
    left: 0;
    transition: opacity 0.5s ease;
}

.course-cover-title {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    width: 90%;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    line-height: 1.4;
    z-index: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* 课程信息 */
.course-info { 
    padding: 14px 16px; 
    flex: 1;
    display: flex;
    flex-direction: column;
}

.course-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    min-height: 2.8em;
}

.course-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #999;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.course-desc {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    flex: 1;
}

/* ========== 详情弹窗 ========== */
.detail-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.detail-modal.show { display: flex; }

.detail-box {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.close-btn {
    position: absolute;
    top: 12px;
    right: 16px;
    color: white;
    font-size: 28px;
    cursor: pointer;
    background: rgba(0,0,0,0.3);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.2s;
}

.close-btn:hover { background: rgba(0,0,0,0.5); }

/* 详情封面 */
.detail-cover {
    aspect-ratio: 16/9;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.detail-cover img {
    display: block;
    width: 100%;
    height: 100%;
    -webkit-object-fit: cover;
    object-fit: cover;
    object-position: center center;
    position: absolute;
    top: 0;
    left: 0;
}

.detail-cover-title {
    color: white;
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    width: 90%;
    text-shadow: 0 2px 8px rgba(0,0,0,0.4);
    line-height: 1.4;
    z-index: 1;
}

/* 详情信息 */
.detail-info {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* 滚动条样式 - 让用户明显知道可以滚动 */
.detail-info::-webkit-scrollbar {
    width: 6px;
}

.detail-info::-webkit-scrollbar-track {
    background: #f5f5f5;
}

.detail-info::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.detail-info::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.detail-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #1a1a1a;
    line-height: 1.4;
}

.detail-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
    font-size: 14px;
    color: #666;
}

.detail-desc {
    font-size: 14px;
    color: #444;
    line-height: 1.8;
    white-space: pre-wrap;
}

/* 详情底部 */
.detail-footer {
    padding: 16px 24px;
    border-top: 1px solid #eee;
    text-align: right;
    flex-shrink: 0;
}

.btn-primary {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(42, 82, 152, 0.3);
}

.btn-primary:active { transform: translateY(0); }

/* ========== 通用状态 ========== */
.loading { 
    text-align: center; 
    padding: 60px; 
    color: #999; 
    grid-column: 1/-1; 
}

.empty { 
    text-align: center; 
    padding: 60px; 
    color: #999; 
    grid-column: 1/-1; 
}

/* ========== Pad端适配 ========== */
@media (max-width: 1024px) {
    .header { padding: 18px 30px; }
    .toolbar { margin: 20px auto 10px; padding: 0 15px; }
    .course-count { padding: 0 15px; }
    .course-grid { 
        padding: 0 15px; 
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 16px; 
    }
    .search-box { width: 220px; }
    .detail-box { max-width: 90%; }
}

/* ========== 平板竖屏适配 ========== */
@media (max-width: 900px) {
    .course-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========== 手机端适配 ========== */
@media (max-width: 640px) {
    .header { padding: 15px 20px; }
    .header h1 { font-size: 20px; }
    .header .subtitle { font-size: 14px; }
    
    .toolbar { 
        margin: 15px auto 10px; 
        padding: 0 15px; 
        gap: 12px;
    }
    
    .category-btn { padding: 9px 14px; font-size: 14px; }
    
    .search-box { 
        width: auto; 
        flex: 1; 
        min-width: 150px;
    }
    
    .search-box input { padding: 9px 12px 9px 36px; font-size: 13px; }
    .search-icon { left: 10px; font-size: 14px; }
    
    .course-count { padding: 0 15px; font-size: 12px; }
    
    .course-grid { 
        padding: 0 15px; 
        grid-template-columns: 1fr;
        gap: 12px; 
    }
    
    .course-cover-title { font-size: 15px; }
    
    .course-info { padding: 12px 14px; }
    .course-name { font-size: 14px; min-height: auto; -webkit-line-clamp: 1; }
    .course-meta { font-size: 11px; }
    .course-desc { font-size: 12px; -webkit-line-clamp: 2; }
    
    .dropdown-menu { min-width: 200px; }
    
    .detail-modal { padding: 10px; }
    .detail-box { max-width: 100%; max-height: 95vh; }
    .detail-cover-title { font-size: 18px; }
    .detail-info { padding: 16px; }
    .detail-title { font-size: 18px; }
    .detail-meta { font-size: 13px; gap: 15px; }
    .detail-desc { font-size: 13px; }
    .detail-footer { padding: 12px 16px; }
    
    .close-btn { 
        top: 8px; 
        right: 10px; 
        width: 32px; 
        height: 32px; 
        font-size: 24px; 
    }
}