/* Спільна компактна шапка (index.html, product.html) і мобільна панель фільтрів */
.site-header {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 16px;
    background: linear-gradient(135deg, #667eea, #764ba2); color: #fff;
    padding: 10px 18px; border-radius: 14px; margin-bottom: 16px;
    position: sticky; top: env(safe-area-inset-top, 0px); z-index: 900;
}
.site-header a { color: #fff; text-decoration: none; }
.sh-logo { font-size: 20px; font-weight: 700; white-space: nowrap; letter-spacing: -0.2px; }
.sh-search { position: relative; display: flex; min-width: 0; }
.sh-search input {
    flex: 1; min-width: 0; height: 42px; border: 0; border-radius: 10px 0 0 10px; padding: 0 40px 0 14px;
    font-size: 15px; color: #1a202c; background: #fff; font-family: inherit;
}
.sh-search input:focus { outline: 2px solid #ffd166; outline-offset: 0; }
.sh-search .voice-btn {
    position: absolute; right: 96px; top: 50%; transform: translateY(-50%); background: none; border: none;
    cursor: pointer; font-size: 16px; padding: 6px; line-height: 1;
}
.sh-search-btn {
    height: 42px; padding: 0 18px; border: 0; border-radius: 0 10px 10px 0; background: #2f855a; color: #fff;
    font-weight: 600; font-size: 15px; cursor: pointer; font-family: inherit; white-space: nowrap;
}
.sh-search-btn:hover { background: #276749; }
.sh-phone { font-size: 14px; font-weight: 600; white-space: nowrap; }
.sh-cart {
    display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,0.18); border: 0; color: #fff;
    height: 42px; padding: 0 14px; border-radius: 10px; cursor: pointer; font-size: 15px; font-weight: 600; font-family: inherit; white-space: nowrap;
}
.sh-cart:hover { background: rgba(255,255,255,0.28); }
.sh-cart .cart-count { background: #ff6b6b; border-radius: 20px; padding: 1px 8px; font-size: 13px; margin: 0; }

/* Підказки пошуку під полем */
.search-suggestions {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; color: #1a202c; border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18); z-index: 950; max-height: 70vh; overflow-y: auto; display: none;
}
.suggestion-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; border-bottom: 1px solid #f0f0f0; text-decoration: none; color: inherit; }
.suggestion-item:hover, .suggestion-item:focus { background: #f7fafc; outline: none; }
.suggestion-img { width: 40px; height: 40px; object-fit: contain; flex-shrink: 0; }
.suggestion-info { flex: 1; min-width: 0; }
.suggestion-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggestion-meta { font-size: 12px; color: #718096; }
.suggestion-price { font-size: 13px; color: #2f855a; font-weight: 600; }
.suggestion-all { display: block; padding: 11px 14px; font-size: 13px; font-weight: 600; color: #5a67d8; cursor: pointer; text-align: center; background: #f7fafc; border-radius: 0 0 12px 12px; }
.suggestion-note { padding: 8px 14px; font-size: 12px; color: #c05621; border-bottom: 1px solid #f0f0f0; }

/* Порожній результат пошуку */
.empty-state { grid-column: 1 / -1; background: #fff; border-radius: 16px; padding: 28px; text-align: center; color: #2d3748; }
.empty-state h3 { font-size: 18px; margin-bottom: 8px; }
.empty-state p { color: #4a5568; margin: 6px 0; }
.empty-state .chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.empty-state .chip { border: 1px solid #cbd5e0; background: #fff; border-radius: 20px; padding: 6px 14px; cursor: pointer; font-size: 13px; color: #2d3748; font-family: inherit; }
.empty-state .chip:hover { border-color: #667eea; color: #5a67d8; }
.dym-link { color: #5a67d8; font-weight: 600; cursor: pointer; text-decoration: underline; background: none; border: 0; font: inherit; }

/* Блок «Доставка · Оплата · Гарантія» біля кнопки купівлі */
.buy-terms { margin-top: 16px; border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden; text-align: left; }
.buy-terms > div { display: grid; grid-template-columns: 28px 1fr; gap: 6px 10px; padding: 12px 14px; border-top: 1px solid #edf2f7; font-size: 14px; color: #2d3748; }
.buy-terms > div:first-child { border-top: 0; }
.buy-terms .bt-ico { font-size: 18px; line-height: 1.2; }
.buy-terms b { display: block; font-size: 14px; }
.buy-terms span { color: #4a5568; font-size: 13px; }
.buy-terms a { color: #5a67d8; }

/* Мобільна панель фільтрів */
.mobile-toolbar { display: none; }
.filters-head, .filters-apply { display: none; }

@media (max-width: 760px) {
    body { padding: 10px !important; }
    .site-header { grid-template-columns: 1fr auto auto; grid-template-areas: "logo phone cart" "search search search"; gap: 8px 10px; padding: 10px 12px; border-radius: 12px; margin-bottom: 10px; }
    .sh-logo { grid-area: logo; font-size: 17px; }
    .sh-phone { grid-area: phone; font-size: 13px; }
    .sh-cart { grid-area: cart; height: 38px; padding: 0 10px; }
    .sh-cart .sh-cart-label { display: none; }
    .sh-search { grid-area: search; }
    .sh-search input { height: 42px; font-size: 16px; }      /* 16px — iOS не збільшує сторінку при фокусі */
    .sh-search-btn { padding: 0 14px; }

    .mobile-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
    .mobile-toolbar .mt-btn {
        display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid #cbd5e0;
        background: #fff; font-size: 14px; font-weight: 600; color: #2d3748; cursor: pointer; font-family: inherit;
    }
    .mobile-toolbar .mt-count { margin-left: auto; font-size: 13px; color: #4a5568; }
    .mt-badge { background: #667eea; color: #fff; border-radius: 10px; padding: 0 7px; font-size: 12px; }

    .filters {
        position: fixed !important; inset: 0; z-index: 1500; margin: 0 !important; border-radius: 0 !important;
        display: none !important; flex-direction: column !important; align-items: stretch !important; flex-wrap: nowrap !important;
        overflow-y: auto; padding: 0 16px calc(84px + env(safe-area-inset-bottom, 0px)) !important; gap: 12px !important;
    }
    body.filters-open { overflow: hidden; }
    body.filters-open .filters { display: flex !important; }
    .filters > * { width: 100% !important; max-width: 100%; flex: none !important; }
    .filters select, .filters input:not([type=checkbox]) { width: 100% !important; height: 44px; font-size: 16px; }
    .filters .stock-toggle { width: auto !important; min-height: 44px; font-size: 15px; gap: 10px; }
    .filters .stock-toggle input { width: 20px; height: 20px; }
    .filters .price-range { display: grid !important; grid-template-columns: 1fr auto 1fr; }
    .filters .price-input { width: 100% !important; }
    .filters-head {
        display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: inherit;
        padding: calc(14px + env(safe-area-inset-top, 0px)) 0 10px; font-size: 18px; font-weight: 700; z-index: 1;
    }
    .filters-head button { border: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: inherit; padding: 4px 8px; }
    .filters-apply {
        display: flex; gap: 10px; position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
        background: inherit; border-top: 1px solid #e2e8f0; z-index: 2;
    }
    .filters-apply button { flex: 1; height: 46px; border-radius: 10px; font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit; }
    .filters-apply .fa-reset { flex: 0 0 auto; padding: 0 16px; background: #fff; border: 1px solid #cbd5e0; color: #2d3748; }
    .filters-apply .fa-show { background: #667eea; color: #fff; border: 0; }

    .stats-bar { display: none !important; }
    .products-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; }
    .card-img { height: 130px !important; padding: 8px !important; }
    .card-info { padding: 10px !important; }
    .card .title { font-size: 13px !important; min-height: 0 !important; }
    .price-current { font-size: 17px !important; }
    .add-btn { padding: 9px 6px !important; font-size: 13px; }
    .category-bar { margin-bottom: 10px !important; }
    .category-pill { min-width: 78px !important; padding: 8px 10px !important; }
    .category-pill .cat-icon { font-size: 18px !important; }
}
@media (max-width: 360px) { .products-grid { grid-template-columns: 1fr !important; } }

body.dark .search-suggestions, body.dark .empty-state, body.dark .mobile-toolbar .mt-btn { background: #0f0f1a; color: #eee; border-color: #2a2a3e; }
body.dark .suggestion-item { border-color: #2a2a3e; }
body.dark .suggestion-item:hover { background: #1a1a2e; }
body.dark .buy-terms, body.dark .buy-terms > div { border-color: #2a2a3e; color: #eee; }
body.dark .buy-terms span { color: #a0aec0; }
