/**
 * Live Search Styles
 * Scoped to the dynamically added classes to prevent global pollution.
 */

/* 
 * Structural flag added via JS. 
 * Ensures the dropdown can be positioned absolutely relative to the form.
 */
.has-live-search {
    position: relative;
}

/* 
 * The dropdown container.
 * Positioned below the search bar. Uses CSS variables for theming.
 */
.vortex-live-search-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background-color: var(--wp--preset--color--accent-1, #161718);
    color: var(--wp--preset--color--accent-3, #F0F0F0);
    border: 2px solid var(--wp--preset--color--custom-gris-resaltado, #5F5F5F);
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    /* High z-index to overlay page content */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    opacity: 1;
    transition: opacity 0.2s ease;
}

/* State: Hidden */
.vortex-live-search-dropdown[hidden] {
    display: none;
    opacity: 0;
}

/* 
 * Loading state wrapper 
 */
.vortex-live-search-loading {
    padding: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 
 * Simple CSS Spinner 
 */
.vortex-loader {
    width: 24px;
    height: 24px;
    border: 2px solid var(--wp--preset--color--accent-3, #e0e0e0);
    border-bottom-color: var(--wp--preset--color--accent-1, #161718);
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: vortex-rotation 1s linear infinite;
}

@keyframes vortex-rotation {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* 
 * Results List Reset 
 */
.vortex-live-search-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 60vh;
    overflow-y: auto;
}

/* 
 * Individual Result Item 
 */
.vortex-live-search-item {
    margin: 0;
    border-bottom: 1px solid var(--wp--preset--color--accent-3, #F0F0F0);
}

.vortex-live-search-item:last-child {
    border-bottom: none;
}

/* 
 * Result Link Layout 
 */
.vortex-live-search-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.2s ease;
}

.vortex-live-search-link:hover,
.vortex-live-search-link:focus {
    background-color: var(--wp--preset--color--custom-gris-resaltado, #5F5F5F);
    outline: none;
}

/* 
 * Thumbnail Styling 
 */
.vortex-live-search-img {
    width: 32px;
    height: 48px;
    object-fit: cover;
    border-radius: 0.25rem;
    flex-shrink: 0;
}

.vortex-live-search-img-placeholder {
    width: 32px;
    height: 48px;
    background-color: var(--wp--preset--color--contrast-4, #f5f5f5);
    border-radius: 0.25rem;
    flex-shrink: 0;
}

/* 
 * Text Info Container 
 */
.vortex-live-search-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow: hidden;
}

.vortex-live-search-title {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vortex-live-search-price {
    font-size: 0.85rem;
    font-weight: 600;
}

/* WooCommerce native price styling inside our dropdown */
.vortex-live-search-price del {
    opacity: 0.6;
    font-weight: 400;
    margin-right: 0.5rem;
}

/* 
 * Messages (Empty / Error) 
 */
.vortex-live-search-message {
    padding: 1.5rem 1rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--wp--preset--color--contrast-2, #666666);
}

/* 
 * Footer / View All Link 
 */
.vortex-live-search-footer {
    background-color: var(--wp--preset--color--contrast, #101011);
    padding: 0.75rem 1rem;
    text-align: center;
    border-top: 2px solid var(--wp--preset--color--custom-gris-resaltado, #5F5F5F);
}

.vortex-live-search-view-all {
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--wp--preset--color--accent-3, #F0F0F0);
}

.vortex-live-search-view-all:hover {
    text-decoration: underline;
}