/* Search Autocomplete Styles - Mobile-First Responsive Design */

/* Main dropdown container */
.search-results-dropdown {
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: white;
    margin-top: 2px;
    max-width: 100%;
    font-size: 14px;
}

.search-results-dropdown .dropdown-item {
    padding: 0;
    border: none;
    background: none;
}

.search-results-dropdown .dropdown-item:hover {
    background-color: #f8f9fa;
}

/* Search result item container */
.search-result-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s ease;
    gap: 12px;
}

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

.search-result-item:hover {
    background-color: #f8f9fa;
}

/* Image container */
.search-result-image-container {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f9fa;
}

.search-result-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.search-result-placeholder {
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background-color: #f5f5f5;
}

.search-result-placeholder svg {
    width: 24px;
    height: 24px;
    opacity: 0.5;
}

/* Details section */
.search-result-details {
    flex: 1;
    min-width: 0;
    /* Allows text truncation to work */
    overflow: hidden;
}

.search-result-name {
    font-weight: 600;
    color: #333;
    line-height: 1.3;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    font-size: 12px;
    line-height: 1.2;
}

/* Meta information styling */
.search-result-category,
.search-result-brand,
.search-result-size {
    background-color: #e9ecef;
    color: #495057;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
}

.search-result-brand {
    background-color: #d4edda;
    color: #155724;
}

.search-result-size {
    background-color: #fff3cd;
    color: #856404;
}

.search-result-match {
    color: #6c757d;
    font-style: italic;
    font-size: 11px;
}

/* Loading and no results states */
.search-loading,
.search-no-results {
    padding: 16px;
    text-align: center;
    color: #6c757d;
    font-style: italic;
}

.search-loading {
    font-size: 14px;
}

.search-no-results {
    font-size: 13px;
}

/* View all results link */
.search-results-dropdown .dropdown-item.text-center {
    padding: 12px;
    color: #00ced1;
    font-weight: 600;
    border-top: 1px solid #dee2e6;
    margin-top: 4px;
}

.search-results-dropdown .dropdown-item.text-center:hover {
    background-color: #f8f9fa;
    color: #007b7f;
}

/* Mobile specific adjustments */
@media (max-width: 768px) {
    .search-results-dropdown {
        font-size: 13px;
        max-height: 300px;
        /* Shorter on mobile */
        border-radius: 6px;
    }

    .search-result-item {
        padding: 10px;
        gap: 10px;
    }

    .search-result-image-container {
        width: 40px;
        height: 40px;
    }

    .search-result-placeholder svg {
        width: 20px;
        height: 20px;
    }

    .search-result-name {
        font-size: 13px;
        margin-bottom: 3px;
    }

    .search-result-meta {
        gap: 6px;
        font-size: 11px;
    }

    .search-result-category,
    .search-result-brand,
    .search-result-size {
        font-size: 10px;
        padding: 1px 4px;
    }

    .search-result-match {
        display: none;
        /* Hide match reason on mobile to save space */
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .search-results-dropdown {
        margin-left: -5px;
        margin-right: -5px;
        width: calc(100% + 10px);
        max-height: 250px;
    }

    .search-result-item {
        padding: 8px;
        gap: 8px;
    }

    .search-result-image-container {
        width: 35px;
        height: 35px;
    }

    .search-result-name {
        font-size: 12px;
    }

    .search-result-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 3px;
    }
}

/* Ensure proper z-index layering */
.search-form {
    position: relative;
}

.search-results-dropdown {
    z-index: 1050 !important;
}

/* Smooth animations */
.search-result-item {
    transition: background-color 0.15s ease;
}

.search-result-image {
    transition: transform 0.2s ease;
}

.search-result-item:hover .search-result-image {
    transform: scale(1.05);
}

/* Dark mode support (if needed in future) */
@media (prefers-color-scheme: dark) {
    .search-results-dropdown {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }

    .search-result-item:hover {
        background-color: #4a5568;
    }

    .search-result-name {
        color: #e2e8f0;
    }

    .search-result-placeholder {
        background-color: #4a5568;
        color: #a0aec0;
    }
}