/* =========================================================================
   App-like mobile enhancement layer  (additive – loaded after main/custom)
   Scoped to touch/handset widths so the desktop design is untouched.
   Author: frontend mobile-app pass
   ========================================================================= */

:root {
    --app-nav-h: 64px;
    --app-radius: 18px;
    --app-shadow: 0 -6px 24px rgba(0, 0, 0, .35);
    --app-surface: #0f0f0f;
    --app-surface-2: #1b1b1b;
    --app-border: rgba(255, 255, 255, .08);
    --app-muted: rgba(255, 255, 255, .55);
}

/* ---------- Bottom Tab Bar (mobile app navigation) ---------------------- */
.app-bottom-nav {
    display: none;
}

@media (max-width: 991px) {

    /* keep page content clear of the fixed bar + iOS home indicator */
    body {
        padding-bottom: calc(var(--app-nav-h) + env(safe-area-inset-bottom, 0px));
    }

    .app-bottom-nav {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1040;
        height: calc(var(--app-nav-h) + env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
        align-items: stretch;
        justify-content: space-around;
        background: rgba(15, 15, 15, .92);
        -webkit-backdrop-filter: saturate(160%) blur(14px);
        backdrop-filter: saturate(160%) blur(14px);
        border-top: 1px solid var(--app-border);
        box-shadow: var(--app-shadow);
    }

    .app-bottom-nav__item {
        flex: 1 1 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 8px 2px 6px;
        color: var(--app-muted);
        font-size: 10.5px;
        font-weight: 500;
        line-height: 1;
        text-decoration: none;
        letter-spacing: .2px;
        position: relative;
        transition: color .2s ease, transform .12s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .app-bottom-nav__item i {
        font-size: 22px;
        line-height: 1;
    }

    .app-bottom-nav__item:active {
        transform: scale(.9);
    }

    .app-bottom-nav__item.active {
        color: hsl(var(--base));
    }

    /* little active indicator dot / pill above the icon */
    .app-bottom-nav__item.active::before {
        content: "";
        position: absolute;
        top: 0;
        width: 26px;
        height: 3px;
        border-radius: 0 0 4px 4px;
        background: hsl(var(--base));
    }

    /* raised center action (Cart) — FAB feel */
    .app-bottom-nav__item--center {
        flex: 0 0 auto;
        margin-top: -22px;
    }

    .app-bottom-nav__fab {
        width: 56px;
        height: 56px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        background: linear-gradient(135deg, hsl(var(--base)), hsl(var(--base-2, var(--base))));
        color: #fff;
        box-shadow: 0 8px 20px hsl(var(--base) / .45);
        border: 4px solid var(--app-surface);
    }

    .app-bottom-nav__fab i {
        font-size: 26px;
    }

    .app-bottom-nav__item--center .app-bottom-nav__label {
        margin-top: 4px;
    }

    /* cart count badge on the fab */
    .app-bottom-nav__badge {
        position: absolute;
        top: -4px;
        right: calc(50% - 30px);
        min-width: 20px;
        height: 20px;
        padding: 0 5px;
        border-radius: 10px;
        background: #e5352b;
        color: #fff;
        font-size: 11px;
        font-weight: 700;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 2px solid var(--app-surface);
    }

    /* keep the scroll-to-top button above the bar */
    .scroll-top {
        bottom: calc(var(--app-nav-h) + 18px) !important;
    }
}

/* ---------- App-like header on mobile ----------------------------------- */
@media (max-width: 991px) {
    .header {
        position: sticky;
        top: 0;
        z-index: 1030;
        -webkit-backdrop-filter: blur(10px);
        backdrop-filter: blur(10px);
    }

    .header .navbar {
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .navbar-brand.logo img {
        max-height: 40px;
        width: auto;
    }

    /* off-canvas style slide-down menu polish */
    .navbar-collapse {
        margin-top: 10px;
        background: var(--app-surface-2);
        border: 1px solid var(--app-border);
        border-radius: var(--app-radius);
        padding: 10px 14px;
    }

    .nav-menu .nav-link {
        padding: 12px 4px !important;
        border-bottom: 1px solid var(--app-border);
    }

    .header-button {
        font-size: 26px;
        line-height: 1;
        padding: 4px 8px;
    }
}

/* ---------- Touch-friendly cards & buttons ------------------------------ */
@media (max-width: 991px) {

    /* tighten oversized desktop section padding on phones */
    .pt-120 { padding-top: 48px !important; }
    .pb-120 { padding-bottom: 48px !important; }
    .pt-60  { padding-top: 36px !important; }
    .pb-60  { padding-bottom: 36px !important; }

    .competition-item {
        border-radius: var(--app-radius);
        overflow: hidden;
        transition: transform .12s ease, box-shadow .2s ease;
        box-shadow: 0 4px 18px rgba(0, 0, 0, .12);
    }

    .competition-item:active {
        transform: scale(.985);
    }

    .competition-item__thumb img {
        width: 100%;
        aspect-ratio: 16 / 10;
        object-fit: cover;
    }

    /* comfy, thumb-reachable primary buttons */
    .cmn--btn,
    .btn--md,
    .btn {
        min-height: 46px;
        border-radius: 12px;
    }

    .cmn--btn.w-100 {
        font-size: 15px;
    }

    /* countdown chips read better small */
    .remaining-time__content .box {
        padding: 6px 4px;
    }

    /* make tables behave like stacked cards is already handled by theme;
       just add breathing room */
    .table-responsive {
        border-radius: var(--app-radius);
    }
}

/* ---------- Smooth momentum scrolling & no horizontal spill ------------- */
@media (max-width: 991px) {
    html, body {
        overflow-x: hidden;
    }
    body {
        -webkit-overflow-scrolling: touch;
    }
}

/* ---------- Respect users who dislike motion --------------------------- */
@media (prefers-reduced-motion: reduce) {
    .app-bottom-nav__item,
    .competition-item {
        transition: none;
    }
}
