/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* 移除移动端点击高亮 */
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%; /* 防止字体自动调整 */
    scroll-behavior: smooth;
}

body {
    font-family: 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    margin: 0;
    padding: 0;
    width: 100vw;
    overflow-x: hidden;
    touch-action: pan-y; /* 优化触摸体验 */
    position: relative;
}

/* 微信内特殊样式 - iPhone X以上机型安全区域适配 */
@supports (padding: env(safe-area-inset-top)) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 导航栏样式 */
.navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    transition: all 0.3s ease;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.nav-logo h2 {
    color: white;
    font-size: 1.5rem;
    font-weight: 600;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: #ffd700;
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 0;
    background-color: #ffd700;
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* 下拉菜单 */
.dropdown {
    position: relative;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-width: 180px;
    list-style: none;
    padding: 10px 0;
    margin-top: 0;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 1001;
}

.dropdown:hover .dropdown-menu,
.dropdown-menu:hover {
    display: block;
}

.dropdown-menu li {
    padding: 0;
}

.dropdown-menu a {
    display: block;
    padding: 10px 20px;
    color: white;
    text-decoration: none;
    font-size: 0.95rem;
    transition: background 0.3s ease;
}

.dropdown-menu a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffd700;
}

/* 汉堡菜单 - 移动端优化 */
.hamburger-menu {
    display: none;
    width: 44px; /* 最小触控尺寸44x44 */
    height: 44px;
    background: none;
    border: none;
    position: relative;
    cursor: pointer;
    padding: 10px;
    z-index: 1002;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s ease;
}

.hamburger-menu:active {
    transform: scale(0.95);
}

.hamburger-line {
    width: 24px;
    height: 2px;
    background-color: white;
    margin: 3px 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    border-radius: 2px;
}

/* 汉堡菜单激活状态 */
.hamburger-menu.active .hamburger-line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.hamburger-menu.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active .hamburger-line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* 移动端导航遮罩层 */
.mobile-nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    z-index: 998; /* 在按钮(1002)和菜单(1001)下方 */
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none; /* 默认不拦截点击 */
}

.mobile-nav-overlay.active {
    opacity: 1;
    /* pointer-events通过JavaScript延迟启用 */
}

/* 遮罩层完全激活后才启用pointer-events */
.mobile-nav-overlay.active.ready {
    pointer-events: auto;
}

/* 兼容旧代码 */
.hamburger {
    display: none;
}

.bar {
    width: 25px;
    height: 3px;
    background-color: white;
    margin: 3px 0;
    transition: 0.3s;
}

/* 轮播图样式 */
.hero {
    position: relative;
    height: 600px;
    overflow: hidden;
    margin-top: 70px;
}

.carousel-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

.carousel-slide.active {
    opacity: 1;
}

/* 主题纯色背景的幻灯片（用于替换图片banner） */
.carousel-slide.themed {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.carousel-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.carousel-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
    z-index: 2;
}

.carousel-content h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.carousel-content p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.carousel-controls {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 3;
}

.carousel-btn {
    background: rgba(255,255,255,0.3);
    border: none;
    color: white;
    font-size: 2rem;
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.carousel-btn:hover {
    background: rgba(255,255,255,0.5);
}

.carousel-indicators {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 3;
}

.indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: background 0.3s ease;
}

.indicator.active {
    background: white;
}

/* 主要内容区域 */
.main-content {
    padding: 60px 0;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: #333;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* 特色介绍 */
.features {
    background: white;
    padding: 80px 0;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-top: 3rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.feature-card {
    text-align: center;
    padding: 1.5rem 1rem;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: white;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.feature-card:hover .feature-icon {
    transform: scale(1.1);
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 0.8rem;
    display: inline-block;
    transition: transform 0.3s ease;
}

.feature-card h3 {
    font-size: 1.2rem;
    margin-bottom: 0.8rem;
    color: #333;
}

.feature-card p {
    color: #666;
    line-height: 1.5;
    font-size: 0.9rem;
}

/* 征订教材预览 */
.materials-preview {
    padding: 80px 0;
    background: #f8f9fa;
}

.materials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.material-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.material-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.material-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.material-content {
    padding: 1.5rem;
}

.material-content h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.material-content p {
    color: #666;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.material-price {
    font-size: 1.5rem;
    font-weight: bold;
    color: #e74c3c;
    margin-bottom: 1rem;
}

/* 新闻预览 */
.news-preview {
    padding: 80px 0;
    background: white;
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.news-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.news-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.news-image {
    width: 100%;
    height: 200px;
    object-fit: contain;
    object-position: center;
    background-color: #f8f9fa;
}

.news-content {
    padding: 1.5rem;
}

.news-content h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: #333;
    line-height: 1.4;
}

.news-content p {
    color: #666;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.news-date {
    color: #999;
    font-size: 0.9rem;
}

/* 按钮样式 */
.btn-primary, .btn-secondary {
    display: inline-block;
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f8f9fa;
    color: #333;
    border: 2px solid #e9ecef;
}

.btn-secondary:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

.text-center {
    text-align: center;
    margin-top: 2rem;
}

/* 页脚样式 */
.footer {
    background: #2c3e50;
    color: white;
    padding: 60px 0 20px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3,
.footer-section h4 {
    margin-bottom: 1rem;
    color: #ffd700;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section ul li a {
    color: #bdc3c7;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section ul li a:hover {
    color: #ffd700;
}

.footer-section p {
    color: #bdc3c7;
    line-height: 1.6;
}

.footer-bottom {
    border-top: 1px solid #34495e;
    padding-top: 2rem;
    text-align: center;
    color: #bdc3c7;
}

.footer-bottom a {
    color: #bdc3c7;
    text-decoration: none;
}

.footer-bottom a:hover {
    color: #ffd700;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .hamburger-menu {
        display: flex;
    }
    
    .hamburger {
        display: flex;
    }
    
    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 320px;
        height: 100vh;
        flex-direction: column;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        text-align: left;
        transition: right 0.3s ease-in-out;
        box-shadow: -2px 0 10px rgba(0,0,0,0.1);
        padding: 80px 0 20px 0;
        z-index: 1001; /* 在遮罩层上方 */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* iOS滚动优化 */
        will-change: right; /* 优化动画性能 */
    }
    
    .nav-menu.active {
        right: 0 !important; /* 强制显示 */
    }
    
    .nav-menu li {
        margin: 0;
        width: 100%;
    }
    
    .nav-link {
        display: block;
        padding: 15px 20px;
        color: white;
        text-decoration: none;
        font-size: 16px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        transition: background 0.2s ease;
        min-height: 44px; /* 最小触控尺寸 */
        display: flex;
        align-items: center;
    }
    
    .nav-link:active {
        background: rgba(255, 255, 255, 0.1);
    }
    
    .nav-link::after {
        display: none; /* 移动端隐藏下划线动画 */
    }
    
    /* 移动端下拉菜单 */
    .dropdown-menu {
        position: static;
        display: none;
        width: 100%;
        background: rgba(0, 0, 0, 0.2);
        box-shadow: none;
        border-radius: 0;
        margin-top: 0;
        padding: 0;
    }
    
    .nav-item.dropdown.active .dropdown-menu {
        display: block;
    }
    
    .dropdown-menu a {
        padding-left: 40px;
        font-size: 15px;
    }
    
    /* 防止滚动穿透 */
    body.menu-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }
    
    .carousel-content h1 {
        font-size: 2rem;
    }
    
    .carousel-content p {
        font-size: 1rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        max-width: 800px;
    }
    
    .materials-grid,
    .news-grid {
        grid-template-columns: 1fr;
    }
    
    .hero {
        height: 400px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .nav-logo h2 {
        font-size: 1.2rem;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        max-width: 400px;
    }
    
    .feature-card {
        padding: 1rem 0.8rem;
    }
    
    .feature-icon {
        font-size: 1.8rem;
    }
    
    .feature-card h3 {
        font-size: 1.1rem;
    }
    
    .feature-card p {
        font-size: 0.85rem;
    }
    
    .carousel-content h1 {
        font-size: 1.5rem;
    }
    
    .carousel-content p {
        font-size: 0.9rem;
    }
    
    .btn-primary,
    .btn-secondary {
        padding: 12px 24px;
        font-size: 16px; /* 防止iOS自动缩放 */
        min-height: 44px; /* 最小触控尺寸 */
    }
}

/* 移动端触控优化 */
@media (max-width: 768px) {
    /* 所有可点击元素最小触控尺寸 */
    button,
    a.btn,
    .btn,
    input[type="submit"],
    input[type="button"],
    .nav-link,
    .menu-item {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 16px;
    }
    
    /* 表单元素优化 */
    input,
    select,
    textarea {
        font-size: 16px; /* 防止iOS自动缩放 */
        padding: 12px;
        border-radius: 8px;
        min-height: 44px;
    }
    
    /* 链接和按钮的触摸反馈 */
    a,
    button,
    .btn {
        transition: opacity 0.2s ease, transform 0.1s ease;
        -webkit-tap-highlight-color: transparent;
    }
    
    a:active,
    button:active,
    .btn:active {
        opacity: 0.7;
        transform: scale(0.98);
    }
    
    /* 响应式图片 */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* 表格响应式 */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* 模态框移动端优化 */
    .modal-dialog {
        width: 95%;
        margin: 20px auto;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-content {
        border-radius: 10px;
    }
    
    /* 卡片移动端优化 */
    .card {
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
}

/* 微信浏览器特殊样式 */
.wechat-browser body {
    -webkit-user-select: none;
    user-select: none;
}

.wechat-browser input,
.wechat-browser textarea {
    -webkit-user-select: text;
    user-select: text;
}

/* 使用CSS自定义属性适配微信底部工具栏 */
.full-height {
    height: 100vh;
    height: calc(var(--vh, 1vh) * 100);
}
