/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #2D3748;
    background-color: #F7FAFC;
    -webkit-overflow-scrolling: touch;
    overflow-x: hidden;
}

/* 链接样式 */
a {
    text-decoration: none;
    color: #667EEA;
    transition: color 0.3s ease;
}

a:hover {
    color: #764BA2;
}

/* 按钮样式 */
button {
    font-family: inherit;
    font-size: inherit;
    border: none;
    outline: none;
    cursor: pointer;
    background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

/* 输入框样式 */
input {
    font-family: inherit;
    font-size: inherit;
    padding: 10px 15px;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    outline: none;
    transition: all 0.3s ease;
}

input:focus {
    border-color: #667EEA;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 标题样式 */
h1, h2, h3, h4, h5, h6 {
    color: #2D3748;
    font-weight: 600;
    line-height: 1.2;
}

h1 {
    font-size: 24px;
}

h2 {
    font-size: 20px;
}

h3 {
    font-size: 18px;
}

/* 容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 导航栏 */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 55px;
    background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.navbar .logo {
    font-size: 18px;
    font-weight: 600;
    color: white;
}

.navbar .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid white;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.navbar .user-avatar:hover {
    transform: scale(1.1);
}

/* 底部导航 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: white;
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    z-index: 1000;
}

.bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 33.33%;
    height: 100%;
    color: #718096;
    text-decoration: none;
    transition: all 0.3s ease;
}

.bottom-nav .nav-item.active {
    color: #667EEA;
}

.bottom-nav .nav-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.bottom-nav .nav-text {
    font-size: 12px;
}

/* 首页图标 */
.home-icon {
    background-image: url('../images/home.png');
}

.favorites-icon {
    background-image: url('../images/favorites.png');
}

.profile-icon {
    background-image: url('../images/profile.png');
}

.bottom-nav .nav-item.active .home-icon {
    background-image: url('../images/home-active.png');
}

.bottom-nav .nav-item.active .favorites-icon {
    background-image: url('../images/favorites-active.png');
}

.bottom-nav .nav-item.active .profile-icon {
    background-image: url('../images/profile-active.png');
}

/* 卡片样式 */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    padding: 16px;
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 50%;
    border-top-color: #667EEA;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 错误提示 */
.error {
    color: #E53E3E;
    font-size: 14px;
    margin-top: 8px;
}

/* 成功提示 */
.success {
    color: #4FD1C5;
    font-size: 14px;
    margin-top: 8px;
}

/* 遮罩层 */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 底部弹出框 */
.bottom-popup {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 20px 20px 0 0;
    padding: 20px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    z-index: 2000;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* 课程卡片 */
.course-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: all 0.3s ease;
    margin-bottom: 16px;
}

.course-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.course-card .course-cover {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.course-card .course-info {
    padding: 16px;
}

.course-card .course-title {
    font-size: 16px;
    font-weight: 600;
    color: #2D3748;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.course-card .course-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 12px;
    color: #718096;
}

.course-card .course-teacher {
    flex: 1;
}

.course-card .course-duration {
    margin-left: 16px;
}

.course-card .course-price {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.course-card .price {
    font-size: 18px;
    font-weight: 600;
    color: #667EEA;
}

.course-card .vip-price {
    font-size: 14px;
    color: #718096;
    text-decoration: line-through;
    margin-left: 8px;
}

.course-card .favorites-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    box-shadow: none;
    color: #718096;
    font-size: 20px;
}

.course-card .favorites-btn.favorited {
    color: #F093FB;
}

/* 章节列表 */
.chapter-list {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.chapter-item {
    padding: 16px;
    border-bottom: 1px solid #F7FAFC;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.chapter-item:last-child {
    border-bottom: none;
}

.chapter-item:hover {
    background-color: #F7FAFC;
}

.chapter-item.active {
    background-color: rgba(102, 126, 234, 0.05);
    border-left: 4px solid #667EEA;
}

.chapter-item .chapter-info {
    flex: 1;
}

.chapter-item .chapter-title {
    font-size: 14px;
    font-weight: 500;
    color: #2D3748;
    margin-bottom: 4px;
}

.chapter-item .chapter-duration {
    font-size: 12px;
    color: #718096;
}

.chapter-item .free-tag {
    font-size: 10px;
    color: #4FD1C5;
    background: rgba(79, 209, 197, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
}

/* 会员标识 */
.vip-tag {
    display: inline-block;
    font-size: 10px;
    color: #F093FB;
    background: rgba(240, 147, 251, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
}

/* 支付弹窗 */
.payment-popup {
    background: white;
    border-radius: 12px;
    padding: 24px;
    width: 90%;
    max-width: 400px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.payment-popup h3 {
    margin-bottom: 20px;
    text-align: center;
}

.payment-method {
    display: flex;
    align-items: center;
    padding: 16px;
    border: 2px solid #E2E8F0;
    border-radius: 12px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.payment-method.active {
    border-color: #667EEA;
    background-color: rgba(102, 126, 234, 0.05);
}

.payment-method .method-icon {
    width: 32px;
    height: 32px;
    margin-right: 16px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.payment-method .method-info {
    flex: 1;
}

.payment-method .method-name {
    font-size: 14px;
    font-weight: 500;
    color: #2D3748;
}

.payment-method .method-desc {
    font-size: 12px;
    color: #718096;
    margin-top: 2px;
}

.payment-amount {
    font-size: 24px;
    font-weight: 600;
    color: #667EEA;
    text-align: center;
    margin: 20px 0;
}

.payment-btn {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
    margin-top: 20px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        font-size: 13px;
    }
    
    .navbar {
        padding: 0 16px;
    }
    
    .navbar .logo {
        font-size: 16px;
    }
    
    .card {
        padding: 12px;
    }
    
    .course-card .course-cover {
        height: 160px;
    }
    
    .course-card .course-info {
        padding: 12px;
    }
}

/* 骨架屏 */
.skeleton {
    background: linear-gradient(90deg, #F7FAFC 25%, #EDF2F7 50%, #F7FAFC 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-course {
    margin-bottom: 16px;
}

.skeleton-course .skeleton-cover {
    height: 180px;
    width: 100%;
    margin-bottom: 12px;
}

.skeleton-course .skeleton-title {
    height: 16px;
    width: 80%;
    margin-bottom: 8px;
}

.skeleton-course .skeleton-meta {
    height: 12px;
    width: 60%;
    margin-bottom: 12px;
}

.skeleton-course .skeleton-price {
    height: 18px;
    width: 40%;
}