/* ==========================================================================
   HivePress Keyword Autocomplete - Main Container
   ========================================================================== */
.ui-autocomplete {
    /* Limit to approximately 5 results (70px * 5 = 350px) */
    max-height: 350px;
    overflow-y: auto;
    overflow-x: hidden;

    /* Presentation */
    background: #ffffff !important;
    border: none !important;
    border-radius: 8px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
    padding: 8px 12px !important;
    z-index: 999999 !important;
    margin-top: 5px;
    list-style: none !important;
}

/* Custom Scrollbar for a cleaner look */
.ui-autocomplete::-webkit-scrollbar {
    width: 6px;
}

.ui-autocomplete::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.ui-autocomplete::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.ui-autocomplete::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* ==========================================================================
   Individual Suggestion Items
   ========================================================================== */
.ui-menu-item {
    margin: 0 !important;
    padding: 0 !important;
    border-bottom: 1px solid #f0f0f0;
}

.ui-menu-item:last-child {
    border-bottom: none;
}

/* Wrapper inside the <li> provided by jQuery UI */
.ui-menu-item-wrapper {
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
}

.hp-suggestion-item {
    display: flex;
    align-items: center;
    padding: 12px 12px;
    height: 70px; /* Fixed height for scrolling calculation */
    box-sizing: border-box;
    cursor: pointer;
    transition: background 0.2s ease;
    border-radius: 4px;
    margin: 2px 0;
}

.ui-state-active .hp-suggestion-item,
.hp-suggestion-item:hover {
    background-color: #f8f9fa !important;
}

/* Thumbnail Styling */
.hp-suggestion-thumb, 
.hp-suggestion-thumb-placeholder {
    width: 46px;
    height: 46px;
    border-radius: 6px;
    object-fit: cover;
    margin-right: 12px;
    flex-shrink: 0; /* Prevents image from squishing */
    background: #eee;
}

/* Text Content Container */
.hp-suggestion-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

.hp-suggestion-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

/* Highlight for matching characters */
.hp-suggestion-title strong {
    color: #ff5a5f; /* Change this to your theme's primary color */
    font-weight: 800;
}

.hp-suggestion-category {
    font-size: 11px;
    color: #8a8a8a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* ==========================================================================
   Loading Indicator - CSS Spinner
   ========================================================================== */
.hp-autocomplete-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: 8px;
    vertical-align: middle;
    border: 3px solid #f0f0f0;
    border-top-color: #ff5a5f;
    border-right-color: #ff5a5f;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   Reset Button Styling
   ========================================================================== */
.hp-form__reset-button {
    margin-left: 8px !important;
    background-color: #f0f0f0 !important;
    color: #333 !important;
    border-color: #ddd !important;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.hp-form__reset-button:hover {
    background-color: #e0e0e0 !important;
    color: #222 !important;
}