/*
 * Mobile-First Enhancements for LaraClassifier
 * Additive-only: these rules layer on top of Bootstrap 5 + the theme CSS.
 * Nothing here removes existing functionality — it only improves the UX
 * on small touch screens.
 */

/* =====================================================
   1. Mobile Bottom Navigation Bar
   ===================================================== */

.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1029;
    height: 60px;
    background: var(--bs-body-bg);
    border-top: 1px solid var(--bs-border-color);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
    display: none; /* shown only at ≤ md via @media below */
}

.mobile-bottom-nav .mnav-items {
    display: flex;
    height: 100%;
    align-items: stretch;
}

.mobile-bottom-nav .mnav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--bs-secondary-color);
    font-size: 0.6rem;
    letter-spacing: 0.02em;
    gap: 2px;
    min-height: 44px;
    transition: color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.mobile-bottom-nav .mnav-item i {
    font-size: 1.25rem;
    line-height: 1;
}

.mobile-bottom-nav .mnav-item.active {
    color: var(--bs-primary);
}

.mobile-bottom-nav .mnav-item:hover,
.mobile-bottom-nav .mnav-item:focus {
    color: var(--bs-primary);
    text-decoration: none;
    outline: none;
}

/* Unread badge on messages icon */
.mobile-bottom-nav .mnav-badge {
    position: absolute;
    top: 6px;
    left: calc(50% + 6px);
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    line-height: 16px;
    font-size: 0.55rem;
    border-radius: 8px;
    background: var(--bs-danger);
    color: #fff;
    text-align: center;
    pointer-events: none;
}

/* Center "Post Ad" circular button */
.mobile-bottom-nav .mnav-item-post {
    flex: 1.1;
    justify-content: flex-end;
    padding-bottom: 4px;
}

.mobile-bottom-nav .mnav-post-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--bs-primary);
    color: #fff !important;
    margin-top: -20px;
    box-shadow: 0 4px 14px rgba(var(--bs-primary-rgb), 0.45);
    text-decoration: none !important;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    -webkit-tap-highlight-color: transparent;
    font-size: 1.4rem;
    margin-bottom: 2px;
}

.mobile-bottom-nav .mnav-post-btn:hover,
.mobile-bottom-nav .mnav-post-btn:active {
    transform: scale(1.1);
    box-shadow: 0 6px 18px rgba(var(--bs-primary-rgb), 0.55);
    color: #fff !important;
}

.mobile-bottom-nav .mnav-post-label {
    font-size: 0.6rem;
    color: var(--bs-secondary-color);
    line-height: 1;
}

/* =====================================================
   2. Responsive Visibility
   ===================================================== */

@media (max-width: 767.98px) {

    /* Show the bottom nav */
    .mobile-bottom-nav {
        display: flex;
    }

    /* Pad body so content never hides behind the bar */
    body {
        padding-bottom: 60px;
    }

    /* ---- Header ---- */
    header .navbar {
        min-height: 54px;
        padding-top: 6px;
        padding-bottom: 6px;
    }

    .navbar-brand .main-logo {
        max-height: 34px !important;
        width: auto !important;
    }

    .navbar-toggler {
        min-width: 44px;
        min-height: 44px;
        padding: 8px;
    }

    .navbar-collapse .navbar-nav .nav-link,
    .navbar-collapse .navbar-nav .dropdown-toggle {
        min-height: 44px;
        display: flex;
        align-items: center;
        padding-top: 8px;
        padding-bottom: 8px;
    }

    .navbar-collapse .navbar-nav .btn {
        width: 100%;
        margin-bottom: 4px;
        min-height: 44px;
    }

    /* ---- Hero / Search form ---- */
    .hero-wrap {
        min-height: 240px;
        height: auto !important;
        padding: 24px 0;
    }

    .hero-wrap h1 {
        font-size: 1.5rem;
    }

    .hero-wrap h5 {
        font-size: 1rem;
    }

    /* Full-width search col in hero */
    .hero-wrap .col-9 {
        flex: 0 0 100%;
        max-width: 100%;
        padding-left: 12px;
        padding-right: 12px;
    }

    /* Bigger inputs */
    #searchForm .form-control,
    #searchForm .form-select,
    .home-search-form .form-control,
    .home-search-form .form-select {
        height: 46px;
        font-size: 1rem;
    }

    #searchForm .btn[type="submit"],
    .home-search-form .btn[type="submit"] {
        height: 46px;
        font-size: 1rem;
        width: 100%;
    }

    /* ---- Search results page ---- */

    /* Horizontal-scroll tab bar */
    #listingType {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    #listingType::-webkit-scrollbar {
        display: none;
    }

    #listingType .nav-item {
        white-space: nowrap;
    }

    /* ---- Listing cards ---- */
    .make-favorite.btn {
        min-height: 40px;
        padding: 6px 12px;
    }

    /* ---- Account pages ---- */

    /* Sidebar comes first on mobile via order, then it collapses nicely */
    .account-mobile-sidebar {
        margin-bottom: 16px;
    }

    .list-group-item {
        min-height: 48px;
        display: flex;
        align-items: center;
    }

    /* ---- Listing detail ---- */
    .items-details-wrapper {
        margin-bottom: 16px;
    }

    /* Back link + breadcrumb row */
    .main-container .container nav[aria-label="breadcrumb"] {
        float: none !important;
        margin-bottom: 4px;
    }

    .main-container .container .float-end {
        float: none !important;
        display: block;
        margin-bottom: 8px;
    }

    /* ---- Global tap targets ---- */
    .btn:not(.btn-xs):not(.btn-sm) {
        min-height: 44px;
    }

    .btn-sm {
        min-height: 38px;
    }

    .pagination .page-link {
        min-width: 40px;
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* ---- Footer ---- */
    footer .row-cols-2 > [class*="col-"] {
        padding: 8px 12px;
    }

    footer .social-media a i {
        font-size: 1.5rem;
    }

    /* ---- Modals ---- */
    .modal-dialog {
        margin: 8px auto;
        max-width: calc(100% - 16px);
    }

    /* ---- Cookie banner ---- */
    .cookie-consent {
        padding: 12px 16px;
        font-size: 0.8rem;
    }

    /* ---- Offcanvas sidebar ---- */
    .offcanvas {
        max-width: 88vw;
    }
}

/* =====================================================
   3. Tablet — Floating "Post Ad" FAB (768px – 991px)
   Useful for when the bottom nav is hidden but a quick
   CTA is still helpful before the full desktop layout.
   ===================================================== */

@media (min-width: 768px) and (max-width: 991.98px) {

    .mobile-fab-post {
        position: fixed;
        bottom: 24px;
        right: 20px;
        z-index: 1000;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
    }

    .mobile-fab-post a {
        width: 54px;
        height: 54px;
        border-radius: 50%;
        background: var(--bs-primary);
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.5rem;
        box-shadow: 0 4px 16px rgba(var(--bs-primary-rgb), 0.4);
        text-decoration: none;
        transition: transform 0.18s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-fab-post a:hover {
        transform: scale(1.1);
        color: #fff;
    }
}

/* Hide FAB on mobile (bottom nav handles it) and desktop */
@media (max-width: 767.98px), (min-width: 992px) {
    .mobile-fab-post {
        display: none !important;
    }
}

/* =====================================================
   4. Small-screen grid — 1 column below 400 px
   ===================================================== */

@media (max-width: 399.98px) {
    .grid-view.row {
        --bs-gutter-x: 4px;
    }

    .grid-view .col {
        flex: 0 0 100%;
        max-width: 100%;
    }
}
