/* =================================================================
   OGLAS1 — MOBILE STYLESHEET (drop-in)
   Activates only at <= 768px width.
   Matches the app-style mockup: hamburger header, search bar,
   category chip scroller, hero card, listing cards with heart,
   quick-access category tiles, trust strip, bottom tab bar.
================================================================= */

@media (max-width: 768px) {

    /* ---------- GLOBAL ---------- */
    body {
        background: #F6F2ED;
        padding-bottom: 90px; /* space for bottom tab bar */
        -webkit-tap-highlight-color: transparent;
    }
    .container { width: 92%; }

    /* hide the desktop-only big stuff on mobile */
    .hero-cards,
    .vehicle-filter-bar,
    .hero-tag,
    .quick-tags,
    .features,
    .lang-dropdown { display: none !important; }

    /* ---------- HEADER ---------- */
    .navbar {
        height: 62px;
        background: rgba(255,255,255,.95);
        backdrop-filter: blur(14px);
        border-bottom: 1px solid rgba(0,0,0,.05);
    }
    .nav-container, .nav-inner {
        width: 94% !important;
        display: flex !important;
        align-items: center;
        gap: 10px !important;
    }
    .nav-container .logo, .nav-inner .logo {
        font-size: 30px;
        letter-spacing: -2.5px;
        font-weight: 900;
        margin-right: auto;
    }
    .nav-container .logo span,
    .nav-inner .logo span { color: #E85A32; }

    /* mobile hamburger menu button (injected via JS or you can leave space) */
    .mobile-menu-btn {
        width: 38px; height: 38px;
        border: none; background: transparent;
        display: flex; flex-direction: column;
        justify-content: center; gap: 4px;
        cursor: pointer; padding: 0;
    }
    .mobile-menu-btn span {
        display: block; width: 22px; height: 2.5px;
        background: #141210; border-radius: 2px;
    }

    /* hide messages/dashboard link, keep only Post Ad pill */
    .nav-right, .nav-actions {
        gap: 0 !important;
    }
    .nav-right .btn-light,
    .nav-actions .btn-light,
    .nav-right a[href*="messages"],
    .nav-right a[href*="dashboard"] {
        display: none !important;
    }
    .nav-right .btn-primary,
    .nav-actions .btn-primary {
        height: 40px !important;
        padding: 0 18px !important;
        font-size: 13px !important;
        font-weight: 800 !important;
        border-radius: 999px !important;
        background: #E85A32 !important;
        color: #fff !important;
        box-shadow: 0 6px 16px rgba(232,90,50,.28) !important;
        display: inline-flex !important;
        align-items: center;
        gap: 5px;
    }
    .nav-right .btn-primary::before,
    .nav-actions .btn-primary::before {
        content: "+";
        font-size: 18px;
        font-weight: 700;
        line-height: 1;
        margin-right: 2px;
    }

    /* ---------- HERO area (search + orange card) ---------- */
    .hero {
        padding: 80px 0 0 !important;
        background: #F6F2ED;
    }
    .hero-container {
        display: block !important;
        gap: 0 !important;
        padding: 0;
    }
    /* hide desktop hero headline & subtext, we'll use the orange card */
    .hero h1, .hero > .hero-container > div > p,
    .hero-container > div > p { display: none; }

    /* search bar — single row, pill style */
    .search-box {
        background: #fff !important;
        backdrop-filter: none !important;
        border-radius: 18px !important;
        padding: 6px !important;
        display: flex !important;
        grid-template-columns: none !important;
        gap: 8px !important;
        box-shadow: 0 8px 24px rgba(0,0,0,.05) !important;
        margin: 0 0 18px 0;
        align-items: center;
    }
    .search-box .search-field {
        flex: 1;
        background: transparent !important;
        padding: 10px 8px 10px 38px !important;
        border-radius: 14px !important;
        position: relative;
    }
    .search-box .search-field:first-child::before {
        content: "";
        position: absolute;
        left: 14px; top: 50%;
        width: 18px; height: 18px;
        transform: translateY(-50%);
        background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") center/contain no-repeat;
    }
    /* hide cat/location fields in main mobile search — they go in filter sheet */
    .search-box .search-field:nth-child(2),
    .search-box .search-field:nth-child(3) { display: none; }
    .search-box .search-field label { display: none; }
    .search-box .search-field input {
        font-size: 15px !important;
        font-weight: 500 !important;
        color: #141210 !important;
        background: transparent;
    }
    .search-box .search-field input::placeholder { color: #999; font-weight: 500; }

    /* filter (sliders) button replaces "Search" button */
    .search-box .search-button {
        width: 44px !important;
        height: 44px !important;
        padding: 0 !important;
        border-radius: 12px !important;
        background: #fff !important;
        color: transparent !important;
        border: 1px solid rgba(0,0,0,.08) !important;
        box-shadow: none !important;
        flex-shrink: 0;
        position: relative;
        font-size: 0 !important;
    }
    .search-box .search-button::after {
        content: "";
        position: absolute;
        inset: 0;
        background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23141210' stroke-width='2.2' stroke-linecap='round'><line x1='4' y1='6' x2='14' y2='6'/><circle cx='17' cy='6' r='2.2'/><line x1='10' y1='12' x2='20' y2='12'/><circle cx='7' cy='12' r='2.2'/><line x1='4' y1='18' x2='14' y2='18'/><circle cx='17' cy='18' r='2.2'/></svg>") center/22px no-repeat;
    }

    /* ---------- CATEGORY CHIP SCROLLER (injected by mobile.js) ---------- */
    .m-cat-strip {
        display: flex;
        gap: 22px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        padding: 4px 4% 18px;
        margin: 0 -4%;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .m-cat-strip::-webkit-scrollbar { display: none; }
    .m-cat-strip .m-cat {
        flex: 0 0 auto;
        display: flex; flex-direction: column;
        align-items: center; gap: 8px;
        font-size: 12px; font-weight: 700;
        color: #141210;
        text-decoration: none;
        min-width: 56px;
        scroll-snap-align: start;
    }
    .m-cat-strip .m-cat .m-cat-icon {
        width: 54px; height: 54px;
        border-radius: 50%;
        background: #fff;
        display: flex; align-items: center; justify-content: center;
        font-size: 22px;
        box-shadow: 0 6px 14px rgba(0,0,0,.04);
    }
    .m-cat-strip .m-cat.active .m-cat-icon {
        background: linear-gradient(135deg, #FFE3D7, #FFCBB6);
    }
    .m-cat-strip .m-cat.active { color: #E85A32; }

    /* ---------- ORANGE HERO CARD (injected) ---------- */
    .m-hero-card {
        background: linear-gradient(135deg, #FFE6D8 0%, #FFD3BD 100%);
        border-radius: 24px;
        padding: 26px 24px;
        margin-bottom: 28px;
        position: relative;
        overflow: hidden;
        display: flex;
        align-items: center;
    }
    .m-hero-card-text { flex: 1; max-width: 60%; }
    .m-hero-card h2 {
        font-size: 26px;
        font-weight: 900;
        line-height: 1.05;
        letter-spacing: -1.2px;
        margin-bottom: 10px;
        color: #141210;
    }
    .m-hero-card h2 .m-accent { color: #E85A32; display: block; }
    .m-hero-card p {
        font-size: 13px;
        line-height: 1.45;
        color: #4a3f37;
        margin-bottom: 18px;
        font-weight: 500;
    }
    .m-hero-card .m-hero-cta {
        display: inline-block;
        background: #E85A32;
        color: #fff;
        font-weight: 800;
        font-size: 13px;
        padding: 12px 22px;
        border-radius: 14px;
        text-decoration: none;
        box-shadow: 0 8px 18px rgba(232,90,50,.28);
    }
    .m-hero-card .m-hero-art {
        position: absolute;
        right: -10px; top: 50%;
        transform: translateY(-50%);
        width: 140px; height: 140px;
        opacity: .95;
    }

    /* ---------- FEATURED SECTION ---------- */
    .featured-section {
        padding: 8px 0 0 !important;
    }
    .featured-inner {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
    }
    .featured-header {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 10px !important;
        margin-bottom: 14px !important;
    }
    .featured-eyebrow { display: none !important; }
    .featured-header h2 {
        font-size: 20px !important;
        font-weight: 900 !important;
        letter-spacing: -0.6px !important;
        line-height: 1.1 !important;
        margin: 0 !important;
        color: #141210 !important;
    }
    .featured-header h2 br { display: none; }
    .featured-header h2 span { color: #141210 !important; }
    .featured-header > div p,
    .featured-header-left p { display: none; }
    .featured-view-all {
        background: transparent !important;
        border: none !important;
        color: #E85A32 !important;
        font-size: 13px !important;
        font-weight: 800 !important;
        padding: 0 !important;
        height: auto !important;
    }
    .featured-view-all:hover { background: transparent !important; transform: none !important; }

    /* featured grid → horizontal scroll on mobile (like an app carousel) */
    .featured-grid,
    .featured-grid.six-col,
    .featured-grid.two-col,
    .featured-grid.one-col {
        display: flex !important;
        flex-direction: row !important;
        gap: 14px !important;
        grid-template-columns: none !important;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        margin: 0 -4% 26px;
        padding: 4px 4% 8px;
    }
    .featured-grid::-webkit-scrollbar,
    .featured-grid.six-col::-webkit-scrollbar,
    .featured-grid.two-col::-webkit-scrollbar,
    .featured-grid.one-col::-webkit-scrollbar { display: none; }

    .featured-card {
        background: #fff !important;
        border-radius: 20px !important;
        overflow: hidden !important;
        box-shadow: 0 8px 20px rgba(0,0,0,.05) !important;
        position: relative;
        grid-row: span 1 !important;
        flex: 0 0 78%;
        scroll-snap-align: start;
    }
    .featured-card-img,
    .featured-card img:first-of-type {
        height: 180px !important;
        object-fit: cover;
    }
    .featured-card .featured-card-content,
    .featured-card-body,
    .featured-card-content {
        padding: 14px 16px 16px !important;
    }
    .featured-card .price,
    .featured-card-price {
        font-size: 20px !important;
        font-weight: 900 !important;
        letter-spacing: -0.8px !important;
        margin-bottom: 4px !important;
    }
    .featured-card .card-title,
    .featured-card-title {
        font-size: 14px !important;
        font-weight: 700 !important;
        margin-bottom: 6px !important;
        color: #141210;
    }
    .featured-card .location,
    .featured-card-location {
        font-size: 12px !important;
        color: #777 !important;
        display: flex;
        align-items: center;
        gap: 4px;
    }
    .featured-card .location::before,
    .featured-card-location::before {
        content: "";
        width: 12px; height: 12px;
        background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23E85A32' stroke-width='2.4'><path d='M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z'/><circle cx='12' cy='10' r='3'/></svg>") center/contain no-repeat;
        flex-shrink: 0;
    }

    /* heart favorite button on every card */
    .featured-card::after {
        content: "";
        position: absolute;
        top: 12px; right: 12px;
        width: 34px; height: 34px;
        background: rgba(255,255,255,.92);
        border-radius: 50%;
        background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23141210' stroke-width='2'><path d='M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z'/></svg>");
        background-repeat: no-repeat;
        background-position: center;
        background-size: 18px;
        box-shadow: 0 4px 10px rgba(0,0,0,.08);
        z-index: 3;
        pointer-events: none;
    }

    /* trending / search-results grid (the "section" block) */
    .listings-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
    }
    .section { padding: 30px 0 !important; }
    .section-header {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        margin-bottom: 14px !important;
    }
    .section-header h2 {
        font-size: 20px !important;
        letter-spacing: -0.6px !important;
        margin-bottom: 0 !important;
    }
    .section-header p { display: none; }
    .product-card {
        border-radius: 18px !important;
        overflow: hidden;
        background: #fff;
        box-shadow: 0 8px 18px rgba(0,0,0,.04);
        position: relative;
    }
    .product-card img { height: 130px !important; object-fit: cover; }
    .product-card .product-content { padding: 12px 14px 14px !important; }
    .product-card .price { font-size: 17px !important; margin-bottom: 4px; letter-spacing: -0.5px; }
    .product-card .card-title { font-size: 13px !important; line-height: 1.3; margin-bottom: 6px; }
    .product-card .card-bottom { font-size: 11px !important; }

    /* ---------- QUICK CATEGORY TILES (injected) ---------- */
    .m-quick-tiles {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
        margin: 0 0 26px 0;
    }
    .m-quick-tile {
        background: #fff;
        border-radius: 16px;
        padding: 14px 8px;
        display: flex; flex-direction: column;
        align-items: flex-start; justify-content: center;
        text-decoration: none;
        color: #141210;
        box-shadow: 0 6px 14px rgba(0,0,0,.03);
        gap: 4px;
        min-height: 72px;
    }
    .m-quick-tile .m-qt-icon {
        width: 28px; height: 28px;
        border-radius: 8px;
        background: #FFF1EA;
        display: flex; align-items: center; justify-content: center;
        font-size: 14px;
        margin-bottom: 4px;
    }
    .m-quick-tile .m-qt-label {
        font-size: 12px; font-weight: 800; line-height: 1;
    }
    .m-quick-tile .m-qt-count {
        font-size: 11px; color: #888; font-weight: 600;
    }

    /* ---------- TRUST STRIP (injected) ---------- */
    .m-trust-strip {
        background: #fff;
        border-radius: 18px;
        padding: 18px 14px;
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        gap: 8px;
        margin-bottom: 24px;
        box-shadow: 0 6px 14px rgba(0,0,0,.03);
    }
    .m-trust-item {
        display: flex; flex-direction: column;
        align-items: center; text-align: center;
        gap: 6px;
        padding: 0 4px;
    }
    .m-trust-item .m-trust-icon {
        width: 32px; height: 32px;
        border-radius: 50%;
        display: flex; align-items: center; justify-content: center;
        font-size: 16px;
    }
    .m-trust-item:nth-child(1) .m-trust-icon { background: #FFEEE5; }
    .m-trust-item:nth-child(2) .m-trust-icon { background: #E8F8EE; }
    .m-trust-item:nth-child(3) .m-trust-icon { background: #E6F0FF; }
    .m-trust-item h4 {
        font-size: 11px; font-weight: 900;
        line-height: 1.2; color: #141210; margin: 0;
    }
    .m-trust-item p {
        font-size: 10px; color: #888; line-height: 1.3;
        font-weight: 500; margin: 0;
    }

    /* ---------- FOOTER — hide on mobile, replaced by tab bar ---------- */
    footer { display: none !important; }

    /* ---------- BOTTOM TAB BAR (injected) ---------- */
    .m-tabbar {
        position: fixed;
        bottom: 0; left: 0; right: 0;
        height: 78px;
        background: #fff;
        border-top: 1px solid rgba(0,0,0,.06);
        display: flex;
        justify-content: space-around;
        align-items: center;
        padding: 6px 8px 14px;
        z-index: 998;
        box-shadow: 0 -4px 20px rgba(0,0,0,.04);
    }
    .m-tabbar .m-tab {
        flex: 1;
        display: flex; flex-direction: column;
        align-items: center; gap: 4px;
        text-decoration: none;
        color: #888;
        font-size: 11px; font-weight: 700;
        padding: 4px 0;
        position: relative;
    }
    .m-tabbar .m-tab svg {
        width: 22px; height: 22px;
        stroke-width: 2;
    }
    .m-tabbar .m-tab.active { color: #E85A32; }
    .m-tabbar .m-tab.active svg { stroke: #E85A32; fill: none; }

    /* floating center "Post" button */
    .m-tabbar .m-tab-post {
        position: relative;
        margin-top: -28px;
    }
    .m-tabbar .m-tab-post .m-tab-post-btn {
        width: 56px; height: 56px;
        border-radius: 50%;
        background: #E85A32;
        display: flex; align-items: center; justify-content: center;
        box-shadow: 0 10px 22px rgba(232,90,50,.45);
        color: #fff;
        font-size: 28px; font-weight: 300;
        line-height: 1;
    }
    .m-tabbar .m-tab-post .m-tab-label {
        margin-top: 4px;
        color: #888;
    }

    /* ---------- DRAWER MENU (slides from left for hamburger) ---------- */
    .m-drawer {
        position: fixed;
        top: 0; left: 0;
        width: 78%; max-width: 320px; height: 100vh;
        background: #fff;
        z-index: 1001;
        transform: translateX(-100%);
        transition: transform .28s ease;
        padding: 24px 22px;
        box-shadow: 4px 0 30px rgba(0,0,0,.1);
        overflow-y: auto;
    }
    .m-drawer.open { transform: translateX(0); }
    .m-drawer-overlay {
        position: fixed; inset: 0;
        background: rgba(0,0,0,.4);
        z-index: 1000;
        opacity: 0; pointer-events: none;
        transition: opacity .25s;
    }
    .m-drawer-overlay.open { opacity: 1; pointer-events: auto; }
    .m-drawer h3 {
        font-size: 22px; font-weight: 900;
        letter-spacing: -1px; margin-bottom: 18px;
    }
    .m-drawer h3 span { color: #E85A32; }
    .m-drawer a {
        display: flex; align-items: center; gap: 12px;
        padding: 14px 4px;
        font-size: 15px; font-weight: 700;
        color: #141210; text-decoration: none;
        border-bottom: 1px solid rgba(0,0,0,.05);
    }
    .m-drawer a:last-child { border-bottom: none; }
    .m-drawer-lang {
        display: flex; gap: 10px; margin-top: 20px;
        padding-top: 16px; border-top: 1px solid rgba(0,0,0,.06);
    }
    .m-drawer-lang a {
        flex: 1; justify-content: center;
        padding: 10px 0; font-size: 13px;
        background: #F5F1EB; border-radius: 12px;
        border-bottom: none;
    }
    .m-drawer-lang a.active {
        background: #E85A32; color: #fff;
    }

    /* Auth buttons in drawer (logged-out state) — Sign in is highlighted */
    .m-drawer .m-drawer-auth {
        margin: 6px 0;
        padding: 14px 16px;
        border-radius: 14px;
        border-bottom: none;
        font-weight: 800;
        justify-content: flex-start;
        background: #F5F1EB;
    }
    .m-drawer .m-drawer-auth-primary {
        background: #E85A32;
        color: #fff;
        box-shadow: 0 8px 18px rgba(232,90,50,.28);
    }
    .m-drawer .m-drawer-auth-primary:hover { color: #fff; }

    /* ---------- LISTINGS PAGE specific ---------- */
    .layout {
        grid-template-columns: 1fr !important;
        gap: 0 !important;
    }
    .filters {
        position: relative !important;
        top: 0 !important;
        padding: 18px !important;
        border-radius: 18px !important;
    }
    .page-header h1 {
        font-size: 26px !important;
        letter-spacing: -0.8px !important;
        margin-bottom: 8px !important;
    }
    .grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
    }
    .grid .card img { height: 130px !important; }
    .grid .card-price { font-size: 17px !important; }
    .grid .card-title { font-size: 13px !important; }
    .page { padding-top: 80px !important; }
}

/* extra small screens */
@media (max-width: 380px) {
    .m-quick-tiles { grid-template-columns: repeat(3, 1fr); }
    .featured-card-img,
    .featured-card img:first-of-type { height: 160px !important; }
    .m-hero-card h2 { font-size: 23px; }
    .m-hero-card-text { max-width: 65%; }
}
