/* ===== CSS Variables — теми ===== */
:root {
    --bg:           #0d0d0d;
    --surface:      #1a1a1a;
    --surface-2:    #242424;
    --border:       #2a2a2a;
    --text:         #f0f0f0;
    --text-muted:   #888;
    --accent:       #22c55e;
    --accent-hover: #16a34a;
    --price:        #ffffff;
    --shadow:       rgba(0, 0, 0, 0.4);
    --logo-shadow:  rgba(0, 0, 0, 1);
    --header-blur:  rgba(13, 13, 13, 0.65);
}

[data-theme="light"] {
    --bg:           #f0f0f0;
    --surface:      #ffffff;
    --surface-2:    #f8f8f8;
    --border:       #e0e0e0;
    --text:         #111111;
    --text-muted:   #6b7280;
    --accent:       #16a34a;
    --accent-hover: #15803d;
    --price:        #111111;
    --shadow:       rgba(0, 0, 0, 0.1);
    --logo-shadow:  rgba(0, 0, 0, 0.2);
    --header-blur:  rgba(240, 240, 240, 0.9);
}

/* ===== Reset ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    transition: background 0.2s, color 0.2s;
}

a { text-decoration: none; color: inherit; }

/* ===== Icons ===== */
.icon {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}
.theme-toggle { color: var(--text); }


/* ===== Header ===== */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--header-blur);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.logo {
    color: var(--text);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.logo-img {
    height: 63px;
    width: auto;
    display: block;
    margin-top: -5px;
    margin-bottom: -27px;
    filter: drop-shadow(0 3px 5px var(--logo-shadow));
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-tagline {
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    color: var(--text-muted);
}

.logo-since {
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: background 0.15s, transform 0.1s;
    white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-ghost {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-ghost:hover { background: var(--border); }

.theme-toggle {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
}

.theme-toggle:hover { background: var(--border); }

/* ===== Main ===== */
.main {
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px 16px 60px;
}

.total-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}


/* ===== Bottom nav (mobile sticky) ===== */
.bottom-nav {
    display: none;
}

@media (max-width: 767px) {
    .toolbar { display: none; }
    .filters { display: none; }
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 200;
        background: rgba(13, 13, 13, 0.55);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-top: 1px solid var(--border);
        padding: 10px 16px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
        gap: 10px;
    }
    .bottom-nav-btn {
        flex: 1;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 10px 8px;
        border-radius: 12px;
        font-size: 0.85rem;
        font-weight: 600;
        color: var(--text-muted);
        background: var(--surface-2);
        border: 1px solid var(--border);
    }
    .bottom-nav-btn.bottom-nav-primary {
        background: var(--accent);
        color: #fff;
        border-color: var(--accent);
    }
    .bottom-nav-icon { font-size: 1rem; }
    .main { padding-bottom: 120px; }
}


/* ===== Grid ===== */
.grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (min-width: 580px) {
    .grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
}

@media (min-width: 900px) {
    .grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
}

@media (min-width: 1200px) {
    .grid { grid-template-columns: repeat(5, 1fr); }
}

/* ===== Card ===== */
.card {
    background: var(--surface);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px var(--shadow);
}

/* ===== Photo ===== */
@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.card-photo-wrap {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1;
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface) 50%, var(--surface-2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.card-photo-wrap.loaded {
    background: none;
    animation: none;
}

.card-photo {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}

.card-photo.loaded {
    opacity: 1;
}

.card:hover .card-photo {
    transform: scale(1.04);
}

.card-photo.placeholder {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    opacity: 1;
    background: var(--surface-2);
}
.card-photo.placeholder svg {
    width: 72px;
    height: 72px;
    opacity: 0.13;
}

/* ===== Badges ===== */
.badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    backdrop-filter: blur(4px);
}

.badge-sell  { background: rgba(34, 197, 94, 0.9);  color: #fff; }
.badge-buy   { background: rgba(59, 130, 246, 0.9);  color: #fff; }
.badge-trade { background: rgba(245, 158, 11, 0.9);  color: #fff; }

/* ===== Card Body ===== */
.card-body {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.card-category {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    margin-top: 6px;
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.card-price {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent);
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-city {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex: 0 0 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 45%;
}

.card-author {
    position: absolute;
    bottom: 6px;
    right: 8px;
    font-size: 0.68rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(4px);
    padding: 2px 6px;
    border-radius: 5px;
}

/* ===== Load more ===== */
.load-more-wrap {
    display: flex;
    justify-content: center;
    margin-top: 32px;
}

.load-more {
    padding: 12px 40px;
    font-size: 0.95rem;
}

/* ===== Empty ===== */
.empty {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.empty-icon { font-size: 3rem; }

/* ===== Mobile tweaks ===== */
@media (max-width: 400px) {
    .btn-ghost.search-btn { display: none; }
    .card-title { font-size: 0.8rem; }
    .card-price { font-size: 0.875rem; }
}

/* ===== Listing page ===== */
.listing-main { padding-top: 12px; }

/* ===== Icon helpers ===== */
.icon-muted { color: var(--text-muted); }

/* ===== Sticky CTA (listing, mobile only) ===== */
.sticky-cta {
    display: none;
}

@media (max-width: 767px) {
    .sticky-cta {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        box-sizing: border-box;
        z-index: 200;
        background: rgba(13, 13, 13, 0.85);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-top: 1px solid var(--border);
        padding: 10px 16px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
        gap: 10px;
        transition: transform 0.25s ease;
    }
    .sticky-cta.hidden {
        transform: translateY(110%);
    }
    .sticky-cta-write {
        flex: 1;
        justify-content: center;
        gap: 8px;
        padding: 12px 16px;
        font-size: 0.95rem;
        min-width: 0;
    }
    .sticky-cta-label {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .sticky-cta-share {
        flex-shrink: 0;
        width: 48px;
        height: 48px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 12px;
    }
    /* На listing ховаємо стандартний bottom-nav */
    body.page-listing #bottomNav {
        display: none !important;
    }
    .listing-main { padding-bottom: 90px; }
}

[data-theme="light"] .sticky-cta {
    background: rgba(240, 240, 240, 0.92);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 16px;
    transition: color 0.15s;
}
.back-link:hover { color: var(--text); }

/* Layout: mobile = column, desktop = side by side */
.listing-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 24px;
}

@media (min-width: 768px) {
    .listing-layout {
        flex-direction: row;
        align-items: flex-start;
        gap: 32px;
    }
    .listing-gallery { width: 50%; flex-shrink: 0; position: sticky; top: 80px; }
    .listing-info    { flex: 1; }
}

/* ===== Gallery ===== */
.gallery-wrap {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    background: var(--surface-2);
    aspect-ratio: 1;
}
.gallery-wrap.multi { cursor: pointer; }

.gallery-placeholder {
    aspect-ratio: 1;
    border-radius: 16px;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
}
.gallery-placeholder svg {
    width: 96px;
    height: 96px;
    opacity: 0.13;
}

.gallery-slide {
    display: none;
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
}
.gallery-slide.active { display: block; }

/* Shimmer поки фото не завантажилось */
.gallery-slide::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface) 50%, var(--surface-2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    z-index: 0;
}
.gallery-slide.loaded::before { display: none; }

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.gallery-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    position: relative;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.gallery-img.loaded { opacity: 1; }

.gallery-btn {
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 10;
    background: transparent;
    border: none;
    color: #fff;
    width: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.gallery-btn-inner {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    line-height: 1;
    transition: background 0.15s;
}
.gallery-btn:hover .gallery-btn-inner { background: rgba(0,0,0,0.7); }
.gallery-prev { left: 0; }
.gallery-next { right: 0; }

.gallery-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 10;
}
.gallery-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255,255,255,0.45);
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
}
.gallery-dot.active {
    background: #fff;
    transform: scale(1.3);
}

.gallery-counter {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(4px);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    z-index: 10;
}

/* ===== Listing info panel ===== */
.listing-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.listing-category {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.listing-views {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.listing-title {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 10px;
}

@media (min-width: 768px) {
    .listing-title { font-size: 1.4rem; }
}

.listing-price {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 8px;
}

.listing-city {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ===== Type label above title ===== */
.listing-type-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

/* ===== Specs pills ===== */
.listing-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0 0;
}

.spec-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 0.82rem;
    color: var(--text);
    line-height: 1.3;
}

.spec-pill-label {
    color: var(--text-muted);
    font-weight: 500;
}

/* ===== Description ===== */
.listing-description {
    font-size: 0.875rem;
    line-height: 1.7;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
}

/* ===== Meta bottom (date + views) ===== */
.listing-meta-bottom {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.listing-date {
    color: var(--text-muted);
}

.listing-divider {
    height: 1px;
    background: var(--border);
    margin: 16px 0;
}

/* ===== Seller block ===== */
.seller-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.seller-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 600;
}

.seller-info { display: flex; flex-direction: column; gap: 4px; }

.seller-name {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
    font-weight: 600;
}
.seller-name a { color: var(--accent); display: flex; align-items: center; gap: 6px; }
.seller-name a:hover { text-decoration: underline; }

.seller-stats {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}


/* ===== CTA buttons ===== */
.listing-cta {
    width: 100%;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    font-size: 0.95rem;
    border-radius: 14px;
    margin-bottom: 8px;
}

.listing-tg-link {
    width: 100%;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    font-size: 0.95rem;
    border-radius: 14px;
}


/* ===== Similar listings ===== */
.similar-section { margin-top: 8px; }

.similar-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--text);
}

/* ===== Desktop nav ===== */
.nav-desktop {
    display: none;
}

@media (min-width: 768px) {
    .nav-desktop {
        display: flex;
        align-items: center;
        gap: 4px;
    }
    .nav-mobile-only { display: none !important; }
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 12px;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: color 0.15s, background 0.15s;
    white-space: nowrap;
}
.nav-link:hover {
    color: var(--text);
    background: var(--surface-2);
}

.nav-link-accent {
    background: var(--accent);
    color: #fff;
    margin-left: 4px;
}
.nav-link-accent:hover {
    background: var(--accent-hover);
    color: #fff;
}

.nav-divider {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 4px;
    flex-shrink: 0;
}

.nav-social {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 7px 8px;
    border-radius: 10px;
    color: var(--text-muted);
    transition: color 0.15s, background 0.15s;
    white-space: nowrap;
}
.nav-social:hover {
    color: var(--text);
    background: var(--surface-2);
}
.nav-social-label {
    font-size: 0.75rem;
    font-weight: 500;
}

/* ===== Burger button ===== */
.burger-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    padding: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    flex-shrink: 0;
}
.burger-line {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}
.burger-btn[aria-expanded="true"] .burger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.burger-btn[aria-expanded="true"] .burger-line:nth-child(2) {
    opacity: 0;
}
.burger-btn[aria-expanded="true"] .burger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ===== Drawer overlay ===== */
.drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.25s;
}
.drawer-overlay.open {
    display: block;
    opacity: 1;
}

/* ===== Drawer ===== */
.drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 400;
    width: 280px;
    background: var(--surface);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.drawer.open {
    transform: translateX(0);
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.drawer-title {
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.drawer-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    color: var(--text);
    transition: background 0.15s;
}
.drawer-close:hover { background: var(--border); }

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 8px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.drawer-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 12px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    transition: background 0.15s, color 0.15s;
}
.drawer-link:hover {
    background: var(--surface-2);
}
.drawer-link-accent {
    color: var(--accent);
}
.drawer-link-accent:hover {
    background: rgba(34, 197, 94, 0.08);
}

.drawer-divider {
    height: 1px;
    background: var(--border);
    margin: 6px 4px;
}

.drawer-theme-row {
    background: transparent !important;
    border: none;
    cursor: pointer;
    font-family: inherit;
    width: 100%;
    text-align: left;
    color: var(--text);
}
.theme-toggle-icon {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

/* ===== Search Page ===== */

.search-page {
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px 16px 130px;
}

.search-form {
    margin: 0 0 12px;
    border: 1px solid var(--border);
    border-radius: 16px;
}

/* --- Блок пошуку --- */
.block-search {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 10px 12px;
    background: var(--surface);
    border-radius: 16px 16px 0 0;
    border-bottom: 1px solid var(--border);
}

.search-input {
    flex: 1;
    height: 40px;
    padding: 0 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 0.875rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
    min-width: 0;
}

.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-muted); }

.search-input-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
}
.search-input-wrap .search-input {
    flex: 1;
    padding-right: 32px;
}
.search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--text-muted);
    color: var(--bg);
    border: none;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity 0.15s;
}
.search-clear:hover { opacity: 1; }
.search-clear.visible { display: flex; }

.btn-search {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 10px;
    border: none;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
}

.btn-search:hover { background: var(--accent-hover); }
.btn-search:active { opacity: 0.85; }
.btn-search:disabled { opacity: 1; cursor: default; }

.btn-search .search-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Категорії --- */
.block-cats {
    padding: 6px 0;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}

.categories-scroll {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 1px;
    padding-left: 10px;
    padding-right: 10px;
}

.categories-scroll::-webkit-scrollbar { display: none; }

.cat-pill {
    height: 44px;
    padding: 0 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    transition: border-color 0.12s, color 0.12s;
    text-decoration: none;
}

@media (hover: hover) {
    .cat-pill:hover { border-color: var(--accent); color: var(--text); }
}

.cat-pill.active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(34, 197, 94, 0.06);
}

/* --- Блок фільтрів --- */
.block-filters {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 12px 10px;
    background: var(--surface);
    border-radius: 0 0 16px 16px;
}

.filter-row {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

/* Inputs і selects у формі пошуку */
.search-form input[type="text"],
.search-form select {
    height: 40px;
    padding: 0 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}

.search-page select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-color: var(--bg);
    padding-right: 24px;
    cursor: pointer;
}

.search-form input[type="text"]:focus,
.search-form select:focus { border-color: var(--accent); }

.search-form input[type="text"].active,
.search-form select.active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(34, 197, 94, 0.06);
}

.search-form input[type="text"]::placeholder { color: var(--text-muted); }

.sel-type  { width: 90px; flex-shrink: 0; }
.sel-cond  { flex: 1; min-width: 0; }
.sel-sort  { flex: 1; min-width: 0; }
.inp-city  { flex: 1; min-width: 0; }
.inp-price { flex: 1; min-width: 0; }
.inp-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
}
.inp-wrap .inp-city,
.inp-wrap .inp-price { width: 100%; box-sizing: border-box; padding-right: 28px; }

/* Автодоповнення міста */
.city-autocomplete {
    position: relative;
    flex: 1;
    min-width: 0;
}
.city-autocomplete .inp-city {
    width: 100%;
    box-sizing: border-box;
    padding-right: 28px;
}
.city-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    z-index: 100;
    overflow: hidden;
    max-height: 240px;
    overflow-y: auto;
}
.city-dropdown-item {
    padding: 0 12px;
    height: 44px;
    line-height: 44px;
    font-size: 0.9rem;
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.city-dropdown-item:active,
.city-dropdown-item.highlighted {
    background: rgba(34, 197, 94, 0.10);
    color: var(--accent);
}

/* Checkbox "тільки в назві" */
.check-label {
    display: flex;
    align-items: center;
    gap: 5px;
    height: 36px;
    white-space: nowrap;
    cursor: pointer;
    flex-shrink: 0;
}

.check-label input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}

.check-label span { font-size: 0.75rem; color: var(--text-muted); }

.title-only-row { display: none; }
.title-only-row.visible { display: flex; }

/* --- Toast --- */
.search-toast {
    display: none;
    margin: 8px 0 0;
    padding: 10px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.8125rem;
    color: var(--text-muted);
}
.search-toast.visible { display: block; }

/* --- Статус і підказка --- */
.search-status {
    font-size: 0.875rem;
    color: var(--text-muted);
    padding: 0 16px 10px;
}

.search-status strong { color: var(--text); }

.search-hint {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 16px;
    font-size: 0.9rem;
}

/* --- Empty state --- */
.search-empty {
    text-align: center;
    padding: 48px 16px;
}

.search-empty .empty-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.search-empty .empty-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text);
}

.empty-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

/* --- Банер розширеного пошуку --- */
.search-expand-banner {
    display: none;
    margin: 16px 0 8px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-align: center;
}
.search-expand-banner.visible { display: block; }
.search-expand-banner p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin: 0 0 10px;
}
.search-expand-banner .btn-expand {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--accent);
    background: transparent;
    color: var(--accent);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.search-expand-banner .btn-expand:hover {
    background: var(--accent);
    color: #fff;
}

/* --- Desktop --- */
@media (min-width: 768px) {
    .block-search { padding: 12px 16px; }
    .block-cats   { padding: 10px 14px; }
    .block-filters { padding: 10px 16px 12px; }

    .search-input,
    .search-form input[type="text"],
    .search-form select,
    .btn-search,
    .cat-pill,
    .check-label { height: 38px; }

    .cat-pill { font-size: 0.875rem; }

    .btn-search { width: 38px; min-width: 38px; }

    .block-filters { flex-direction: row; align-items: center; gap: 6px; flex-wrap: nowrap; }
    .block-filters .filter-row { flex-wrap: nowrap; flex: none; }

    .categories-scroll { gap: 4px; padding-left: 0; padding-right: 0; }

    .inp-city  { width: 160px; }
    .inp-price { width: 130px; }
    .sel-cond  { width: 155px; }
    .sel-sort  { width: 165px; }
}

/* Ховаємо десктоп-бургер */
@media (min-width: 768px) {
    .drawer,
    .drawer-overlay { display: none !important; }
}

/* ===== Seller page ===== */
.seller-main { max-width: 1280px; margin: 0 auto; padding: 20px 16px 90px; }

.seller-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 0px 16px 28px;
    text-align: center;
}

.seller-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    margin-bottom: 4px;
}

.seller-profile-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.seller-profile-city,
.seller-profile-count {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.seller-write-btn {
    margin-top: 8px;
    min-width: 220px;
}

.seller-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 48px 16px;
    font-size: 0.95rem;
}

/* Sticky CTA на seller page — тільки кнопка написати, без share */
.page-seller .sticky-cta { justify-content: stretch; }
.page-seller .sticky-cta-write { flex: 1; justify-content: center; }
