/* 基础重置和变量 */
:root {
    /* 浅色模式变量 */
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #f59e0b;
    --accent-color: #10b981;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.12);
    --border-radius: 12px;
    --transition: all 0.3s ease;
    --border-color: #e5e7eb;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    
    /* 移动端字体大小调整 */
    --font-size-xs: 0.75rem;   /* 12px */
    --font-size-sm: 0.875rem;  /* 14px */
    --font-size-base: 1rem;    /* 16px */
    --font-size-lg: 1.125rem;  /* 18px */
    --font-size-xl: 1.25rem;   /* 20px */
    --font-size-2xl: 1.5rem;   /* 24px */
}

/* 深色模式变量 */
[data-theme="dark"] {
    --primary-color: #818cf8;
    --primary-dark: #6366f1;
    --secondary-color: #fbbf24;
    --accent-color: #34d399;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --bg-light: #111827;
    --bg-white: #1f2937;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
    --border-color: #374151;
    --success-color: #34d399;
    --warning-color: #fbbf24;
    --error-color: #f87171;
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
    /* 改善字体渲染 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-light);
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    /* 改善触摸体验 */
    -webkit-tap-highlight-color: transparent;
}

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

/* 移动端优先的容器调整 */
@media (max-width: 768px) {
    .container {
        padding: 0 12px;
    }
    
    /* 移动端字体调整 */
    html {
        font-size: 14px;
    }
}

/* 导航栏样式 - 完全响应式 */
.header {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    z-index: 1000;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    transition: var(--transition);
}

.navbar {
    padding: 0.75rem 0;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--primary-color);
    z-index: 1001;
}

.logo-icon {
    font-size: var(--font-size-xl);
}

/* 汉堡菜单 */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.menu-toggle span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--text-primary);
    border-radius: 2px;
    transition: var(--transition);
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 1rem;
    align-items: center;
    transition: var(--transition);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
    white-space: nowrap;
    min-height: 44px; /* 移动端最小触摸目标 */
    font-size: var(--font-size-sm);
}

.nav-link:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
}

/* 移动端导航菜单样式 */
@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }
    
    .nav-menu {
        position: fixed;
        top: 100%;
        left: 0;
        width: 100%;
        background: white;
        flex-direction: column;
        padding: 1rem 0;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        gap: 0;
        max-height: calc(100vh - 100%);
        overflow-y: auto;
    }
    
    .nav-menu.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    
    .nav-item {
        width: 100%;
        text-align: center;
    }
    
    .nav-link {
        padding: 1rem 1.5rem;
        justify-content: center;
        border-radius: 0;
        width: 100%;
        font-size: var(--font-size-base);
    }
    
    .nav-link:hover {
        background: var(--primary-color);
        color: white;
        transform: none;
    }
    
    .nav-brand {
        font-size: var(--font-size-base);
    }
}

/* 英雄区域 */
.hero {
    position: relative;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 120px 0 60px;
    margin-top: 70px;
    overflow: hidden;
    min-height: 50vh;
    display: flex;
    align-items: center;
}

.hero-content {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.hero-title {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.3;
    background: linear-gradient(45deg, #fff, #e0e7ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: clamp(0.9rem, 3vw, 1.1rem);
    margin-bottom: 2rem;
    opacity: 0.9;
    line-height: 1.5;
    padding: 0 1rem;
    font-weight: 400;
}

.hero-search {
    max-width: 800px; /* 搜索框加宽 */
    margin: 0 auto;
    width: 100%;
}

.search-box {
    display: flex;
    background: white;
    border-radius: 50px;
    padding: 0.5rem;
    box-shadow: var(--shadow-lg);
    flex-wrap: wrap;
}

.search-icon {
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: var(--font-size-base);
    padding: 0.75rem 0.5rem;
    min-width: 0;
    background: transparent;
    width: 400px; /* 搜索输入框加宽 */
}

.search-select {
    border: none;
    outline: none;
    background: transparent;
    margin-right: 0.5rem;
    cursor: pointer;
    min-width: 120px; /* 选择框加宽 */
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

.search-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    padding: 0.75rem 1.5rem; /* 按钮加宽 */
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--font-size-sm);
    min-height: 44px;
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.search-btn-text {
    display: inline;
}

/* 移动端搜索框优化 */
@media (max-width: 768px) {
    .hero {
        padding: 100px 0 40px;
        min-height: 60vh;
        margin-top: 60px;
    }
    
    .search-box {
        flex-direction: column;
        border-radius: var(--border-radius);
        padding: 0.75rem;
        gap: 0.5rem;
    }
    
    .search-input {
        padding: 0.875rem;
        border: 1px solid #e5e7eb;
        border-radius: var(--border-radius);
        font-size: 16px; /* 防止iOS缩放 */
        width: 100%; /* 移动端恢复100%宽度 */
    }
    
    .search-select {
        padding: 0.875rem;
        border: 1px solid #e5e7eb;
        border-radius: var(--border-radius);
        margin-right: 0;
        font-size: 16px;
        width: 100%;
    }
    
    .search-btn {
        border-radius: var(--border-radius);
        padding: 0.875rem;
        justify-content: center;
        font-size: var(--font-size-base);
        width: 100%;
    }
    
    .search-icon {
        display: none;
    }
    
    .search-btn-text {
        display: inline;
    }
    
    .hero-title {
        font-size: 1.5rem;
        margin-bottom: 0.75rem;
    }
    
    .hero-subtitle {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 90px 0 30px;
        min-height: 55vh;
    }
    
    .search-btn-text {
        display: none;
    }
    
    .search-btn {
        padding: 0.875rem;
    }
}

.hero-wave {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    overflow: hidden;
    line-height: 0;
}

.hero-wave svg {
    position: relative;
    display: block;
    width: calc(100% + 1.3px);
    height: 60px;
}

.shape-fill {
    fill: var(--bg-light);
}

/* 主要内容区域 */
.main-content {
    padding: 2rem 0;
}

.category-section {
    margin-bottom: 2.5rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: clamp(1.25rem, 4vw, 1.75rem);
    font-weight: 700;
    color: var(--text-primary);
}

.section-title i {
    color: var(--primary-color);
    font-size: clamp(1.5rem, 4vw, 2rem);
}

.view-all-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.625rem 1.25rem;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
    min-height: 44px;
    font-size: var(--font-size-sm);
}

.view-all-btn:hover {
    background: var(--primary-dark);
    transform: translateX(3px);
}

/* 资源网格 */
.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}

/* 平板端调整 */
@media (max-width: 1024px) and (min-width: 769px) {
    .resources-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 移动端调整 */
@media (max-width: 768px) {
    .main-content {
        padding: 1.5rem 0;
    }
    
    .category-section {
        margin-bottom: 2rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 1rem;
    }
    
    .view-all-btn {
        align-self: flex-start;
    }
    
    .resources-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .section-title {
        font-size: 1.375rem;
    }
}

/* 小屏手机优化 */
@media (max-width: 480px) {
    .resources-grid {
        gap: 0.875rem;
    }
}

.resource-card {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
}

.resource-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.card-image {
    position: relative;
    height: 180px;
    overflow: hidden;
}

.image-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
}

.resource-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
    display: block;
}

.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.resource-card:hover .card-overlay {
    opacity: 1;
}

.action-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.action-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    font-size: 1rem;
    transition: var(--transition);
    transform: translateY(15px);
    min-width: 44px;
    min-height: 44px;
}

.resource-card:hover .action-btn {
    transform: translateY(0);
}

.action-btn.download {
    background: var(--secondary-color);
}

.action-btn:hover {
    transform: scale(1.05);
}

.card-content {
    padding: 1.125rem;
}

.card-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    margin-bottom: 0.375rem;
    color: var(--text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-description {
    color: var(--text-secondary);
    margin-bottom: 0.875rem;
    font-size: var(--font-size-sm);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 0.875rem;
    opacity: 0.5;
}

.empty-state h3 {
    margin-bottom: 0.375rem;
    color: var(--text-primary);
    font-size: var(--font-size-lg);
}

/* 移动端卡片优化 */
@media (max-width: 768px) {
    .card-image {
        height: 160px;
    }
    
    .card-content {
        padding: 1rem;
    }
    
    .card-title {
        font-size: var(--font-size-sm);
        margin-bottom: 0.25rem;
    }
    
    .card-description {
        font-size: var(--font-size-xs);
        margin-bottom: 0.75rem;
    }
    
    .action-btn {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
        min-width: 40px;
        min-height: 40px;
    }
    
    .empty-state {
        padding: 2rem 1rem;
    }
    
    .empty-state i {
        font-size: 2rem;
    }
}

/* 页脚 */
.footer {
    background: linear-gradient(135deg, #1f2937, #111827);
    color: white;
    padding: 2.5rem 0 1.25rem;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--font-size-lg);
    font-weight: 700;
    margin-bottom: 0.875rem;
    color: var(--primary-color);
}

.footer-description {
    color: #9ca3af;
    margin-bottom: 1.25rem;
    line-height: 1.6;
    font-size: var(--font-size-sm);
}

.social-links {
    display: flex;
    gap: 0.5rem;
}

.social-link {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.875rem;
    min-width: 36px;
    min-height: 36px;
}

.social-link:hover {
    background: var(--primary-color);
    transform: translateY(-2px);
}

.footer-section h3 {
    font-size: var(--font-size-base);
    margin-bottom: 1rem;
    color: white;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.375rem;
}

.footer-links a {
    color: #9ca3af;
    text-decoration: none;
    transition: var(--transition);
    font-size: var(--font-size-sm);
    cursor: pointer;
}

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

.contact-info p {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: #9ca3af;
    font-size: var(--font-size-sm);
}

.footer-bottom {
    border-top: 1px solid #374151;
    padding-top: 1.25rem;
    text-align: center;
    color: #9ca3af;
    font-size: var(--font-size-xs);
}

.footer-bottom p {
    margin-bottom: 0.375rem;
}

/* 页脚响应式布局 */
@media (max-width: 1024px) {
    .footer-content {
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .footer {
        padding: 2rem 0 1rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        text-align: center;
    }
    
    .footer-brand {
        justify-content: center;
    }
    
    .social-links {
        justify-content: center;
    }
    
    .footer-section h3 {
        text-align: center;
    }
    
    .contact-info p {
        justify-content: center;
    }
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    width: 44px;
    height: 44px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    min-width: 44px;
    min-height: 44px;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* 移动端返回顶部按钮位置调整 */
@media (max-width: 768px) {
    .back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
        font-size: 0.875rem;
        min-width: 40px;
        min-height: 40px;
    }
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6b7280;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: #ef4444;
    color: white;
}

.modal-body {
    padding: 2rem;
}

/* 帮助内容样式 */
.help-content h4 {
    color: #1f2937;
    margin: 1.5rem 0 0.75rem;
    font-size: 1.1rem;
}

.help-content h4:first-child {
    margin-top: 0;
}

.help-content ol, .help-content ul {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.help-content li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

/* 常见问题样式 */
.faq-item {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.faq-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.faq-item h4 {
    color: #1f2937;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.faq-item p {
    color: #6b7280;
    line-height: 1.6;
    margin: 0;
}

/* 隐私政策样式 */
.privacy-content h4 {
    color: #1f2937;
    margin: 1.5rem 0 0.75rem;
    font-size: 1.1rem;
}

.privacy-content h4:first-child {
    margin-top: 0;
}

.privacy-content p {
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.update-time {
    font-size: 0.875rem;
    color: #9ca3af;
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .resource-card:hover {
        transform: none;
    }
    
    .nav-link:hover {
        transform: none;
    }
    
    .action-btn:hover {
        transform: none;
    }
    
    .search-btn:hover {
        transform: none;
    }
    
    .view-all-btn:hover {
        transform: none;
    }
    
    .btn:hover {
        transform: none;
    }
    
    .social-link:hover {
        transform: none;
    }
    
    .back-to-top:hover {
        transform: none;
    }
    
    /* 为触摸设备添加点击反馈 */
    .resource-card:active {
        transform: scale(0.98);
    }
    
    .nav-link:active {
        background: var(--primary-color);
        color: white;
    }
    
    .action-btn:active {
        transform: scale(0.95);
    }
}

/* 高分辨率屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .hero {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }
}

/* 减少动画（对于偏好减少动画的用户） */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .resource-card:hover {
        transform: none;
    }
}