/* =============== 基础样式重置 =============== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    /* 简化背景：纯色渐变 */
    background: linear-gradient(135deg, #667eea, #764ba2);
    background-attachment: fixed;
    overflow-x: hidden;
}

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

/* =============== 导航栏 =============== */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    transition: all 0.3s ease;
}

.navbar.scrolled {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.15);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #333;
    font-weight: 700;
    font-size: 1.4rem;
}

.nav-icon {
    font-size: 1.8rem;
    color: #667eea;
}

.nav-menu {
    display: flex;
    gap: 2rem;
    list-style: none;
    align-items: center;
}

/* =============== 语言切换器样式 =============== */
.language-switcher {
    margin-left: 1rem;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 8px 12px;
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 20px;
    color: #667eea;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.lang-btn:hover {
    background: rgba(102, 126, 234, 0.15);
    border-color: rgba(102, 126, 234, 0.3);
    transform: translateY(-1px);
}

.lang-btn:active {
    transform: translateY(0);
}

.lang-btn i {
    font-size: 1rem;
}

.lang-btn span {
    font-weight: 600;
    letter-spacing: 0.5px;
}

.nav-link {
    color: #333;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.nav-link:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

/* =============== 主页区域 =============== */
.hero {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding-top: 70px;
    color: white;
}

.hero-container {
    max-width: 800px;
    padding: 0 20px;
}

.hero-icon {
    margin-bottom: 2rem;
}

.hero-icon i {
    font-size: 5rem;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.hero p {
    font-size: 1.3rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 2rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    font-weight: 300;
}

/* =============== 应用展示区域 =============== */
.apps-section {
    padding: 80px 0;
    background: rgba(255, 255, 255, 0.95);
    min-height: 100vh;
}

.apps-section h2 {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 3rem;
    position: relative;
}

.apps-section h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 2px;
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

/* =============== 应用卡片样式 =============== */
.app-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    height: 520px; /* 固定卡片高度 */
    min-height: 520px;
    position: relative;
    cursor: pointer; /* 添加点击指针 */
}

.app-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(45deg, #667eea, #764ba2);
}

.app-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* 卡片内容区域分配 */
.app-card-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 0;
}

.app-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-shrink: 0; /* 不允许头部压缩 */
    height: 80px; /* 固定头部高度 */
}

.app-icon {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.8rem;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.app-icon img {
    width: 100%;
    height: 100%;
    border-radius: 15px;
    object-fit: cover;
}

.app-info h3 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 0.3rem;
}

.app-info .subtitle {
    color: #666;
    font-size: 0.9rem;
    font-weight: 400;
}

.app-description {
    color: #555;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    flex-grow: 0; /* 不允许描述区域自动扩展 */
    height: 60px; /* 固定描述区域高度 */
    overflow: hidden; /* 超出部分隐藏 */
    display: -webkit-box;
    -webkit-line-clamp: 3; /* 最多显示3行 */
    line-clamp: 3; /* 标准属性兼容性 */
    -webkit-box-orient: vertical;
    text-overflow: ellipsis; /* 超出显示省略号 */
}

/* =============== 应用截图样式 =============== */
.app-screenshots {
    margin-bottom: 1.5rem;
    flex-grow: 1; /* 允许截图区域填充剩余空间 */
    display: flex;
    flex-direction: column;
    justify-content: center; /* 截图垂直居中 */
    min-height: 180px; /* 截图区域最小高度 */
    max-height: 200px; /* 截图区域最大高度 */
}

.screenshots-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem;
    margin-bottom: 1rem;
    align-items: start;
}

.screenshot-item {
    position: relative;
    width: 100%;
    height: 160px; /* 固定高度确保一致性 */
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.screenshot-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.screenshot-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
}

.screenshot-item:hover img {
    transform: scale(1.05);
}

.screenshot-placeholder {
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
    color: #6c757d;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.screenshot-placeholder::before {
    content: '📱';
    font-size: 1.5rem;
    opacity: 0.6;
}

.app-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center; /* 确保按钮垂直居中对齐 */
    flex-wrap: wrap; /* 允许按钮换行 */
    margin-top: 0; /* 取消自动推到底部 */
    height: 60px; /* 固定按钮区域高度 */
    flex-shrink: 0; /* 不允许按钮区域压缩 */
    padding: 0; /* 去除额外内边距 */
}

/* =============== 按钮样式 =============== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px; /* 增加内边距确保一致高度 */
    border: none;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    min-width: 130px; /* 稍微增加最小宽度 */
    height: 44px; /* 固定按钮高度确保一致性 */
    justify-content: center;
    box-sizing: border-box; /* 确保边框和内边距计算正确 */
    white-space: nowrap; /* 防止文字换行 */
    vertical-align: middle; /* 垂直对齐 */
}

.btn-primary {
    background: linear-gradient(45deg, #007bff, #0056b3);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 123, 255, 0.4);
}

.btn-secondary {
    background: linear-gradient(45deg, #28a745, #1e7e34);
    color: white;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.4);
}

.btn-disabled {
    background: linear-gradient(45deg, #6c757d, #5a6268);
    color: white;
    cursor: not-allowed;
    opacity: 0.7;
}

/* =============== 加载和状态样式 =============== */
.loading-state, .empty-state, .error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    grid-column: 1 / -1; /* 占满整个网格 */
}

.loading-state i, .empty-state .empty-icon i, .error-state .error-icon i {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    color: #667eea;
}

.loading-state i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.empty-state h3, .error-state h3 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: #333;
}

.empty-state p, .error-state p {
    color: #666;
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.empty-state .hint {
    font-style: italic;
    color: #999;
}

.debug-info {
    font-size: 0.9rem;
    color: #999;
    font-family: monospace;
    background: rgba(0,0,0,0.05);
    padding: 5px 10px;
    border-radius: 4px;
    margin-top: 10px;
}

.debug-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.debug-actions .btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.debug-actions .btn-primary {
    background: #667eea;
    color: white;
}

.debug-actions .btn-primary:hover {
    background: #5a6fd8;
}

.debug-actions .btn-secondary {
    background: #95a5a6;
    color: white;
}

.debug-actions .btn-secondary:hover {
    background: #7f8c8d;
}

/* =============== 动画效果 =============== */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.fa-spin {
    animation: spin 1s linear infinite;
}

/* =============== 页脚 =============== */
.footer {
    background: rgba(0, 0, 0, 0.8);
    padding: 30px 0;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
}

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

/* =============== 响应式设计 =============== */
@media (max-width: 768px) {
    .nav-menu {
        gap: 1rem;
    }

    .language-switcher {
        margin-left: 0.5rem;
    }

    .lang-btn {
        padding: 6px 10px;
        font-size: 0.85rem;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .hero p {
        font-size: 1.1rem;
    }

    .apps-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .app-card {
        padding: 1.5rem;
        height: 520px; /* 移动端稍微减少高度 */
    }

    .app-header {
        height: 70px; /* 移动端减少头部高度 */
        margin-bottom: 1.2rem;
    }

    .app-description {
        height: 50px; /* 移动端减少描述高度 */
        -webkit-line-clamp: 2; /* 移动端只显示2行 */
        line-clamp: 2;
    }

    .app-screenshots {
        min-height: 150px;
        max-height: 170px;
    }

    .apps-section h2 {
        font-size: 2rem;
    }

    .hero-icon i {
        font-size: 4rem;
    }

    .nav-container {
        padding: 0 15px;
    }

    .container {
        padding: 0 15px;
    }

    .loading-state,
    .empty-state,
    .error-state {
        padding: 3rem 1rem;
    }

    .loading-state i,
    .empty-state .empty-icon i,
    .error-state .error-icon i {
        font-size: 3rem;
    }

    /* 移动端截图优化 */
    .screenshots-grid {
        gap: 0.6rem;
    }

    .screenshot-item {
        height: 140px;
    }

    .screenshot-placeholder {
        font-size: 0.8rem;
    }

    .screenshot-placeholder::before {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 2rem;
    }

    .app-card {
        height: 480px; /* 小屏幕进一步减少高度 */
        padding: 1.2rem;
    }

    .app-header {
        height: 60px;
        margin-bottom: 1rem;
    }

    .app-description {
        height: 40px;
        font-size: 0.9rem;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }

    .app-screenshots {
        min-height: 130px;
        max-height: 150px;
        margin-bottom: 1rem;
    }

    .app-actions {
        flex-direction: column;
        align-items: center;
        gap: 0.8rem;
        height: 50px; /* 小屏幕减少按钮区域高度 */
    }

    .btn {
        width: 100%;
        max-width: 200px;
        height: 40px; /* 小屏幕减少按钮高度 */
        font-size: 0.85rem;
        padding: 10px 20px;
    }

    /* 小屏幕截图进一步优化 */
    .screenshots-grid {
        gap: 0.5rem;
    }

    .screenshot-item {
        height: 120px;
        border-radius: 10px;
    }

    .screenshot-placeholder {
        font-size: 0.75rem;
    }

    .screenshot-placeholder::before {
        font-size: 1rem;
    }

    .app-screenshots {
        margin-bottom: 1.2rem;
    }
}

/* 应用详情模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease-out;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #ffffff;
    margin: 20px;
    padding: 0;
    border: none;
    border-radius: 16px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
    position: relative;
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close:hover,
.close:focus {
    background-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.modal-app-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.modal-app-icon {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: white;
    overflow: hidden;
}

.modal-app-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 16px;
}

.modal-app-details h2 {
    margin: 0 0 8px 0;
    font-size: 28px;
    font-weight: 700;
    color: white;
}

.modal-app-details p {
    margin: 0;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
}

.modal-body {
    padding: 24px;
    max-height: calc(90vh - 140px);
    overflow-y: auto;
}

.modal-description {
    margin-bottom: 32px;
}

.modal-description h3 {
    margin: 0 0 16px 0;
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
}

.modal-description p {
    margin: 0;
    font-size: 16px;
    line-height: 1.6;
    color: #4b5563;
}

.modal-screenshots {
    margin-bottom: 32px;
}

.modal-screenshots h3 {
    margin: 0 0 16px 0;
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
}

.modal-screenshots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.modal-screenshot-item {
    position: relative;
    aspect-ratio: 9/16;
    border-radius: 12px;
    overflow: hidden;
    background: #f3f4f6;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.modal-screenshot-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.modal-screenshot-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.modal-screenshot-item:hover img {
    transform: scale(1.05);
}

.modal-screenshot-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    color: #9ca3af;
    font-size: 14px;
    font-weight: 500;
}

.modal-actions {
    border-top: 1px solid #e5e7eb;
    padding-top: 24px;
}

.modal-app-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.modal-app-actions .btn {
    min-width: 160px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.modal-app-actions .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.modal-app-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.modal-app-actions .btn-secondary {
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(52, 211, 153, 0.3);
}

.modal-app-actions .btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 211, 153, 0.4);
}

.modal-app-actions .btn-disabled {
    background: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
}

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

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

/* 模态框响应式设计 */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 10px;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 20px;
    }
    
    .modal-app-info {
        gap: 12px;
    }
    
    .modal-app-icon {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }
    
    .modal-app-details h2 {
        font-size: 22px;
    }
    
    .modal-app-details p {
        font-size: 14px;
    }
    
    .modal-body {
        padding: 20px;
        max-height: calc(95vh - 120px);
    }
    
    .modal-screenshots-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 12px;
    }
    
    .modal-app-actions {
        flex-direction: column;
    }
    
    .modal-app-actions .btn {
        min-width: 100%;
    }
}