
/* Кнопка истории поиска */
.search-history-btn {
    position: absolute;
    left: -40px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(114, 46, 133, 0.9);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
    padding: 0;
}
.search-history-btn:hover {
    background: rgba(114, 46, 133, 1);
    transform: translateY(-50%) scale(1.1);
}
.search-history-btn svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: #fff;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.search-history-btn.has-history::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    background: #4caf50;
    border-radius: 50%;
    border: 1px solid rgba(114, 46, 133, 0.9);
}
/* Ripple эффект для кнопки истории (#9) */
.search-history-btn {
    overflow: hidden;
    transform-origin: center;
}
.search-history-btn .ripple {
    display: block;
    position: absolute;
    pointer-events: none;
    border-radius: 50%;
    transform: scale(0);
    background: #fff;
    opacity: 0.4;
}
.search-history-btn .ripple.ripple-animate {
    animation: history-ripple 0.7s linear;
}
@keyframes history-ripple {
    100% {
        opacity: 0;
        transform: scale(2);
    }
}

/* Выпадающий блок с результатами поиска — стиль как у хедера */
.live-search-dropdown {
    position: absolute;
    z-index: 10000;
    background: transparent;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 0;
    box-shadow: 0px 4px 18px 0px #0000001F;
    max-height: calc(100vh - 150px);
    overflow: hidden;
    display: none;
    min-width: 320px;
    border: 1px solid rgba(255,255,255,0.1);
}

.live-search-dropdown.active {
    display: block;
}

.live-search-results {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

/* Скроллбар */
.live-search-results::-webkit-scrollbar {
    width: 8px;
}
.live-search-results::-webkit-scrollbar-track {
    background: rgba(59, 62, 66, 0.5);
}
.live-search-results::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 0;
}
.live-search-results::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Элемент результата */
.live-search-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.15s;
}
.live-search-item:hover {
    background: #f8fafc;
}

.live-search-image {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    background: #fafafa;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.live-search-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
/* Принудительно загружаем lazy картинки в результатах поиска */
.live-search-dropdown img.lazy,
.live-search-dropdown img[data-lazyload] {
    opacity: 1 !important;
}

.live-search-info {
    flex: 1;
    min-width: 0;
}

.live-search-name {
    font-weight: 600;
    color: #222;
    font-size: 14px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.live-search-article {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}

.live-search-specs {
    font-size: 11px;
    color: #666;
    margin-top: 4px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.live-search-price {
    flex-shrink: 0;
    text-align: right;
    font-weight: 700;
    color: #1a73e8;
    font-size: 15px;
    white-space: nowrap;
}

.live-search-all {
    display: block;
    padding: 14px 16px;
    text-align: center;
    color: #1a73e8;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    background: #f8fafc;
    border-top: 1px solid #e5e7eb;
}
.live-search-all:hover {
    background: #f0f4f8;
    color: #1557b0;
}

/* Пустой результат */
.live-search-empty {
    padding: 30px 20px;
    text-align: center;
    color: #888;
}

/* Модальное окно характеристик — тёмная тема с glassmorphism */
.ls-chars-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}
.ls-chars-modal-overlay.open {
    opacity: 1;
    visibility: visible;
}
.ls-chars-modal {
    background: transparent;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 8px;
    max-width: 700px;
    width: 90%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0px 4px 18px 0px #0000001F;
    border: 1px solid rgba(255,255,255,0.1);
    transform: translateY(20px);
    transition: transform 0.2s;
}
.ls-chars-modal-overlay.open .ls-chars-modal {
    transform: translateY(0);
}
.ls-chars-modal-header {
    padding: 16px 20px;
    background: rgba(20, 22, 25, 0.85);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.ls-chars-modal-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    flex: 1;
    padding-right: 16px;
}
.ls-chars-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: background 0.15s;
    flex-shrink: 0;
}
.ls-chars-modal-close:hover {
    background: rgba(255,255,255,0.3);
}
.ls-chars-modal-body {
    padding: 0;
    overflow-y: auto;
    flex: 1;
    background: rgba(20, 22, 25, 0.6);
}
.ls-chars-modal-body::-webkit-scrollbar {
    width: 6px;
}
.ls-chars-modal-body::-webkit-scrollbar-track {
    background: rgba(59, 62, 66, 0.5);
}
.ls-chars-modal-body::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 3px;
}
.ls-chars-table {
    width: 100%;
    border-collapse: collapse;
}
.ls-chars-table tr:nth-child(even) {
    background: rgba(255,255,255,0.015);
}
.ls-chars-table tr:hover {
    background: rgba(0, 0, 0, 0.2);
}
.ls-chars-table td {
    padding: 10px 16px;
    font-size: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.ls-chars-table td:first-child {
    color: #aaa;
    width: 45%;
}
.ls-chars-table td:last-child {
    color: #fff;
    font-weight: 500;
}
.ls-chars-modal-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: rgba(20, 22, 25, 0.6);
}
.ls-chars-btn {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.ls-chars-btn-primary {
    background: #722e85;
    color: #fff;
}
.ls-chars-btn-primary:hover {
    background: #5a2469;
    color: #fff;
}
.ls-chars-btn-secondary {
    background: rgba(255,255,255,0.1);
    color: #ccc;
}
.ls-chars-btn-secondary:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}
.ls-chars-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
}
.ls-chars-loader svg {
    animation: ls-spin 1s linear infinite;
}
@keyframes ls-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.ls-chars-error {
    padding: 40px 20px;
    text-align: center;
    color: #999;
}

/* Лоадер */
.live-search-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    background: transparent;
}
.live-search-loader svg {
    animation: live-search-spin 1s linear infinite;
}
@keyframes live-search-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Адаптив для мобилок */
@media (max-width: 767px) {
    .live-search-dropdown {
        min-width: 100%;
        max-width: 100%;
        left: 0 !important;
        right: 0 !important;
        border-radius: 0;
        position: fixed;
        top: 60px !important;
        max-height: calc(100vh - 60px);
    }
    .live-search-results {
        max-height: calc(100vh - 120px);
    }
}

/* ========================================
   АВТОДОПОЛНЕНИЕ И ИСТОРИЯ ПОИСКА
   ======================================== */

/* Dropdown подсказок — прикреплён к поисковой строке */
.search-suggest-dropdown {
    position: absolute;
    z-index: 10001;
    background: rgba(30, 32, 36, 0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 0 0 8px 8px; /* Скругления только снизу */
    box-shadow: 0px 8px 24px 0px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    border-top: none; /* Убираем верхнюю границу — прикреплено к строке */
    min-width: 320px;
    overflow: hidden;
    display: none;
}
.search-suggest-dropdown.active {
    display: block;
}

/* Секции */
.suggest-section {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.suggest-section:last-child {
    border-bottom: none;
}

/* Заголовок секции */
.suggest-section-title {
    padding: 6px 16px;
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.suggest-section-title svg {
    opacity: 0.5;
}

/* Элемент подсказки */
.suggest-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s;
    gap: 12px;
}
.suggest-item:hover,
.suggest-item.active {
    background: rgba(114, 46, 133, 0.3);
}
.suggest-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #aaa;
}
.suggest-item:hover .suggest-item-icon,
.suggest-item.active .suggest-item-icon {
    background: rgba(114, 46, 133, 0.5);
    color: #fff;
}
.suggest-item-content {
    flex: 1;
    min-width: 0;
}
.suggest-item-name {
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.suggest-item-hint {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Тип подсказки */
.suggest-item-type {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(255,255,255,0.1);
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}
.suggest-item-type.series { background: rgba(114, 46, 133, 0.3); color: #d4a5e0; }
.suggest-item-type.filter { background: rgba(46, 114, 133, 0.3); color: #a5d4e0; }
.suggest-item-type.query { background: rgba(133, 114, 46, 0.3); color: #e0d4a5; }

/* Компактные теги для популярных запросов */
.suggest-tags-group {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.suggest-tags-group:last-child {
    border-bottom: none;
}
.suggest-tags-title {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.suggest-tags-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.suggest-tag {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    background: rgba(255,255,255,0.08);
    border-radius: 16px;
    font-size: 13px;
    color: #e0e0e0;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}
/* Ripple для тегов (#9 на #5) */
.suggest-tag .ripple {
    display: block;
    position: absolute;
    pointer-events: none;
    border-radius: 50%;
    transform: scale(0);
    background: #fff;
    opacity: 0.4;
}
.suggest-tag .ripple.ripple-animate {
    animation: tag-ripple 0.7s linear;
}
@keyframes tag-ripple {
    100% {
        opacity: 0;
        transform: scale(2);
    }
}
.suggest-tag:hover {
    background: #85369c;
    border-color: #85369c;
    color: #fff;
}
.suggest-tag.series,
.suggest-tag.filter,
.suggest-tag.query {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: none;
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.suggest-tag.series:hover,
.suggest-tag.filter:hover,
.suggest-tag.query:hover {
    background: #85369c;
    box-shadow: 0 4px 12px rgba(114, 46, 133, 0.3);
}

/* История в виде компактных тегов */
.suggest-history-tags {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.suggest-history-title {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.suggest-history-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.suggest-tag.history {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: none;
    border-radius: 5px;
    padding-right: 6px; /* Меньше отступ справа для крестика */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.suggest-tag.history:hover {
    background: #85369c;
    box-shadow: 0 4px 12px rgba(114, 46, 133, 0.3);
}
.suggest-tag-delete {
    width: 18px;
    height: 18px;
    margin-left: 4px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #888;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}
.suggest-tag-delete:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}
.suggest-tag-delete:hover svg {
    transform: rotate(360deg);
}
.suggest-tag-delete svg {
    transition: transform 0.4s ease;
}
/* Ripple для крестика (#5 стиль) */
.suggest-tag-delete .ripple {
    display: block;
    position: absolute;
    pointer-events: none;
    border-radius: 50%;
    transform: scale(0);
    background: #fff;
    opacity: 0.4;
}
.suggest-tag-delete .ripple.ripple-animate {
    animation: delete-ripple 0.7s linear;
}
@keyframes delete-ripple {
    100% { opacity: 0; transform: scale(2); }
}
.suggest-clear-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 11px;
    color: #888;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: all 0.15s;
    margin-left: auto;
}
.suggest-clear-all-btn:hover {
    background: rgba(220, 53, 69, 0.2);
    border-color: rgba(220, 53, 69, 0.4);
    color: #ff6b6b;
}

/* Кнопка удаления из истории (старый стиль, оставляем для совместимости) */
.suggest-item-delete {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
    opacity: 0;
}
.suggest-item:hover .suggest-item-delete {
    opacity: 1;
}
.suggest-item-delete:hover {
    background: rgba(220, 53, 69, 0.3);
    color: #ff6b6b;
}

/* Кнопка очистки истории */
.suggest-clear-history {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    font-size: 13px;
    color: #888;
    cursor: pointer;
    transition: all 0.15s;
    border: none;
    background: transparent;
    width: 100%;
}
.suggest-clear-history:hover {
    background: rgba(220, 53, 69, 0.2);
    color: #ff6b6b;
}

/* Подсветка совпадения */
.suggest-match {
    color: #d4a5e0;
    font-weight: 600;
}
