.custom-search-wrapper {
    position: relative; 
    z-index: 99999;
}

.search-icon-toggle {
    display: block;
    cursor: pointer;
    padding: 5px;
}

.search-icon-toggle .ast-icon svg {
    width: 30px;
    height: 30px;
    vertical-align: middle;
}

.custom-search-form {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    height: 0;
    overflow: hidden;
    
    position: fixed;
    left: 0;
    right: 0;
    width: 50%;
    margin: 0 auto;
    top:70px; 
    z-index: 99999;
    padding: 0;
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    box-sizing: border-box;
}

.custom-search-wrapper.active .custom-search-form {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    height: auto;
    padding: 15px;
}

.search-input-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

#custom-search-field {
    flex-grow: 1;
    height: 50px;
    padding: 10px 15px;
    font-size: 1em;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

.search-submit {
    height: 50px;
    padding: 0 20px;
    background: #FF5722;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    white-space: nowrap;
}

.live-results-dropdown {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.live-results-dropdown .search-section {
    margin-bottom: 10px;
}

.live-results-dropdown h4 {
    font-size: 1.1em;
    color: #333;
    margin: 5px 0;
    padding: 0;
    font-weight: 600;
}

.live-results-dropdown ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.live-results-dropdown li a {
    display: flex;
    justify-content: space-between;
    padding: 6px 10px;
    text-decoration: none;
    color: #555;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.live-results-dropdown li a:hover {
    background-color: #f0f0f0;
}

.live-results-dropdown .type {
    font-size: 0.85em;
    color: #999;
}

.search-close-button {
    position: absolute;
    display: none; 
    width: 25px;
    height: 25px;
    background: #fff;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 99999;
    color: #999; 
    transition: color 0.2s;
}

.search-close-button:hover {
    color: #333;
}

.search-close-button svg {
    width: 20px;
    height: 20px;
    display: block;
}

/* Ajuste al padding del formulario para que el botón no interfiera */
.custom-search-wrapper.active .custom-search-form {
    padding: 15px 15px 15px 15px;
    padding-top: 30px; 
}

.custom-search-wrapper.active .search-close-button {
    display: block;
}

@media (max-width: 768px) {
    .custom-search-form {
        width: 95%;
        top: 60px;
        padding: 10px;
    }
    
    .search-input-container {
        gap: 5px;
    }
    
    #custom-search-field {
        height: 45px;
        font-size: 0.9em;
    }
    
    .search-submit {
        height: 45px;
        padding: 0 15px;
        font-size: 0.9em;
    }
    .custom-search-wrapper.active .custom-search-form {
        padding-top: 30px;
    }
}

@media (min-width: 769px) {
    .custom-search-wrapper.active .search-close-button {
        top: 0px;
         right: 0%;
    }
}

@media (max-width: 768px) {
    .custom-search-wrapper.active .search-close-button {
        top: 0px; 
        right: 0%; 
    }
}