/* ========================================================================
   CCBONLINE Inc. (智桥国际) - 统一页首样式系统 v4.0
   最后更新: 2025-01-31
   
   整合内容:
   - optimized-header.css (核心布局和交互)
   - header-unified-optimized.css (SVG Logo支持和完整响应式)
   - header-mobile-enhancements.css (移动端优化)
   - unified-logo.css (Logo图标系统)
   
   优化重点:
   ✅ 性能优化 (CSS Containment, 硬件加速)
   ✅ 完整响应式设计 (桌面/平板/移动)
   ✅ 无障碍支持 (ARIA, 键盘导航, 屏幕阅读器)
   ✅ 品牌一致性 (智桥国际橙色主题)
   ✅ 暗色模式/高对比度/减少动效支持
   ======================================================================== */

/* ==================== CSS变量系统 ==================== */
:root {
    /* 品牌颜色 - 智桥国际橙色主题 */
    --zhiqiao-primary: #f97316;
    --zhiqiao-primary-hover: #ea580c;
    --zhiqiao-secondary: #dc2626;
    --zhiqiao-gradient-primary: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    --zhiqiao-gradient-hover: linear-gradient(135deg, #ea580c 0%, #dc2626 100%);
    
    /* 页首背景和边框 */
    --header-bg: rgba(255, 255, 255, 0.95);
    --header-border: rgba(229, 231, 235, 0.3);
    --header-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    --header-shadow-scroll: 0 4px 30px rgba(0, 0, 0, 0.12);
    
    /* 文字颜色 */
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    
    /* 中性色 */
    --neutral-50: #f9fafb;
    --neutral-100: #f3f4f6;
    --neutral-200: #e5e7eb;
    --neutral-300: #d1d5db;
    
    /* 过渡效果 */
    --transition-fast: 0.2s ease;
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* 移动端尺寸 */
    --mobile-header-height: 65px;
    --mobile-touch-target: 44px;
}

/* ==================== 性能优化 ==================== */
.header {
    contain: layout style;
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--header-border);
    box-shadow: var(--header-shadow);
    transition: all var(--transition-smooth);
}

/* 硬件加速优化 */
.header,
.header-logo-svg,
.ccb-header-logo,
.nav-link,
.nav-contact-btn,
.mobile-menu-btn {
    transform: translateZ(0);
    will-change: transform;
}

/* 滚动时页首效果 */
.header.scrolled {
    box-shadow: var(--header-shadow-scroll);
    border-bottom-color: rgba(229, 231, 235, 0.5);
}

/* ==================== 容器布局 ==================== */
.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 80px;
    position: relative;
}

/* ==================== Logo区域 (支持SVG和图标两种模式) ==================== */

/* 方案A: SVG Logo (推荐用于页首) */
.ccb-header-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: all var(--transition-fast);
    border-radius: 8px;
    padding: 0.25rem;
    position: relative;
    z-index: 10;
}

.ccb-header-logo:hover {
    transform: scale(1.02);
    background: rgba(249, 115, 22, 0.05);
}

.ccb-header-logo:focus {
    outline: 2px solid var(--zhiqiao-primary);
    outline-offset: 2px;
}

.header-logo-svg {
    height: 50px;
    width: auto;
    display: block;
    transition: all var(--transition-smooth);
}

/* 方案B: 纯图标Logo (备用方案) */
.ccb-logo-icon {
    background: var(--zhiqiao-gradient-primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(249, 115, 22, 0.2);
    transition: all var(--transition-fast);
}

.ccb-logo-icon:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

/* 图标内部桥梁元素 */
.ccb-logo-bridge {
    width: 20px;
    height: 3px;
    background: white;
    border-radius: 2px;
    position: relative;
}

.ccb-logo-bridge::before,
.ccb-logo-bridge::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    top: -1.5px;
}

.ccb-logo-bridge::before {
    left: -3px;
}

.ccb-logo-bridge::after {
    right: -3px;
}

/* 品牌文字 */
.ccb-brand-text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    line-height: 1;
}

.ccb-brand-cn {
    font-family: 'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.025em;
}

.ccb-brand-en {
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Logo尺寸变体 */
.ccb-logo-xs { width: 24px; height: 24px; border-radius: 6px; }
.ccb-logo-sm { width: 32px; height: 32px; border-radius: 8px; }
.ccb-logo-md { width: 40px; height: 40px; border-radius: 10px; }
.ccb-logo-lg { width: 60px; height: 60px; border-radius: 15px; }

/* ==================== 主导航样式 ==================== */
.nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    justify-content: center;
    margin: 0 2rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95rem;
    border-radius: 8px;
    transition: all var(--transition-smooth);
    position: relative;
    white-space: nowrap;
}

/* 导航链接底部装饰线 */
.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--zhiqiao-gradient-primary);
    transition: all var(--transition-smooth);
    transform: translateX(-50%);
    border-radius: 1px;
}

.nav-link:hover {
    color: var(--zhiqiao-primary);
    background: rgba(249, 115, 22, 0.08);
    transform: translateY(-1px);
}

.nav-link:hover::after {
    width: 80%;
}

.nav-link:focus {
    outline: 2px solid var(--zhiqiao-primary);
    outline-offset: 2px;
    background: rgba(249, 115, 22, 0.1);
}

/* 当前页面激活状态 */
.nav-link.active,
.nav-link[aria-current="page"] {
    color: var(--zhiqiao-primary);
    background: rgba(249, 115, 22, 0.1);
    font-weight: 600;
}

.nav-link.active::after {
    width: 100%;
}

/* ==================== CTA联系按钮 ==================== */
.nav-contact-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--zhiqiao-gradient-primary);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all var(--transition-smooth);
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.3);
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    margin-left: 0.5rem;
}

/* 按钮悬浮光效 */
.nav-contact-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.nav-contact-btn:hover::before {
    left: 100%;
}

.nav-contact-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
    background: var(--zhiqiao-gradient-hover);
}

.nav-contact-btn:focus {
    outline: 2px solid #fbbf24;
    outline-offset: 2px;
}

.nav-contact-btn:active {
    transform: translateY(0) scale(0.98);
}

/* ==================== 语言切换器 ==================== */
.language-switcher {
    display: flex;
    align-items: center;
    position: relative;
    top: auto;
    right: auto;
    background: transparent;
    box-shadow: none;
    border: none;
    backdrop-filter: none;
    margin-left: 1rem;
}

.lang-switch-container {
    display: flex;
    align-items: center;
    background: var(--neutral-50);
    border-radius: 20px;
    padding: 0.25rem;
    border: 1px solid var(--neutral-200);
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: none;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-smooth);
    min-width: var(--mobile-touch-target);
}

.lang-btn:hover {
    background: var(--neutral-200);
    color: var(--text-primary);
}

.lang-btn.active {
    background: var(--zhiqiao-primary);
    color: white;
    box-shadow: 0 2px 4px rgba(249, 115, 22, 0.3);
}

.lang-btn:focus {
    outline: 2px solid var(--zhiqiao-primary);
    outline-offset: 1px;
}

.flag {
    font-size: 1rem;
}

.lang-text {
    font-weight: 600;
}

/* ==================== 移动端菜单按钮 ==================== */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: var(--mobile-touch-target);
    height: var(--mobile-touch-target);
    background: none;
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 0.5rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    z-index: 1001;
}

.mobile-menu-btn:hover {
    background: rgba(249, 115, 22, 0.05);
    border-color: rgba(249, 115, 22, 0.1);
    color: var(--zhiqiao-primary);
}

.mobile-menu-btn:focus {
    outline: 2px solid var(--zhiqiao-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

.mobile-menu-btn.active,
.mobile-menu-btn[aria-expanded="true"] {
    background: var(--zhiqiao-primary);
    color: white;
}

/* Hamburger图标线条 */
.hamburger-line {
    width: 24px;
    height: 2px;
    background: currentColor;
    transition: all var(--transition-smooth);
    margin: 2px 0;
    transform-origin: center;
}

.mobile-menu-btn:hover .hamburger-line {
    background: var(--zhiqiao-primary);
}

.mobile-menu-btn[aria-expanded="true"] .hamburger-line {
    background: white;
}

/* 菜单展开动画 */
.mobile-menu-btn[aria-expanded="true"] .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn[aria-expanded="true"] .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn[aria-expanded="true"] .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* ==================== 移动端导航展开 ==================== */
.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-smooth);
    z-index: 999;
}

.mobile-nav-overlay.show,
.mobile-nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-nav-menu {
    display: none;
    position: fixed;
    top: 81px;
    left: 0;
    right: 0;
    background: white;
    border-bottom: 1px solid var(--header-border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: calc(100vh - 81px);
    overflow-y: auto;
}

.mobile-nav-menu.show {
    display: block;
    animation: slideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-nav-content {
    padding: 1.5rem;
}

.mobile-nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.mobile-nav-links .nav-link {
    width: 100%;
    justify-content: center;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 1rem;
    min-height: var(--mobile-touch-target);
}

.mobile-nav-links .nav-link:hover {
    border-color: var(--header-border);
    background: rgba(249, 115, 22, 0.03);
}

.mobile-nav-links .nav-contact-btn {
    margin-left: 0;
    text-align: center;
    justify-content: center;
    width: 100%;
}

/* 移动端下拉动画 */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== 响应式设计 ==================== */

/* 大屏幕 (≥1440px) */
@media (min-width: 1440px) {
    .header-content {
        max-width: 1400px;
        padding: 0 2rem;
    }
    
    .nav {
        gap: 1rem;
    }
    
    .nav-link {
        padding: 0.8rem 1.2rem;
    }
}

/* 平板尺寸 (768px - 1023px) */
@media (max-width: 1023px) {
    .header-content {
        padding: 0 1rem;
    }
    
    .nav {
        margin: 0 1rem;
        gap: 0.25rem;
    }
    
    .nav-link {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .nav-contact-btn {
        padding: 0.65rem 1.25rem;
        font-size: 0.85rem;
    }
}

/* 移动端 (≤767px) */
@media (max-width: 767px) {
    :root {
        --mobile-header-height: 65px;
    }
    
    .header-content {
        height: var(--mobile-header-height);
        padding: 0 1rem;
    }
    
    .header-logo-svg {
        height: 40px;
    }
    
    .ccb-logo-icon {
        width: 36px;
        height: 36px;
    }
    
    .ccb-brand-text {
        display: none;
    }
    
    /* 隐藏桌面导航 */
    .nav {
        position: fixed;
        top: var(--mobile-header-height);
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 1.5rem;
        gap: 0.5rem;
        margin: 0;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-smooth);
        z-index: 1000;
        max-height: calc(100vh - var(--mobile-header-height));
        overflow-y: auto;
    }
    
    .nav.show,
    .nav.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    
    .nav-link {
        width: 100%;
        justify-content: center;
        padding: 1rem;
        font-size: 1rem;
        border-radius: 12px;
    }
    
    .nav-contact-btn {
        width: 100%;
        justify-content: center;
        padding: 1rem;
        margin-top: 0.5rem;
        margin-left: 0;
    }
    
    .language-switcher {
        margin: 1rem auto 0 auto;
        align-self: center;
    }
    
    /* 显示移动端菜单按钮 */
    .mobile-menu-btn {
        display: flex;
    }
    
    .mobile-nav-overlay {
        top: var(--mobile-header-height);
    }
    
    .mobile-nav-menu {
        top: var(--mobile-header-height);
        max-height: calc(100vh - var(--mobile-header-height));
    }
}

/* 小屏幕移动端 (≤480px) */
@media (max-width: 480px) {
    :root {
        --mobile-header-height: 60px;
    }
    
    .header-content {
        padding: 0 0.75rem;
        height: var(--mobile-header-height);
    }
    
    .header-logo-svg {
        height: 36px;
    }
    
    .ccb-logo-icon {
        width: 32px;
        height: 32px;
    }
    
    .ccb-brand-cn {
        font-size: 0.8rem;
    }
    
    .nav {
        top: var(--mobile-header-height);
        padding: 1rem;
    }
    
    .nav-link {
        padding: 0.75rem;
        font-size: 0.95rem;
    }
    
    .language-switcher {
        margin-left: 0.5rem;
        margin-right: 0.5rem;
    }
    
    .lang-switch-container {
        padding: 1px;
    }
    
    .lang-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .lang-btn .lang-text {
        display: none;
    }
}

/* 横屏模式优化 (移动端横屏) */
@media (orientation: landscape) and (max-height: 500px) {
    :root {
        --mobile-header-height: 55px;
    }
    
    .mobile-nav-menu,
    .nav {
        max-height: calc(100vh - 55px);
    }
    
    .mobile-nav-content {
        padding: 1rem;
    }
    
    .mobile-nav-links .nav-link,
    .mobile-nav-links .nav-contact-btn {
        padding: 0.75rem 1rem;
        min-height: 40px;
    }
}

/* ==================== 触摸设备优化 ==================== */
@media (hover: none) and (pointer: coarse) {
    .nav-link:hover {
        background: transparent;
        transform: none;
    }
    
    .nav-link:active {
        background: rgba(249, 115, 22, 0.08);
        transform: scale(0.98);
        transition: all 0.1s ease;
    }
    
    .nav-contact-btn:hover {
        transform: none;
        box-shadow: 0 2px 8px rgba(249, 115, 22, 0.3);
    }
    
    .nav-contact-btn:active {
        transform: scale(0.98);
    }
    
    .mobile-menu-btn:hover {
        background: transparent;
        border-color: transparent;
    }
    
    .mobile-menu-btn:active {
        background: rgba(249, 115, 22, 0.1);
    }
}

/* ==================== PWA和全屏模式支持 ==================== */
@media (display-mode: standalone) {
    .header {
        padding-top: env(safe-area-inset-top, 0);
    }
    
    .header-content {
        padding-left: max(1rem, env(safe-area-inset-left, 0));
        padding-right: max(1rem, env(safe-area-inset-right, 0));
    }
}

/* ==================== 高DPI屏幕优化 ==================== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .ccb-logo-icon {
        box-shadow: 0 1px 8px rgba(249, 115, 22, 0.25);
    }
    
    .nav-contact-btn {
        box-shadow: 0 1px 8px rgba(249, 115, 22, 0.25);
    }
}

/* ==================== 无障碍支持 ==================== */

/* 减少动效模式 */
@media (prefers-reduced-motion: reduce) {
    .header,
    .ccb-header-logo,
    .nav-link,
    .nav-contact-btn,
    .mobile-menu-btn,
    .hamburger-line,
    .nav,
    .mobile-nav-overlay,
    .mobile-nav-menu {
        transition: none;
        animation: none;
    }
    
    .ccb-header-logo:hover,
    .nav-link:hover,
    .nav-contact-btn:hover,
    .nav-link:active,
    .nav-contact-btn:active {
        transform: none;
    }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    .header {
        border-bottom-width: 2px;
        background: #fff;
    }
    
    .nav-link {
        color: #000;
        border: 1px solid transparent;
    }
    
    .nav-link:hover,
    .nav-link:focus {
        border-color: #000;
        background: #f0f0f0;
    }
    
    .nav-link.active::after {
        height: 3px;
    }
    
    .nav-contact-btn {
        background: #000;
        color: #fff;
        border: 2px solid #000;
    }
    
    .mobile-nav-menu {
        border: 2px solid #000;
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --header-bg: rgba(17, 24, 39, 0.95);
        --header-border: rgba(75, 85, 99, 0.3);
        --text-primary: #f9fafb;
        --text-secondary: #d1d5db;
        --neutral-50: #374151;
        --neutral-100: #4b5563;
        --neutral-200: #6b7280;
    }
    
    .header {
        background: var(--header-bg);
        border-bottom-color: var(--header-border);
    }
    
    .nav-link {
        color: var(--text-primary);
    }
    
    .nav-link:hover {
        color: var(--zhiqiao-primary);
        background: rgba(249, 115, 22, 0.1);
    }
    
    .hamburger-line {
        background: var(--text-primary);
    }
    
    .lang-switch-container {
        background: var(--neutral-50);
        border-color: var(--neutral-200);
    }
    
    .lang-btn {
        color: var(--text-secondary);
    }
    
    .lang-btn:hover {
        background: var(--neutral-100);
        color: var(--text-primary);
    }
    
    .mobile-nav-menu,
    .nav {
        background: #111827;
    }
    
    .mobile-nav-overlay {
        background: rgba(0, 0, 0, 0.7);
    }
}

/* ==================== 打印样式 ==================== */
@media print {
    .header {
        position: static;
        background: transparent;
        box-shadow: none;
        border-bottom: 1px solid #000;
    }
    
    .nav,
    .nav-contact-btn,
    .language-switcher,
    .mobile-menu-btn {
        display: none;
    }
    
    .ccb-header-logo {
        margin: 0;
    }
}

/* ==================== 屏幕阅读器支持 ==================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ==================== Focus可见性增强 ==================== */
:focus-visible {
    outline: 2px solid var(--zhiqiao-primary);
    outline-offset: 2px;
}
