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

html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #fff;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

img {
    max-width: 100%;
    height: auto;
}

/* 工具类 */
.w-full {
    width: 100%;
}

.flex {
    display: flex;
}

.block {
    display: block;
}

.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

.sticky {
    position: sticky;
    top: 20px;
}

.grid {
    display: grid;
}

.overflow-hidden {
    overflow: hidden;
}

.overflow-x-auto {
    overflow-x: auto;
}

.text-pretty {
    white-space: pre-line;
}

.z-10 {
    z-index: 10;
}

.mb-4 {
    margin-bottom: 1rem;
}

.ml-1 {
    margin-left: 0.25rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.font-bold {
    font-weight: bold;
}

.cursor-pointer {
    cursor: pointer;
}

.pointer-events-none {
    pointer-events: none;
}

.bg-white {
    background-color: #fff;
}

.border-t {
    border-top: 1px solid #e5e5e5;
}

.col-span-5 {
    grid-column: span 5;
}

.fit {
    width: 100%;
}

.h-max {
    height: max-content;
}

.w-screen {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
}

/* 顶部横幅 */
.top-banner {
    height: 30px;
    background-color: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 40px;
    text-decoration: none;
    position: relative;
    width: 100%;
}

.top-banner .flex {
    width: 100%;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
}

.top-banner-text {
    font-size: 12px;
    color: #fff;
    font-weight: 500;
}

.top-banner picture {
    height: 100%;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.top-banner picture img {
    height: 14px;
    width: auto;
    max-width: 200px;
    display: block;
}

/* 导航栏 */
.header {
    height: 70px;
    border-bottom: 1px solid transparent;
    position: sticky;
    top: 0;
    background: #1a1a1a;
    z-index: 1000;
    transition: background-color 0.3s ease, border-bottom-color 0.3s ease, box-shadow 0.3s ease;
}

/* 导航栏悬停时变为白色背景 */
.header.hovered {
    background: #fff;
    border-bottom-color: #e5e5e5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.header.hovered .nav-link {
    color: #333;
}

.header.hovered .menuitem.hot-sale span {
    color: #333;
}

.header.hovered .nav-actions button,
.header.hovered .nav-actions a {
    color: #333;
}

.header.hovered .language-switcher i {
    background: #333;
}

.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
    height: 70px;
    align-items: center;
    justify-content: space-between;
    display: flex;
    width: 100%;
    position: relative;
    gap: 0;
}

.go-home {
    margin-right: 32px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    flex-grow: 0;
    width: auto;
    min-width: fit-content;
}

.go-home img {
    height: 40px;
    width: auto;
    max-width: 150px;
    object-fit: contain;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-start;
    min-width: 0;
    flex: 1 1 0%;
    overflow: visible;
    margin-right: 20px;
}

.nav-menu > * {
    flex-shrink: 1;
    white-space: nowrap;
    min-width: 0;
}

.nav-menu .nav-item,
.nav-menu .menuitem {
    flex-shrink: 1;
}

.nav-item {
    position: relative;
    flex-shrink: 1;
}

.menuitem.hot-sale {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding-right: 16px;
    cursor: pointer;
    flex-shrink: 0;
    min-width: fit-content;
}

.menuitem.hot-sale picture {
    position: absolute;
    right: 0;
    top: -8px;
    width: 20px;
    height: 20px;
    z-index: 1;
    display: block;
    overflow: hidden;
}

.menuitem.hot-sale picture img {
    width: 20px !important;
    height: 20px !important;
    max-width: 20px !important;
    max-height: 20px !important;
    object-fit: contain;
    display: block;
}

.menuitem.hot-sale span {
    font-size: 14px;
    line-height: 1.2;
    color: #fff;
    transition: color 0.3s ease;
}

.nav-item {
    position: relative;
}

.nav-link {
    text-decoration: none;
    color: #fff;
    font-size: 13px;
    line-height: 1.2;
    transition: color 0.3s;
    display: block;
    padding: 8px 2px;
    white-space: nowrap;
}

.nav-link:hover {
    color: #007bff;
}

.header.hovered .nav-link:hover {
    color: #007bff;
}

/* 下拉菜单 */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    z-index: 2000;
    pointer-events: none;
}

.nav-item.dropdown:hover .dropdown-menu,
.nav-item.dropdown:focus-within .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

/* 在下拉菜单上方创建一个连接区域，防止鼠标移动时菜单消失 */
.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 8px;
    background: transparent;
}

/* 下拉菜单的显示/隐藏由JavaScript控制 */

.dropdown-content {
    padding: 12px 0;
}

.dropdown-link {
    display: block;
    padding: 10px 20px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.2s ease, color 0.2s ease;
    white-space: nowrap;
}

.dropdown-link:hover {
    background-color: #f8f9fa;
    color: #007bff;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    flex-grow: 0;
    min-width: 220px;
    width: 220px;
    justify-content: flex-end;
}

.nav-actions button,
.nav-actions a {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: #fff;
    transition: color 0.3s;
}

.nav-actions button:hover,
.nav-actions a:hover {
    color: #007bff;
}

.header.hovered .nav-actions button:hover,
.header.hovered .nav-actions a:hover {
    color: #007bff;
}

.language-switcher {
    position: relative;
    width: 28px;
    height: 28px;
}

.language-switcher i {
    position: absolute;
    width: 2px;
    background: #fff;
    transition: background 0.3s ease;
}

.language-switcher i:nth-child(2) {
    left: 6px;
    bottom: 15px;
    height: 5px;
}

.language-switcher i:nth-child(3) {
    left: 10px;
    bottom: 16px;
    height: 4px;
}

.language-switcher i:nth-child(4) {
    left: 14px;
    bottom: 17px;
    height: 3px;
}

/* 主内容区 */
main {
    min-height: calc(100vh - 100px);
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .nav-container {
        padding: 0 15px;
    }
    
    .nav-menu {
        gap: 4px;
        font-size: 12px;
    }
    
    .nav-link {
        font-size: 12px;
        padding: 6px 2px;
    }
    
    .go-home {
        margin-right: 16px;
    }
    
    .go-home img {
        height: 35px;
    }
    
    .nav-actions {
        min-width: 180px;
        width: 180px;
        gap: 8px;
    }
    
    .nav-actions button,
    .nav-actions a {
        width: 35px;
        height: 35px;
    }
}

@media (max-width: 768px) {
    .top-banner {
        padding: 0 15px;
        height: 40px;
    }
    
    .top-banner-text {
        font-size: 11px;
    }
    
    .header {
        height: 60px;
    }
    
    .nav-container {
        padding: 0 15px;
        height: 60px;
    }
    
    .go-home {
        margin-right: 10px;
    }
    
    .go-home img {
        height: 30px;
        max-width: 120px;
    }
    
    .nav-menu {
        display: none;
    }
    
    .nav-actions {
        min-width: auto;
        width: auto;
        gap: 6px;
    }
    
    .nav-actions button,
    .nav-actions a {
        width: 32px;
        height: 32px;
    }
    
    .nav-actions svg {
        width: 18px;
        height: 18px;
    }
    
    .language-switcher {
        width: 24px;
        height: 24px;
    }
    
    .dropdown-menu {
        position: static;
        transform: none;
        opacity: 1;
        visibility: visible;
        box-shadow: none;
        border: none;
        margin-top: 0;
        display: none;
    }
    
    .nav-item.active .dropdown-menu {
        display: block;
    }
}

@media (max-width: 480px) {
    .top-banner {
        height: 35px;
        padding: 0 10px;
    }
    
    .top-banner-text {
        font-size: 10px;
    }
    
    .header {
        height: 55px;
    }
    
    .nav-container {
        padding: 0 10px;
        height: 55px;
    }
    
    .go-home img {
        height: 28px;
        max-width: 100px;
    }
    
    .nav-actions button,
    .nav-actions a {
        width: 28px;
        height: 28px;
    }
    
    .nav-actions svg {
        width: 16px;
        height: 16px;
    }
}
