/* =========================================
   1. Global Styles (全局样式)
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f4f7f6;
    color: #333;
}

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

/* =========================================
   2. Header & Search (头部与搜索)
   ========================================= */
header {
    background: #fff;
    padding: 20px 0;
    border-bottom: 1px solid #ddd;
}

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

.logo {
    font-size: 24px;
    font-weight: bold;
    color: #003366;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.logo img {
    max-height: 50px;
    width: auto;
}

/* Search Bar - 保持居中 */
.search-bar {
    display: flex;
    flex: 0.5;
    margin: 0 auto; /* 自动左右边距，使其居中 */
}

.search-bar input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px 0 0 4px;
    outline: none;
}

.search-bar button {
    padding: 10px 20px;
    background: #003366;
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
}

/* =========================================
   3. Navigation Bar (导航栏 - 核心修改)
   ========================================= */
.main-nav {
    background: #003366;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.nav-container {
    display: flex;
    justify-content: space-between; /* 手机端分开按钮和菜单 */
    align-items: center;
    position: relative;
    padding: 0; /* 移除内边距，靠 container 控制 */
}

/* 汉堡菜单按钮 (默认隐藏，仅手机显示) */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 15px 0;
    width: 100%;
    text-align: left;
    font-weight: bold;
}

.menu-toggle i {
    margin-right: 10px;
}

/* 菜单列表 */
.nav-menu {
    list-style: none;
    display: flex;
    align-items: center;
    width: 100%;
    margin: 0;
    padding: 0;
}

.nav-menu li {
    position: relative;
}

/* 菜单链接样式 */
.nav-menu li > a {
    display: block;
    padding: 15px 25px;
    color: white;
    text-decoration: none;
    font-size: 14px;
    transition: 0.3s;
    text-transform: uppercase;
}

.nav-menu li a:hover,
.nav-menu li a.active {
    background: #fca311;
    color: #003366;
}

/* 下拉菜单 - 桌面端样式 */
.dropdown-menu {
    display: none; /* 默认隐藏 */
    position: absolute;
    top: 100%;
    left: 0;
    background-color: white;
    min-width: 240px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    z-index: 9999;
    border-top: 3px solid #fca311;
    padding: 0;
}

/* 桌面端：鼠标悬停显示下拉 */
@media (min-width: 769px) {
    .nav-menu li:hover .dropdown-menu {
        display: block;
    }
}

.dropdown-menu li {
    width: 100%;
    display: block;
}

.dropdown-menu li a {
    color: #333 !important; /* 强制黑色字体 */
    padding: 12px 20px;
    border-bottom: 1px solid #eee;
    text-transform: none; /* 取消全大写 */
    background: white;
}

.dropdown-menu li a:hover {
    background-color: #f4f7f6 !important;
    color: #003366 !important;
    padding-left: 25px; /* 滑动效果 */
}

/* 旋转箭头动画 */
.dropdown-toggle i {
    transition: transform 0.3s;
    margin-left: 5px;
}

/* =========================================
   4. Mobile Navigation Logic (手机端导航逻辑)
   ========================================= */
@media (max-width: 768px) {
    /* 1. 显示汉堡按钮 */
    .menu-toggle {
        display: block;
    }

    /* 2. 隐藏菜单列表，垂直排列 */
    .nav-menu {
        display: none; /* 默认关闭 */
        flex-direction: column;
        width: 100%;
        background: #003366;
        border-top: 1px solid rgba(255,255,255,0.1);
    }

    /* JS 添加 .show 类时显示菜单 */
    .nav-menu.show {
        display: flex;
    }

    .nav-menu li {
        width: 100%;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }

    /* 3. 手机端 Dropdown 样式 */
    .dropdown-menu {
        position: static; /* 不再悬浮，挤开下方内容 */
        box-shadow: none;
        border-top: none;
        background-color: #002244; /* 深色背景区分层级 */
        width: 100%;
        display: none; /* 默认隐藏 */
        padding-left: 0;
    }
    
    /* JS 点击后显示下拉 */
    .dropdown-menu.show {
        display: block;
    }

    .dropdown-menu li a {
        color: #ccc !important; /* 浅灰色文字 */
        background: transparent;
        padding-left: 40px; /* 缩进 */
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }

    .dropdown-menu li a:hover {
        background-color: #fca311 !important;
        color: #003366 !important;
    }
    
    /* 箭头旋转 */
    .dropdown-toggle.active i {
        transform: rotate(180deg);
    }
    .dropdown-toggle i {
        float: right; /* 箭头靠右 */
        margin-top: 3px;
    }
}

/* =========================================
   5. Hero Section (轮播与Banner)
   ========================================= */
.hero {
    background: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6)), 
                url('https://images.unsplash.com/photo-1565814329452-e1efa11c5b89?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80');
    background-size: cover;
    background-position: center;
    height: 450px;
    display: flex;
    align-items: center;
    color: white;
    text-align: center;
}

.hero-text h1 {
    font-size: 48px;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.hero-text p {
    font-size: 18px;
    margin-bottom: 30px;
}

.btn-primary {
    display: inline-block;
    padding: 12px 30px;
    background: #fca311;
    color: #003366;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: 0.3s;
}

.btn-primary:hover {
    background: #fff;
}

/* =========================================
   6. Product Grid (产品列表)
   ========================================= */
.section-title {
    margin: 50px 0 30px;
    text-align: center;
    font-size: 28px;
    color: #003366;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: #fca311;
    margin: 10px auto 0;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

.product-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    cursor: pointer;
    border: 1px solid #eee;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.product-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #fca311;
    color: #003366;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: bold;
    border-radius: 3px;
    z-index: 2;
}

.product-card img {
    width: 100%;
    height: 250px;
    object-fit: contain;
    padding: 20px;
    background: #fff;
}

.product-info {
    padding: 20px;
    text-align: center;
    border-top: 1px solid #eee;
}

.product-info h3 {
    font-size: 16px;
    margin-bottom: 5px;
    color: #333;
    height: 40px;
    overflow: hidden;
}

.category {
    font-size: 13px;
    color: #999;
    margin-bottom: 10px;
}

.price {
    font-size: 18px;
    font-weight: bold;
    color: #cc0000;
    margin-bottom: 15px;
}

.add-to-cart {
    width: 100%;
    padding: 10px;
    background: white;
    border: 1px solid #003366;
    color: #003366;
    cursor: pointer;
    transition: 0.3s;
    border-radius: 4px;
}

.add-to-cart:hover {
    background: #003366;
    color: white;
}

/* =========================================
   7. Detail Page (详情页)
   ========================================= */
.detail-container {
    display: flex;
    gap: 40px;
    margin-top: 50px;
    margin-bottom: 50px;
}
.detail-image { flex: 1; background: white; padding: 20px; border: 1px solid #eee; }
.detail-image img { width: 100%; height: auto; }
.detail-info { flex: 1; }
.detail-info h1 { font-size: 32px; margin-bottom: 10px; color: #003366; }
.detail-price { font-size: 28px; color: #cc0000; font-weight: bold; margin: 20px 0; }
.detail-description { line-height: 1.6; color: #666; margin-bottom: 30px; }
.specs-list { margin-bottom: 30px; list-style: none; }
.specs-list li { margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px dashed #ddd; }
.btn-cart-large { padding: 15px 40px; background: #ee4d2d; color: white; border: none; font-size: 18px; cursor: pointer; border-radius: 5px; }

/* =========================================
   8. About Us / Policy (文本页)
   ========================================= */
.about-section {
    padding: 60px 50px; 
    background: white;
    margin-top: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); 
}

.about-content {
    line-height: 1.8;
    font-size: 16px;
    color: #444;
    max-width: 1000px; 
    margin: 0 auto;
}

.about-content ul, 
.policy-content ul {
    margin-left: 40px;
    margin-bottom: 20px;
    list-style-type: disc;
}

.about-content li, 
.policy-content li {
    margin-bottom: 10px;
    line-height: 1.6;
    padding-left: 10px;
}

.about-content p, 
.policy-content p {
    margin-bottom: 15px;
}

.about-content strong, 
.policy-content strong {
    color: #003366;
    font-size: 18px;
    display: block;
    margin-top: 25px;
    margin-bottom: 10px;
}

/* =========================================
   9. Footer (页脚)
   ========================================= */
footer {
    background: #1a1a1a;
    color: #bbb;
    padding: 40px 0;
    text-align: center;
    margin-top: auto;
}

.footer-links-container {
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.footer-links-container a {
    color: #ddd;
    text-decoration: none;
    font-size: 14px;
    transition: 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.footer-links-container a:hover {
    color: #fca311;
}

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

.social-links a {
    color: #bbb;
    font-size: 20px;
    margin-left: 15px;
    transition: 0.3s;
}

.social-links a:hover {
    color: #fca311;
}

/* =========================================
   10. General Mobile Adjustments (通用移动端修复)
   ========================================= */
@media (max-width: 768px) {
    .header-content, .detail-container { 
        flex-direction: column; 
    }
    
    .search-bar { 
        margin: 15px 0; 
        width: 100%; 
    }
    
    .footer-content { 
        flex-direction: column; 
        gap: 20px; 
    }

    .about-section {
        padding: 30px 20px;
    }
}