* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
    flex: 1;
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px 0;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 100%;
}

header h1 {
    font-size: clamp(1.8em, 4vw, 2.5em);
    margin-bottom: 10px;
}

.subtitle {
    font-size: clamp(0.9em, 2vw, 1.1em);
    opacity: 0.9;
}

/* Main Content */
main {
    padding: 40px 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.courses {
    width: 100%;
    max-width: 1200px;
}

.courses h2 {
    text-align: center;
    font-size: clamp(1.5em, 3vw, 2em);
    margin-bottom: 30px;
    color: #333;
}

.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
    gap: 30px;
    margin-top: 30px;
    width: 100%;
    justify-items: center;
}

.course-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
}

.course-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.course-image {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    display: block;
    cursor: pointer;
    transition: opacity 0.3s;
}

.course-image:hover {
    opacity: 0.9;
}

.course-info {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.course-info h3 {
    margin-bottom: 10px;
}

.course-info h3 a {
    color: #333;
    text-decoration: none;
    font-size: clamp(1.1em, 2.5vw, 1.3em);
}

.course-info h3 a:hover {
    color: #667eea;
}

.course-desc {
    color: #666;
    margin-bottom: 15px;
    font-size: clamp(0.85em, 2vw, 0.95em);
    min-height: 40px;
    flex: 1;
}

.course-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: clamp(0.8em, 2vw, 0.9em);
    color: #999;
    flex-wrap: wrap;
    gap: 10px;
}

.course-price {
    font-size: clamp(1.2em, 3vw, 1.5em);
    color: #e74c3c;
    font-weight: bold;
    margin-bottom: 15px;
}

.btn-buy {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 30px;
    text-decoration: none;
    border-radius: 5px;
    text-align: center;
    width: 100%;
    transition: opacity 0.3s;
    font-size: clamp(0.9em, 2vw, 1em);
}

.btn-buy:hover {
    opacity: 0.9;
}

/* Detail Page */
.detail-container {
    background: white;
    padding: clamp(20px, 4vw, 40px);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin: 30px auto;
    max-width: 1000px;
    width: 100%;
}

.detail-header {
    margin-bottom: 30px;
    text-align: center;
}

.detail-header h1 {
    font-size: clamp(1.8em, 4vw, 2.5em);
    color: #333;
    margin-bottom: 10px;
}

.detail-price {
    font-size: clamp(1.5em, 3vw, 2em);
    color: #e74c3c;
    font-weight: bold;
    margin: 20px 0;
}

.detail-images {
    margin: 30px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.detail-images img {
    width: 100%;
    max-width: 600px;
    height: auto;
    aspect-ratio: 3 / 2;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    object-fit: cover;
}

.detail-content {
    margin: 30px 0;
    line-height: 1.8;
}

.detail-content h2 {
    color: #667eea;
    margin: 30px 0 15px 0;
    font-size: clamp(1.2em, 2.5vw, 1.5em);
}

.detail-content p {
    margin-bottom: 15px;
    color: #555;
    font-size: clamp(0.9em, 2vw, 1em);
}

.detail-content ul {
    margin-left: 30px;
    margin-bottom: 20px;
}

.detail-content li {
    margin-bottom: 10px;
    color: #555;
    font-size: clamp(0.9em, 2vw, 1em);
}

.reviews {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #eee;
}

.reviews h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: clamp(1.2em, 2.5vw, 1.5em);
}

.review-item {
    background: #f9f9f9;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.review-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.review-user {
    font-weight: bold;
    color: #333;
}

.review-date {
    color: #999;
    font-size: clamp(0.8em, 1.8vw, 0.9em);
}

.review-rating {
    color: #f39c12;
    margin: 10px 0;
}

.review-content {
    color: #555;
    line-height: 1.6;
    font-size: clamp(0.9em, 2vw, 1em);
}

.back-link {
    display: inline-block;
    margin: 20px 0;
    color: #667eea;
    text-decoration: none;
    font-size: clamp(1em, 2vw, 1.1em);
}

.back-link:hover {
    text-decoration: underline;
}

/* Order Page */
.order-container {
    background: white;
    padding: clamp(20px, 4vw, 40px);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin: 30px auto;
    max-width: 800px;
    width: 100%;
}

.order-container h1 {
    margin-bottom: 30px;
    color: #333;
    text-align: center;
    font-size: clamp(1.5em, 3vw, 2em);
}

.order-item {
    display: flex;
    align-items: center;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.order-item img {
    width: 120px;
    height: auto;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    border-radius: 5px;
    flex-shrink: 0;
}

.order-item-info {
    flex: 1;
    min-width: 200px;
}

.order-item-info h3 {
    margin-bottom: 10px;
    font-size: clamp(1em, 2.5vw, 1.2em);
}

.order-item-price {
    font-size: clamp(1.1em, 2.5vw, 1.3em);
    color: #e74c3c;
    font-weight: bold;
}

.order-info {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.order-info-item {
    font-size: clamp(1em, 2.2vw, 1.1em);
    color: #333;
}

.order-info-item strong {
    color: #667eea;
    margin-right: 8px;
}

.order-info-item span {
    color: #e74c3c;
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

.order-form {
    margin-top: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: bold;
    font-size: clamp(0.9em, 2vw, 1em);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: clamp(0.9em, 2vw, 1em);
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.btn-submit {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 40px;
    border: none;
    border-radius: 5px;
    font-size: clamp(1em, 2.2vw, 1.1em);
    cursor: pointer;
    width: 100%;
    transition: opacity 0.3s;
}

.btn-submit:hover {
    opacity: 0.9;
}

.total-price {
    text-align: right;
    font-size: clamp(1.2em, 3vw, 1.5em);
    color: #e74c3c;
    font-weight: bold;
    margin: 20px 0;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

/* Footer */
footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 30px 0;
    margin-top: 50px;
    width: 100%;
}

footer p {
    margin: 5px 0;
    font-size: clamp(0.85em, 2vw, 1em);
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: clamp(45px, 5vw, 50px);
    height: clamp(45px, 5vw, 50px);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    z-index: 1000;
}

.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.back-to-top.show {
    display: flex;
}

.back-to-top svg {
    width: clamp(20px, 3vw, 24px);
    height: clamp(20px, 3vw, 24px);
    fill: white;
}

/* 侧边在线客服 - 右侧隐藏式 */
.online-service {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 900;
}

.online-service-main {
    position: relative;
    right: -150px; /* 大部分隐藏在右侧 */
    background: #ffffff;
    border-radius: 10px 0 0 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
    padding: 10px 12px 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 170px;
    border: 1px solid #e5e5e5;
    border-right: none;
    transition: right 0.25s ease;
}

/* 悬停时滑出 */
.online-service:hover .online-service-main {
    right: 0;
}

.online-service-title {
    font-size: 14px;
    font-weight: bold;
    color: #333;
}

.online-service-text {
    font-size: 12px;
    color: #777;
}

.online-service-btn {
    margin-top: 4px;
    display: inline-block;
    text-align: center;
    padding: 8px 0;
    border-radius: 6px;
    background: linear-gradient(135deg, #ff9a3c 0%, #ff6a00 100%);
    color: #fff;
    font-size: 13px;
    text-decoration: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.online-service-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* Responsive */
@media (max-width: 768px) {
    .course-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .container {
        padding: 0 15px;
    }
    
    main {
        padding: 20px 0;
    }
    
    .detail-container,
    .order-container {
        padding: 20px;
        margin: 20px auto;
    }
    
    .back-to-top {
        bottom: 20px;
        right: 20px;
    }
    
    .order-item {
        flex-direction: column;
        text-align: center;
    }
    
    .order-item img {
        width: 100%;
        max-width: 200px;
    }

    .online-service {
        top: auto;
        bottom: 90px;
        right: 0;
        transform: none;
    }

    .online-service-main {
        right: -120px;
    }
}

@media (max-width: 480px) {
    header {
        padding: 20px 0;
    }
    
    .course-card {
        max-width: 100%;
    }
    
    .detail-images img {
        max-width: 100%;
    }
}

/* 确保内容始终居中 */
body > * {
    width: 100%;
}

main > * {
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}
