/**
 * Custom Product Search - DROPDOWN ONLY
 * Version: 1.0.10
 * 
 * This CSS ONLY styles the dropdown results
 * It does NOT touch: wrapper, form, input, or any existing elements
 * Use this if your search box already looks perfect without CSS
 */

/* ==============================================
   RESULTS DROPDOWN ONLY
   ============================================== */

.custom-product-search-wrapper .search-results-dropdown {
    position: absolute !important;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    max-height: 320px;
    overflow: hidden;
}

/* ==============================================
   RESULTS LIST
   ============================================== */

.custom-product-search-wrapper .search-results-list {
    max-height: 280px;
    overflow-y: auto;
    overflow-x: hidden;
}

.custom-product-search-wrapper .search-results-list::-webkit-scrollbar {
    width: 6px;
}

.custom-product-search-wrapper .search-results-list::-webkit-scrollbar-track {
    background: #f9fafb;
}

.custom-product-search-wrapper .search-results-list::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.custom-product-search-wrapper .search-results-list::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ==============================================
   INDIVIDUAL RESULT ITEM
   ============================================== */

.custom-product-search-wrapper .search-result-item {
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

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

.custom-product-search-wrapper .search-result-item:hover {
    background-color: #f9fafb;
}

.custom-product-search-wrapper .search-result-item.selected {
    background-color: #eff6ff;
}

/* Product image */
.custom-product-search-wrapper .search-result-item .product-image {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-product-search-wrapper .search-result-item .product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Product info */
.custom-product-search-wrapper .search-result-item .product-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

/* Product title */
.custom-product-search-wrapper .search-result-item .product-title {
    font-size: 13px;
    font-weight: 600;
    color: #2563eb;
    line-height: 1.3;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.custom-product-search-wrapper .search-result-item .product-title mark {
    background: #fef3c7;
    color: inherit;
    font-weight: 700;
    padding: 0 2px;
    border-radius: 2px;
}

/* Stock status */
.custom-product-search-wrapper .search-result-item .product-stock {
    font-size: 11px;
    font-weight: 500;
    margin: 0;
}

.custom-product-search-wrapper .search-result-item .product-stock.in-stock {
    color: #059669;
}

.custom-product-search-wrapper .search-result-item .product-stock.out-of-stock {
    color: #dc2626;
}

/* SKU */
.custom-product-search-wrapper .search-result-item .product-sku {
    font-size: 12px;
    font-weight: 700;
    color: #374151;
    margin: 0;
}

.custom-product-search-wrapper .search-result-item .product-sku mark {
    background: #fef3c7;
    color: inherit;
    font-weight: 700;
    padding: 0 2px;
    border-radius: 2px;
}

/* Product description */
.custom-product-search-wrapper .search-result-item .product-description {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}

/* Price */
.custom-product-search-wrapper .search-result-item .product-price {
    font-size: 14px;
    font-weight: 700;
    color: #dc2626;
    margin: 2px 0 0 0;
}

/* ==============================================
   VIEW ALL RESULTS LINK
   ============================================== */

.custom-product-search-wrapper .search-view-all {
    padding: 10px 12px;
    text-align: center;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.custom-product-search-wrapper .view-all-link {
    color: #2563eb;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s ease;
}

.custom-product-search-wrapper .view-all-link:hover {
    color: #1d4ed8;
}

/* ==============================================
   NO RESULTS / ERROR STATES
   ============================================== */

.custom-product-search-wrapper .search-no-results,
.custom-product-search-wrapper .search-error {
    padding: 32px 16px;
    text-align: center;
}

.custom-product-search-wrapper .no-results-icon,
.custom-product-search-wrapper .error-icon {
    font-size: 40px;
    margin-bottom: 10px;
    opacity: 0.5;
}

.custom-product-search-wrapper .no-results-text,
.custom-product-search-wrapper .error-text {
    font-size: 15px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.custom-product-search-wrapper .no-results-hint,
.custom-product-search-wrapper .error-hint {
    font-size: 13px;
    color: #6b7280;
}

/* ==============================================
   LOADING SPINNER - Only if you want it styled
   ============================================== */

.custom-product-search-wrapper .search-loading {
    position: absolute;
    right: 42px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
}

.custom-product-search-wrapper .loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #2563eb;
    border-radius: 50%;
    animation: cps-spin 0.8s linear infinite;
}

@keyframes cps-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==============================================
   MOBILE RESPONSIVE - Dropdown only
   ============================================== */

@media (max-width: 768px) {
    .custom-product-search-wrapper .search-results-dropdown {
        max-height: 400px;
    }
    
    .custom-product-search-wrapper .search-results-list {
        max-height: 350px;
    }
    
    .custom-product-search-wrapper .search-result-item {
        padding: 9px 10px;
        gap: 9px;
    }
    
    .custom-product-search-wrapper .search-result-item .product-image {
        width: 45px;
        height: 45px;
    }
    
    .custom-product-search-wrapper .search-result-item .product-title {
        font-size: 12px;
    }
    
    .custom-product-search-wrapper .search-result-item .product-sku {
        font-size: 11px;
    }
    
    .custom-product-search-wrapper .search-result-item .product-description {
        font-size: 11px;
    }
    
    .custom-product-search-wrapper .search-result-item .product-price {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .custom-product-search-wrapper .search-result-item .product-image {
        width: 42px;
        height: 42px;
    }
}