/* ===========================================
   HUB 应用中心 - 清爽科技风
   =========================================== */

/* CSS 变量 - 科技主题 */
:root {
    /* 主色调 - 清爽蓝色 */
    --primary-color: #3b82f6;           /* 亮蓝色 */
    --primary-dark: #2563eb;            /* 深蓝色 */
    --primary-light: #60a5fa;           /* 浅蓝色 */
    --secondary-color: #0ea5e9;         /* 天蓝色 */
    --accent-color: #06b6d4;            /* 青色 */

    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;

    /* 背景色 - 清爽干净 */
    --bg-color: #f8fafc;                /* 浅灰蓝 */
    --bg-alt: #ffffff;                  /* 纯白 */
    --surface-color: #ffffff;
    --surface-hover: #f1f5f9;

    /* 文字颜色 */
    --text-primary: #0f172a;            /* 深蓝黑 */
    --text-secondary: #475569;          /* 中灰 */
    --text-light: #94a3b8;              /* 浅灰 */

    /* 边框和分割线 */
    --border-color: #e2e8f0;
    --divider-color: #cbd5e1;

    /* 阴影 - 轻盈通透 */
    --shadow-sm: 0 1px 2px 0 rgba(59, 130, 246, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(59, 130, 246, 0.08), 0 2px 4px -1px rgba(59, 130, 246, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(59, 130, 246, 0.08), 0 4px 6px -2px rgba(59, 130, 246, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(59, 130, 246, 0.08), 0 8px 10px -6px rgba(59, 130, 246, 0.04);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15);

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

    /* 过渡 */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 全局重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ===========================================
   顶部导航 - 科技感
   =========================================== */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 56px 0;
    position: relative;
    overflow: hidden;
}

/* 科技感背景装饰 */
.header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.header::after {
    content: '';
    position: absolute;
    bottom: -40%;
    left: -5%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.header-content {
    text-align: center;
    position: relative;
    z-index: 1;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.logo-icon {
    font-size: 3.2rem;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    font-weight: 400;
    letter-spacing: 0.5px;
}

/* ===========================================
   搜索和筛选区域
   =========================================== */
.search-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    padding: 28px 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
}

.search-box {
    display: flex;
    gap: 12px;
    max-width: 640px;
    margin: 0 auto 24px;
}

.search-input {
    flex: 1;
    padding: 14px 20px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
    background: var(--surface-color);
    color: var(--text-primary);
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-input::placeholder {
    color: var(--text-light);
}

.search-button {
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    font-weight: 600;
    font-size: 0.95rem;
}

.search-button:hover {
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.search-button:active {
    transform: translateY(0);
}

/* 分类筛选按钮 */
.category-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.filter-btn {
    padding: 10px 16px;
    background: var(--surface-color);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--surface-hover);
}

.filter-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-color: transparent;
    color: white;
    box-shadow: var(--shadow-sm);
}

.filter-icon {
    font-size: 1.1rem;
}

.filter-btn .count {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.filter-btn:not(.active) .count {
    background: var(--bg-color);
    color: var(--text-light);
}

/* ===========================================
   主内容区域
   =========================================== */
.main-content {
    padding: 40px 0 60px;
}

/* 统计栏 */
.stats-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    padding: 16px 20px;
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

#resultCount {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
}

.view-toggle {
    display: flex;
    gap: 6px;
    background: var(--bg-color);
    padding: 4px;
    border-radius: var(--radius-md);
}

.view-btn {
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-btn:hover {
    background: rgba(59, 130, 246, 0.08);
    color: var(--primary-color);
}

.view-btn.active {
    background: var(--surface-color);
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

/* ===========================================
   应用卡片网格
   =========================================== */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.apps-grid.list-view {
    grid-template-columns: 1fr;
}

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

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

.app-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}

/* 应用图标 */
.app-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
    font-weight: 700;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.app-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-md);
}

.app-icon.initial {
    font-size: 1.6rem;
    text-transform: uppercase;
}

.app-category {
    padding: 5px 12px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(139, 92, 246, 0.08));
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    color: var(--primary-color);
    font-weight: 600;
    border: 1px solid rgba(59, 130, 246, 0.15);
}

.app-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.4;
}

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

.app-meta {
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-light);
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
}

.app-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* 列表视图样式 */
.apps-grid.list-view .app-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 20px;
    align-items: center;
}

.apps-grid.list-view .app-card-header {
    margin-bottom: 0;
}

.apps-grid.list-view .app-description {
    margin-bottom: 0;
    -webkit-line-clamp: 1;
    border-top: none;
    padding-top: 0;
}

.apps-grid.list-view .app-meta {
    border-top: none;
    padding-top: 0;
}

/* ===========================================
   空状态
   =========================================== */
.empty-state {
    text-align: center;
    padding: 80px 20px;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.4;
}

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

.empty-state p {
    color: var(--text-secondary);
}

/* ===========================================
   模态框
   =========================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    animation: fadeIn 0.15s ease;
}

.modal.active {
    display: block;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    max-width: 580px;
    margin: 80px auto;
    background: var(--surface-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.25s ease;
    overflow: hidden;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: var(--bg-color);
    border: none;
    border-radius: var(--radius-full);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    color: var(--text-secondary);
}

.modal-close:hover {
    background: var(--danger-color);
    color: white;
    transform: rotate(90deg);
}

.modal-body {
    padding: 40px;
}

/* ===========================================
   页脚
   =========================================== */
.footer {
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    padding: 32px 0;
    text-align: center;
    color: var(--text-secondary);
}

.footer p {
    font-size: 0.9rem;
}

.footer-links {
    margin-top: 12px;
}

.footer-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ===========================================
   动画
   =========================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

    .header {
        padding: 40px 0;
    }

    .logo {
        font-size: 2.2rem;
    }

    .logo-icon {
        font-size: 2.6rem;
    }

    .search-box {
        flex-direction: column;
        max-width: 100%;
    }

    .search-button {
        width: 100%;
    }

    .category-filters {
        gap: 6px;
    }

    .filter-btn {
        padding: 8px 14px;
        font-size: 0.85rem;
    }

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

    .stats-bar {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .modal-content {
        margin: 20px;
        max-width: calc(100% - 40px);
    }

    .modal-body {
        padding: 28px 20px;
    }

    .apps-grid.list-view .app-card {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .filter-btn span:not(.filter-icon):not(.count) {
        display: none;
    }

    .filter-btn .count {
        display: inline;
    }

    .app-card {
        padding: 20px;
    }

    .modal-body {
        padding: 24px 16px;
    }
}
