/**
 * Search Autocomplete Styles
 *
 * Styles for the AJAX-powered search suggestions dropdown.
 *
 * @package GridMode WordPress Theme
 * @since 1.0.0
 */

/* Container */
.search-autocomplete-container {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 10002;
    max-height: 400px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    margin-top: 8px;
}

.search-autocomplete-container.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* For pin-search overlay positioning */
.pin-search-form {
    position: relative;
}

.pin-search-form .search-autocomplete-container {
    left: 0;
    right: auto;
    width: 100%;
    min-width: 400px;
}

/* Group headers */
.search-autocomplete-group {
    padding: 8px 0;
}

.search-autocomplete-group:not(:first-child) {
    border-top: 1px solid #eee;
}

.search-autocomplete-group-label {
    padding: 8px 16px 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #888;
    letter-spacing: 0.5px;
}

/* Individual items */
.search-autocomplete-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    gap: 12px;
}

.search-autocomplete-item:hover,
.search-autocomplete-item.selected {
    background-color: #f5f5f5;
}

/* Thumbnail */
.search-autocomplete-thumb {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 6px;
    overflow: hidden;
    background: #f0f0f0;
}

.search-autocomplete-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-autocomplete-thumb-placeholder,
.search-autocomplete-thumb-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
    font-size: 18px;
}

.search-autocomplete-item-category .search-autocomplete-thumb-icon {
    background: #e8f4fd;
    color: #1976d2;
}

.search-autocomplete-item-topic .search-autocomplete-thumb-icon {
    background: #fef3e2;
    color: #f57c00;
}

/* Content */
.search-autocomplete-content {
    flex: 1;
    min-width: 0;
}

.search-autocomplete-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.search-autocomplete-title mark {
    background: #fff3cd;
    color: #856404;
    padding: 0 2px;
    border-radius: 2px;
}

.search-autocomplete-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
    font-size: 12px;
    color: #888;
}

.search-autocomplete-category {
    color: #dd3333;
    font-weight: 500;
}

.search-autocomplete-type {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 600;
}

/* Footer - View all link */
.search-autocomplete-footer {
    border-top: 1px solid #eee;
    padding: 12px 16px;
    background: #fafafa;
    border-radius: 0 0 8px 8px;
}

.search-autocomplete-view-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #dd3333;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.15s ease;
}

.search-autocomplete-view-all:hover {
    color: #b71c1c;
}

/* Loading state */
.search-autocomplete-loading {
    padding: 24px 16px;
    text-align: center;
    color: #888;
    font-size: 14px;
}

.search-autocomplete-loading i {
    margin-right: 8px;
}

/* Empty state */
.search-autocomplete-empty {
    padding: 24px 16px;
    text-align: center;
    color: #888;
    font-size: 14px;
}

.search-autocomplete-empty i {
    display: block;
    font-size: 24px;
    margin-bottom: 8px;
    opacity: 0.5;
}

/* Scrollbar styling */
.search-autocomplete-container::-webkit-scrollbar {
    width: 6px;
}

.search-autocomplete-container::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 3px;
}

.search-autocomplete-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.search-autocomplete-container::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .pin-search-form .search-autocomplete-container {
        min-width: 280px;
        max-height: 350px;
    }

    .search-autocomplete-thumb {
        width: 40px;
        height: 40px;
    }

    .search-autocomplete-title {
        font-size: 13px;
    }

    .search-autocomplete-meta {
        font-size: 11px;
    }
}

/* Dark overlay background adjustment */
.pin-search-overlay .search-autocomplete-container {
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}
