/* ============================================================
   common.css —— 全局重置 + 导航栏 + Mega Menu + 侧边抽屉 + 页脚
   ============================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

a, button {
    -webkit-tap-highlight-color: transparent;
}

a { text-decoration: none; color: inherit; }

/* ========== 导航栏 ========== */
.navbar-tesla {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    padding: 0 32px;
    height: 56px;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.navbar-tesla.scrolled {
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.nav-logo {
    width: 60px;
    height: 80%;
    flex-shrink: 0;
}

.nav-center-menu {
    display: flex;
    align-items: center;
    gap: 2px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.nav-center-menu .nav-item {
    position: relative;
}

.nav-center-menu .nav-link {
    color: #171a20;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 4px;
    transition: background-color 0.2s;
    cursor: pointer;
    white-space: nowrap;
    display: inline-block;
}

.nav-center-menu .nav-link:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.nav-right-menu {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.nav-right-menu .nav-link {
    color: #171a20;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 12px;
    text-decoration: none;
    white-space: nowrap;
}

.menu-toggle-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    color: #171a20;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ========== 巨型下拉菜单 Mega Menu（仅PC） ========== */
.mega-menu {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    background-color: white;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1029;
    padding: 0 40px;
}

.mega-menu.active {
    max-height: 500px;
    opacity: 1;
    visibility: visible;
    padding: 32px 40px 40px;
}

.mega-menu-overlay {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1028;
}

.mega-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mega-menu-content {
     /* max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px; */
	max-width: 1200px;
	margin: 0 auto;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 24px;
}

.mega-menu-item {
    text-align: center;
    cursor: pointer;
    padding: 16px 8px;
    border-radius: 8px;
    transition: background-color 0.2s;
	flex: 0 1 calc((100% - 72px) / 4);   /* 一行 4 个：3 个 gap × 24px = 72px */
	min-width: 0;                         /* 防止长内容撑破 */
}

.mega-menu-item:hover {
    background-color: #FFFFFF;
}

.mega-menu-item img {
    width: 100%;
    height: 100px;
    margin-bottom: 12px;
    object-fit: contain;
}

.mega-menu-item h4 {
    font-size: 13px;
    font-weight: 600;
    color: #171a20;
    margin-bottom: 4px;
}

.mega-menu-item p {
    font-size: 12px;
    color: #5c5e62;
    margin-bottom: 8px;
}

.mega-menu-item .price {
    font-size: 13px;
    color: #171a20;
    font-weight: 500;
}

.mega-menu-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e8e8e8;
    flex-wrap: wrap;
}

.mega-menu-links a {
    color: #393c41;
    font-size: 13px;
    text-decoration: none;
    transition: color 0.2s;
}

.mega-menu-links a:hover {
    color: #171a20;
    text-decoration: underline;
}

/* ========== 侧边抽屉菜单（移动端主菜单） ========== */
.side-drawer {
    position: fixed;
    top: 0;
    right: -320px;
    width: 320px;
    max-width: 85vw;
    height: 100vh;
    background-color: white;
    z-index: 2000;
    overflow-y: auto;
    overflow-x: hidden;
    transition: right 0.3s ease;
    padding: 40px 24px 24px;
    -webkit-overflow-scrolling: touch;
}

.side-drawer.open {
    right: 0;
}

.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.drawer-overlay.open {
    opacity: 1;
    visibility: visible;
}

.drawer-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #171a20;
    padding: 8px;
    line-height: 1;
}

.drawer-menu {
    list-style: none;
    padding: 0;
    margin-top: 20px;
}

.drawer-menu > li {
    margin-bottom: 2px;
}

.drawer-menu > li > a,
.drawer-menu > li > .drawer-menu-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    color: #171a20;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    border-radius: 4px;
    transition: background-color 0.2s;
    cursor: pointer;
    width: 100%;
    border: none;
    background: none;
    text-align: left;
}

.drawer-menu > li > a:hover,
.drawer-menu > li > .drawer-menu-title:hover {
    background-color: #f4f4f4;
}

.drawer-menu-title i {
    transition: transform 0.2s;
    font-size: 12px;
}

.drawer-menu-title.active i {
    transform: rotate(180deg);
}

.drawer-submenu {
    list-style: none;
    padding: 0 0 0 12px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.drawer-submenu.open {
    max-height: 500px;
}

.drawer-submenu li a {
    display: block;
    padding: 10px 12px;
    color: #5c5e62;
    text-decoration: none;
    font-size: 14px;
    border-radius: 4px;
}

.drawer-submenu li a:hover {
    background-color: #f4f4f4;
    color: #171a20;
}

/* ========== 页脚 ========== */
.footer-tesla {
    background-color: #FFFFFF;
    color: #000000;
    padding: 32px 24px 24px;
    font-size: 12px;
}

.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
}

.footer-links a {
    color: #000000;
    text-decoration: none;
    transition: color 0.2s;
}

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

.footer-copyright {
    text-align: center;
    color: #000000;
    font-size: 12px;
}

/* ========== 响应式适配（公共部分） ========== */
@media (min-width: 1200px) {
    .mega-menu-content {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 992px) and (max-width: 1199px) {
	.mega-menu-item {
		flex: 0 1 calc((100% - 48px) / 3);   /* 2 个 gap × 24px = 48px */
	}
		
    .mega-menu-content {
        grid-template-columns: repeat(3, 1fr);
    }

    .nav-center-menu .nav-link {
        padding: 8px 12px;
        font-size: 13px;
    }
	
    .nav-right-menu .nav-link {
        padding: 8px 8px;
        font-size: 13px;
    }
	
}

@media (max-width: 991.98px) {
    .nav-center-menu {
        display: none !important;
    }

    .nav-right-menu .nav-link:not(.menu-btn-wrap) {
        display: none;
    }

    .navbar-tesla {
        padding: 0 16px;
    }

    .mega-menu, .mega-menu-overlay {
        display: none !important;
    }
}

@media (max-width: 767.98px) {
    .navbar-tesla {
        height: 48px;
    }

    .nav-logo {
        width: 100px;
    }

    .side-drawer {
        width: 280px;
        right: -280px;
    }

    .content-section h2 {
        font-size: 28px;
    }

    .footer-links {
        gap: 12px;
        font-size: 11px;
    }
}

@media (max-width: 375px) {
    .side-drawer {
        width: 260px;
        right: -260px;
    }
}