/* ===== ROOT ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg-dark: #0f172a;
    --surface-dark: #1e293b;
    --surface-elevated: #334155;
    --primary-color: #00e5ff;
    --primary-glow: rgba(0, 229, 255, 0.25);
    --accent-green: #10b981;
    --text-main: #f8fafc;
    --text-sub: #94a3b8;
    --border-color: #334155;
    --card-radius: 20px;
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    padding-bottom: 90px;
    min-height: 100vh;
}

/* ===== HEADER ===== */
.app-header {
    background: rgba(30, 41, 59, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-main);
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.5px;
}
.brand-logo i {
    color: var(--primary-color);
    font-size: 1.4rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
.profile-badge {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--surface-elevated);
    border: 1.5px solid var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 1.1rem;
    transition: 0.2s;
}
.profile-badge:active {
    transform: scale(0.95);
}

/* ===== SEARCH BAR ===== */
.search-container {
    padding: 12px 16px 4px 16px;
    max-width: 900px;
    margin: 0 auto;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--surface-dark);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    padding: 6px 18px;
    transition: 0.3s;
}
.search-box:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 15px var(--primary-glow);
}
.search-box i {
    color: var(--text-sub);
    font-size: 1rem;
}
.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px 12px;
    color: var(--text-main);
    font-size: 0.95rem;
    outline: none;
}
.search-box input::placeholder {
    color: var(--text-sub);
}
.search-box .clear-search {
    color: var(--text-sub);
    cursor: pointer;
    padding: 4px 8px;
    display: none;
}
.search-box .clear-search.visible {
    display: block;
}

/* ===== CONTAINER ===== */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 16px;
}

/* ===== FEATURED BANNER ===== */
.featured-banner {
    background: linear-gradient(135deg, #1e1b4b, #312e81, #0f172a);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: var(--card-radius);
    padding: 20px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}
.featured-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 50%, rgba(0, 229, 255, 0.05), transparent 60%);
    pointer-events: none;
}
.banner-content {
    max-width: 65%;
    z-index: 2;
}
.banner-tag {
    background: var(--primary-color);
    color: #000;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    display: inline-block;
    margin-bottom: 8px;
}
.banner-title {
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 6px;
    color: #fff;
}
.banner-desc {
    font-size: 0.82rem;
    color: var(--text-sub);
    line-height: 1.4;
}
.banner-icon {
    font-size: 4rem;
    color: rgba(0, 229, 255, 0.15);
    position: absolute;
    right: 15px;
    bottom: -10px;
    transform: rotate(-15deg);
    z-index: 1;
}

/* ===== CATEGORY TABS ===== */
.category-scroll {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.category-scroll::-webkit-scrollbar {
    display: none;
}
.cat-chip {
    background: var(--surface-dark);
    border: 1px solid var(--border-color);
    color: var(--text-sub);
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    white-space: nowrap;
    transition: 0.25s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
    -webkit-touch-callout: none;
}
.cat-chip:active {
    transform: scale(0.95);
}
.cat-chip.active {
    background: var(--primary-color);
    color: #0f172a;
    border-color: var(--primary-color);
    box-shadow: 0 0 15px var(--primary-glow);
    font-weight: 700;
}

/* ===== SECTION HEADER ===== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 6px;
}
.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-title i {
    color: var(--primary-color);
}
.result-count {
    color: var(--text-sub);
    font-size: 0.8rem;
}

/* ===== AD BANNER ===== */
.ad-banner {
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--border-color);
    border-radius: 12px;
    padding: 8px;
    text-align: center;
    color: var(--text-sub);
    font-size: 0.7rem;
    margin: 12px 0;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.ad-banner .ad-label {
    color: var(--text-sub);
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.5;
}

/* ===== APP CARD ===== */
.app-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.app-card {
    background: var(--surface-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: 0.25s ease;
    cursor: pointer;
    position: relative;
}
.app-card:active {
    transform: scale(0.98);
}
.app-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.app-icon {
    width: 68px;
    height: 68px;
    border-radius: 16px;
    object-fit: cover;
    background: var(--surface-elevated);
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.app-details {
    flex: 1;
    min-width: 0;
}
.app-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.app-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    color: var(--text-sub);
    margin-bottom: 4px;
    flex-wrap: wrap;
}
.app-badge {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.7rem;
}
.app-rating {
    color: #fbbf24;
    display: flex;
    align-items: center;
    gap: 3px;
}
.app-downloads {
    color: var(--text-sub);
    display: flex;
    align-items: center;
    gap: 3px;
}
.app-desc-preview {
    font-size: 0.75rem;
    color: var(--text-sub);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.get-btn {
    background: var(--surface-elevated);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: 0.2s ease;
    flex-shrink: 0;
    cursor: pointer;
    user-select: none;
    -webkit-touch-callout: none;
}
.get-btn:active {
    transform: scale(0.92);
}
.app-card:hover .get-btn {
    background: var(--primary-color);
    color: #0f172a;
    box-shadow: 0 0 10px var(--primary-glow);
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 16px;
    animation: fadeIn 0.25s ease;
}
.modal-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.modal-card {
    background: var(--surface-dark);
    max-width: 500px;
    width: 100%;
    border-radius: 28px;
    border: 1px solid var(--border-color);
    padding: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
    position: relative;
    max-height: 95vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 1.6rem;
    color: var(--text-sub);
    background: none;
    border: none;
    cursor: pointer;
    transition: 0.2s;
    padding: 4px 8px;
    border-radius: 50%;
}
.modal-close:hover {
    color: #fff;
    transform: rotate(90deg);
}
.modal-close:active {
    transform: rotate(90deg) scale(0.9);
}

.modal-icon {
    width: 90px;
    height: 90px;
    border-radius: 24px;
    object-fit: cover;
    margin-bottom: 10px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}
.modal-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 4px;
}
.modal-sub {
    color: var(--text-sub);
    font-size: 0.85rem;
    margin-bottom: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 14px 0;
}
.stat-box {
    background: rgba(0, 0, 0, 0.25);
    border-radius: 12px;
    padding: 12px 8px;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: 0.2s;
}
.stat-box:hover {
    border-color: var(--primary-color);
}
.stat-box .stat-number {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary-color);
}
.stat-box .stat-label {
    font-size: 0.6rem;
    color: var(--text-sub);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}
.stat-box .stat-icon {
    color: var(--text-sub);
    font-size: 0.8rem;
}

.modal-desc {
    color: var(--text-main);
    line-height: 1.6;
    margin: 12px 0;
    font-size: 0.92rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 14px;
    border-radius: 14px;
    border-left: 3px solid var(--primary-color);
}

.modal-screenshots {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 6px 0 14px 0;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.modal-screenshots::-webkit-scrollbar {
    display: none;
}
.modal-screenshots img {
    height: 140px;
    border-radius: 14px;
    object-fit: cover;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
    width: auto;
    min-width: 100px;
}

/* ===== DOWNLOAD SECTION ===== */
.download-section {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.modal-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--primary-color);
    color: #0f172a;
    font-weight: 800;
    padding: 12px 24px;
    border-radius: 30px;
    text-decoration: none;
    border: none;
    font-size: 1rem;
    transition: 0.2s;
    cursor: pointer;
    flex: 1;
    justify-content: center;
    min-height: 52px;
}
.modal-download-btn:active {
    transform: scale(0.96);
}
.modal-download-btn:hover {
    box-shadow: 0 0 20px var(--primary-glow);
}
.modal-download-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.share-btn {
    background: var(--surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.share-btn:active {
    transform: scale(0.9);
}
.share-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.timer-text {
    color: var(--text-sub);
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 60px;
    text-align: center;
}

/* ===== BOTTOM DOCK ===== */
.bottom-dock {
    position: fixed;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 450px;
    height: 62px;
    background: rgba(30, 41, 59, 0.92);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--border-color);
    border-radius: 35px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    padding: 0 10px;
}
.dock-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--text-sub);
    text-decoration: none;
    font-size: 0.65rem;
    font-weight: 600;
    transition: 0.2s;
    flex: 1;
    padding: 4px 0;
}
.dock-item i {
    font-size: 1.2rem;
}
.dock-item.active {
    color: var(--primary-color);
}
.dock-item:active {
    transform: scale(0.9);
}
.dock-center-btn {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color), #0072ff);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0f172a;
    font-size: 1.3rem;
    box-shadow: 0 0 15px var(--primary-glow);
    text-decoration: none;
    border: 3px solid var(--bg-dark);
    margin-top: -20px;
    transition: 0.2s;
    cursor: pointer;
}
.dock-center-btn:active {
    transform: scale(0.92);
}

.status-msg {
    text-align: center;
    color: var(--text-sub);
    padding: 40px 0;
    font-size: 0.95rem;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    .stat-box .stat-number {
        font-size: 1rem;
    }
    .modal-card {
        padding: 16px;
        border-radius: 20px;
    }
    .modal-icon {
        width: 70px;
        height: 70px;
    }
    .modal-title {
        font-size: 1.2rem;
    }
    .app-card {
        padding: 12px 14px;
        gap: 10px;
    }
    .app-icon {
        width: 56px;
        height: 56px;
    }
    .get-btn {
        padding: 6px 12px;
        font-size: 0.7rem;
    }
    .banner-title {
        font-size: 1.1rem;
    }
    .banner-icon {
        font-size: 3rem;
    }
}

@media (max-width: 380px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 4px;
    }
    .stat-box {
        padding: 8px 4px;
    }
    .stat-box .stat-number {
        font-size: 0.9rem;
    }
    .modal-download-btn {
        font-size: 0.85rem;
        padding: 10px 16px;
    }
}
