/**
 * Intelligent Search Autocomplete Styles
 */

/* Wrapper */
.te-search-wrapper {
    position: relative;
    width: 100%;
}

/* Dropdown container */
.te-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    margin-top: 4px;
    overflow: hidden;
    max-height: 480px;
    overflow-y: auto;
}

/* Individual item */
.te-search-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.15s ease;
    gap: 12px;
}

.te-search-item:last-of-type {
    border-bottom: none;
}

.te-search-item:hover,
.te-search-item-selected {
    background: #f0f7ff;
}

/* Item image */
.te-search-item-image {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    overflow: hidden;
    background: #f3f4f6;
}

.te-search-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.te-search-item-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.te-search-item-placeholder::after {
    content: '';
    width: 24px;
    height: 24px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z'/%3E%3C/svg%3E");
    background-size: contain;
}

/* Item content */
.te-search-item-content {
    flex: 1;
    min-width: 0;
}

.te-search-item-name {
    font-weight: 500;
    color: #1f2937;
    font-size: 14px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.te-search-item-name mark {
    background: #fef3c7;
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}

.te-search-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    font-size: 12px;
    color: #6b7280;
}

.te-search-item-brand {
    font-weight: 500;
    color: #1776C8;
}

.te-search-item-category {
    padding: 2px 6px;
    background: #f3f4f6;
    border-radius: 4px;
}

.te-search-item-price {
    font-weight: 600;
    color: #059669;
}

/* SKU badge */
.te-search-item-sku {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 500;
    color: #9ca3af;
    background: #f9fafb;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: monospace;
}

/* Footer with "See all results" */
.te-search-footer {
    background: #f9fafb;
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
}

.te-search-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #1776C8;
    font-weight: 500;
    font-size: 14px;
    text-decoration: none;
    transition: color 0.15s ease;
}

.te-search-all:hover {
    color: #125A9C;
}

.te-search-all svg {
    transition: transform 0.15s ease;
}

.te-search-all:hover svg {
    transform: translateX(4px);
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .te-search-dropdown {
        position: fixed;
        top: auto;
        left: 8px;
        right: 8px;
        bottom: 0;
        margin-top: 0;
        border-radius: 16px 16px 0 0;
        max-height: 60vh;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
    }

    .te-search-item {
        padding: 14px 16px;
    }

    .te-search-item-image {
        width: 56px;
        height: 56px;
    }

    .te-search-item-name {
        font-size: 15px;
    }

    .te-search-item-meta {
        flex-wrap: wrap;
    }
}

/* Animation */
.te-search-dropdown {
    animation: te-search-slide-in 0.2s ease;
}

@keyframes te-search-slide-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar styling */
.te-search-dropdown::-webkit-scrollbar {
    width: 6px;
}

.te-search-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.te-search-dropdown::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.te-search-dropdown::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

