/* ══════════════════════════════════════════════════════════════════════════
   TezAl.shop — Mobile Fixes (tap.az-style compact UI)
   Bu fayl yalnız mobil cihazlara tətbiq olunur (≤768px)
   ══════════════════════════════════════════════════════════════════════════ */

/* ── 1. HEADER — LIGHT/WHITE BACKGROUND for mobile ── */
@media (max-width: 768px) {
    .hdr {
        height: 52px !important;
        background: rgba(255,255,255,.98) !important;
        border-bottom: 1px solid rgba(0,0,0,.06) !important;
        backdrop-filter: blur(12px) !important;
        -webkit-backdrop-filter: blur(12px) !important;
    }
    [data-theme="dark"] .hdr {
        background: rgba(15,18,30,.97) !important;
        border-bottom: 1px solid rgba(255,255,255,.06) !important;
    }
    body { padding-top: 52px !important; }

    .hdr-inner { padding: 0 10px !important; gap: 8px !important; }

    .hdr-logo-icon { width: 28px !important; height: 28px !important; border-radius: 7px !important; }
    .hdr-logo { font-size: 17px !important; }

    /* Search bar compact */
    .hdr-search form { border-radius: 8px !important; }
    .hdr-search input { padding: 8px 10px !important; font-size: 13px !important; }
    .hdr-search i { font-size: 13px !important; padding: 0 0 0 10px !important; }

    /* Hamburger compact */
    .hdr-hamburger {
        width: 32px !important; height: 32px !important;
        border-radius: 7px !important; font-size: 16px !important;
    }
}

/* ── 2. BACK BUTTON for inner pages ── */
.hdr-back-btn {
    display: none;
    width: 32px; height: 32px; border-radius: 8px;
    background: transparent; border: none;
    color: var(--hdr-text); font-size: 18px;
    align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0;
    transition: background .15s;
    text-decoration: none;
}
.hdr-back-btn:hover { background: var(--hdr-btn-ghost-hover); }
@media (max-width: 768px) {
    body:not(.is-homepage) .hdr-back-btn { display: flex !important; }
    body:not(.is-homepage) .hdr-logo { display: none !important; }
}

/* ── 3. SPONSOR/REKLAM — HIDE on mobile ── */
@media (max-width: 768px) {
    /* Top banner */
    .sponsor-banner-top,
    [style*="REKLAM"],
    .banner-top-wrap {
        display: none !important;
    }
    /* Side banners already hidden at 960px, enforce */
    .side-banner, .side-banner-left, .side-banner-right {
        display: none !important;
    }
    /* Inline sponsor cards in listings */
    .lc-sponsor, .sponsor-inline-card {
        display: none !important;
    }
}

/* ── 4. CATEGORY GRID — compact horizontal scroll (tap.az style) ── */
@media (max-width: 768px) {
    .catalogue-section {
        padding: 12px 0 8px !important;
    }
    .catalogue-section h2 {
        font-size: 16px !important;
        margin-bottom: 10px !important;
        padding: 0 14px !important;
    }
    .catalogue-section .container {
        padding: 0 !important;
    }
    .catalogue-grid {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        scroll-snap-type: x mandatory !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        gap: 8px !important;
        padding: 0 14px 8px !important;
        scroll-behavior: smooth !important;
    }
    .catalogue-grid::-webkit-scrollbar { display: none !important; }
    .catalogue-item {
        flex: 0 0 72px !important;
        scroll-snap-align: start !important;
        padding: 8px 4px !important;
        border-radius: 10px !important;
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
    }
    .catalogue-item:hover {
        transform: none !important;
        box-shadow: none !important;
    }
    .catalogue-img {
        width: 44px !important; height: 44px !important;
        margin-bottom: 4px !important;
        background: var(--bg-secondary, #f1f5f9) !important;
        border-radius: 12px !important;
        padding: 6px !important;
    }
    [data-theme="dark"] .catalogue-img {
        background: rgba(255,255,255,.06) !important;
    }
    .catalogue-item p {
        font-size: 10px !important;
        height: auto !important;
        -webkit-line-clamp: 1 !important;
        min-height: unset !important;
        line-height: 1.2 !important;
    }
}

/* ── 5. LISTING CARDS — compact (tap.az style) ── */
@media (max-width: 768px) {
    .listings-grid {
        gap: 6px !important;
    }
    .lc-unified {
        border-radius: 10px !important;
    }
    .lcu-img {
        aspect-ratio: 1/1 !important;
    }
    .lcu-body {
        padding: 6px 8px 8px !important;
    }
    .lcu-title {
        font-size: 12px !important;
        margin: 0 0 3px !important;
        min-height: unset !important;
        -webkit-line-clamp: 2 !important;
        line-height: 1.35 !important;
    }
    .lcu-price {
        font-size: 13px !important;
        font-weight: 800 !important;
        margin-bottom: 2px !important;
    }
    .lcu-date {
        font-size: 10px !important;
    }
    .lcu-badge {
        font-size: 8px !important;
        padding: 1px 5px !important;
        top: 5px !important; left: 5px !important;
    }
    .lcu-loc {
        font-size: 9px !important;
        top: 5px !important; right: 5px !important;
        padding: 1px 5px !important;
    }
    .lcu-views {
        font-size: 9px !important;
        padding: 1px 5px !important;
        bottom: 5px !important; right: 5px !important;
    }

    /* Section titles */
    .section-title {
        font-size: 14px !important;
    }
    .listings-header {
        margin-bottom: 10px !important;
    }

    /* VIP section */
    #vipGrid {
        margin-bottom: 16px !important;
    }
}

/* ── 6. LISTINGS SECTION — reduce padding ── */
@media (max-width: 768px) {
    .listings-section {
        padding: 8px 0 80px !important;
    }
    .listings-section .container,
    .sticky-main {
        padding: 0 8px !important;
    }
}

/* ── 7. LOGIN PAGE — fix input focus scroll issue ── */
@media (max-width: 768px) {
    .auth-container {
        min-height: auto !important;
        height: auto !important;
        align-items: flex-start !important;
        padding-top: 20px !important;
        padding-bottom: 80px !important;
        overflow: visible !important;
    }
    body.auth-page, html.auth-page {
        overflow: auto !important;
        overflow-x: hidden !important;
    }
    .auth-card {
        max-width: 100% !important;
        border-radius: 16px !important;
        padding: 24px 18px !important;
        box-shadow: 0 8px 32px rgba(0,0,0,.12) !important;
        margin-bottom: 40px !important;
    }
    .auth-phone-input,
    .auth-pw-wrap input {
        font-size: 16px !important; /* prevent iOS zoom */
    }
}

/* ── 8. LINK BEHAVIOR — app-like (no URL bar flash) ── */
/* All internal links behave like buttons - prevent long-press menu, remove highlight */
@media (max-width: 768px) {
    a {
        -webkit-tap-highlight-color: transparent !important;
        -webkit-touch-callout: none !important;
    }
    /* Listing cards — no text select, no long press */
    .lc-unified,
    .catalogue-item,
    .mob-bn-item,
    .mob-nav-item {
        -webkit-user-select: none !important;
        user-select: none !important;
        -webkit-touch-callout: none !important;
    }
}

/* ── 9. BOTTOM NAV — compact ── */
@media (max-width: 768px) {
    .mob-bottom-nav {
        height: 52px !important;
    }
    .mob-bn-item { font-size: 10px !important; gap: 1px !important; }
    .mob-bn-item i { font-size: 18px !important; }
    .mob-bn-add-inner {
        width: 44px !important; height: 44px !important;
        font-size: 22px !important;
    }
    /* Ensure body has enough bottom padding for fixed nav */
    body { padding-bottom: calc(52px + env(safe-area-inset-bottom, 0)) !important; }
}

/* ── 10. GIVEAWAY SECTION — compact on mobile ── */
@media (max-width: 768px) {
    .giveaway-section {
        padding: 32px 0 !important;
    }
    .giveaway-section h2 {
        font-size: 22px !important;
    }
    .giveaway-section .container > div:nth-child(2) {
        margin-bottom: 28px !important;
    }
}

/* ── 11. SOLD SLIDER — compact ── */
@media (max-width: 768px) {
    .sold-section {
        padding: 10px 0 4px !important;
    }
    .sold-title {
        font-size: 14px !important;
        margin-bottom: 8px !important;
    }
}

/* ── 12. SEARCH PAGE — compact on mobile ── */
@media (max-width: 768px) {
    .search-container {
        padding: 8px !important;
    }
    .search-container .listings-grid {
        gap: 6px !important;
    }
}

/* ── 13. SUBTLE SCROLL — mobile smooth scroll everywhere ── */
@media (max-width: 768px) {
    * {
        scroll-behavior: smooth;
    }
    html {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }
}

/* ── 14. PROMO BANNER SLIDER (search-bitişik) — mobile only ── */
.promo-slider-wrap {
    display: none;
}
@media (max-width: 768px) {
    .promo-slider-wrap {
        display: block;
        margin: 0 0 6px;
        padding: 0 14px;
    }
    .promo-slider {
        position: relative;
        border-radius: 10px;
        overflow: hidden;
        height: 110px;
        background: var(--bg-secondary, #f1f5f9);
    }
    [data-theme="dark"] .promo-slider {
        background: rgba(255,255,255,.04);
    }
    .promo-slide {
        position: absolute;
        inset: 0;
        opacity: 0;
        transition: opacity .5s;
    }
    .promo-slide.active { opacity: 1; }
    .promo-slide a { display: block; height: 100%; }
    .promo-slide img {
        width: 100%; height: 100%;
        object-fit: cover; display: block;
    }
    .promo-slider-dots {
        position: absolute; bottom: 6px;
        left: 50%; transform: translateX(-50%);
        display: flex; gap: 4px; z-index: 2;
    }
    .promo-slider-dot {
        width: 6px; height: 6px; border-radius: 50%;
        background: rgba(255,255,255,.5);
        transition: all .3s;
        cursor: pointer;
    }
    .promo-slider-dot.active {
        width: 16px; border-radius: 4px;
        background: #fff;
    }
}

/* ── 15. FOOTER — hide on mobile (bottom nav replaces it) ── */
@media (max-width: 768px) {
    .ft {
        display: none !important;
    }
}

/* ── 16. FLASH MESSAGES — above bottom nav ── */
@media (max-width: 768px) {
    .flash-messages {
        bottom: 60px !important;
    }
}
