/**
 * Search Suggestions CSS
 * สไตล์สำหรับช่องค้นหาแบบ auto-complete
 */

/* Search suggestions box */
.search-suggestions-box {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
}

/* Individual suggestion item */
.search-suggestion {
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    color: var(--text-color);
}

.search-suggestion:last-child {
    border-bottom: none;
}

.search-suggestion:hover {
    background: linear-gradient(
        135deg,
        rgba(102, 126, 234, 0.1) 0%,
        rgba(118, 75, 162, 0.1) 100%
    );
    padding-left: 20px;
}

.search-suggestion i {
    color: var(--primary-color);
    font-size: 14px;
    margin-right: 12px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.search-suggestion:hover i {
    opacity: 1;
}

/* Search form positioning */
#search-form {
    position: relative;
}

/* Loading state for search */
.search-loading {
    padding: 16px;
    text-align: center;
    color: var(--text-color);
    opacity: 0.7;
}

.search-loading .spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--primary-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* No results message */
.search-no-results {
    padding: 16px;
    text-align: center;
    color: var(--text-color);
    opacity: 0.7;
    font-style: italic;
}

/* Search highlight */
.search-highlight {
    background: linear-gradient(
        135deg,
        rgba(102, 126, 234, 0.2) 0%,
        rgba(118, 75, 162, 0.2) 100%
    );
    font-weight: 600;
}

/* Categories in suggestions */
.search-category {
    background: var(--primary-color);
    color: white;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 11px;
    margin-left: 8px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .search-suggestions-box {
        max-height: 250px;
    }

    .search-suggestion {
        padding: 10px 12px;
        font-size: 14px;
    }

    .search-suggestion i {
        font-size: 12px;
        margin-right: 8px;
    }
}

/* Animation for showing/hiding */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-suggestions-box.show {
    animation: slideDown 0.2s ease-out;
}

/* Scrollbar styling for suggestions */
.search-suggestions-box::-webkit-scrollbar {
    width: 6px;
}

.search-suggestions-box::-webkit-scrollbar-track {
    background: var(--bg-color);
}

.search-suggestions-box::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
    opacity: 0.5;
}

.search-suggestions-box::-webkit-scrollbar-thumb:hover {
    opacity: 0.8;
}
