/**
 * 共享组件样式
 * 包含Header和Footer的通用样式
 */

/* ========== 头部专用品牌变量 ==========
 * 用于锁定顶部菜单的品牌色，确保 7 个页面顶部菜单「除背景色外」完全一致。
 * 产品页正文可自由使用 --brand-primary / --brand-border-accent 做主题色，不影响头部。
 */
:root {
    --header-brand: #534AB7;
    --header-brand-dark: #3C3489;
    --header-brand-light: #EEEDFE;
    --header-border: #AFA9EC;
}

/* ========== Header样式 ========== */
.sticky-header {
    background: var(--bg-gray);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

.sticky-header.scrolled {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 2px 8px rgba(83, 74, 183, 0.08);
}

.header-content {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-link {
    text-decoration: none;
}

.logo-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: contain;
}

.logo-text h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

nav {
    display: flex;
    gap: 2rem;
    align-items: center;
}

nav a {
    color: var(--text-secondary);
    font-weight: 500;
    text-decoration: none;
    transition: color 0.3s ease;
}

nav a:hover {
    color: var(--header-brand) !important;
}

.nav-item {
    position: relative;
}

.dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid var(--header-border);
    border-radius: 8px;
    padding: 0.5rem;
    box-shadow: 0 4px 12px rgba(83, 74, 183, 0.1);
    min-width: 200px;
}

.nav-item:hover .dropdown {
    display: block;
}

.dropdown a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.dropdown a:hover {
    background: var(--header-brand-light);
    color: var(--header-brand);
}

.cta-buttons {
    display: flex;
    gap: 1rem;
}

/* ========== 按钮样式 ========== */
.btn-p {
    background: var(--brand-primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-p:hover {
    background: var(--brand-primary-dark);
}

.btn-s {
    background: white;
    color: var(--brand-primary);
    border: 1px solid var(--brand-border-accent);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-s:hover {
    background: var(--brand-primary-light);
}

/* 头部 CTA 按钮锁定为统一品牌色与尺寸（不受产品页内联 .btn-p/.btn-s 影响） */
.sticky-header .btn-p,
.sticky-header .btn-s {
    padding: 0.75rem 1.5rem;
    font-size: 15px;
    border-radius: 8px;
}

.sticky-header .btn-p {
    background: var(--header-brand);
}

.sticky-header .btn-p:hover {
    background: var(--header-brand-dark);
}

.sticky-header .btn-s {
    color: var(--header-brand);
    border: 1px solid var(--header-border);
}

.sticky-header .btn-s:hover {
    background: var(--header-brand-light);
}

.btn-dark-s {
    background: transparent;
    color: var(--text-dark-primary);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-dark-s:hover {
    background: rgba(255, 255, 255, 0.06);
}

/* ========== Footer样式 ========== */
footer {
    background: var(--bg-dark);
    color: var(--text-dark-primary);
    padding: 2rem 0;
}

footer h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 1rem;
}

footer a {
    font-size: 14px;
    color: var(--text-dark-secondary);
    text-decoration: none;
    display: block;
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
}

footer a:hover {
    color: var(--text-dark-primary);
}

footer p {
    font-size: 14px;
    color: var(--text-dark-secondary);
    line-height: 1.8;
}

/* ========== 移动端菜单按钮 ========== */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}

.mobile-menu-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    margin: 5px 0;
    transition: all 0.3s ease;
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ========== 移动端菜单覆盖层 ========== */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
}

/* ========== 移动端菜单面板 ========== */
.mobile-menu-panel {
    display: none;
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100%;
    background: white;
    z-index: 1000;
    padding: 5rem 2rem 2rem;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    overflow-y: auto;
}

.mobile-menu-panel.active {
    display: block;
    right: 0;
}

.mobile-menu-panel nav {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.mobile-menu-panel nav a {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 16px;
}

.mobile-menu-panel nav a:hover {
    color: var(--header-brand);
    background: var(--header-brand-light);
    padding-left: 1rem;
}

.mobile-menu-panel .cta-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2rem;
}

.mobile-menu-panel .cta-buttons .btn-p,
.mobile-menu-panel .cta-buttons .btn-s {
    width: 100%;
    text-align: center;
}

/* 移动端菜单面板按钮同样锁定为统一品牌色 */
.mobile-menu-panel .cta-buttons .btn-p {
    background: var(--header-brand);
}

.mobile-menu-panel .cta-buttons .btn-p:hover {
    background: var(--header-brand-dark);
}

.mobile-menu-panel .cta-buttons .btn-s {
    color: var(--header-brand);
    border: 1px solid var(--header-border);
}

.mobile-menu-panel .cta-buttons .btn-s:hover {
    background: var(--header-brand-light);
}

/* ========== 响应式设计 ========== */
@media (max-width: 768px) {
    .sticky-header {
        padding: 1rem;
    }
    
    /* 移动端隐藏桌面端导航和CTA按钮 */
    .header-content nav {
        display: none !important;
    }
    
    .header-content .cta-buttons {
        display: none !important;
    }
    
    /* 移动端显示汉堡菜单按钮 */
    .mobile-menu-btn {
        display: block;
    }
    
    .cta-buttons {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    footer .container > div:first-child {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.5rem;
    }
}
