/**
 * Masine Products Live Search Styles
 *
 * Dropdown and result item styles for the AJAX live search.
 *
 * @package Masine_Products_Live_Search
 * @since   1.0.0
 */

/* Dropdown container - position is set via JS (fixed) for sticky header compatibility */
.masine-live-search-dropdown {
    z-index: 9999999999;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* Loading state */
.masine-live-search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    color: #666666;
    font-size: 14px;
}

/* Spinner animation */
.masine-live-search-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #e0e0e0;
    border-top-color: #333333;
    border-radius: 50%;
    animation: masine-live-search-spin 0.8s linear infinite;
}

@keyframes masine-live-search-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error state */
.masine-live-search-error {
    padding: 20px;
    color: #cc0000;
    font-size: 14px;
    text-align: center;
}

/* No results state */
.masine-live-search-no-results {
    padding: 20px;
    color: #666666;
    font-size: 14px;
    text-align: center;
}

/* Result item */
.masine-live-search-item {
    border-bottom: 1px solid #f0f0f0;
}

.masine-live-search-item:last-child {
    border-bottom: none;
}

/* Brand archive row (whole name match) */
.masine-live-search-item--brand .masine-live-search-item__thumb--brand {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e8ecf2 0%, #f4f6f9 100%);
}

.masine-live-search-item--brand .masine-live-search-item__thumb--brand::before {
    content: '';
    width: 22px;
    height: 22px;
    opacity: 0.55;
    background: #5a6b7d;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z'/%3E%3C/svg%3E") no-repeat center center;
    mask-size: contain;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z'/%3E%3C/svg%3E") no-repeat center center;
    -webkit-mask-size: contain;
}

.masine-live-search-item__brand-hint {
    font-style: italic;
}

.masine-live-search-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.15s ease;
}

.masine-live-search-item:hover a,
.masine-live-search-item.is-focused a {
    background-color: #f8f8f8;
}

/* Thumbnail */
.masine-live-search-item__thumb {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    border-radius: 4px;
    overflow: hidden;
    background: #f5f5f5;
}

.masine-live-search-item__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Placeholder for missing thumbnail */
.masine-live-search-item__placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e8e8e8 0%, #f5f5f5 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.masine-live-search-item__placeholder::before {
    content: '';
    display: block;
    width: 24px;
    height: 24px;
    background: #d0d0d0;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z'/%3E%3C/svg%3E") no-repeat center center;
    mask-size: contain;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z'/%3E%3C/svg%3E") no-repeat center center;
    -webkit-mask-size: contain;
}

/* Content area */
.masine-live-search-item__content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

/* Title */
.masine-live-search-item__title {
    font-size: 14px;
    font-weight: 500;
    color: #222222;
    line-height: 1.3;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Meta (brand + categories) */
.masine-live-search-item__meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #888888;
    line-height: 1.4;
}

.masine-live-search-item__brand {
    font-weight: 500;
    color: #666666;
}

.masine-live-search-item__separator {
    color: #cccccc;
}

.masine-live-search-item__categories {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Scrollbar styling */
.masine-live-search-dropdown::-webkit-scrollbar {
    width: 8px;
}

.masine-live-search-dropdown::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 4px;
}

.masine-live-search-dropdown::-webkit-scrollbar-thumb {
    background: #cccccc;
    border-radius: 4px;
}

.masine-live-search-dropdown::-webkit-scrollbar-thumb:hover {
    background: #aaaaaa;
}

/* Responsive adjustments */
@media screen and (max-width: 480px) {
    .masine-live-search-item a {
        padding: 8px 10px;
        gap: 10px;
    }

    .masine-live-search-item__thumb {
        width: 40px;
        height: 40px;
    }

    .masine-live-search-item__title {
        font-size: 13px;
    }

    .masine-live-search-item__meta {
        font-size: 11px;
    }
}
