/* =============================================
   WSS Instant Search - Theme Integration
   Works with: Bricks, Flatsome, WooCommerce, Generic WP
   ============================================= */

/* Results Dropdown - attached to any theme search input */
.wss-search-results.wss-theme-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.15);
    max-height: 480px;
    overflow-y: auto;
    z-index: 999999;
    min-width: 320px;
}

/* Flatsome lightbox specific */
#search-lightbox .wss-search-results.wss-theme-dropdown {
    position: relative;
    margin-top: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    max-height: 400px;
}

/* Bricks popup specific */
.bricks-search .wss-search-results.wss-theme-dropdown,
.brxe-search-form .wss-search-results.wss-theme-dropdown {
    min-width: 100%;
}

/* Result Item */
.wss-result-item {
    display: flex;
    gap: 12px;
    padding: 10px 14px;
    text-decoration: none !important;
    color: #333 !important;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.15s ease;
    align-items: center;
    cursor: pointer;
}

.wss-result-item:hover,
.wss-result-item.wss-active {
    background: #f8f9fa !important;
    color: #333 !important;
}

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

/* Product Image */
.wss-result-image {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    background: #f5f5f5;
}

.wss-result-image.no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 6px;
}

/* Product Info */
.wss-result-info {
    flex: 1;
    min-width: 0;
}

.wss-result-name {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 2px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #222;
}

.wss-result-name mark {
    background: #fff3cd;
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}

.wss-result-meta {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}

/* Price */
.wss-result-price {
    font-weight: 700;
    font-size: 14px;
    color: #e74c3c;
    white-space: nowrap;
    flex-shrink: 0;
}

.wss-result-price del {
    color: #bbb;
    font-weight: 400;
    font-size: 12px;
}

.wss-result-price ins {
    text-decoration: none;
}

/* No Results */
.wss-no-results {
    padding: 24px 16px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

/* Footer */
.wss-search-footer {
    padding: 12px 14px;
    text-align: center;
    border-top: 1px solid #f0f0f0;
    font-size: 13px;
    color: #888;
    background: #fafafa;
    border-radius: 0 0 10px 10px;
}

.wss-showing-count {
    display: block;
    margin-bottom: 8px;
    font-size: 12px;
    color: #aaa;
}

.wss-footer-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
}

.wss-load-more {
    background: #f0f0f0;
    border: 1px solid #ddd;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    color: #333;
    transition: all 0.2s;
}

.wss-load-more:hover {
    background: #e0e0e0;
}

.wss-load-more:disabled {
    opacity: 0.6;
    cursor: wait;
}

.wss-view-all {
    color: #2271b1 !important;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 13px;
    transition: color 0.2s;
}

.wss-view-all:hover {
    color: #135e96 !important;
    text-decoration: underline !important;
}

/* Skeleton Loading */
.wss-skeleton {
    display: flex;
    gap: 12px;
    padding: 10px 14px;
    align-items: center;
}

.wss-skeleton-img {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: wss-shimmer 1.5s infinite;
    flex-shrink: 0;
}

.wss-skeleton-text {
    flex: 1;
}

.wss-skeleton-line {
    height: 12px;
    border-radius: 4px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: wss-shimmer 1.5s infinite;
    margin-bottom: 6px;
}

.wss-skeleton-line:last-child {
    width: 60%;
    margin-bottom: 0;
}

@keyframes wss-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

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

.wss-search-results::-webkit-scrollbar-track {
    background: transparent;
}

.wss-search-results::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

.wss-search-results::-webkit-scrollbar-thumb:hover {
    background: #ccc;
}

/* =============================================
   WSS Shortcode Widget (standalone search box)
   ============================================= */
.wss-search-wrapper {
    position: relative;
    max-width: 600px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.wss-search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.wss-search-input {
    width: 100%;
    padding: 12px 40px 12px 42px;
    font-size: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.wss-search-input:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

.wss-search-icon {
    position: absolute;
    left: 12px;
    color: #999;
    display: flex;
    pointer-events: none;
}

.wss-search-clear {
    position: absolute;
    right: 12px;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.wss-search-clear:hover {
    color: #333;
}

/* Filters */
.wss-search-filters {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.wss-search-filters select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
}

/* Hide theme default live search results when our plugin is active */
.header-search-form .search-results-container,
.flatsome-live-search-results,
.live-search-results .search-results-container,
.live-search-results .product-search-results,
div.live-search-results:not(.wss-search-results),
.dgwt-wcas-suggestions-wrapp,
.lxh-search-returns,
.lnh-search-returns {
    display: none !important;
}
