/* ============================================
   AppGalaxy 全局深色科幻风格样式 v3.0
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans Arabic', 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: radial-gradient(circle at 10% 20%, #0f0c29, #1a1a3e, #24243e);
    background-attachment: fixed;
    min-height: 100vh;
    color: #fff;
    padding-bottom: 90px;
}

/* ========== 滚动条美化 ========== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #ffd700, #ff6b6b);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #ff8c00, #ff4757);
}

/* ========== 头部导航 ========== */
.header {
    background: rgba(10, 20, 35, 0.85);
    backdrop-filter: blur(20px);
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(0, 255, 255, 0.3);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.logo {
    font-size: 1.3rem;
    font-weight: 800;
    background: linear-gradient(135deg, #ffd700, #ff6b6b, #ff8c00);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    cursor: pointer;
    letter-spacing: -0.5px;
}
.logo i {
    background: none;
    color: #ffd700;
    margin-right: 6px;
}
.lang-btn {
    background: rgba(255,255,255,0.1);
    padding: 6px 16px;
    border-radius: 40px;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,215,0,0.3);
    transition: all 0.3s;
}
.lang-btn:hover {
    background: rgba(255,215,0,0.2);
    border-color: #ffd700;
}

/* ========== 搜索框 ========== */
.search-container {
    padding: 16px 20px;
    background: rgba(0,0,0,0.2);
}
.search-box {
    display: flex;
    gap: 12px;
    background: rgba(255,255,255,0.08);
    border-radius: 60px;
    padding: 6px 6px 6px 20px;
    border: 1px solid rgba(255,215,0,0.2);
    backdrop-filter: blur(10px);
}
.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 0.95rem;
    outline: none;
}
.search-box input::placeholder {
    color: rgba(255,255,255,0.5);
}
.search-box button {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    border: none;
    width: 46px;
    border-radius: 50px;
    cursor: pointer;
    color: #1a1a2e;
    transition: transform 0.2s;
}
.search-box button:hover {
    transform: scale(1.05);
}

/* ========== 幻灯片 ========== */
.swiper-container {
    margin: 20px;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
}
.swiper-slide {
    position: relative;
}
.swiper-slide img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}
.slide-title {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    padding: 6px 18px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #ffd700;
    border-left: 3px solid #ffd700;
}
.swiper-pagination {
    display: none !important;
}

/* ========== 分类图标（圆形+多彩渐变） ========== */
.categories-section {
    padding: 0 20px;
    margin: 20px 0;
}
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.section-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
}
.section-header h2 i {
    background: linear-gradient(135deg, #ffd700, #ff6b6b);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.more-link {
    background: rgba(255,255,255,0.08);
    padding: 6px 16px;
    border-radius: 40px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 0.8rem;
    transition: all 0.3s;
}
.more-link:hover {
    background: rgba(255,215,0,0.2);
    color: #ffd700;
}
.categories-grid {
    display: flex;
    gap: 24px;
    overflow-x: auto;
    padding-bottom: 8px;
}
.cat-item {
    text-align: center;
    cursor: pointer;
    min-width: 70px;
}
.cat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    transition: all 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    position: relative;
    overflow: hidden;
}
.cat-icon i {
    font-size: 1.6rem;
    color: #fff;
    transition: all 0.3s;
}
.cat-item:nth-child(1) .cat-icon { background: linear-gradient(135deg, #667eea, #764ba2); box-shadow: 0 5px 15px rgba(102,126,234,0.4); }
.cat-item:nth-child(2) .cat-icon { background: linear-gradient(135deg, #f093fb, #f5576c); box-shadow: 0 5px 15px rgba(240,147,251,0.4); }
.cat-item:nth-child(3) .cat-icon { background: linear-gradient(135deg, #4facfe, #00f2fe); box-shadow: 0 5px 15px rgba(79,172,254,0.4); }
.cat-item:nth-child(4) .cat-icon { background: linear-gradient(135deg, #43e97b, #38f9d7); box-shadow: 0 5px 15px rgba(67,233,123,0.4); }
.cat-item:nth-child(5) .cat-icon { background: linear-gradient(135deg, #fa709a, #fee140); box-shadow: 0 5px 15px rgba(250,112,154,0.4); }
.cat-item:hover .cat-icon {
    transform: translateY(-6px) scale(1.08);
}
.cat-item:hover .cat-icon i {
    transform: scale(1.1);
    text-shadow: 0 0 12px rgba(255,255,255,0.8);
}
.cat-icon::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
    border-radius: 50%;
}
.cat-item:hover .cat-icon::after {
    left: 100%;
}
.cat-item span {
    font-size: 0.75rem;
    font-weight: 500;
    color: rgba(255,255,255,0.8);
    transition: color 0.3s;
}
.cat-item:hover span {
    color: #ffd700;
}

/* ========== 应用卡片 ========== */
.apps-section {
    padding: 0 20px;
    margin: 28px 0;
}
.apps-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.app-card {
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(12px);
    border-radius: 24px;
    padding: 16px;
    display: flex;
    gap: 14px;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.3s;
}
.app-card:hover {
    background: rgba(255,255,255,0.12);
    transform: translateY(-4px);
    border-color: rgba(255,215,0,0.4);
    box-shadow: 0 12px 25px -10px rgba(0,0,0,0.4);
}
.app-icon {
    width: 55px;
    height: 55px;
    background: rgba(255,255,255,0.1);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.app-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.app-icon i {
    font-size: 1.6rem;
    color: #ffd700;
}
.app-info {
    flex: 1;
}
.app-name {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 6px;
}
.app-price {
    font-weight: 700;
    color: #ffd700;
    font-size: 0.9rem;
}

/* ========== 高级科幻底部导航 ========== */
.bottom-nav {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    max-width: 520px;
    background: rgba(10, 20, 40, 0.9);
    backdrop-filter: blur(20px);
    border-radius: 60px;
    padding: 8px 16px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    border: 1px solid rgba(0, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 15px rgba(0, 255, 255, 0.2);
    transition: all 0.3s;
}
.bottom-nav:hover {
    box-shadow: 0 10px 40px rgba(0, 255, 255, 0.3);
    border-color: rgba(0, 255, 255, 0.7);
}
.bottom-nav::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00ffff, #ff00ff, #00ffff, transparent);
    animation: scanMove 4s linear infinite;
    opacity: 0.6;
}
@keyframes scanMove {
    0% { left: -100%; }
    100% { left: 100%; }
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 16px;
    border-radius: 50px;
    color: rgba(180, 200, 255, 0.6);
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 500;
    transition: all 0.3s;
    position: relative;
    min-width: 65px;
}
.nav-item i {
    font-size: 1.3rem;
    transition: all 0.3s;
}
.nav-item span {
    font-size: 0.65rem;
}
.nav-item:hover {
    color: #fff;
    background: rgba(0, 255, 255, 0.15);
    transform: translateY(-3px);
}
.nav-item:hover i {
    text-shadow: 0 0 8px #00ffff;
}
.nav-item.active {
    color: #00ffff;
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.2), rgba(0, 150, 255, 0.1));
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.4);
}
.nav-item.active i {
    text-shadow: 0 0 10px #00ffff;
}
.nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00ffff, #ff00ff, transparent);
    border-radius: 2px;
    animation: pulseWidth 1.5s infinite;
}
@keyframes pulseWidth {
    0%, 100% { width: 25px; opacity: 0.6; }
    50% { width: 40px; opacity: 1; }
}

/* ========== RTL 完全支持 ========== */
html[dir="rtl"] body {
    direction: rtl;
    text-align: right;
}
html[dir="rtl"] .header,
html[dir="rtl"] .search-box,
html[dir="rtl"] .section-header,
html[dir="rtl"] .more-link,
html[dir="rtl"] .categories-grid,
html[dir="rtl"] .apps-grid,
html[dir="rtl"] .app-card,
html[dir="rtl"] .app-info,
html[dir="rtl"] .bottom-nav,
html[dir="rtl"] .nav-item,
html[dir="rtl"] .menu-item,
html[dir="rtl"] .user-profile-card,
html[dir="rtl"] .stats-cards {
    direction: rtl;
}
html[dir="rtl"] .app-card .app-info {
    text-align: right;
}
html[dir="rtl"] .more-link i {
    transform: rotate(180deg);
    display: inline-block;
}
html[dir="rtl"] .back-btn {
    left: auto;
    right: 16px;
}
html[dir="rtl"] .back-btn i {
    transform: rotate(180deg);
}
html[dir="rtl"] .cat-item span,
html[dir="rtl"] .app-name,
html[dir="rtl"] .section-header h2,
html[dir="rtl"] .price {
    text-align: right;
}
html[dir="rtl"] .search-box {
    padding: 6px 20px 6px 6px;
}
html[dir="rtl"] .slide-title {
    left: auto;
    right: 20px;
    border-left: none;
    border-right: 3px solid #ffd700;
}
html[dir="rtl"] .categories-grid {
    flex-direction: row-reverse;
}
html[dir="rtl"] .apps-grid {
    direction: ltr;
}
html[dir="rtl"] .action-buttons,
html[dir="rtl"] .share-buttons {
    flex-direction: row-reverse;
}

/* ========== 响应式 ========== */
@media (max-width: 500px) {
    .bottom-nav {
        bottom: 15px;
        padding: 6px 12px;
    }
    .nav-item {
        padding: 4px 8px;
        min-width: 50px;
    }
    .nav-item i {
        font-size: 1.1rem;
    }
    .nav-item span {
        font-size: 0.55rem;
    }
    .cat-icon {
        width: 50px;
        height: 50px;
    }
    .cat-icon i {
        font-size: 1.3rem;
    }
}