/* ── Variables ─────────────────────────────────────────────── */
:root {
    --primary-bg:    #f8f9fa;
    --secondary-bg:  #ffffff;
    --card-bg:       #ffffff;
    --text-dark:     #1a1a1a;
    --text-medium:   #2c2c2c;
    --text-light:    #5e5e5e;
    --accent-gray:   #7c7c7c;
    --accent-dark:   #1a1a1a;
    --border-color:  #e6e8ec;
    --border-light:  #f0f0f0;
    --shadow-light:  rgba(0, 0, 0, 0.02);
    --shadow-medium: rgba(0, 0, 0, 0.05);
    --transition:    all 0.25s cubic-bezier(0.2, 0.9, 0.4, 1.1);
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, 'Inter', sans-serif;
    background: #f5f7fb;
    color: var(--text-medium);
    line-height: 1.5;
    scroll-behavior: smooth;
    min-height: 100vh;
    padding-top: 60px;
    padding-bottom: 110px;
}

/* ── Header ─────────────────────────────────────────────────── */
header {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    background: rgba(255,255,255,0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(0,0,0,0.04);
    z-index: 1000;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
}

.logo {
    display: flex; align-items: center; gap: 10px;
    text-decoration: none;
}
.logo i { color: var(--accent-dark); font-size: 1.8rem; transition: transform 0.3s ease; }
.logo:hover i { transform: rotate(360deg); }
.logo-text { font-size: 1.3rem; font-weight: 700; color: var(--text-dark); letter-spacing: -0.2px; }

/* ── Nav toggle (hamburger) ─────────────────────────────────── */
.nav-toggle {
    display: flex; flex-direction: column; justify-content: space-between;
    width: 28px; height: 20px;
    background: transparent; border: none; cursor: pointer; padding: 0;
}
.nav-toggle span {
    display: block; height: 2px; width: 100%;
    background: var(--accent-dark); border-radius: 2px; transition: var(--transition);
}
.nav-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px,5px); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(6px,-6px); }

.nav-container { position: relative; }

/* ── Dropdown ───────────────────────────────────────────────── */
.dropdown-menu {
    position: absolute; top: 100%; right: 0;
    background: var(--card-bg); border-radius: 20px;
    box-shadow: 0 12px 28px rgba(0,0,0,0.12);
    padding: 8px 0; width: 200px;
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: var(--transition); border: 1px solid var(--border-color); z-index: 999;
}
.dropdown-menu.active { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-menu a {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 18px; color: var(--text-medium);
    text-decoration: none; font-size: 0.9rem;
    transition: all 0.2s; border-bottom: 1px solid var(--border-light);
}
.dropdown-menu a:last-child { border-bottom: none; }
.dropdown-menu a:hover { background: #f4f6fa; color: #000; padding-left: 24px; }

/* ── Hero ───────────────────────────────────────────────────── */
.post-hero {
    text-align: center; padding: 1.8rem 15px 1.2rem;
    position: relative;
}
.post-hero::after {
    content: ''; position: absolute; bottom: 6px; left: 50%;
    transform: translateX(-50%); width: 48px; height: 2px; background: #d4d8dd;
}
.post-hero h1 { font-size: 2rem; font-weight: 700; color: #111; margin-bottom: 0.4rem; letter-spacing: -0.3px; }
.post-hero p  { color: #6c6f78; font-size: 0.95rem; }

/* ── Container ──────────────────────────────────────────────── */
.container { max-width: 680px; margin: 0 auto; padding: 0 18px 2rem; }

.cards-title {
    font-size: 1.35rem; font-weight: 650; color: #1e1e2a;
    margin: 0.75rem 0 1rem 0; letter-spacing: -0.2px;
    border-left: 3px solid #1a1a1a; padding-left: 12px;
}

/* ── App list ───────────────────────────────────────────────── */
.apps-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: transparent;
}

/* ── App card ───────────────────────────────────────────────── */
.app-card {
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 14px 12px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: background 0.22s ease, transform 0.2s ease;
    opacity: 0;
    transform: translateY(8px);
    border-bottom: 1px solid #edeff2;
}
.app-card:last-child { border-bottom: none; }
.app-card.visible   { opacity: 1; transform: translateY(0); }
.app-card:hover     { background: #f9fafc; transform: translateX(2px); }

/* ── Icon ───────────────────────────────────────────────────── */
.app-icon {
    width: 58px; height: 58px;
    border-radius: 16px; object-fit: cover;
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
    flex-shrink: 0;
    border: 0.5px solid #eff1f4;
}

/* ── Info block ─────────────────────────────────────────────── */
.app-info { flex: 1; min-width: 0; }

.app-name {
    font-size: 1.08rem; font-weight: 680; color: #121212;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-bottom: 3px; letter-spacing: -0.2px;
}

.app-desc {
    font-size: 0.7rem; color: #9aa0aa;
    line-height: 1.3; margin-bottom: 6px;
    font-weight: 450; letter-spacing: -0.1px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.app-meta {
    display: flex; align-items: center;
    gap: 12px; flex-wrap: wrap;
}

.app-rating {
    display: flex; align-items: center; gap: 4px;
    font-size: 0.78rem; color: #4a4e57; font-weight: 500;
}
.app-rating i { color: #f5b342; font-size: 0.7rem; }

.app-size {
    font-size: 0.72rem; color: #6c727e;
    background: #eff2f6; padding: 3px 8px;
    border-radius: 20px; font-weight: 500;
}

.app-version { font-size: 0.7rem; color: #8f949e; font-weight: 500; }

/* ── Download button ────────────────────────────────────────── */
.download-btn {
    background: #1f242e; border: none; border-radius: 14px;
    padding: 12px 16px; cursor: pointer;
    transition: all 0.2s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    flex-shrink: 0; min-width: 48px;
    display: flex; align-items: center; justify-content: center;
    text-decoration: none; color: white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.download-btn i { font-size: 1.2rem; color: white; transition: transform 0.2s; }
.download-btn:hover  { background: #0a0e14; transform: scale(1.05); box-shadow: 0 6px 14px rgba(0,0,0,0.12); }
.download-btn:active { transform: scale(0.96); background: #000000; }

/* ── Footer ─────────────────────────────────────────────────── */
.footer {
    text-align: center; padding: 2rem 15px 1rem; margin-top: 1rem;
    border-top: 1px solid #eef2f5;
    color: #8b8f99; font-size: 0.78rem;
}

/* ── Bottom nav ─────────────────────────────────────────────── */
.bottom-nav-wrapper {
    position: fixed; bottom: 0; left: 0; width: 100%;
    padding: 0 16px 14px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
    z-index: 1000; pointer-events: none;
    background: linear-gradient(to top, #f5f7fb 70%, transparent);
}

.bottom-nav {
    position: relative; width: 100%; max-width: 500px;
    margin: 0 auto; height: 64px;
    background: rgba(255,255,255,0.96);
    backdrop-filter: blur(24px);
    border-radius: 32px;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08), 0 1px 1px rgba(0,0,0,0.02);
    display: flex; align-items: center; justify-content: space-around;
    padding: 0 8px; pointer-events: all;
}

.bottom-nav-item {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 3px; flex: 1;
    text-decoration: none; color: #9ca3af;
    font-size: 0.6rem; font-weight: 600; letter-spacing: 0.02em;
    transition: all 0.2s; border-radius: 30px; padding: 6px 0;
}
.bottom-nav-item i           { font-size: 1.2rem; transition: all 0.2s; }
.bottom-nav-item.active      { color: #1e1e2a; }
.bottom-nav-item.active i    { transform: translateY(-1px); }
.bottom-nav-item:hover       { color: #1f2937; }

.nav-icon-wrap {
    width: 38px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 20px;
}

.bottom-nav-upload { margin-top: -28px; gap: 4px; }
.upload-fab {
    width: 54px; height: 54px; background: #1a1e26; border-radius: 28px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 18px rgba(0,0,0,0.2);
    transition: all 0.2s; border: 1px solid rgba(255,255,255,0.2);
}
.upload-fab i { font-size: 1.3rem; color: white; }
.bottom-nav-upload:hover .upload-fab { background: #000; transform: translateY(-3px); }
.bottom-nav-upload span { color: #111; font-weight: 700; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 480px) {
    .app-name     { font-size: 1rem; }
    .app-desc     { font-size: 0.65rem; }
    .app-icon     { width: 52px; height: 52px; border-radius: 14px; }
    .download-btn { padding: 10px 14px; }
    .app-card     { padding: 12px 8px; gap: 12px; }
    .container    { padding: 0 12px 2rem; }
}

/* ── Animation ──────────────────────────────────────────────── */
@keyframes fadeSlide {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Nav right group (search + hamburger) ───────────────────── */
.nav-right {
    display: flex; align-items: center; gap: 6px;
}

/* ── Search icon button ──────────────────────────────────────── */
.search-icon-btn {
    display: flex; align-items: center; justify-content: center;
    width: 38px; height: 38px;
    background: transparent; border: none; cursor: pointer;
    border-radius: 50%; color: var(--accent-dark);
    font-size: 1.05rem;
    transition: background 0.2s ease, transform 0.2s ease;
    position: relative; z-index: 1;
}
.search-icon-btn:hover  { background: rgba(0,0,0,0.05); transform: scale(1.08); }
.search-icon-btn:active { transform: scale(0.94); }
.search-icon-btn.active { color: #000; }

/* ── Search overlay ──────────────────────────────────────────── */
.search-overlay {
    position: fixed; inset: 0; z-index: 2000;
    pointer-events: none;
    visibility: hidden;
}
.search-overlay.open {
    pointer-events: all;
    visibility: visible;
}

/* Blur backdrop */
.search-backdrop {
    position: absolute; inset: 0;
    background: rgba(10,12,18,0.45);
    backdrop-filter: blur(16px) saturate(0.7);
    -webkit-backdrop-filter: blur(16px) saturate(0.7);
    opacity: 0;
    transition: opacity 0.32s cubic-bezier(0.4,0,0.2,1);
}
.search-overlay.open .search-backdrop { opacity: 1; }

/* Panel that slides down */
.search-panel {
    position: absolute;
    top: 0; left: 0; right: 0;
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid rgba(0,0,0,0.07);
    border-radius: 0 0 28px 28px;
    box-shadow: 0 24px 48px rgba(0,0,0,0.14);
    transform: translateY(-100%);
    transition: transform 0.38s cubic-bezier(0.22,1,0.36,1);
    max-height: 88vh;
    display: flex; flex-direction: column;
    overflow: hidden;
}
.search-overlay.open .search-panel {
    transform: translateY(0);
}

/* Input row */
.search-input-row {
    display: flex; align-items: center;
    gap: 12px;
    padding: 16px 18px 14px;
    border-bottom: 1px solid #f0f2f5;
    flex-shrink: 0;
}
.search-input-icon {
    color: #9aa0aa; font-size: 1rem; flex-shrink: 0;
}
.search-input {
    flex: 1; border: none; outline: none;
    font-size: 1.05rem; font-weight: 500; color: #111;
    background: transparent;
    font-family: inherit; letter-spacing: -0.2px;
}
.search-input::placeholder { color: #bec3cc; font-weight: 400; }

.search-close-btn {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 50%;
    background: #f0f2f6; border: none; cursor: pointer;
    color: #666; font-size: 0.85rem;
    transition: background 0.18s, transform 0.18s;
    flex-shrink: 0;
}
.search-close-btn:hover  { background: #e4e7ed; transform: rotate(90deg); }
.search-close-btn:active { transform: rotate(90deg) scale(0.92); }

/* Results list */
.search-results {
    overflow-y: auto; flex: 1;
    padding: 8px 0 12px;
    -webkit-overflow-scrolling: touch;
}

.search-result-item {
    display: flex; align-items: center; gap: 14px;
    padding: 11px 18px;
    cursor: pointer;
    transition: background 0.15s ease;
    text-decoration: none;
    color: inherit;
}
.search-result-item:hover { background: #f6f8fb; }
.search-result-item:active { background: #eef1f6; }

.search-result-icon {
    width: 46px; height: 46px; border-radius: 13px;
    object-fit: cover; flex-shrink: 0;
    border: 0.5px solid #eff1f4;
}
.search-result-info { flex: 1; min-width: 0; }
.search-result-name {
    font-size: 0.95rem; font-weight: 650; color: #111;
    letter-spacing: -0.2px; margin-bottom: 2px;
}
.search-result-name mark {
    background: #fff3b0; color: #111; border-radius: 3px;
    padding: 0 1px;
}
.search-result-desc {
    font-size: 0.72rem; color: #9aa0aa;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.search-result-arrow {
    color: #ccd0d9; font-size: 0.75rem; flex-shrink: 0;
}

/* Stagger-in animation for result rows */
.search-result-item {
    opacity: 0; transform: translateX(-6px);
    animation: resultIn 0.22s cubic-bezier(0.22,1,0.36,1) forwards;
}
@keyframes resultIn {
    to { opacity: 1; transform: translateX(0); }
}

/* Empty state */
.search-empty {
    display: none; flex-direction: column; align-items: center;
    justify-content: center; gap: 10px;
    padding: 40px 20px;
    color: #b0b5bf;
}
.search-empty i   { font-size: 2.2rem; }
.search-empty p   { font-size: 0.9rem; font-weight: 500; }
.search-empty.show { display: flex; }

/* Hint text when nothing typed yet */
.search-hint {
    padding: 18px 18px 12px;
    color: #bec3cc; font-size: 0.8rem;
    font-weight: 500; letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* Result count badge */
.search-count {
    padding: 6px 18px 4px;
    font-size: 0.72rem; color: #b0b5bf;
    font-weight: 500;
}

