.all-results-btn { background:var(--color-primary); border-radius: 0 0 12px 12px; margin:-2px; }
.all-results-btn:hover {background:var(--color-primary-hover)!important; }

.tags-scroll { display: flex; gap: 10px; overflow-x: auto; margin-top: 16px; scrollbar-width: none; }
.tags-scroll::-webkit-scrollbar { display: none; }
.tags-scroll .btn-subscribe { color: var(--color-text-main); }

.btn-subscribe { background: var(--bg-body); padding: 6px 12px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; transition: background 0.2s ease-in-out; display: flex; align-items: center; gap: 6px; white-space: nowrap; border: 1px solid transparent; }
.btn-subscribe:hover { background: #e5e5e5; border-color: var(--color-border); }

.search-empty { margin-top:16px; gap:16px; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; }
.clearBtn { height:40px; width:40px; border-top:1px solid var(--color-border); border-bottom:1px solid var(--color-border); font-size:20px; }
.nosearch { width:100%; max-width:200px; border-radius:var(--radius-md); }
.searchForm { width:100%; margin:0 auto; font-family:var(--font-main); }
.searchForm form { display:flex; width:100%; align-items:center; gap:0; }
.searchForm .queryField { height:40px; flex:1; padding:10px 14px; font-size:17px; border:1px solid var(--color-border); border-radius:var(--radius-sm) 0 0 var(--radius-sm); outline:none; transition:border-color var(--transition); color:var(--color-text-main); background:var(--bg-card); }
.searchForm .queryField:focus { border-color:var(--color-primary); }
.searchForm .searchBtn { display:flex; align-items:center; justify-content:center; padding:0 12px; background-color:var(--color-primary); border:1px solid var(--color-primary); border-left:none; border-radius:0 var(--radius-sm) var(--radius-sm) 0; cursor:pointer; transition:background-color var(--transition),border-color var(--transition); height:40px; }
.searchForm .searchBtn svg { width:20px; height:20px; stroke:#fff; }
.searchForm .searchBtn:hover { background-color:var(--color-primary-hover); border-color:var(--color-primary-hover); }

@media (max-width:400px){
    .searchForm .queryField { font-size:14px; padding:8px 10px; }
    .searchForm .searchBtn { padding:0 10px; }
    .searchForm .searchBtn svg { width:18px; height:18px; }
}

.search-grid img { border-radius:var(--radius-md); }
.search-loading { background-image:url('/img/loading-mini.svg')!important; background-repeat:no-repeat!important; background-position:right 20px center!important; background-size:12px 12px!important; }

div[id^=sData-] { position:absolute; display:flex; top:10px; background:var(--bg-card); border:2px solid var(--color-primary); width:100%; flex-flow:column nowrap; border-radius:var(--radius-md); z-index:6; }
div[id^=sData-]::before { content:""; position:absolute; top:-10px; left:50%; transform:translateX(-50%); border-left:8px solid transparent; border-right:8px solid transparent; border-bottom:8px solid var(--color-primary); z-index:7; }

.search-group-title:first-of-type, div[id^=sData-] div:first-child { border-radius:12px 12px 0 0; }
.search-group-title:last-of-type, div[id^=sData-] div:last-child { border-radius:0 0 12px 12px; border-bottom:0; }
.show-all { border-radius:0 0 12px 12px; }

/* =========================================================
   ВИПАДАЮЧИЙ СПИСОК ПОШУКУ ТА АВТОЗАПОВНЕННЯ
   ========================================================= */

.search-history-item {
    position: relative;
    display: flex;
    align-items: center;
    padding: 10px 15px; 
    text-decoration: none;
    color: #333;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    justify-content: space-between;
}

.search-history-item:hover { background: #f5f5f5; }
.search-history-item:active { background: #e0e0e0; }
.search-history-item.active-item { background: #f5f5f5; }

/* Контейнер тексту та іконки всередині рядка */
.search-item-content {
    display: flex;
    align-items: center;
    min-width: 0;
    width: 100%;
}

/* Якщо поруч є картинка, додаємо відступ справа, щоб текст під неї не залазив */
.search-item-content.has-img {
    padding-right: 42px;
}

/* Текст пошукового запиту (обрізання крапками) */
.search-item-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.search-item-text-bold { font-weight: 500; }

/* Іконки (лупа, годинник, лінк) */
.search-icon {
    margin-right: 10px;
    flex-shrink: 0;opacity: 0.6;
}

/* Стилі для мініатюри (вирвана з потоку, центрована по вертикалі) */
.autocomplete-img {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 35px;
    height: 35px;
    object-fit: cover;
    border-radius: 4px;
    background: #eee;
}


.category-badge {
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    color: #ff9800;
    border: 1px solid #ff9800;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 10px;
    flex-shrink: 0;
}

/* Кнопка очищення історії */
.search-history-clear {
    display: flex;
    padding: 10px;
    text-decoration: none;
    color: red;
    cursor: pointer;
    justify-content: center;
    border-radius: 0 0 12px 12px;
    background: #fafafa;
    opacity: 0.7;
    font-size: 0.9em;
    border-top: 1px solid rgba(128,128,128,0.1);
}
.search-history-clear:hover { background: #f5f5f5; }

/* Кнопка "Всі результати" */
.all-results-btn a {
    color: #fff;
    display: flex;
    align-items: center;
    width: 100%;
    justify-content: center;
    text-decoration: none;
}

/* Контейнер для правильного випадання списку під інпутом */
.relative-parent-container { position: relative; }

/* Блок "нічого не знайдено" */
.no-rezultat { padding: 10px; text-align: center; opacity: 0.5; cursor: default; }

/* =========================================================
   ІСТОРІЯ ПОШУКУ НИЖЧЕ (КАРУСЕЛЬ)
   ========================================================= */

.history-section { margin: 20px 0; width: 100%; }
.history-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.history-title { font-size: 1.2rem; font-weight: 600; color: var(--color-text); margin: 0; }
.history-clear-btn { background: none; border: none; color: #888; font-size: 0.9rem; cursor: pointer; padding: 5px 10px; transition: color 0.2s; }
.history-clear-btn:hover { color: #ff4d4d; }
.history-scroll-wrapper { display: flex; overflow-x: auto; gap: 15px; padding-bottom: 10px; scroll-behavior: smooth; scroll-snap-type: x mandatory; scrollbar-width: thin; scrollbar-color: #888 #f1f1f1; }
.history-scroll-wrapper::-webkit-scrollbar { height: 8px; -webkit-appearance: none; display: block; }
.history-scroll-wrapper::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 10px; }
.history-scroll-wrapper::-webkit-scrollbar-thumb { background-color: #888; border-radius: 10px; border: 2px solid #f1f1f1; }
.history-scroll-wrapper::-webkit-scrollbar-thumb:hover { background-color: #555; }
.history-item { flex: 0 0 auto; width: 140px; display: flex; flex-direction: column; text-decoration: none; color: inherit; transition: transform 0.2s; scroll-snap-align: start; }
.history-item:hover { transform: translateY(-2px); }
.history-item img { width: 140px; height: 140px; object-fit: cover; border-radius: var(--radius-sm); margin-bottom: 8px; }
.history-item span { font-size: 0.85rem; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-empty { color: var(--color-text-muted); }