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

:root {
    --primary: #3B82F6;
    --primary-dark: #2563EB;
    --primary-light: #60A5FA;
    --primary-shadow: rgba(59, 130, 246, 0.35);
    --background: #FAFAF9;
    --surface: #FFFFFF;
    --text-primary: #1C1917;
    --text-secondary: #57534E;
    --text-tertiary: #78716C;
    --border: #E7E5E4;
    --hover-bg: rgba(0, 0, 0, 0.04);
    --accent: #60A5FA;
    --gradient-start: rgba(59, 130, 246, 0.1);
    --gradient-end: rgba(37, 99, 235, 0.2);
    --card-hover-bg: rgba(59, 130, 246, 0.05);
    --code-bg: #F5F5F4;
    --code-text: #292524;
    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;
    --method-get: #10B981;
    --method-post: #3B82F6;
    --method-put: #F59E0B;
    --method-delete: #EF4444;
}

[data-theme="dark"] {
    --primary: #3B82F6;
    --primary-dark: #2563EB;
    --primary-light: #60A5FA;
    --primary-shadow: rgba(59, 130, 246, 0.5);
    --background: #0F172A;
    --surface: #1E293B;
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-tertiary: #64748B;
    --border: #334155;
    --hover-bg: rgba(255, 255, 255, 0.08);
    --accent: #60A5FA;
    --gradient-start: rgba(59, 130, 246, 0.1);
    --gradient-end: rgba(37, 99, 235, 0.2);
    --card-hover-bg: rgba(59, 130, 246, 0.05);
    --code-bg: #1E293B;
    --code-text: #E2E8F0;
    --success: #34D399;
    --warning: #FBBF24;
    --error: #F87171;
    --method-get: #34D399;
    --method-post: #60A5FA;
    --method-put: #FBBF24;
    --method-delete: #F87171;
}

[data-theme="dark"] .lang-switcher {
    background: var(--surface);
    color: var(--text-primary);
}

[data-theme="dark"] select {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

[data-theme="dark"] select option {
    background: var(--background);
    color: var(--text-primary);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

html {
    scroll-behavior: smooth;
}

section {
    scroll-margin-top: 0;
}

/* Navigation */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    height: 72px;
    background: var(--surface);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    transition: all 0.3s ease;
}

nav.scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.nav-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 32px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary);
    cursor: pointer;
    text-decoration: none;
    margin-right: 48px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo img {
    height: 30px;
    width: auto;
}

.nav-links {
    display: flex;
    gap: 32px;
    align-items: center;
    height: 100%;
    margin-right: auto;
}

.nav-links a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

/* 一级菜单当前页高亮 */
.nav-links a.nav-active,
.nav-links .nav-item.nav-active > a {
    color: var(--primary);
    font-weight: 600;
}

.mobile-nav-menu a.nav-active,
.mobile-nav-menu .mobile-nav-dropdown.nav-active > .dropdown-toggle {
    color: var(--primary);
    font-weight: 600;
}

.nav-item {
    position: relative;
}

.nav-dropdown > a {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-dropdown > a::after {
    content: '';
    border: 4px solid transparent;
    border-top-color: currentColor;
    margin-top: 2px;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
}

.nav-dropdown:hover .nav-dropdown-menu {
    display: block;
}

.nav-dropdown-menu a {
    display: block;
    padding: 10px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: background 0.3s ease;
}

.nav-links a:hover {
    color: var(--primary);
}

.mobile-nav-dropdown {
    border-bottom: 1px solid var(--border);
}

.mobile-nav-dropdown > a {
    align-items: center;
    padding: 16px 32px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    border-bottom: none;
}

.mobile-nav-dropdown > a::after {
    content: '▼';
    font-size: 10px;
}

.mobile-nav-dropdown.active > a::after {
    content: '▲';
}

.mobile-nav-dropdown-menu {
    display: none;
}

.mobile-nav-dropdown.active > .mobile-nav-dropdown-menu {
    display: block;
}

.mobile-nav-dropdown-menu a {
    display: block;
    padding: 14px 16px 14px 48px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 15px;
    border-bottom: 1px solid var(--border);
}

.mobile-nav-dropdown-menu a:last-child {
    border-bottom: none;
}

.mobile-nav-dropdown-menu a:hover,
.mobile-nav-dropdown-menu a:active {
    color: var(--primary);
    background: var(--card-hover-bg);
}

/* Mobile section nav (for pages using section-based mobile menu) */
.mobile-nav-section {
    border-bottom: 1px solid var(--border);
}

.mobile-nav-section-title {
    padding: 20px 24px 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mobile-nav-section a {
    display: block;
    padding: 14px 24px 14px 48px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 16px;
    transition: background 0.3s ease;
}

.mobile-nav-section a:hover {
    background: var(--card-hover-bg);
}

/* Nav Apply Trial */
.nav-apply-trial {
    background: transparent;
    color: var(--text-primary);
    font-weight: 500;
    text-decoration: none;
    transition: color 0.3s ease;
}

.nav-apply-trial:hover {
    color: var(--primary);
}

.nav-controls {
    display: flex;
    gap: 16px;
    align-items: center;
}

.lang-switcher, .theme-toggle {
    background: none;
    border: 1px solid var(--border);
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-primary);
    font-weight: 500;
    transition: all 0.3s ease;
}

.theme-toggle {
    padding: 8px;
    width: 40px;
    height: auto;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

.lang-switcher:hover, .theme-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Apply Trial Button */
.apply-trial-btn {
    background: linear-gradient(135deg, var(--primary) 0%, #6366F1 100%);
    color: white;
    padding: 10px 20px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.25);
    letter-spacing: 0.5px;
    border: none;
    cursor: pointer;
}

.apply-trial-btn:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #4F46E5 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.35);
    color: white;
}

.mobile-apply-trial {
    background: linear-gradient(135deg, var(--primary) 0%, #6366F1 100%);
    color: white;
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    margin-top: 16px;
    display: block;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.25);
}

.mobile-apply-trial:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #4F46E5 100%);
    color: white;
}

/* Mobile Menu Styles */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--text-primary);
    z-index: 1001;
}

.mobile-menu-toggle svg {
    width: 24px;
    height: 24px;
    transition: transform 0.3s ease;
}

.mobile-menu-toggle .close-icon {
    display: none;
}

.mobile-menu-toggle.active .close-icon {
    display: block;
}

.mobile-menu-toggle.active .menu-icon {
    display: none;
}

.mobile-nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    backdrop-filter: blur(4px);
}

.mobile-nav-overlay.active {
    display: block;
}

.mobile-nav-menu {
    position: fixed;
    top: 72px;
    left: 0;
    width: 100%;
    background: var(--surface);
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    max-height: calc(100vh - 72px);
    overflow-y: auto;
    padding: 24px 0;
    border-bottom: 1px solid var(--border);
}

.mobile-nav-menu.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.mobile-nav-menu a {
    display: block;
    padding: 16px 32px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 18px;
    font-weight: 500;
    transition: background 0.3s ease;
    border-bottom: 1px solid var(--border);
}

.mobile-nav-menu a:last-child {
    border-bottom: none;
}

.mobile-nav-menu a:hover {
    background: var(--card-hover-bg);
}

/* Footer */
footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 64px 32px 32px;
}

.footer-container {
    max-width: 1440px;
    margin: 0 auto;
    width: 100%;
}

/* 微信公众号（页脚列内，与菜单同行） */
.footer-wechat-qr {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

.footer-wechat-qr img {
    width: 260px;
    height: auto;
    display: block;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.footer-wechat-qr span {
    font-size: 12px;
    color: var(--text-tertiary);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 48px;
    margin-bottom: 48px;
}

.footer-column h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--primary);
}

.footer-column ul {
    list-style: none;
}

.footer-column ul li {
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.footer-column a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-column a:hover {
    color: var(--primary);
}

.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.footer-bottom a {
    color: var(--text-secondary);
    text-decoration: none;
}

/* Responsive */
@media (max-width: 991px) {
    .nav-container {
        justify-content: flex-start;
        gap: 16px;
        padding: 0 16px;
    }

    .nav-links {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .logo {
        margin-right: auto;
    }

    .nav-controls {
        gap: 8px;
    }

    .lang-switcher {
        padding: 8px 12px;
        font-size: 13px;
    }

    .theme-toggle {
        padding: 6px;
        width: 36px;
    }
}

@media (max-width: 768px) {
    .nav-container {
        padding: 0 16px;
    }

    .logo {
        font-size: 20px;
    }

    .logo img {
        height: 30px;
    }

    section {
        padding: 64px 24px;
    }

    .btn {
        width: 100%;
        padding: 16px 32px;
        font-size: 16px;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 0 12px;
    }

    .lang-switcher {
        padding: 6px 8px;
        font-size: 12px;
        min-width: 60px;
    }

    .theme-toggle {
        padding: 4px;
        width: 32px;
    }

    .theme-toggle svg {
        width: 18px;
        height: 18px;
    }

    .mobile-nav-menu a {
        padding: 14px 20px;
        font-size: 16px;
    }

    .mobile-nav-dropdown > a {
        padding: 14px 20px;
    }

    .mobile-nav-dropdown-menu a {
        padding-left: 40px;
    }

    section {
        padding: 48px 16px;
    }

    .footer-container {
        padding: 0 16px;
    }

    .footer-grid {
        gap: 32px;
    }

    .footer-column h4 {
        font-size: 14px;
    }

    .footer-column ul li {
        font-size: 13px;
    }

    .btn {
        padding: 14px 24px;
        font-size: 15px;
    }
}

/* Touch-friendly Optimizations */
button, a {
    cursor: pointer;
}

/* Optimize scrolling on mobile */
@media (max-width: 991px) {
    html {
        -webkit-overflow-scrolling: touch;
    }

    body {
        touch-action: pan-y;
    }

    button, a, input, select {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        min-height: 44px;
        min-width: 44px;
    }

    button, a, .btn, .nav-links a, .mobile-nav-menu a, .service-card {
        user-select: none;
        -webkit-user-select: none;
    }
}

@media (max-width: 768px) {
    /* Smooth tap transitions for mobile */
    button:active,
    a:active,
    .btn:active,
    .service-card:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
}
