/*
 * =================================
 *      Futuristic Tech Theme for Chatspeed
 * =================================
 */

/* CSS 变量定义 */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #16213e;
    --accent-primary: #00d4ff;
    --accent-secondary: #0f3460;
    --accent-glow: #00a8cc;
    --text-primary: #ffffff;
    --text-secondary: #b8c5d6;
    --text-muted: #7a8ba0;
    --border-primary: #2a3f5f;
    --border-glow: rgba(0, 212, 255, 0.3);
    --shadow-primary: rgba(0, 212, 255, 0.1);
    --shadow-secondary: rgba(0, 0, 0, 0.3);
    --gradient-primary: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 50%, #16213e 100%);
    --gradient-accent: linear-gradient(135deg, #00d4ff 0%, #0f3460 100%);
    --gradient-card: linear-gradient(145deg, rgba(26, 26, 46, 0.8) 0%, rgba(22, 33, 62, 0.6) 100%);
}

/* =================================
 *      通用样式定义
 * ================================= */

/* 全局样式重置与基础设置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    overscroll-behavior: none;
}

html {
    scroll-behavior: smooth;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gradient-primary);
    color: var(--text-primary);
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior: none;
    background-attachment: fixed;
    color-scheme: dark;
}

/* 通用链接样式 */
a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:visited {
    color: var(--accent-primary);
}

a:hover {
    color: var(--accent-glow);
}

/* 通用排版 */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    line-height: 1.1;
    margin-bottom: 1.5rem;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: textGlow 3s ease-in-out infinite alternate;
}

h2 {
    font-size: clamp(2rem, 4vw, 3rem);
    margin-bottom: 3rem;
    text-align: center;
    position: relative;
    color: var(--text-primary);
}

h3 {
    font-size: 1.5rem;
    color: var(--accent-primary);
    margin-bottom: 1rem;
}

p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* =================================
 *      动画定义
 * ================================= */

@keyframes backgroundShift {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

@keyframes textGlow {
    from { filter: drop-shadow(0 0 10px rgba(0, 212, 255, 0.3)); }
    to { filter: drop-shadow(0 0 20px rgba(0, 212, 255, 0.6)); }
}

@keyframes lineGlow {
    from { box-shadow: 0 0 5px rgba(0, 212, 255, 0.5); }
    to { box-shadow: 0 0 15px rgba(0, 212, 255, 0.8); }
}

@keyframes pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
    50% { transform: translate(-50%, -50%) scale(1.1); opacity: 0.8; }
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes floating {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: var(--accent-primary); }
}

@keyframes progress {
    to { transform: translateX(0); }
}

@keyframes wave {
    0% { left: -100%; }
    100% { left: 100%; }
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(0, 212, 255, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(0, 212, 255, 0.8);
    }
}

/* =================================
 *      具体组件样式
 * ================================= */

/* 动画背景 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 80%, rgba(0, 212, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(15, 52, 96, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(0, 168, 204, 0.05) 0%, transparent 50%);
    z-index: -1;
    animation: backgroundShift 20s ease-in-out infinite;
}

/* h2 装饰线 */
h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--gradient-accent);
    border-radius: 2px;
    animation: lineGlow 2s ease-in-out infinite alternate;
}

/* 头部导航 */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

header.scrolled {
    background: rgba(10, 10, 15, 0.95);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
}

.logo {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 0 10px rgba(0, 212, 255, 0.5));
}

.logo img {
    width: 40px;
    height: 40px;
    margin-right: 12px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.logo:hover img {
    transform: rotate(5deg);
}

nav {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.nav-links a::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 0;
    height: 100%;
    background: rgba(0, 212, 255, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: -1;
    border-radius: 8px;
    transform: translateX(-50%);
}

.nav-links a:hover::before {
    width: 100%;
}

.nav-links a:hover {
    color: var(--text-primary);
    transform: translateY(-2px);
}

.nav-links a:visited {
    color: var(--text-secondary);
}

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

.nav-links a[href*="github"]:visited {
    color: var(--text-secondary);
}

.nav-links a[href*="github"]:visited:hover {
    color: var(--text-primary);
}

.lang-switcher select {
    background: rgba(26, 26, 46, 0.8);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lang-switcher select:hover,
.lang-switcher select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.2);
    outline: none;
}

/* 主要内容区域 */
main {
    padding-top: 80px;
}

section {
    padding: 6rem 0;
    position: relative;
}

/* Hero 区域 */
.hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(0, 212, 255, 0.1) 0%, transparent 70%);
    animation: pulse 4s ease-in-out infinite;
}

.hero-section .container {
    position: relative;
    z-index: 2;
}

.subtitle {
    font-size: 1.3rem;
    color: var(--text-secondary);
    max-width: 800px;
    margin: 0 auto 3rem;
    line-height: 1.6;
    animation: fadeInUp 1s ease-out 0.5s both;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 1rem 2.5rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1.1rem;
    text-decoration: none;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.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 ease;
}

.btn:hover::before {
    left: 100%;
}

.primary-btn {
    background: var(--gradient-accent);
    color: var(--text-primary);
    box-shadow: 0 8px 32px rgba(0, 212, 255, 0.3);
}

.primary-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(0, 212, 255, 0.4);
}

.secondary-btn {
    background: transparent;
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.secondary-btn:hover {
    background: var(--accent-primary);
    color: #000000;
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(0, 212, 255, 0.3);
}

/* 功能网格 */
.features-section {
    position: relative;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-top: 4rem;
}

.feature-item {
    background: var(--gradient-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-primary);
    border-radius: 16px;
    padding: 2.5rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.feature-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--gradient-accent);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.feature-item:hover::before {
    transform: scaleX(1);
}

.feature-item:hover {
    transform: translateY(-8px);
    border-color: var(--accent-primary);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(0, 212, 255, 0.2);
}

.feature-item h3 {
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
    color: var(--accent-primary);
}

.feature-item p {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.feature-item code {
    background: rgba(0, 212, 255, 0.1);
    color: var(--accent-primary);
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.9rem;
    border: 1px solid rgba(0, 212, 255, 0.2);
}

/* 优势区域 */
.benefits-section {
    background: rgba(26, 26, 46, 0.3);
    position: relative;
}

.benefit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 3rem;
    margin-top: 4rem;
}

.benefit-item {
    text-align: center;
    padding: 2rem;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.benefit-item:hover {
    transform: translateY(-5px);
    background: rgba(0, 212, 255, 0.05);
}

.benefit-item h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.benefit-item p {
    color: var(--text-secondary);
}

/* CTA 区域 */
.cta-section {
    text-align: center;
    background: radial-gradient(ellipse at center, rgba(0, 212, 255, 0.1) 0%, transparent 70%);
}

.cta-section h2 {
    margin-bottom: 1.5rem;
}

.cta-section p {
    max-width: 600px;
    margin: 0 auto 3rem;
    font-size: 1.2rem;
}

/* 页脚 */
footer {
    background: rgba(10, 10, 15, 0.9);
    border-top: 1px solid var(--border-primary);
    padding: 2rem 0;
    text-align: center;
}

footer p {
    color: var(--text-muted);
    margin: 0;
}

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

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

footer a:visited {
    color: var(--text-muted);
}

footer a:visited:hover {
    color: var(--accent-primary);
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-glow);
}

/* =================================
 *      动画效果类
 * ================================= */

/* 需要动画的元素初始状态 */
.feature-item,
.benefit-item,
.cta-section {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

.floating {
    animation: floating 3s ease-in-out infinite;
}

.cursor-glow {
    position: fixed;
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, rgba(0, 212, 255, 0.6) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transition: transform 0.1s ease;
    mix-blend-mode: screen;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0, 212, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--accent-primary);
    animation: spin 1s ease-in-out infinite;
}

.typewriter {
    overflow: hidden;
    border-right: 2px solid var(--accent-primary);
    white-space: nowrap;
    animation:
        typing 3.5s steps(40, end),
        blink-caret 0.75s step-end infinite;
}

.counter {
    font-weight: 700;
    color: var(--accent-primary);
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(0, 212, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-bar::before {
    content: '';
    display: block;
    height: 100%;
    background: var(--gradient-accent);
    border-radius: 2px;
    transform: translateX(-100%);
    animation: progress 2s ease-in-out forwards;
}

.card-3d {
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
}

.card-3d:hover {
    transform: rotateY(5deg) rotateX(5deg);
}

.neon-border {
    position: relative;
    border: 1px solid var(--accent-primary);
    box-shadow:
        0 0 5px var(--accent-primary),
        inset 0 0 5px var(--accent-primary);
}

.neon-border::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: var(--gradient-accent);
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.neon-border:hover::before {
    opacity: 0.7;
}

.wave {
    position: relative;
    overflow: hidden;
}

.wave::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.2), transparent);
    animation: wave 2s infinite;
}

.pulse {
    animation: pulse-glow 2s infinite;
}

/* =================================
 *      下载弹窗样式
 * ================================= */

.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease-out;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--gradient-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-primary);
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: fadeInUp 0.3s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 2rem 1rem;
    border-bottom: 1px solid var(--border-primary);
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.modal-body {
    padding: 2rem;
}

.download-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-primary);
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(0, 212, 255, 0.1);
}

.tab-btn.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.platform-content {
    display: none;
}

.platform-content.active {
    display: block;
}

.download-options {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.download-item {
    background: rgba(26, 26, 46, 0.5);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.download-item:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 212, 255, 0.2);
}

.download-item h4 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    font-size: 1.2rem;
}

.download-item p {
    margin: 0 0 1rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.download-item .btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
}

.github-link {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border-primary);
}

.github-link p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

/* 系统检测指示器 */
.platform-indicator {
    display: inline-block;
    background: var(--accent-primary);
    color: #000;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
    text-transform: uppercase;
}

/* =================================
 *      媒体查询
 * ================================= */

/* 无障碍支持 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    :root {
        --text-primary: #ffffff;
        --text-secondary: #ffffff;
        --bg-primary: #000000;
        --accent-primary: #00ffff;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    header .container {
        padding: 1rem;
    }

    .nav-links {
        display: none;
    }

    .feature-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .benefit-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    section {
        padding: 4rem 0;
    }

    .hero-section {
        min-height: 80vh;
    }

    h1 {
        font-size: 2.5rem;
    }

    h2 {
        font-size: 2rem;
    }

    /* 移动端弹窗优化 */
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .modal-header,
    .modal-body {
        padding: 1.5rem;
    }

    .download-tabs {
        flex-direction: column;
        gap: 0;
    }

    .tab-btn {
        padding: 0.75rem 1rem;
        border-bottom: 1px solid var(--border-primary);
        border-radius: 0;
    }

    .tab-btn:last-child {
        border-bottom: none;
    }

    .tab-btn.active {
        border-bottom-color: var(--accent-primary);
    }

    .download-item {
        padding: 1rem;
    }
}