/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部样式 */
header {
    background: white !important;
    color: #333 !important;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
}

nav {
    display: flex;
    gap: 1rem;
}

nav a {
    color: #333 !important;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

nav a:hover {
    background: rgba(0,0,0,0.1) !important;
}

/* 多语言切换器 */
.language-switcher {
    display: flex !important;
    gap: 0.5rem;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 1001 !important;
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
    clip: auto !important;
    clip-path: none !important;
}

.lang-btn {
    background: none !important;
    border: none !important;
    font-size: 1.5rem !important;
    cursor: pointer !important;
    padding: 0.5rem !important;
    border-radius: 5px !important;
    transition: all 0.3s ease !important;
    color: #333 !important;
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
}

.lang-btn:hover {
    background: rgba(0,0,0,0.1) !important;
    transform: scale(1.1);
}

.lang-btn.active {
    background: rgba(0,0,0,0.2) !important;
    transform: scale(1.1);
}

/* 主要内容 */
main {
    min-height: calc(100vh - 200px);
}

section {
    padding: 4rem 0;
}

section h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: #333;
}

/* 轮转图片区域 */
.hero {
    background: #fff;
    padding: 0;
    border-bottom: 2px solid #f0f0f0;
    margin-bottom: 30px;
}

.slider {
    position: relative;
    height: 500px;
    overflow: hidden;
    border-radius: 20px;
    margin: 20px;
    background: #fff;
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.slide.active {
    opacity: 1;
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.slide-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
    background-color: rgba(0,0,0,0.6);
    padding: 30px;
    border-radius: 10px;
    min-width: 300px;
}

.slide-content h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: white;
}

.slide-content p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* 轮转控制按钮 */
.slider-controls {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
}

.prev-btn, .next-btn {
    background: rgba(255,255,255,0.8);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    color: #333;
    transition: all 0.3s ease;
}

.prev-btn:hover, .next-btn:hover {
    background: white;
    transform: scale(1.1);
}

/* 轮转指示器 */
.slider-indicators {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
}

.indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.indicator.active {
    background-color: white;
}

/* 产品9宫格 - 正方形设计 */
.products {
    background-color: white;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 2rem;
}

.product-item {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
    text-align: center;
    aspect-ratio: 1; /* 保持正方形 */
}

.product-item:hover {
    transform: translateY(-5px);
}

.product-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    aspect-ratio: 1; /* 图片保持正方形 */
}

.product-item h3 {
    color: #333;
    margin: 15px 0 10px 0;
    font-size: 1.2rem;
}

.product-item .brand {
    color: #007bff;
    font-weight: 600;
    margin-bottom: 5px;
}

.product-item .quality {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

/* 页脚 */
footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 2rem 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    header .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    nav {
        justify-content: center;
    }
    
    .slider {
        height: 400px;
        background: #fff;
    }
    
    .slide-content h2 {
        font-size: 2rem;
    }
    
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .language-switcher {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .slider {
        height: 300px;
        background: #fff;
    }
    
    .slide-content {
        padding: 20px;
        min-width: 250px;
    }
    
    .slide-content h2 {
        font-size: 1.5rem;
    }
    
    .product-grid {
        grid-template-columns: 1fr;
    }
    
    .lang-btn {
        font-size: 1.2rem;
    }
}

/* 桌面端隐藏移动端菜单 */
@media (min-width: 769px) {
    .mobile-menu-toggle {
        display: none !important;
    }
    
    .mobile-menu {
        display: none !important;
    }
}

/* 移动端触摸优化 */
@media (max-width: 768px) {
    /* 基础布局修复 */
    body {
        overflow-x: hidden;
        font-size: 14px;
    }
    
    .container {
        padding: 0 15px;
        max-width: 100%;
    }
    
    /* 触摸友好的按钮尺寸 */
    button, .btn, .cta-button {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 20px;
        font-size: 16px;
    }
    
    /* 触摸反馈 */
    .product-item, .product-card {
        transition: transform 0.2s ease;
    }
    
    .product-item:active, .product-card:active {
        transform: scale(0.98);
    }
    
    /* 修复可能的溢出问题 */
    * {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* 确保图片不会溢出 */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* 移动端导航 */
    .mobile-menu-toggle {
        display: block;
        background: none;
        border: none;
        font-size: 1.5rem;
        color: #333;
        cursor: pointer;
        padding: 10px;
    }
    
    .mobile-menu {
        display: none;
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        max-width: 300px;
        height: 100vh;
        background: white;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
        transition: left 0.3s ease;
        z-index: 1000;
        padding: 20px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .mobile-menu.active {
        display: block;
        left: 0;
    }
    
    .mobile-menu-close {
        background: none;
        border: none;
        font-size: 1.5rem;
        float: right;
        margin-bottom: 20px;
        padding: 10px;
    }
    
    .mobile-menu .nav-links {
        display: flex;
        flex-direction: column;
        gap: 15px;
        margin-top: 20px;
    }
    
    .mobile-menu .nav-links a {
        padding: 15px 0;
        border-bottom: 1px solid #eee;
        font-size: 1.1rem;
    }
    
    /* 隐藏桌面导航 */
    .desktop-nav {
        display: none;
    }
    
    /* 轮播图触摸优化 */
    .slider {
        touch-action: pan-x;
    }
    
    .slide {
        touch-action: manipulation;
    }
    
    /* 图片触摸优化 */
    .product-item img, .product-card img {
        touch-action: manipulation;
    }
    
    /* 防止双击缩放 */
    .product-item, .product-card, button, .btn {
        touch-action: manipulation;
    }
}

/* 超小屏幕进一步优化 */
@media (max-width: 480px) {
    body {
        font-size: 13px;
    }
    
    .container {
        padding: 0 10px;
    }
    
    .mobile-menu {
        width: 90%;
        max-width: 280px;
    }
    
    .slider {
        height: 250px;
    }
    
    .slide-content h2 {
        font-size: 1.3rem;
        line-height: 1.2;
    }
    
    .product-grid {
        gap: 10px;
    }
    
    .product-item {
        padding: 10px;
    }
    
    /* 确保所有元素不溢出 */
    * {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    /* 表格在小屏幕上的处理 */
    table {
        font-size: 12px;
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    /* 按钮在小屏幕上的优化 */
    .btn, button {
        font-size: 14px;
        padding: 10px 15px;
    }
    
    /* 文本内容优化 */
    h1, h2, h3 {
        line-height: 1.2;
        margin-bottom: 0.5rem;
    }
    
    p {
        line-height: 1.4;
        margin-bottom: 0.8rem;
    }
}
