/* =========================================================
   GreenFuture 主题 - 页头模块
   顶栏 / 导航 / 搜索 / Products 多级 Mega Menu / 移动端
   配合 fragments/gf/header.html 使用
   ========================================================= */

/* ===== 顶栏 ===== */
.top-bar {
    background: linear-gradient(90deg, var(--secondary) 0%, #164E63 100%);
    color: #A5F3FC; font-size: 13px; padding: 10px 0;
}
.top-bar .container { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.top-bar .contact-info { display: flex; gap: 24px; align-items: center; }
.top-bar .contact-info span { display: flex; align-items: center; gap: 6px; }
.top-bar .contact-info a { color: #A5F3FC; }
.top-bar .contact-info a:hover { color: #fff; }
.top-bar .social-lang { display: flex; gap: 20px; align-items: center; }
.lang-switch { display: flex; gap: 4px; background: rgba(255,255,255,0.08); border-radius: 20px; padding: 3px; }
.lang-switch a { padding: 3px 12px; border-radius: 16px; font-size: 12px; font-weight: 600; color: #A5F3FC; }
.lang-switch a.active, .lang-switch a:hover { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; }

/* ===== 主导航 ===== */
.header {
    background: var(--surface); position: sticky; top: 0; z-index: 1000;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.header .container { display: flex; justify-content: space-between; align-items: center; height: 76px; position: relative; }
.header .logo img { height: 42px; width: auto; }
.nav-menu { display: flex; gap: 32px; }
.nav-menu a {
    font-size: 14px; font-weight: 600; color: var(--secondary-light);
    position: relative; padding: 8px 0;
}
.nav-menu a::after {
    content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 0; height: 2.5px; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 2px;
    transition: var(--transition);
}
.nav-menu a:hover { color: var(--primary); }
.nav-menu a:hover::after { width: 24px; }
.header-actions { display: flex; gap: 12px; align-items: center; }
.search-box { position: relative; }
.search-box input {
    width: 200px; padding: 8px 36px 8px 14px;
    border: 1.5px solid var(--border); border-radius: 24px;
    font-size: 13px; background: var(--bg); transition: var(--transition);
}
.search-box input:focus { outline: none; border-color: var(--primary); width: 260px; }
.search-box button { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; font-size: 14px; color: var(--text-muted); }
.mobile-toggle { display: none; font-size: 24px; cursor: pointer; }

/* ===== Products Mega Menu（点击展开多级导航） ===== */
.nav-menu > li { display: flex; align-items: center; height: 76px; }
.nav-arrow { font-size: 10px; margin-left: 5px; display: inline-block; transition: transform 0.3s; }
.has-dropdown.open .nav-arrow { transform: rotate(180deg); }
.has-dropdown.open > .dropdown-toggle { color: var(--primary); }
.vdrop-menu {
    position: absolute; top: 100%; left: 24px; right: 24px;
    background: var(--surface); border: 1px solid var(--border);
    border-top: 2px solid var(--primary);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow-lg);
    opacity: 0; visibility: hidden;
    transform: translateY(8px); transition: var(--transition); z-index: 1001;
}
.has-dropdown.open > .vdrop-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.vdrop-menu a { display: block; }
.vdrop-menu a::after { display: none; }
.mega-all { padding: 18px 32px 0; }
.vdrop-menu .mega-all a { display: inline-block; font-size: 13px; font-weight: 700; color: var(--primary); }
.vdrop-menu .mega-all a:hover { color: var(--accent-dark); }
.mega-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px 32px;
    padding: 18px 32px 28px; max-height: 72vh; overflow-y: auto;
}
.mega-parent-row { display: flex; align-items: center; justify-content: space-between; border-bottom: 2px solid var(--bg); margin-bottom: 6px; }
.vdrop-menu .mega-parent { flex: 1; font-size: 13px; font-weight: 700; color: var(--secondary); padding-bottom: 8px; }
.vdrop-menu .mega-parent:hover { color: var(--primary); }
.mega-arrow {
    width: 22px; height: 22px; margin-left: 8px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 10px; color: var(--primary); cursor: pointer;
    border-radius: 50%; background: var(--bg);
    transition: transform 0.3s;
}
.mega-col.expanded .mega-arrow { transform: rotate(180deg); }
.mega-col.expanded .mega-parent-row { border-bottom-color: var(--primary); }
.mega-children { display: none; }
.mega-col.expanded .mega-children { display: block; }
.vdrop-menu .mega-children li a { font-size: 12.5px; font-weight: 500; color: var(--text-muted); padding: 4px 0; }
.vdrop-menu .mega-children li a:hover { color: var(--primary); padding-left: 4px; }

@media (max-width: 1024px) {
    .mega-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .nav-menu { position: fixed; top: 76px; left: -100%; width: 100%; height: calc(100vh - 76px); background: var(--surface); flex-direction: column; padding: 32px 24px; transition: left 0.3s; box-shadow: 0 10px 30px rgba(0,0,0,0.1); overflow-y: auto; }
    .nav-menu.active { left: 0; }
    .mobile-toggle { display: block; }
    .search-box { display: none; }
    .top-bar .contact-info { display: none; }
    .nav-menu > li { height: auto; flex-wrap: wrap; }
    .vdrop-menu {
        position: static; opacity: 1; visibility: visible; transform: none;
        display: none; width: 100%;
        box-shadow: none; border: none; border-radius: 0; margin: 2px 0 8px 0;
    }
    .has-dropdown.open > .vdrop-menu { display: block; }
    .mega-all { padding: 0 0 4px 12px; }
    .mega-grid { grid-template-columns: 1fr; gap: 0; padding: 0 0 0 12px; max-height: none; overflow-y: visible; }
    .vdrop-menu .mega-parent { padding: 8px 0; font-weight: 600; }
    .mega-parent-row { margin-bottom: 0; border-bottom-width: 1px; }
}
