/* 响应式软件下载站模板 - 主样式文件 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #007bff;
    --primary-dark: #0056b3;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-color);
    padding-bottom: 60px;
    min-height: 100vh;
}

/* ========== 顶部搜索栏 ========== */
.search-bar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    padding: 12px 16px;
}

.search-bar-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-input-wrapper {
    flex: 1;
    position: relative;
}

.search-input-wrapper input {
    width: 100%;
    padding: 12px 48px 12px 20px;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-size: 14px;
    transition: var(--transition);
    background: #f8f9fa;
}

.search-input-wrapper input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.search-input-wrapper .search-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

.search-btn {
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.search-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

/* ========== 轮播推荐区 ========== */
.hero-section {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 16px;
    display: flex;
    justify-content: center;
}

.carousel-container {
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    aspect-ratio: 16/9;
    max-height: 400px;
}

.carousel-track {
    display: flex;
    transition: transform 0.5s ease;
    height: 100%;
}

.carousel-item {
    min-width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    position: relative;
}

.carousel-content {
    text-align: center;
    color: #fff;
    z-index: 2;
}

.carousel-content h2 {
    font-size: 2.5rem;
    margin-bottom: 12px;
    font-weight: 700;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.carousel-content p {
    font-size: 1.1rem;
    opacity: 0.95;
    margin-bottom: 20px;
}

.carousel-content .cta-btn {
    display: inline-block;
    padding: 12px 32px;
    background: #fff;
    color: #667eea;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.carousel-content .cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.carousel-dots {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: var(--transition);
}

.carousel-dot.active {
    width: 24px;
    border-radius: 4px;
    background: #fff;
}

.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: var(--transition);
    z-index: 10;
}

.carousel-arrow:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.1);
}

.carousel-arrow.prev { left: 16px; }
.carousel-arrow.next { right: 16px; }

.swipe-hint {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    animation: swipeHint 2s infinite;
}

@keyframes swipeHint {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.swipe-hint svg {
    animation: swipeIcon 1.5s infinite;
}

@keyframes swipeIcon {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(10px); }
}

/* ========== 分类标签栏 ========== */
category-section {
    max-width: 1200px;
    margin: 24px auto;
    padding: 0 16px;
}

.category-tabs {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 4px;
    scrollbar-width: none;
    -webkit-scrollbar: none;
    justify-content: center;
    flex-wrap: wrap;
}

.category-tab {
    flex-shrink: 0;
    padding: 10px 24px;
    background: #fff;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.category-tab:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.category-tab.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

/* ========== 热门榜单 / 最新发布 ========== */
.content-section {
    max-width: 1200px;
    margin: 24px auto;
    padding: 0 16px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title .icon {
    font-size: 1.8rem;
}

.section-more {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.section-more:hover {
    color: var(--primary-dark);
}

/* 卡片网格布局 */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* 应用卡片 */
.app-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    border: 1px solid #f0f0f0;
}

.app-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), #667eea);
    opacity: 0;
    transition: var(--transition);
}

.app-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: #e9ecef;
}

.app-card:hover::before {
    opacity: 1;
}

.app-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}

.app-icon {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    object-fit: cover;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.app-card:hover .app-icon {
    transform: scale(1.05);
}

.app-info {
    flex: 1;
    min-width: 0;
}

.app-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-category {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.app-category-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.app-description {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.app-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
}

.app-stats {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-item svg {
    width: 14px;
    height: 14px;
    color: var(--text-secondary);
}

.download-btn {
    background: linear-gradient(135deg, var(--primary-color), #667eea);
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.download-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.download-btn svg {
    width: 14px;
    height: 14px;
}

/* 热门标签 */
.hot-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
}

/* ========== 底部导航栏 ========== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    padding: 8px 0 calc(env(safe-area-inset-bottom) + 8px);
    z-index: 1000;
}

.bottom-nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-around;
    padding: 0 16px;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    border-radius: 12px;
    transition: var(--transition);
    text-decoration: none;
    color: var(--text-secondary);
    position: relative;
}

.nav-item svg {
    width: 24px;
    height: 24px;
    transition: var(--transition);
}

.nav-item span {
    font-size: 11px;
    font-weight: 500;
}

.nav-item:hover {
    background: rgba(0, 123, 255, 0.08);
    color: var(--primary-color);
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-item.active svg {
    transform: translateY(-2px);
}

.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 2px;
}

/* ========== 页脚 ========== */
footer {
    text-align: center;
    background: transparent;
    color: var(--text-secondary);
    padding: 30px 16px 100px;
    margin-top: 40px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

.gitee-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    margin-bottom: 12px;
}

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

.gitee-logo {
    width: 24px;
    height: 24px;
}

/* ========== 分页 ========== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
    flex-wrap: wrap;
}

.pagination a {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.pagination a:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.pagination a.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

/* ========== 加载动画 ========== */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e9ecef;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ========== 响应式设计 ========== */

/* 平板设备 */
@media (max-width: 768px) {
    .carousel-container {
        aspect-ratio: 3/2;
        max-height: 300px;
    }

    .carousel-content h2 {
        font-size: 1.8rem;
    }

    .carousel-content p {
        font-size: 0.95rem;
    }

    .app-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 12px;
    }

    .section-title {
        font-size: 1.3rem;
    }

    .search-btn {
        padding: 12px 20px;
    }
}

/* 手机设备 */
@media (max-width: 480px) {
    .search-bar {
        padding: 10px 12px;
    }

    .search-input-wrapper input {
        padding: 10px 44px 10px 16px;
        font-size: 13px;
    }

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

    .carousel-container {
        aspect-ratio: 4/3;
        max-height: 220px;
    }

    .carousel-content h2 {
        font-size: 1.4rem;
    }

    .carousel-content p {
        font-size: 0.85rem;
    }

    .carousel-arrow {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .category-tabs {
        gap: 8px;
    }

    .category-tab {
        padding: 8px 18px;
        font-size: 13px;
    }

    .app-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 10px;
    }

    .app-card {
        padding: 12px;
    }

    .app-icon {
        width: 52px;
        height: 52px;
    }

    .app-title {
        font-size: 14px;
    }

    .app-description {
        font-size: 12px;
        -webkit-line-clamp: 2;
    }

    .app-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .download-btn {
        width: 100%;
        justify-content: center;
        padding: 8px 16px;
    }

    .bottom-nav {
        padding: 6px 0 calc(env(safe-area-inset-bottom) + 6px);
    }

    .nav-item {
        padding: 6px 12px;
    }

    .nav-item svg {
        width: 22px;
        height: 22px;
    }

    .nav-item span {
        font-size: 10px;
    }
}

/* 大屏幕优化 */
@media (min-width: 1440px) {
    .app-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 20px;
    }

    .carousel-container {
        max-height: 450px;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a1a1a;
        --card-bg: #2d2d2d;
        --text-primary: #f0f0f0;
        --text-secondary: #a0a0a0;
    }

    .search-bar {
        background: rgba(45, 45, 45, 0.95);
    }

    .search-input-wrapper input {
        background: #1a1a1a;
        border-color: #404040;
        color: var(--text-primary);
    }

    .category-tab {
        background: #2d2d2d;
        border-color: #404040;
        color: var(--text-secondary);
    }

    .app-card {
        background: var(--card-bg);
        border-color: #404040;
    }

    .bottom-nav {
        background: rgba(45, 45, 45, 0.98);
    }
}
