/* ========================================
   下载资源站 - 样式表
   
   【配色自定义说明】
   修改以下CSS变量可以自定义网站配色：
   --primary: 主色调（按钮、高亮）
   --primary-light: 主色浅色版
   --bg-main: 页面背景色
   --bg-card: 卡片背景色
   ======================================== */

/* ========================================
   CSS 变量 - 配色方案
   ======================================== */
:root {
    /* 主色调 */
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #818cf8;
    --gradient-start: #4f46e5;
    --gradient-end: #9333ea;
    
    /* 背景色 */
    --bg-main: #f9fafb;
    --bg-card: #ffffff;
    --bg-hover: #f3f4f6;
    
    /* 文字颜色 */
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    
    /* 边框颜色 */
    --border-color: #e5e7eb;
    --border-hover: #d1d5db;
    
    /* 阴影 */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    /* 圆角 */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    
    /* 过渡 */
    --transition: all 0.2s ease;
}

/* 深色模式变量 */
[data-theme="dark"] {
    --bg-main: #111827;
    --bg-card: #1f2937;
    --bg-hover: #374151;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
    --border-color: #374151;
    --border-hover: #4b5563;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

/* ========================================
   基础样式重置
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
}

/* ========================================
   Header - 顶部导航栏
   ======================================== */
.header {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background-color: var(--bg-card);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: var(--transition);
}

.theme-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ========================================
   Category Bar - 分类导航栏
   ======================================== */
.category-bar {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
}

.category-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.category-tabs {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    flex: 1;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.category-tabs::-webkit-scrollbar {
    display: none;
}

.category-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    white-space: nowrap;
    transition: var(--transition);
}

.category-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.category-tab.active {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.category-tab i {
    font-size: 0.9rem;
}

/* 搜索框 */
.search-box {
    position: relative;
    min-width: 220px;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.search-input {
    width: 100%;
    padding: 0.625rem 1rem 0.625rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    background-color: var(--bg-main);
    color: var(--text-primary);
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.search-input::placeholder {
    color: var(--text-muted);
}

/* ========================================
   Main Content - 主内容区
   ======================================== */
.main-content {
    flex: 1;
    padding: 2rem 0;
}

.content-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* 资源卡片网格 */
.resource-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

/* 无结果提示 */
.no-results {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.no-results i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-results p {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

/* ========================================
   Resource Card - 资源卡片
   ======================================== */
.resource-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.resource-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

/* 卡片头部 */
.card-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.card-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    object-fit: cover;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.card-icon img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-md);
    object-fit: cover;
}

.card-title-section {
    flex: 1;
    min-width: 0;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-category-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    background-color: var(--bg-main);
    border-radius: 9999px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* 卡片描述 */
.card-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

/* 卡片信息栏 */
.card-info {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.info-badge {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.info-badge i {
    font-size: 0.7rem;
}

/* 卡片标签区 */
.card-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.tag {
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 500;
}

.tag-github {
    background-color: #24292e;
    color: white;
}

.tag-free {
    background-color: #10b981;
    color: white;
}

.tag-new {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
}

.tag-hot {
    background-color: #ef4444;
    color: white;
}

/* 卡片操作区 */
.card-actions {
    display: flex;
    gap: 0.5rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
}

.btn-primary {
    flex: 1;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: scale(0.98);
}

.btn-primary:active {
    transform: scale(0.95);
}

.btn-secondary {
    width: 40px;
    height: 40px;
    padding: 0;
    background-color: var(--bg-main);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ========================================
   Modal - 详情弹窗
   ======================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 1rem;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--bg-card);
    border-radius: var(--radius-xl);
    max-width: 640px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--bg-main);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 10;
}

.modal-close:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-icon {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-lg);
    object-fit: cover;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
}

.modal-title-section {
    flex: 1;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.modal-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.modal-body {
    padding: 1.5rem;
}

.modal-info {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.modal-info .info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.modal-info .info-item i {
    color: var(--primary);
}

.modal-section {
    margin-bottom: 1.5rem;
}

.modal-section h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.modal-section h3 i {
    color: var(--primary);
    font-size: 0.9rem;
}

.modal-section p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.changelog-list {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.changelog-list li {
    padding: 0.375rem 0;
    padding-left: 1rem;
    position: relative;
}

.changelog-list li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--primary);
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.btn-download-modal {
    width: 100%;
    padding: 0.875rem;
    font-size: 1rem;
}

/* ========================================
   Footer - 底部区域
   ======================================== */
.footer {
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: auto;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.footer-content {
    text-align: center;
}

.copyright {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.disclaimer {
    font-size: 0.75rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

/* ========================================
   Toast - 提示框
   ======================================== */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
    padding: 0.875rem 1.5rem;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1100;
}

.toast.active {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
}

/* ========================================
   响应式适配
   ======================================== */

/* 平板端 (768px - 1023px) */
@media (max-width: 1023px) {
    .resource-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .header-container {
        padding: 0.875rem 1rem;
    }
    
    .category-container {
        padding: 0 1rem;
    }
    
    .content-container {
        padding: 0 1rem;
    }
}

/* 移动端 (< 768px) */
@media (max-width: 767px) {
    .resource-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .logo-text {
        font-size: 1.25rem;
    }
    
    .logo-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    .category-container {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .category-tabs {
        order: 2;
        padding-bottom: 0.5rem;
    }
    
    .search-box {
        order: 1;
        min-width: 100%;
    }
    
    .main-content {
        padding: 1rem 0;
    }
    
    .card-info {
        gap: 0.75rem;
    }
    
    .modal-header {
        flex-direction: column;
        text-align: center;
    }
    
    .modal-info {
        justify-content: center;
    }
    
    .modal-tags {
        justify-content: center;
    }
}

/* 超小屏幕 (< 375px) */
@media (max-width: 374px) {
    .header-container,
    .category-container,
    .content-container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .resource-card {
        padding: 1rem;
    }
    
    .card-header {
        gap: 0.75rem;
    }
    
    .card-icon {
        width: 48px;
        height: 48px;
    }
}

/* 大屏幕适配 */
@media (min-width: 1920px) {
    .content-container,
    .header-container,
    .category-container,
    .footer-container {
        max-width: 1600px;
    }
    
    .resource-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* ========================================
   图片懒加载占位样式
   ======================================== */
.lazy-image {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lazy-image.loaded {
    opacity: 1;
}

/* ========================================
   滚动条美化
   ======================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ========================================
   动画效果
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.resource-card {
    animation: fadeIn 0.4s ease forwards;
}

.resource-card:nth-child(1) { animation-delay: 0.05s; }
.resource-card:nth-child(2) { animation-delay: 0.1s; }
.resource-card:nth-child(3) { animation-delay: 0.15s; }
.resource-card:nth-child(4) { animation-delay: 0.2s; }
.resource-card:nth-child(5) { animation-delay: 0.25s; }
.resource-card:nth-child(6) { animation-delay: 0.3s; }
.resource-card:nth-child(7) { animation-delay: 0.35s; }
.resource-card:nth-child(8) { animation-delay: 0.4s; }
