/* 全局样式 */
:root {
    --primary-color: #007aff;
    --primary-hover: #0051d5;
    --secondary-color: #5856d6;
    --success-color: #34c759;
    --warning-color: #ff9500;
    --danger-color: #ff3b30;
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f7;
    --bg-tertiary: #e8e8ed;
    --border-color: #d2d2d7;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --transition: all 0.3s 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', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部导航 */
.header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.8);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.nav {
    display: flex;
    gap: 30px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    transition: var(--transition);
    padding: 8px 0;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

/* 主内容 */
.main {
    flex: 1;
    padding: 40px 0;
}

/* Hero区域 */
.hero {
    text-align: center;
    padding: 60px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--radius-lg);
    margin-bottom: 60px;
    color: white;
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.25rem;
    opacity: 0.95;
    max-width: 600px;
    margin: 0 auto;
}

.hero-cta {
    margin-top: 28px;
    display: flex;
    justify-content: center;
}

.hero-pill {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    padding: 12px 24px;
    font-size: 0.95rem;
    letter-spacing: 0.03em;
}

/* Section标题 */
.section-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 30px;
    color: var(--text-primary);
}

.section-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* 应用网格 */
.apps-section {
    margin-bottom: 80px;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}

.search-field {
    position: relative;
    flex: 1 1 280px;
    min-width: 240px;
}

.search-field input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.search-field input::placeholder {
    color: var(--text-secondary);
}

.search-field input:focus {
    outline: none;
    border-color: rgba(0, 122, 255, 0.45);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.12);
}

.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.tag-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 24px;
}

.filter-placeholder {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.filter-chip {
    padding: 8px 16px;
    border-radius: 999px;
    background: var(--bg-primary);
    border: 1px solid rgba(0, 0, 0, 0.04);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.filter-chip:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.filter-chip.active {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-tertiary {
    background: var(--bg-primary);
    color: var(--primary-color);
    border: 1px solid rgba(0, 122, 255, 0.25);
}

.btn-tertiary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-tertiary:not(:disabled):hover {
    background: rgba(0, 122, 255, 0.08);
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    animation: fadeInUp 0.6s ease-out;
}

.empty-state {
    grid-column: 1 / -1;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: 48px 24px;
    text-align: center;
    border: 1px dashed var(--border-color);
    color: var(--text-secondary);
}

.empty-state h4 {
    font-size: 1.3rem;
    margin-bottom: 12px;
    color: var(--text-primary);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 应用卡片 */
.app-card {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: 24px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.app-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.app-card:focus-visible {
    outline: 3px solid rgba(0, 122, 255, 0.35);
    outline-offset: 4px;
}

.app-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    display: block;
}

.app-name {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.app-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 16px;
    line-height: 1.5;
}

.app-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    font-size: 0.85rem;
}

.app-version {
    background: var(--bg-secondary);
    border-radius: 999px;
    padding: 4px 10px;
    color: var(--text-secondary);
    font-weight: 600;
}

.app-badge {
    background: rgba(255, 149, 0, 0.15);
    color: var(--warning-color);
    border-radius: 999px;
    padding: 4px 10px;
    font-weight: 600;
}

.app-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.app-tag {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* 关于区域 */
.about-section {
    margin-bottom: 60px;
}

.about-content {
    background: var(--bg-primary);
    padding: 40px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.about-content p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 30px;
    margin-top: 40px;
    text-align: center;
}

.stat-item {
    padding: 20px;
}

.stat-number {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.stat-label {
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 底部 */
.footer {
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    padding: 30px 0;
    text-align: center;
    color: var(--text-secondary);
}

.footer p {
    margin: 8px 0;
}

.footer-link {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

.footer-link:hover {
    color: var(--primary-hover);
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 100%;
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-body {
    padding: 40px;
    text-align: center;
}

.modal-icon {
    font-size: 5rem;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.modal-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.6;
}

.modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 32px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* 按钮 */
.btn {
    padding: 12px 32px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 140px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .apps-grid {
        grid-template-columns: 1fr;
    }

    .header .container {
        flex-direction: column;
        gap: 16px;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-tertiary {
        width: 100%;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .modal-body {
        padding: 30px 20px;
    }

    .stats {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

@media (max-width: 480px) {
    .modal-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .hero {
        padding: 40px 20px;
    }
}
