/* ========================================
   КОМПОНЕНТ ПОИСКА
   ======================================== */

.search-component {
    position: relative !important;
    top: auto !important;
    right: auto !important;
    left: auto !important;
    display: flex;
    align-items: center;
    gap: 0;
    background: rgba(26, 26, 46, 0.9);
    border: 2px solid rgba(255, 215, 0, 0.5);
    border-radius: 0;
    padding: 0;
    z-index: auto;
    box-shadow: none;
}

.search-component:hover {
    border-color: rgba(255, 215, 0, 0.5);
    box-shadow: none;
}

.search-component:focus-within {
    border-color: rgba(255, 215, 0, 0.5);
    box-shadow: none;
}

/* Иконка поиска */
.search-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    font-size: 18px;
    color: #EDD8A5;
    pointer-events: none;
}

.search-component:focus-within .search-icon {
    color: #EDD8A5;
}

/* Input поиска */
.search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 12px 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-family: 'Cinzel', serif;
    min-width: 150px;
    max-width: 200px;
}

.search-input::placeholder {
    color: rgba(255, 215, 0, 0.5);
}

/* Кнопка очистки */
.search-clear-btn {
    display: none;
    background: transparent;
    border: none;
    outline: none;
    padding: 0 12px;
    color: #EDD8A5;
    font-size: 18px;
    cursor: pointer;
}

.search-clear-btn:hover {
    color: #EDD8A5;
}

/* Dropdown с результатами */
.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    background: rgba(26, 26, 46, 0.95);
    border: 2px solid rgba(255, 215, 0, 0.5);
    border-top: none;
    border-radius: 0;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: none;
    margin-top: -2px;
}

.search-results-dropdown::-webkit-scrollbar {
    width: 6px;
}

.search-results-dropdown::-webkit-scrollbar-track {
    background: rgba(255, 215, 0, 0.1);
}

.search-results-dropdown::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.4);
    border-radius: 3px;
}

.search-results-dropdown::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 215, 0, 0.6);
}

/* Контейнер результатов */
.search-results {
    padding: 0;
}

/* Группа результатов по страницам */
.search-result-group {
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
    padding: 0;
}

.search-result-group:last-child {
    border-bottom: none;
}

/* Название страницы */
.search-result-page-name {
    padding: 10px 15px 5px 15px;
    background: rgba(255, 215, 0, 0.05);
    color: rgba(255, 215, 0, 0.9);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.1);
}

/* Элемент результата */
.search-result-item {
    padding: 12px 15px;
    cursor: pointer;
    border-left: 3px solid transparent;
}

.search-result-item:hover {
    background: rgba(255, 215, 0, 0.1);
    border-left-color: rgba(255, 215, 0, 0.8);
    padding-left: 15px;
}

/* Контекст результата */
.search-result-context {
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    line-height: 1.4;
    max-height: 50px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Выделенный текст поиска */
.search-result-context mark {
    background: rgba(255, 215, 0, 0.3);
    color: rgba(255, 215, 0, 1);
    font-weight: 600;
    border-radius: 2px;
    padding: 0 2px;
}

/* Пустые результаты */
.search-result-empty,
.search-result-error {
    padding: 30px 15px;
    text-align: center;
    color: rgba(255, 215, 0, 0.6);
    font-size: 13px;
}

.search-result-error {
    color: rgba(255, 100, 100, 0.8);
}

/* Подсветка найденного элемента при переходе из поиска */
@keyframes search-highlight-pulse {
    0%   { box-shadow: 0 0 0 0px rgba(218, 165, 32, 0); }
    15%  { box-shadow: 0 0 0 6px rgba(218, 165, 32, 0.7); }
    50%  { box-shadow: 0 0 0 8px rgba(218, 165, 32, 0.4); }
    100% { box-shadow: 0 0 0 4px rgba(218, 165, 32, 0); }
}

.search-highlight {
    animation: search-highlight-pulse 2s ease-out forwards;
    border-radius: 4px;
    position: relative;
    z-index: 1;
}

@keyframes search-highlight-inline-pulse {
    0% {
        opacity: 0.35;
        background-color: rgba(255, 215, 0, 0.24);
        box-shadow: 0 0 0 rgba(218, 165, 32, 0);
    }
    18% {
        opacity: 1;
        background-color: rgba(255, 215, 0, 0.75);
        box-shadow: 0 0 18px rgba(218, 165, 32, 0.45);
    }
    70% {
        opacity: 1;
        background-color: rgba(255, 215, 0, 0.62);
        box-shadow: 0 0 14px rgba(218, 165, 32, 0.35);
    }
    100% {
        opacity: 0;
        background-color: rgba(255, 215, 0, 0);
        box-shadow: 0 0 0 rgba(218, 165, 32, 0);
    }
}

.search-highlight-inline {
    animation: search-highlight-inline-pulse 2.2s ease-out forwards;
    position: absolute;
    pointer-events: none;
    border-radius: 0.35em;
    background: rgba(255, 215, 0, 0.38);
    z-index: 2000;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

::highlight(search-highlight-inline) {
    background: rgba(255, 215, 0, 0.68);
    color: #1a1a2e;
    text-shadow: none;
}

/* ========================================
   АДАПТИВНОСТЬ ПОИСКА
   ======================================== */

/* Большие экраны (>1024px) */
@media (min-width: 1025px) {
    .search-input {
        min-width: 180px;
        max-width: 220px;
    }
}

/* Средние экраны (769px - 1024px) */
@media (max-width: 1024px) and (min-width: 769px) {
    .search-input {
        min-width: 150px;
        max-width: 180px;
        font-size: 13px;
    }

    .search-icon {
        padding: 0 10px;
    }

    .search-clear-btn {
        padding: 0 10px;
    }
}

/* Маленькие экраны (481px - 768px) */
@media (max-width: 768px) and (min-width: 481px) {
    .search-input {
        min-width: 120px;
        max-width: 140px;
        font-size: 13px;
        padding: 10px 0;
    }

    .search-icon {
        padding: 0 9px;
        font-size: 15px;
    }

    .search-clear-btn {
        padding: 0 9px;
        font-size: 15px;
    }

    .search-results-dropdown {
        max-height: 320px;
    }
}

/* Очень маленькие экраны (≤480px) */
@media (max-width: 480px) {
    .search-input {
        min-width: 90px;
        max-width: 110px;
        font-size: 12px;
        padding: 9px 0;
    }

    .search-icon {
        padding: 0 7px;
        font-size: 14px;
    }

    .search-clear-btn {
        padding: 0 7px;
        font-size: 14px;
    }

    .search-results-dropdown {
        max-height: 280px;
    }

    .search-result-context {
        font-size: 11px;
        -webkit-line-clamp: 2;
    }

    .search-result-page-name {
        font-size: 10px;
    }

    .search-result-item {
        padding: 9px 12px;
    }
}

/* Экраны меньше 375px */
@media (max-width: 375px) {
    .search-icon {
        padding: 0 6px;
        font-size: 13px;
    }

    .search-input {
        font-size: 11px;
        min-width: 70px;
        max-width: 90px;
        padding: 8px 0;
    }

    .search-clear-btn {
        padding: 0 6px;
        font-size: 13px;
    }

    .search-results-dropdown {
        max-height: 250px;
    }

    .search-result-empty,
    .search-result-error {
        font-size: 10px;
    }

    .search-result-page-name {
        font-size: 9px;
    }

    .search-result-item {
        padding: 8px 10px;
    }
}

/* ========================================
   СОСТОЯНИЯ И АНИМАЦИИ
   ======================================== */

/* Фокус на input */
.search-input:focus {
    color: rgba(255, 255, 255, 1);
}

