/* Custom Autocomplete Styles */

/* Container for the autocomplete component */
.autocomplete-container {
    position: relative;
    width: 100%;
    display: block;
}

/* Dropdown styles */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    display: none;
    min-width: 250px; /* Ensure minimum width */
    width: 100%; /* Take full width of container */
    max-height: 300px;
    overflow-y: auto;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-top: 5px;
}

/* Individual result item */
.autocomplete-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item-focused {
    background-color: #f5f5f5;
}

/* Title of result */
.autocomplete-title {
    display: block;
    font-weight: bold;
    color: #333;
    margin-bottom: 3px;
    word-break: break-word; /* Prevent long titles from overflowing */
}

/* Description of result */
.autocomplete-description {
    font-size: 0.85em;
    color: #6c757d;
    margin-top: 3px;
}

/* Message for no results, loading, etc. */
.autocomplete-message {
    padding: 10px 15px;
    color: #6c757d;
    font-style: italic;
}

/* Input field styling */
.custom-autocomplete {
    width: 100%;
    min-width: 250px; /* Ensure minimum width */
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: border-color 0.3s, box-shadow 0.3s;
    box-sizing: border-box; /* Include padding in width calculation */
}

.custom-autocomplete:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Navigation search form specific styles */
.nav-search-form {
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 250px;
}

.nav-search-form .autocomplete-container {
    flex: 1;
    min-width: 200px;
}

.nav-search-button {
    margin-left: 5px;
    padding: 8px 12px;
    background-color: #4a90e2;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.nav-search-button:hover {
    background-color: #3a80d2;
}

/* Ensure proper handling of non-ASCII characters */
.autocomplete-item,
.custom-autocomplete {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .nav-search-form {
        flex-direction: column;
        align-items: stretch;
    }

    .nav-search-button {
        margin-left: 0;
        margin-top: 5px;
    }
}
