/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    line-height: 1.6;
    overflow-x: hidden;
}



/* 主应用容器 */
.app-container {
    min-height: 100vh;
    display: flex !important;
    flex-direction: column;
    background: #f2f2f2;
}

/* 顶部导航 */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-left .logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    width: 28px;
    height: 28px;
}

.logo-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: #e56045;
}

.nav-right {
    display: flex;
    gap: 0.5rem;
}

.search-btn, .menu-btn {
    background: none;
    border: none;
    padding: 0.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background 0.2s;
    color: #999999;
}

.search-btn:hover, .menu-btn:hover {
    background: #e5e5e5;
}

/* 搜索容器 */
.search-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 1rem 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 200;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

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

.search-box {
    display: flex;
    align-items: center;
    background: #e5e5e5;
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
}

.search-box input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    font-size: 1rem;
    color: #1a1a1a;
}

.search-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999999;
    padding: 0 0.5rem;
}

/* 主要内容区域 */
.main-content {
    flex: 1;
    padding: 0 1.5rem;
    margin-bottom: 80px; /* 为底部导航留出空间 */
}

/* 板块样式 */
.section {
    margin: 2rem 0;
}

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

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a1a;
}

.section-count {
    font-size: 0.9rem;
    color: #999999;
    background: #e5e5e5;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
}

/* 卡片网格 */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .cards-grid {
        grid-template-columns: 1fr;
    }
}

/* 应用卡片 */
.app-card {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    border: 1px solid #cccccc;
}

.app-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.app-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.app-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: linear-gradient(135deg, #e56045 0%, #cc553d 100%);
    color: white;
    font-weight: bold;
}

.app-info h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 0.25rem;
}

.app-category {
    font-size: 0.8rem;
    color: #999999;
    background: #e5e5e5;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
}

.app-description {
    color: #999999;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.app-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat {
    font-size: 0.9rem;
    color: #999999;
}

.rating {
    color: #f7941d;
    font-weight: 600;
}

.users {
    color: #53cfc8;
    font-weight: 600;
}

/* 底部导航 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #cccccc;
    display: flex !important;
    justify-content: space-around;
    padding: 0.5rem 0;
    z-index: 100;
    min-height: 65px;
    align-items: center;
}

.nav-item {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    transition: color 0.2s;
    color: #999999;
    font-size: 0.8rem;
    min-width: 50px;
    text-align: center;
    flex: 1;
}

.nav-item.active {
    color: #e56045;
}

.nav-icon {
    font-size: 1.2rem;
}

/* PWA 安装提示 */
.install-prompt {
    position: fixed;
    bottom: 400px;
    left: 1rem;
    right: 1rem;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    padding: 1rem;
    z-index: 1000;
    transform: translateY(calc(100% + 100px));
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.install-prompt.show {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* 确保按钮在显示状态下可点击 */
.install-prompt.show .install-btn,
.install-prompt.show .dismiss-btn {
    pointer-events: auto;
    cursor: pointer;
}

.install-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.install-icon {
    font-size: 2rem;
}

.install-text {
    flex: 1;
}

.install-text h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.install-text p {
    font-size: 0.9rem;
    color: #999999;
}

.install-actions {
    display: flex;
    gap: 0.5rem;
}

.install-btn {
    background: #e56045;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer !important;
    font-size: 0.9rem;
    transition: background 0.2s;
    pointer-events: auto !important;
    z-index: 1001;
    position: relative;
}

.install-btn:hover {
    background: #cc553d;
}

.install-btn:active {
    transform: scale(0.98);
}

.dismiss-btn {
    background: #e5e5e5;
    color: #999999;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer !important;
    font-size: 0.9rem;
    transition: background 0.2s;
    pointer-events: auto !important;
    z-index: 1001;
    position: relative;
}

.dismiss-btn:hover {
    background: #cccccc;
}

.dismiss-btn:active {
    transform: scale(0.98);
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 1rem;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999999;
    padding: 0.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.app-detail {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.app-detail .app-icon {
    width: 80px;
    height: 80px;
    font-size: 2rem;
}

.app-detail .app-info {
    flex: 1;
}

.app-detail .app-info p {
    margin-bottom: 1rem;
    color: #999999;
}

.app-detail .app-stats {
    display: flex;
    gap: 1rem;
}

.app-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.action-btn.primary {
    background: #e56045;
    color: white;
}

.action-btn.primary:hover {
    background: #cc553d;
}

.action-btn {
    background: #e5e5e5;
    color: #999999;
}

.action-btn:hover {
    background: #cccccc;
}

/* 确保底部导航始终可见和可点击 */
.bottom-nav {
    visibility: visible !important;
    opacity: 1 !important;
}

.nav-item {
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .top-nav {
        padding: 0.75rem 1rem;
    }
    
    .main-content {
        padding: 0 1rem;
    }
    
    .section-header h2 {
        font-size: 1.3rem;
    }
    
    .app-card {
        padding: 1rem;
    }
    
    .install-content {
        flex-direction: column;
        text-align: center;
    }
    
    .install-actions {
        width: 100%;
        justify-content: center;
    }
    
    /* 移动端底部导航优化 */
    .bottom-nav {
        padding: 0.75rem 0;
    }
    
    .nav-item {
        font-size: 0.75rem;
        padding: 0.25rem;
    }
}

/* 隐藏部分 */
.section {
    display: none;
}

.section.active {
    display: block;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 侧边菜单 */
.side-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    z-index: 1001;
    pointer-events: none;
    transition: all 0.3s ease;
}

.side-menu.show {
    pointer-events: auto;
}

.side-menu-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.side-menu.show .side-menu-overlay {
    opacity: 1;
}

.side-menu-content {
    position: absolute;
    top: 0;
    right: 0;
    width: 320px;
    height: 100%;
    background: white;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    z-index: 2;
}

.side-menu.show .side-menu-content {
    transform: translateX(0);
}

.side-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #cccccc;
    background: #f2f2f2;
    position: relative;
    z-index: 3;
}

.side-menu-header h3 {
    margin: 0;
    color: #1a1a1a;
    font-size: 1.2rem;
    font-weight: 600;
}

.side-menu-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999999;
    padding: 0.5rem;
    border-radius: 0.25rem;
    transition: background 0.2s;
    z-index: 4;
    position: relative;
}

.side-menu-close:hover {
    background: #cccccc;
}

.side-menu-body {
    flex: 1;
    padding: 1rem 0;
    position: relative;
    z-index: 3;
}

.menu-section {
    margin-bottom: 1.5rem;
}

.menu-section h4 {
    margin: 0 0 1rem 0;
    padding: 0 1.5rem;
    color: #4d4d4d;
    font-size: 1rem;
    font-weight: 600;
}

.menu-stats {
    padding: 0 1.5rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e5e5e5;
    position: relative;
    z-index: 5;
    pointer-events: auto;
}

.stat-item:last-child {
    border-bottom: none;
}

/* 可点击的统计项目样式 */
.clickable-stat {
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
    border-radius: 0.5rem;
    margin: 0 -0.5rem;
    padding: 0.75rem 0.5rem;
    position: relative;
    z-index: 6;
    pointer-events: auto;
}

.clickable-stat:hover {
    background-color: #e5e5e5;
    transform: translateX(4px);
}

.clickable-stat:active {
    background-color: #cccccc;
    transform: translateX(2px);
}

/* 深色模式下的可点击统计项目 */
body.dark-mode .clickable-stat:hover {
    background-color: #4d4d4d;
}

body.dark-mode .clickable-stat:active {
    background-color: #1a1a1a;
}

.stat-label {
    color: #999999;
    font-size: 0.9rem;
}

.stat-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-value {
    color: #1a1a1a;
    font-weight: 600;
    font-size: 0.9rem;
}

.stat-arrow {
    color: #cccccc;
    font-size: 0.8rem;
    transition: transform 0.2s, color 0.2s;
    opacity: 0;
}

/* 鼠标悬停时显示箭头 */
.clickable-stat:hover .stat-arrow {
    opacity: 1;
    transform: translateX(2px);
    color: #e56045;
}

/* 深色模式下的箭头 */
body.dark-mode .stat-arrow {
    color: #999999;
}

body.dark-mode .clickable-stat:hover .stat-arrow {
    color: #ffb9b2;
}

.menu-option {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    color: #4d4d4d !important;
    font-size: 0.9rem;
    cursor: pointer !important;
    transition: background 0.2s, color 0.2s;
    text-align: left;
    position: relative;
    z-index: 10;
}

.menu-option:hover {
    background: #e5e5e5 !important;
    color: #1a1a1a !important;
}

.menu-option:active {
    background: #cccccc !important;
}

.option-icon {
    font-size: 1.1rem;
    transition: transform 0.2s;
}

.option-text {
    flex: 1;
    font-weight: 500;
}

.menu-option:hover .option-icon {
    transform: scale(1.1);
}

/* 确保菜单按钮可点击 */
.menu-option,
.menu-link {
    pointer-events: auto !important;
    user-select: none;
}

/* 添加点击效果 */
.menu-option:focus {
    outline: 2px solid #e56045;
    outline-offset: 2px;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: #4d4d4d;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.menu-link:hover {
    background: #e5e5e5;
    color: #e56045;
}

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

.link-text {
    flex: 1;
}

/* 深色模式支持 */
body.dark-mode {
    background: linear-gradient(135deg, #1a1a1a 0%, #4d4d4d 100%);
    color: #e5e5e5;
}

body.dark-mode .app-container {
    background: #1a1a1a;
}

body.dark-mode .top-nav {
    background: #4d4d4d;
    color: #e5e5e5;
}

body.dark-mode .app-card {
    background: #4d4d4d;
    border-color: #999999;
    color: #e5e5e5;
}

body.dark-mode .side-menu-content {
    background: #4d4d4d;
    color: #e5e5e5;
}

body.dark-mode .side-menu-header {
    background: #1a1a1a;
    border-color: #999999;
}

body.dark-mode .menu-option {
    color: #e5e5e5 !important;
}

body.dark-mode .menu-option:hover {
    background: #999999 !important;
    color: #f2f2f2 !important;
}

body.dark-mode .menu-option:active {
    background: #cccccc !important;
}

body.dark-mode .menu-link:hover {
    background: #999999;
}

body.dark-mode .bottom-nav {
    background: #4d4d4d;
    border-color: #999999;
    color: #e5e5e5;
}

body.dark-mode .nav-item {
    color: #cccccc;
}

body.dark-mode .nav-item.active {
    color: #ffb9b2;
}

/* 响应式设计 - 侧边菜单 */
@media (max-width: 768px) {
    .side-menu-content {
        width: 280px;
    }
}

@media (max-width: 480px) {
    .side-menu-content {
        width: 100%;
    }
}

/* 深色模式下的PWA安装提示 */
body.dark-mode .install-prompt {
    background: #1a1a1a;
    border: 1px solid #4d4d4d;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

body.dark-mode .install-text h3 {
    color: #e5e5e5;
}

body.dark-mode .install-text p {
    color: #999999;
}

body.dark-mode .dismiss-btn {
    background: #4d4d4d;
    color: #e5e5e5;
}

body.dark-mode .dismiss-btn:hover {
    background: #999999;
    color: #f2f2f2;
} 