/* === Поиск в шапке сайта === */
.header-search {
    position: relative;
    display: flex;
    align-items: center;
    transition: margin-right 0.3s ease;
}

@media (min-width: 1300px) {
    .header-search.open {
        margin-right: 330px;
    }
}

.header-search .search-btn {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border: 1px solid #b8d4f0;
    background: #ffffff;
    border-radius: 50%;
    cursor: pointer;
    font-size: 17px;
    line-height: 1;
    transition: background 0.2s, transform 0.2s;
    z-index: 2;
}

.header-search .search-btn:hover {
    background: #b8d4f0;
    transform: scale(1.05);
}

.header-search.open .search-btn {
    background: #2c5aa0;
    border-color: #2c5aa0;
}

.header-search .search-expand {
    position: absolute;
    top: 50%;
    left: calc(100% + 10px);
    width: 320px;
    box-sizing: border-box;
    transform: translateY(-50%) translateX(-15px);
    display: flex;
    align-items: center;
    gap: 6px;
    background: #ffffff;
    border: 1px solid #b8d4f0;
    border-radius: 8px;
    padding: 8px 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
    white-space: nowrap;
    z-index: 100;
}

.header-search.open .search-expand {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}

@media (max-width: 1299px) {
    .header-search .search-expand {
        left: auto;
        right: calc(100% + 10px);
        width: 280px;
        transform: translateY(-50%) translateX(15px);
    }

    .header-search.open .search-expand {
        transform: translateY(-50%) translateX(0);
    }
}

.header-search .search-input {
    flex: 1;
    min-width: 0;
    height: 34px;
    padding: 0 12px;
    border: 1px solid #b8d4f0;
    border-radius: 6px;
    font-size: 0.9rem;
    outline: none;
    box-sizing: border-box;
}

.header-search .search-input:focus {
    border-color: #2c5aa0;
}

.header-search .search-input::placeholder {
    color: #999;
    font-style: italic;
}

.header-search .search-clear {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border: 1px solid #b8d4f0;
    background: #f0f5fb;
    border-radius: 4px;
    cursor: pointer;
    color: #2c5aa0;
    font-size: 13px;
    line-height: 1;
    transition: background 0.2s;
}

.header-search .search-clear:hover {
    background: #b8d4f0;
}

/* === Выпадающие подсказки в шапке === */
.header-search .search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #b8d4f0;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
    display: none;
    overflow: hidden;
    z-index: 101;
}

.header-search.show-results .search-results {
    display: block;
}

.search-result-item {
    display: block;
    padding: 10px 14px;
    color: #2c3e50;
    text-decoration: none;
    font-size: 0.9rem;
    border-bottom: 1px solid #eef5ff;
    white-space: normal;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: #eef5ff;
    color: #1a4d8f;
}

.search-global-item {
    background: #f0f5fb;
    font-weight: 600;
    color: #2c5aa0;
}

.search-global-item:hover {
    background: #b8d4f0;
}

/* === Страница результатов глобального поиска === */
.gs-progress {
    background: #eef5ff;
    border-left: 4px solid #2c5aa0;
    padding: 12px 18px;
    border-radius: 5px;
    color: #1a4d8f;
    font-size: 0.95rem;
    margin-bottom: 20px;
}

.gs-summary {
    color: #555;
    font-size: 0.95rem;
    margin-bottom: 20px;
}

.gs-empty {
    background: #fff8e1;
    border-left: 4px solid #fbc02d;
    padding: 15px 20px;
    border-radius: 5px;
    color: #7a6200;
    font-size: 0.95rem;
}

.gs-result {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-left: 4px solid #2c5aa0;
    border-radius: 8px;
    padding: 18px 22px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.3s;
}

.gs-result:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.gs-result-title {
    font-size: 1.05rem;
    color: #1a4d8f;
    font-weight: 700;
    margin-bottom: 4px;
}

.gs-meta {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 8px;
}

.gs-excerpt {
    color: #555;
    font-size: 0.92rem;
    line-height: 1.6;
    margin-bottom: 12px;
}

.gs-mark {
    background: #fff59d;
    padding: 0 2px;
    border-radius: 2px;
    box-shadow: 0 0 0 1px #fbc02d;
    color: #000;
}

.gs-link {
    display: inline-flex;
    align-items: center;
    padding: 7px 14px;
    background: #2c5aa0;
    color: #ffffff !important;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.2s;
}

.gs-link:hover {
    background: #1a4d8f;
    color: #ffffff;
    text-decoration: none;
}

/* === Подсветка слова на открытой странице === */
.search-highlight {
    background-color: #fff59d !important;
    color: #000 !important;
    padding: 1px 2px;
    border-radius: 2px;
    box-shadow: 0 0 0 1px #fbc02d;
}

.search-highlight-active {
    background-color: #ff9800 !important;
    color: #fff !important;
    box-shadow: 0 0 0 2px #e65100;
}

@media (max-width: 600px) {
    .header-search .search-expand {
        width: 240px;
    }
}