/* App-style fixed bottom tab bar — quiet monochrome, 3D active depth */
:root {
    --app-nav-height: 58px;
}

body.has-app-bottom-nav {
    padding-bottom: calc(var(--app-nav-height) + 12px + env(safe-area-inset-bottom, 0px));
}

.app-bottom-nav {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: min(430px, calc(100% - 20px));
    z-index: 9990;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: stretch;
    min-height: var(--app-nav-height);
    padding: 5px 8px calc(5px + env(safe-area-inset-bottom, 0px));
    background: rgba(12, 12, 12, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    backdrop-filter: blur(22px) saturate(1.15);
    -webkit-backdrop-filter: blur(22px) saturate(1.15);
    box-shadow:
        0 18px 44px rgba(0, 0, 0, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    perspective: 600px;
}

@media (min-width: 768px) {
    .app-bottom-nav {
        display: none;
    }
}

.app-bottom-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 4px 2px;
    font-size: 0.6rem;
    font-weight: 300;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    text-align: center;
    text-decoration: none;
    border: none;
    background: none;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.3s ease, transform 0.45s var(--ease-expo);
    position: relative;
    transform-style: preserve-3d;
}

.app-bottom-nav__item i {
    font-size: 1.14rem;
    line-height: 1;
    transition: transform 0.5s var(--ease-expo), color 0.3s ease;
    transform-style: preserve-3d;
}

/* hover — icon leans toward you in 3D */
.app-bottom-nav__item:hover i {
    transform: translateY(-2px) rotateX(12deg);
}

/* press — pushes into the glass */
.app-bottom-nav__item:active {
    transform: scale(0.92) translateZ(-8px);
}

/* ACTIVE — the tab rises out of the bar */
.app-bottom-nav__item.active {
    color: var(--text);
    transform: translateY(-4px);
}

.app-bottom-nav__item.active i {
    transform: rotateX(16deg) translateZ(10px);
    filter: drop-shadow(0 6px 10px rgba(255, 255, 255, 0.12));
}

/* soft light pool under the raised active tab */
.app-bottom-nav__item.active::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 42px;
    height: 26px;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.1), transparent 70%);
    pointer-events: none;
}

/* active marker — a single quiet dot beneath the icon */
.app-bottom-nav__item.active::after {
    content: '';
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--text);
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
}

.brand-logo-img {
    width: 30px;
    height: 30px;
    border-radius: 0;
    object-fit: cover;
    flex-shrink: 0;
}

@media (prefers-reduced-motion: reduce) {
    .app-bottom-nav__item,
    .app-bottom-nav__item i {
        transition: none !important;
        transform: none !important;
    }
}

/* ── Recently viewed + back-to-top (ux-extras.js) ── */
.recent-viewed {
    max-width: 1280px;
    margin: 0 auto;
    padding: 40px 24px 8px;
}
.recent-viewed__title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: .9;
}
.recent-viewed__row {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
}
.recent-viewed__card {
    flex: 0 0 150px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform .2s, border-color .2s;
}
.recent-viewed__card:hover { transform: translateY(-3px); border-color: rgba(255,255,255,.25); }
.recent-viewed__media { aspect-ratio: 3/4; background: #111; }
.recent-viewed__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.recent-viewed__ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; opacity: .3; font-size: 1.4rem; }
.recent-viewed__info { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.recent-viewed__name { font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-viewed__price { font-size: .82rem; font-weight: 600; }

#backToTopBtn {
    position: fixed;
    right: 20px;
    bottom: 96px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.18);
    background: rgba(20,20,20,.9);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity .25s, transform .25s;
    z-index: 150;
    backdrop-filter: blur(6px);
}
#backToTopBtn.is-visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
#backToTopBtn:hover { background: rgba(40,40,40,.95); }
@media (min-width: 900px) { #backToTopBtn { bottom: 28px; } }
