/* 全局样式 - 增强的主题配色方案 */
:root {
    /* 主题色调 - 更专业的配色方案 */
    --primary: #1e88e5;
    --primary-dark: #1565c0;
    --secondary: #43a047;
    --secondary-dark: #2e7d32;
    --accent: #f57c00;
    --accent-light: #ffb74d;

    /* 背景和卡片 */
    --bg-light: #f8fafc;
    --bg-dark: #121824;
    --card-light: #ffffff;
    --card-dark: #1e2233;
    --hover-light: rgba(0, 0, 0, 0.03);
    --hover-dark: rgba(255, 255, 255, 0.05);

    /* 文本颜色 */
    --text-primary-light: #2c3e50;
    --text-secondary-light: #546e7a;
    --text-primary-dark: #ecf0f1;
    --text-secondary-dark: #b0bec5;

    /* 边框和阴影 */
    --border-light: rgba(0, 0, 0, 0.08);
    --border-dark: rgba(255, 255, 255, 0.08);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --shadow-dark-sm: 0 2px 4px rgba(0, 0, 0, 0.15);
    --shadow-dark-md: 0 4px 6px rgba(0, 0, 0, 0.18);
    --shadow-dark-lg: 0 10px 25px rgba(0, 0, 0, 0.25);

    /* 圆角 */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    /* 动画 */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

    /* 字体 */
    --font-sans: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* 统一的变量命名 */
    --primary-color: var(--primary);
    --secondary-color: var(--secondary);
    --text-color: var(--text-primary-light);
    --bg-color: var(--bg-light);
    --card-bg: var(--card-light);
    --border-color: var(--border-light);
    --hover-color: var(--hover-light);
    --shadow-color: var(--shadow-md);
    --transition-duration: var(--transition-normal);
}

[data-theme="dark"] {
    /* 暗色主题变量 */
    --text-color: var(--text-primary-dark);
    --bg-color: var(--bg-dark);
    --card-bg: var(--card-dark);
    --border-color: var(--border-dark);
    --hover-color: var(--hover-dark);
    --shadow-color: var(--shadow-dark-md);
}

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

body {
    font-family: var(--font-sans);
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.5;
    transition: background-color var(--transition-duration) ease,
        color var(--transition-duration) ease;
    overflow-x: hidden;
    position: relative;
}

/* 简化背景 - 移除粒子画布 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 50%, rgba(30, 136, 229, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(67, 160, 71, 0.05) 0%, transparent 50%);
    z-index: -1;
    pointer-events: none;
}

[data-theme="dark"] body::before {
    background: radial-gradient(circle at 20% 50%, rgba(30, 136, 229, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(67, 160, 71, 0.08) 0%, transparent 50%);
}

/* 防止用户选择（安全功能） */
body {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* 允许在输入框中选择文本 */
input,
textarea,
[contenteditable] {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 加载动画 - 优化版 */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    margin-bottom: 16px;
}

.loader-text {
    font-size: 16px;
    color: var(--text-color);
    font-weight: 500;
    opacity: 0;
    animation: fadeIn 1s forwards 0.5s;
}

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

[data-theme="dark"] .spinner {
    border-color: rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary-color);
}

/* 主题切换按钮样式 */
#theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition-duration) ease;
    color: var(--text-color);
}

#theme-toggle:hover {
    background-color: var(--hover-color);
}

#theme-toggle svg {
    transition: transform var(--transition-duration) ease;
    stroke: var(--text-color);
}

#theme-toggle:hover svg {
    transform: rotate(30deg);
}

#theme-toggle path,
#theme-toggle circle,
#theme-toggle line {
    transition: opacity var(--transition-duration) ease,
        fill var(--transition-duration) ease,
        stroke var(--transition-duration) ease;
    stroke: var(--text-color);
}

#theme-toggle:hover circle {
    fill: var(--primary-color);
}

#theme-toggle:hover line {
    stroke: var(--primary-color);
}

/* 确保夜间模式下图标可见 */
[data-theme="dark"] #theme-toggle svg {
    stroke: var(--text-color);
}

[data-theme="dark"] #theme-toggle path,
[data-theme="dark"] #theme-toggle circle,
[data-theme="dark"] #theme-toggle line {
    stroke: var(--text-color);
}

/* 主题切换动画 */
.theme-switch-animation {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: transform var(--transition-duration) ease,
        opacity var(--transition-duration) ease;
}

.theme-switch-animation.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.theme-switch-animation svg {
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.5));
    transition: transform var(--transition-duration) ease;
}

.theme-switch-animation .moon-icon,
.theme-switch-animation .sun-icon {
    position: absolute;
    top: 0;
    left: 0;
}

.theme-switch-animation .moon-icon {
    display: block;
}

.theme-switch-animation .sun-icon {
    display: none;
}

[data-theme="dark"] .theme-switch-animation .moon-icon {
    display: none;
}

[data-theme="dark"] .theme-switch-animation .sun-icon {
    display: block;
}

/* 移除未使用的背景动效代码 */

/* 简化动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* 移除复杂的页面加载动画，直接显示内容 */
.hero,
.search-bar,
.software-grid {
    opacity: 1;
}

/* 简化的卡片悬停效果 */
.software-card {
    position: relative;
    overflow: hidden;
}

/* 头部导航 */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: var(--card-bg);
    box-shadow: 0 2px 8px var(--shadow-color);
    z-index: 1000;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--text-color);
}

.logo-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    background: transparent;
}

.logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.logo-text {
    font-size: 18px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.header-btn {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.header-btn:hover {
    background-color: var(--hover-color);
}

.nav-links {
    display: flex;
    gap: 24px;
    margin-right: 12px;
}

.nav-link {
    color: var(--text-color);
    text-decoration: none;
    font-size: 16px;
    transition: color 0.3s;
    padding: 8px;
    border-radius: 4px;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
    background-color: var(--hover-color);
}

/* 主要内容 */
.main {
    padding-top: 84px;
    min-height: calc(100vh - 200px);
}

.hero {
    text-align: center;
    padding: 48px 0;
}

.hero-title {
    font-size: 36px;
    font-weight: bold;
    margin-bottom: 16px;
}

.hero-subtitle {
    font-size: 18px;
    color: var(--text-color);
    opacity: 0.8;
}

/* 搜索栏 */
.search-bar {
    display: flex;
    max-width: 600px;
    margin: 0 auto 32px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: none;
    color: var(--text-color);
    font-size: 16px;
}

.search-input:focus {
    outline: none;
}

/* 确保夜间模式下搜索框文字可见 */
[data-theme="dark"] .search-input::placeholder {
    color: rgba(224, 224, 224, 0.6);
}

/* 清空搜索按钮 */
.clear-search-btn {
    background: none;
    border: none;
    color: var(--text-secondary-light);
    cursor: pointer;
    padding: 0 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s, color 0.3s;
    visibility: hidden;
}

.clear-search-btn.visible {
    opacity: 0.7;
    visibility: visible;
}

.clear-search-btn:hover {
    opacity: 1;
    color: var(--primary-color);
}

[data-theme="dark"] .clear-search-btn {
    color: var(--text-secondary-dark);
}

.search-btn {
    padding: 12px 24px;
    background: var(--primary-color);
    border: none;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s;
}

.search-btn:hover {
    background-color: var(--primary-color);
    opacity: 0.9;
}

/* 软件网格 - 优化响应式布局 */
.software-grid {
    display: grid;
    gap: 24px;
    margin-bottom: 32px;
}

/* 默认移动设备布局 - 1列 */
.software-grid {
    grid-template-columns: 1fr;
}

/* 平板设备布局 (768px to 1199px) - 2列 */
@media (min-width: 768px) and (max-width: 1199px) {
    .software-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 桌面设备布局 (1200px to 1600px) - 3列 */
@media (min-width: 1200px) and (max-width: 1600px) {
    .software-grid {
        grid-template-columns: repeat(3, 1fr);
        max-width: 1400px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* 超大桌面设备布局 (above 1600px) - 4列 */
@media (min-width: 1601px) {
    .software-grid {
        grid-template-columns: repeat(4, 1fr);
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
        gap: 20px;
    }
}

.software-card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 24px;
    transition: transform var(--transition-duration) ease,
        box-shadow var(--transition-duration) ease,
        background-color var(--transition-duration) ease;
    border: 1px solid transparent;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 280px;
}

/* 价格标签样式 */
.price-tag {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 6px 10px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    color: white;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    max-width: 60px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.price-tag.free {
    background: #4caf50;
}

.price-tag.paid {
    background: #f44336;
}

.price-tag.gradient {
    background: #2196f3;
    top: 12px;
    right: 12px;
    font-size: 12px;
    padding: 6px 10px;
}

/* 暗色模式下的价格标签 */
[data-theme="dark"] .price-tag {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .price-tag.free {
    background: #43a047;
}

[data-theme="dark"] .price-tag.paid {
    background: #e53935;
}

[data-theme="dark"] .price-tag.gradient {
    background: #1976d2;
}

.software-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px var(--shadow-color);
}

/* 夜间模式下的卡片样式优化 */
[data-theme="dark"] .software-card {
    border-color: var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .software-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.software-header {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-right: 70px;
}

.software-icon {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    overflow: hidden;
    margin-right: 16px;
    background: var(--hover-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.software-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.software-title {
    flex: 1;
    min-height: 50px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.software-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 6px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    overflow-wrap: break-word;
    min-height: 45px;
}

.software-version {
    font-size: 14px;
    color: var(--text-color);
    opacity: 0.6;
    margin-top: 4px;
    line-height: 1.2;
}

.software-description {
    color: var(--text-color);
    opacity: 0.8;
    margin-bottom: 16px;
    font-size: 15px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 45px;
    word-break: break-word;
}

.software-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    margin-top: auto;
}

.software-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 10px;
    height: 10px;
    background: var(--secondary-color);
    border-radius: 50%;
}

.status-dot.error {
    background: #f44336;
}

.status-text {
    font-size: 15px;
    color: var(--secondary-color);
}

.status-text.error {
    color: #f44336;
}

.software-size {
    font-size: 15px;
    color: var(--text-color);
    opacity: 0.6;
}

.software-card .download-btn,
.software-card .download-btn:hover,
.software-card .download-btn:focus,
.software-card .download-btn:active {
    text-decoration: none !important;
    color: white !important;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    background: var(--primary-color);
    color: white !important;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
    text-decoration: none !important;
    width: 100%;
    margin-top: 8px;
    font-size: 16px;
    font-weight: 500;
    min-height: 48px;
}

/* 移除图标间距，使用emoji图标 */

.download-btn:hover {
    background-color: var(--secondary-color);
    text-decoration: none !important;
    color: white !important;
}

/* 移除未使用的special-card样式 */

/* 透明纵向页脚 */
.footer-vertical {
    background: transparent;
    padding: 48px 0 24px;
    margin-top: 48px;
    position: relative;
    z-index: 10;
}

.footer-vertical-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 20px;
}

.footer-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 10px;
}

.footer-logo-img {
    width: 40px;
    height: 40px;
    margin-bottom: 10px;
}

.footer-logo h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.footer-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-info p {
    color: var(--text-color);
    opacity: 0.8;
    margin: 0;
    font-size: 14px;
}

/* 移除未使用的社交链接样式 */

.footer-copyright {
    margin-top: 10px;
}

.footer-copyright p {
    color: var(--text-color);
    opacity: 0.6;
    font-size: 12px;
}

/* 适配深色模式 */
[data-theme="dark"] .footer-vertical {
    background: transparent;
}

[data-theme="dark"] .footer-logo h3,
[data-theme="dark"] .footer-info p,
[data-theme="dark"] .social-link,
[data-theme="dark"] .footer-copyright p {
    color: var(--text-primary-dark);
}

/* 回到顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    background: var(--primary-color);
    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: opacity 0.3s, visibility 0.3s, transform 0.3s, background-color 0.3s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 900;
}

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

.back-to-top:hover {
    background: var(--secondary-color);
}

/* 响应式设计 - 优化版 */
@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }

    .hero {
        padding: 32px 0;
    }

    .hero-title {
        font-size: 24px;
        margin-bottom: 12px;
    }

    .hero-subtitle {
        font-size: 14px;
    }

    .search-bar {
        margin-bottom: 24px;
    }

    .search-input {
        padding: 10px 12px;
        font-size: 14px;
    }

    .search-btn {
        padding: 10px 16px;
    }

    .software-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .software-card {
        padding: 16px;
        min-height: 230px;
    }

    .software-icon {
        width: 56px;
        height: 56px;
        margin-right: 12px;
    }

    .software-name {
        font-size: 16px;
    }

    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        width: 100%;
        background: var(--card-bg);
        flex-direction: column;
        padding: 16px;
        box-shadow: 0 4px 8px var(--shadow-color);
        opacity: 0;
        transition: opacity 0.3s ease;
        z-index: 1000;
        border-top: 1px solid var(--border-color);
    }

    .nav-link {
        padding: 12px 16px;
        width: 100%;
        text-align: center;
        border-bottom: 1px solid var(--border-color);
        border-radius: 4px;
        margin-bottom: 4px;
    }

    .nav-link:last-child {
        border-bottom: none;
        margin-bottom: 0;
    }

    .mobile-menu-btn {
        display: block;
    }

    .hero-title {
        font-size: 28px;
    }

    .hero-subtitle {
        font-size: 16px;
    }

    .software-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .footer-vertical {
        padding: 32px 0 20px;
    }

    .footer-info p {
        font-size: 13px;
    }
}

/* 中等手机和小平板横屏优化 */
@media (min-width: 600px) and (max-width: 768px) {
    .software-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
    }

    .software-card {
        min-height: 220px;
    }
}

@media (min-width: 769px) {
    .mobile-menu-btn {
        display: none;
    }
}

/* 平板设备优化 - 确保在中等屏幕上也有良好的布局 */
@media (min-width: 769px) and (max-width: 1023px) {
    .software-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
        max-width: 800px;
        margin: 0 auto 32px;
    }

    .software-card {
        min-height: 240px;
    }

    .software-name {
        font-size: 16px;
        min-height: 39px;
    }

    .software-description {
        font-size: 14px;
        min-height: 39px;
    }
}

/* 小平板设备特殊优化 */
@media (min-width: 769px) and (max-width: 900px) {
    .software-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        max-width: 720px;
    }
}

/* 大平板设备优化（如iPad Pro横屏） */
@media (min-width: 901px) and (max-width: 1200px) {
    .software-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
        max-width: 960px;
        margin: 0 auto 32px;
    }

    .software-card {
        min-height: 250px;
    }
}

/* 中等PC屏幕优化 */
@media (min-width: 1200px) and (max-width: 1599px) {
    .software-grid {
        grid-template-columns: repeat(3, 1fr);
        max-width: 1280px;
        margin: 0 auto 32px;
        gap: 24px;
    }
}

/* 确保PC端在足够宽度时显示4列 */
@media (min-width: 1601px) {
    .software-grid {
        grid-template-columns: repeat(4, 1fr);
        max-width: 100%;
        margin: 0 auto 24px;
        gap: 20px;
    }

    .software-card {
        padding: 20px;
        min-height: 260px;
    }

    .software-name {
        -webkit-line-clamp: 1;
        white-space: nowrap;
        min-height: auto;
        font-size: 16px;
    }

    .software-header {
        padding-right: 70px;
    }
}

/* 高分辨率屏幕优化 */
@media (min-width: 1601px) {
    .software-grid {
        grid-template-columns: repeat(4, 1fr);
        max-width: 100%;
        gap: 20px;
    }

    .software-card {
        padding: 20px;
        min-height: 260px;
    }

    .software-name {
        -webkit-line-clamp: 1;
        white-space: nowrap;
        min-height: auto;
        font-size: 16px;
    }

    .software-header {
        padding-right: 70px;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .software-card:hover {
        transform: none;
    }

    .software-card:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }

    .download-btn {
        padding: 12px 16px;
        font-size: 16px;
    }

    .header-btn {
        padding: 12px;
    }
}