/* ===================================================
   navbar.css — 顶部固定导航栏样式
   核力科技（上海）有限公司
   
   包含：导航栏布局、导航项样式、Header 滚动效果、
         移动端汉堡菜单（下拉展开）、页面容器偏移
   =================================================== */

/* ---------- 导航栏容器 ---------- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 1000;
    transition: all 0.3s ease;
}

/* 滚动后加深背景 */
.navbar.scrolled {
    background: rgba(15, 23, 42, 0.95);
    border-bottom-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* ---------- 导航栏内部布局 ---------- */
.navbar-inner {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ---------- Logo 区域 ---------- */
.navbar-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    flex-shrink: 0;
}

.navbar-logo .logo-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.navbar-logo .logo-icon svg {
    width: 28px;
    height: 28px;
}

.navbar-logo .logo-text {
    font-size: 1.05rem;
    font-weight: 700;
    color: white;
    white-space: nowrap;
}

/* ---------- 桌面端导航菜单 ---------- */
.navbar-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.25s ease;
    cursor: pointer;
    position: relative;
    white-space: nowrap;
}

.nav-link:hover {
    color: rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.06);
}

.nav-link.nav-active {
    color: #00D4AA;
    background: rgba(0, 212, 170, 0.1);
}

/* 激活状态底部指示线 */
.nav-link.nav-active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 2px;
    background: var(--gradient-1);
    border-radius: 2px;
}

/* "联系我们"特殊样式 */
.nav-link-contact {
    color: #00D4AA;
    border: 1px solid rgba(0, 212, 170, 0.3);
    margin-left: 0.5rem;
}

.nav-link-contact:hover {
    background: rgba(0, 212, 170, 0.15);
    color: #00D4AA;
}

.nav-link-contact.nav-active {
    background: rgba(0, 212, 170, 0.1);
    color: #00D4AA;
}

/* ---------- 移动端汉堡按钮 ---------- */
.hamburger-btn {
    display: none;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: all 0.3s ease;
}

.hamburger-btn .hamburger-line {
    display: block;
    width: 18px;
    height: 2px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Hamburger → X 动画 */
.hamburger-btn.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ---------- 移动端下拉菜单 ---------- */
.mobile-nav {
    display: none;
    flex-direction: column;
    background: rgba(15, 23, 42, 0.98);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
}

.mobile-nav.active {
    max-height: 400px;
}

.mobile-nav-link {
    display: block;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    padding: 1rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
    cursor: pointer;
}

.mobile-nav-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.95);
}

.mobile-nav-link.nav-active {
    color: #00D4AA;
    background: rgba(0, 212, 170, 0.08);
}

/* 移动端"联系我们"特殊样式 */
.mobile-nav-link-contact {
    color: #00D4AA;
}

/* ---------- 移动端遮罩 ---------- */
.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.mobile-nav-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* ---------- 页面主内容区偏移 ---------- */
.main-content {
    padding-top: 64px; /* 导航栏高度 */
    min-height: 100vh;
}

/* ---------- 响应式：768px 断点 ---------- */
@media (max-width: 768px) {
    .navbar-nav {
        display: none; /* 隐藏桌面端菜单 */
    }

    .hamburger-btn {
        display: flex; /* 显示汉堡按钮 */
    }

    .mobile-nav {
        display: flex; /* 启用移动端菜单 */
    }

    .navbar-inner {
        padding: 0 1rem;
    }
}

/* ---------- 页面切换动画 ---------- */
.page-section {
    animation: pageFadeIn 0.3s ease;
}

@keyframes pageFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- 回到顶部按钮 ---------- */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    background: var(--gradient-1);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 102, 255, 0.3);
    z-index: 998;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

@media (max-width: 768px) {
    .back-to-top {
        bottom: 1.5rem;
        right: 1.5rem;
    }
}
