.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    transition: 0.3s ease-in-out;
}

.search-box {
    position: absolute;
    left: 0;
    right: 0;
    width: 98%;
    max-width: 872px;
    margin: auto;
    transform: translateY(-320%);
    z-index: -1;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}



.search-box.open { 
    transform: translateY(10px); 
    z-index: 1001;
    position: fixed;
}


.search-form {
    position: relative;  
}

.search-field-wrapper {
    position: relative;
}

.search-field {
    font-size: 20px; 
    height: 64px;
    width: 100%; 
    padding: 0 30px 0 60px;
    color: #fff;
   border: 4px solid #463F3A; 
    background: #302B28;
    border-radius: 8px; 
    font-family: 'SFPro';
}

.search-field:focus {
    outline: none;
    border-color: #008980; 
}

.search-submit {
    position: absolute;
    left: 28px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none; 
    pointer-events: none;
}
 
.ajax-search-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff; 
    border-radius: 0 0 8px 8px; 
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
}
 
.ajax-search__list {
    list-style: none;
    margin: 0;
    padding: 0;
}


.ajax-search__link {
    display: block;
    padding: 12px 36px;
    text-decoration: none;
    color: #2D2926;
    transition: background-color 0.2s ease;
}

.ajax-search__link:hover {
    background-color: #F5F5F5;
}

.ajax-search__title {
    display: block; 
}
 
 
.ajax-search__show-all {
    background-color: #008980;
}

.ajax-search__show-all-link {
    display: block;
    padding: 12px 15px;
    text-decoration: none;    
    color: #fff;
    font-weight: 500;
    text-align: center;
    transition: background-color 0.2s ease;
}

.ajax-search__show-all-link:hover {
    background-color: #0d5c57; 
}

 
.ajax-search__empty,
.ajax-search__error {
    padding: 20px 15px;
    text-align: center;
    color: #fff;
    background: #008980;
    font-weight: 500;
}

/* Индикатор загрузки */
.ajax-search-results.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1001;
}

.ajax-search-results.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 1000;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

 
@media (max-width: 768px) {
    .search-form {
        max-width: 100%;
    }
    
    .search-field {
        padding: 10px 45px 10px 12px;
        font-size: 16px; /* Предотвращает zoom на iOS */
    }
    
    .ajax-search-results {
        position: fixed;
        left: 10px;
        right: 10px;
        max-height: 60vh;
    }
}