/* === GRIDE X CENTRAL — Mobile-First UI === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #0a0a1a;
    --bg-card: #12122a;
    --bg-card-hover: #1a1a3a;
    --bg-nav: #0d0d24;
    --text: #ffffff;
    --text-muted: #8888bb;
    --primary: #6c5ce7;
    --primary-dark: #5a4bd1;
    --accent: #00b894;
    --orange: #fdcb6e;
    --blue: #74b9ff;
    --radius: 14px;
    --shadow: 0 4px 20px rgba(108, 92, 231, 0.2);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    padding-bottom: 80px;
    min-height: 100vh;
}

.container { max-width: 480px; margin: 0 auto; padding: 0 16px; }

/* === HEADER === */
.header {
    background: linear-gradient(135deg, #0d0d24 0%, #141430 100%);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-link { display: flex; align-items: center; }

.logo-img {
    height: 36px;
    width: auto;
    border-radius: 4px;
}

.theme-toggle {
    background: rgba(255,255,255,0.06);
    border: none;
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === HERO BANNER === */
.hero {
    padding: 16px 0;
}

.banner-img {
    width: 100%;
    border-radius: var(--radius);
    display: block;
    margin-bottom: 12px;
}

.badge-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-green { background: rgba(0, 184, 148, 0.15); color: #00e6b0; }
.badge-blue { background: rgba(116, 185, 255, 0.15); color: #74b9ff; }
.badge-orange { background: rgba(253, 203, 110, 0.15); color: #fdcb6e; }

}

/* === SEARCH === */
.search-section { padding: 8px 0 4px; }

.search-box {
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 4px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-box input {
    width: 100%;
    padding: 10px 0;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 15px;
    outline: none;
}

.search-box input::placeholder { color: var(--text-muted); }

/* === APK LIST === */
.main-content { padding: 8px 0 16px; }

.apk-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.apk-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 14px;
    display: flex;
    gap: 14px;
    align-items: center;
    transition: all 0.2s;
    border: 1px solid rgba(255,255,255,0.04);
    position: relative;
}

.apk-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(108, 92, 231, 0.2);
}

.apk-icon {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(255,255,255,0.04);
}

.apk-info {
    flex: 1;
    min-width: 0;
}

.apk-name {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.apk-desc {
    font-size: 12px;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 6px;
}

.apk-meta {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    font-size: 11px;
}

.apk-version, .apk-category {
    background: rgba(255,255,255,0.06);
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 500;
}

.apk-features {
    color: var(--accent);
    font-weight: 500;
}

.apk-downloads {
    background: rgba(108, 92, 231, 0.12);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 10px;
}

.apk-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.download-btn-sm {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 18px;
    background: linear-gradient(135deg, var(--primary), #8b7cf7);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.download-btn-sm:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(108, 92, 231, 0.4);
}

.safe-badge {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    color: var(--accent);
    font-weight: 600;
}

.safe-badge .shield {
    font-size: 12px;
}

/* === EMPTY STATE === */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
}

.empty-state h3 { margin-bottom: 8px; font-size: 16px; }
.empty-state p { color: var(--text-muted); font-size: 14px; }

/* === BOTTOM NAV === */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-nav);
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 999;
    backdrop-filter: blur(20px);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-decoration: none;
    color: var(--text-muted);
    padding: 4px 12px;
    border-radius: 10px;
    transition: all 0.2s;
}

.nav-item.active { color: var(--primary); }

/* === SVG ICONS === */
.icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

.icon-sm { width: 14px; height: 14px; }
.icon-md { width: 18px; height: 18px; }
.icon-nav { width: 24px; height: 24px; display: block; margin: 0 auto; color: var(--text-muted); }
.nav-item.active .icon-nav { color: var(--primary); }
.icon-sun { width: 18px; height: 18px; color: var(--text-muted); }
.icon-search-input { width: 18px; height: 18px; color: var(--text-muted); flex-shrink: 0; }

.nav-label { font-size: 10px; font-weight: 500; }

/* === APP DETAIL PAGE === */
.app-detail-page { padding: 16px 0; }

.app-header-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    margin-bottom: 16px;
}

.app-icon-lg {
    width: 80px;
    height: 80px;
    border-radius: 18px;
    object-fit: cover;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 36px;
    background: linear-gradient(135deg, var(--primary), #8b7cf7);
    color: #fff;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s;
}

.download-btn:hover { transform: scale(1.03); box-shadow: 0 6px 24px rgba(108, 92, 231, 0.4); }

.feature-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    padding: 8px 0;
}

.feature-tag {
    background: rgba(0, 184, 148, 0.1);
    color: var(--accent);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 12px;
}

.back-link:hover { color: var(--text); }

/* === AD BANNER === */
.ad-banner-link {
    display: block;
    text-decoration: none;
    margin: 12px 0;
    padding: 0 16px;
}

.ad-banner-container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    border-radius: 16px;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid rgba(108, 92, 231, 0.15);
    transition: all 0.3s;
}

.ad-banner-container:hover {
    border-color: rgba(108, 92, 231, 0.4);
    box-shadow: 0 0 20px rgba(108, 92, 231, 0.15);
}

.ad-banner-svg {
    display: block;
    width: 100%;
    height: auto;
    min-height: 80px;
}

/* === INVISIBLE CLICK LAYER === */
.invisible-layer {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: transparent;
    cursor: pointer;
}

/* === RESPONSIVE === */
@media (min-width: 768px) {
    .container { max-width: 720px; }
    .apk-list {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 14px;
    }
    .apk-card { flex-direction: column; text-align: center; }
    .apk-right { flex-direction: row; }
}

@media (min-width: 1024px) {
    .container { max-width: 960px; }
    .apk-list { grid-template-columns: 1fr 1fr 1fr; }
}