/* Product Search Bar Styles - Unique classes to avoid conflicts */

/* Product Search Bar Container */
.product-search-bar {
    max-width: 500px;
    /* margin: 0 auto; */
    border-radius: 4px;
    position: relative;
}

/* Search Bar Icon - positioned relative to product-search-bar container */
/* Icon is positioned to align with input field center (input is 48px high) */
.product-search-icon {
    position: absolute;
    top: 24px; /* Half of input height (48px / 2 = 24px) to center with input */
    left: 15px;
    transform: translateY(-50%); /* Center the icon itself */
    width: 20px;
    height: 20px;
    z-index: 10;
    pointer-events: none;
    opacity: 0.6;
}

/* Search Input Text */
.product-search-bar input.product-search-input {
    color: #9C9C9C !important;
    font-family: Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 24px;
    padding: 8px 10px 8px 55px !important;
    border: none;
    width: 100%;
    min-width: 432px;
    height: 48px !important;
    max-height: 48px !important;
    border-radius: 4px;
    border: 1px solid #E8E8E8 !important;
    background: #FFF !important;
    box-sizing: border-box;
    position: relative;
    text-decoration: none !important;
    -webkit-text-decoration: none !important;
    -moz-text-decoration: none !important;
    min-width: 435px;
}

.product-search-bar input.product-search-input:focus {
    outline: none !important;
    border: 1px solid #ddd  !important;
    background: #FFF !important;
    color: #333 !important;
    box-shadow: 0 0 0 1px rgba(0, 130, 198, 0.15) !important;
}

.product-search-bar input.product-search-input:focus-visible {
    outline: none !important;
    border: 1px solid #ddd !important;
    box-shadow: 0 0 0 1px rgba(0, 130, 198, 0.15) !important;
}

.product-search-bar input.product-search-input::placeholder {
    color: #9C9C9C;
    opacity: 1;
}

/* Search Status - Hidden by default, only shows when it has content */
.product-search-status {
    font-size: 14px;
    color: #666;
    margin: 0;
    padding: 0;
    display: none; /* Hidden by default */
    min-height: 0;
    height: 0;
    overflow: hidden;
    line-height: 0;
}

/* Show status when it has content or has-status class */
.product-search-status:not(:empty),
.product-search-status.has-status {
    display: block;
    margin-top: 8px;
    min-height: auto;
    height: auto;
    overflow: visible;
    line-height: normal;
}

/* Additional safety: ensure empty divs take absolutely no space */
.product-search-status:empty:not(.has-status) {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
    line-height: 0 !important;
    overflow: hidden !important;
}

/* Search Results Container */
.product-search-results {
    margin-top: 10px;
    animation: productSearchFadeIn 0.3s ease;
    max-height: 600px;
    overflow-y: auto;
    overflow-x: hidden;
    position: absolute;
    top: 58px; /* just below 48px input + small gap */
    left: 0;
    width: 100%;
    z-index: 50;
}

/* Show background only when there are results */
.product-search-results.has-results {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    padding-right: 28px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: absolute;
   z-index: 555;
}

@keyframes productSearchFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Results Header */
.product-results-header {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

/* Result Items */
.product-result-item {
    display: flex;
    gap: 12px;
    background: #f9f9f9;
    padding: 16px;
    margin-bottom: 12px;
    border-radius: 6px;
    border-left: 4px solid #0073aa;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.product-result-item:hover {
    background: #f5f5f5;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateX(4px);
}

.product-result-number {
    min-width: 28px;
    height: 28px;
    background: #0073aa;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

.product-result-content {
    flex: 1;
    min-width: 0;
}

/* Result Name (Link) */
.product-result-name {
    display: flex;
    align-items: flex-start;
    gap: 5px;
    font-weight: 600;
    color: #0073aa;
    text-decoration: none !important;
    font-size: 15px;
    margin-bottom: 8px;
    word-break: break-word;
    transition: color 0.3s ease;
}

.product-result-name img,
.product-result-name span {
    flex-shrink: 0;
    margin-top: 2px;
}

.product-result-name:hover {
    color: #005a87;
    text-decoration: none !important;
}

/* Snippet */
.product-result-snippet {
    font-size: 13px;
    color: #666;
    line-height: 1.6;
    word-break: break-word;
    max-height: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Highlight matched text */
.product-result-snippet strong.highlight {
    background: #fff59d;
    color: #333;
    padding: 2px 4px;
    border-radius: 2px;
}

/* Product Result Image */
.product-result-image {
    margin-bottom: 8px;
}

.product-result-image img {
    max-width: 60px;
    max-height: 60px;
    border-radius: 4px;
    object-fit: cover;
}

/* Error Message */
.product-error {
    color: #d63638;
    padding: 10px;
    background: #fef0f1;
    border-left: 4px solid #d63638;
    border-radius: 4px;
    margin-top: 10px;
}

/* Responsive Layout */
@media screen and (max-width: 1200px) {
    .product-search-bar {
        margin-top: 10px;
        width: 100%;
        margin-left: auto;
        margin-right: auto;
    }
}

/* Mobile - Ensure text wraps properly without going under icon */
@media screen and (max-width: 600px) {
    .product-search-bar input.product-search-input {
        min-width: auto;
        width: 100%;
    }

    .product-result-name {
        display: flex;
        align-items: flex-start;
        gap: 5px;
    }
    
    .product-result-name img,
    .product-result-name span {
        flex-shrink: 0;
        width: 20px;
        height: 20px;
        margin-top: 2px;
    }
    
    .product-result-name {
        word-break: break-word;
        overflow-wrap: break-word;
    }
}

