/**
 * WoodMart Smart Search — Integration Styles
 * RTL | Grid layout مشابه WoodMart native
 */

.wss-rtl {
    direction: rtl;
    text-align: right;
}

/* ════════════════════════════════════════════════════════
   Fuzzy Section
════════════════════════════════════════════════════════ */

.wss-fuzzy-section {
    border-top: 1px solid var(--woodmart-border-color, #e8e8e8);
    direction: rtl;
    padding-bottom: 10px;
}

.wss-fuzzy-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px 6px;
    font-size: 11px;
    font-weight: 700;
    color: var(--woodmart-body-color, #999);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.wss-fuzzy-badge {
    display: inline-flex;
    align-items: center;
    background: #fff3cd;
    color: #856404;
    border-radius: 20px;
    padding: 1px 8px;
    font-size: 10px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
}

/* Grid — 4 ستون مانند WoodMart */
.wss-fuzzy-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    direction: rtl;
}

/* کارت محصول */
.wss-fuzzy-product {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    padding: 10px 12px;
    border-left: 1px solid var(--woodmart-border-color, #f0f0f0);
    border-bottom: 1px solid var(--woodmart-border-color, #f0f0f0);
    transition: background 0.12s ease;
    gap: 8px;
}

.wss-fuzzy-product:nth-child(4n) {
    border-left: none;
}

.wss-fuzzy-product:hover {
    background: var(--woodmart-lightest, #f8f8f8);
    text-decoration: none;
    color: inherit;
}

/* تصویر */
.wss-fuzzy-product-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f5f5f5;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wss-fuzzy-product-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* اطلاعات محصول */
.wss-fuzzy-product-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: right;
}

.wss-fuzzy-product-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--woodmart-body-color, #333);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.wss-fuzzy-product:hover .wss-fuzzy-product-title {
    color: var(--woodmart-primary-color, #e91e63);
}

/* قیمت */
.wss-fuzzy-product-price {
    font-size: 12px;
    font-weight: 600;
    color: var(--woodmart-primary-color, #e91e63);
    direction: rtl;
}

.wss-fuzzy-product-price .woocommerce-Price-amount {
    font-size: 12px;
    font-weight: 600;
}

.wss-fuzzy-product-price del {
    color: #bbb;
    font-weight: 400;
    font-size: 11px;
    display: block;
    text-decoration: line-through;
}

.wss-fuzzy-product-price del .woocommerce-Price-amount {
    color: #bbb;
    font-weight: 400;
}

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

/* موجودی */
.wss-stock-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 500;
    border-radius: 3px;
    padding: 1px 6px;
    width: fit-content;
}

.wss-in-stock  { color: #2e7d32; background: #e8f5e9; }
.wss-out-of-stock { color: #c62828; background: #ffebee; }

/* موبایل: ۲ ستون */
@media (max-width: 767px) {
    .wss-fuzzy-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .wss-fuzzy-product:nth-child(4n) {
        border-left: 1px solid var(--woodmart-border-color, #f0f0f0);
    }
    .wss-fuzzy-product:nth-child(2n) {
        border-left: none;
    }
}

/* ════════════════════════════════════════════════════════
   Taxonomy (دسته + برند)
════════════════════════════════════════════════════════ */

.wss-taxonomy-section {
    border-top: 1px solid var(--woodmart-border-color, #e8e8e8);
    padding: 4px 0;
    direction: rtl;
}

.wss-group-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--woodmart-body-color, #999);
}

/* Badges row (categories + brands) */
.wss-tax-badges-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 14px 12px;
    direction: rtl;
}

.wss-tax-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--woodmart-lightest, #f5f5f5);
    border: 1px solid var(--woodmart-border-color, #e0e0e0);
    border-radius: 20px;
    padding: 4px 10px 4px 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--woodmart-body-color, #444);
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.wss-tax-badge:hover {
    background: var(--woodmart-primary-color, #333);
    color: #fff;
    border-color: var(--woodmart-primary-color, #333);
    text-decoration: none;
}

.wss-badge-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wss-badge-icon img {
    width: 18px;
    height: 18px;
    object-fit: cover;
    display: block;
}

.wss-badge-count {
    font-size: 10px;
    opacity: 0.55;
}

.wss-brand-badge .wss-badge-icon {
    width: 24px;
    height: 16px;
    border-radius: 2px;
}

.wss-brand-badge .wss-badge-icon img {
    width: 24px;
    height: 16px;
    object-fit: contain;
}

/* Legacy: keep old selectors for backward compat if needed */
.wss-tax-item { display: none; }

/* ════════════════════════════════════════════════════════
   Suggestions (پیشنهاد کلمه)
════════════════════════════════════════════════════════ */

.wss-suggestions-section {
    border-top: 1px solid var(--woodmart-border-color, #e8e8e8);
    padding: 4px 0;
    direction: rtl;
}

.wss-suggestion-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 14px 12px;
}

.wss-tag {
    background: var(--woodmart-lightest, #f5f5f5);
    border: 1px solid var(--woodmart-border-color, #ddd);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    color: var(--woodmart-body-color, #555);
    font-family: inherit;
    transition: all 0.12s;
    white-space: nowrap;
}
.wss-tag:hover {
    background: var(--woodmart-primary-color, #333);
    color: #fff;
    border-color: var(--woodmart-primary-color, #333);
}

/* ════════════════════════════════════════════════════════
   Hot Searches Panel — نمایش قبل از تایپ (داخل wrapper)
════════════════════════════════════════════════════════ */

.wss-hot-panel {
    position: fixed;
    background: #fff;
    border: 1px solid var(--woodmart-border-color, #e0e0e0);
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.10);
    z-index: 9999;
    direction: rtl;
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
    pointer-events: none;
    margin-top: 4px;
}

.wss-hot-panel.wss-hot-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.wss-hot-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--woodmart-body-color, #999);
}

.wss-hot-fire {
    font-size: 12px;
    line-height: 1;
}

.wss-hot-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 14px 12px;
    direction: rtl;
}

.wss-hot-panel .wss-hot-tag {
    display: inline-flex;
    align-items: center;
    background: var(--woodmart-lightest, #f5f5f5);
    border: 1px solid var(--woodmart-border-color, #e0e0e0);
    border-radius: 20px !important;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    color: var(--woodmart-body-color, #444);
    font-family: inherit;
    text-decoration: none;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
    white-space: nowrap;
    line-height: 1.4;
    outline: none;
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
}

.wss-hot-panel .wss-hot-tag:hover {
    background: var(--woodmart-primary-color, #333);
    color: #fff;
    border-color: var(--woodmart-primary-color, #333);
    text-decoration: none;
}

/* ════════════════════════════════════════════════════════
   Dark Mode
════════════════════════════════════════════════════════ */

.dark-scheme .wss-fuzzy-section,
.dark-scheme .wss-taxonomy-section,
.dark-scheme .wss-suggestions-section {
    border-top-color: rgba(255,255,255,0.1);
}
.dark-scheme .wss-fuzzy-header,
.dark-scheme .wss-group-label { color: rgba(255,255,255,0.5); }
.dark-scheme .wss-fuzzy-product { border-color: rgba(255,255,255,0.08); }
.dark-scheme .wss-fuzzy-product:hover { background: rgba(255,255,255,0.07); }
.dark-scheme .wss-fuzzy-product-title { color: rgba(255,255,255,0.85); }
.dark-scheme .wss-fuzzy-badge { background: rgba(255,193,7,0.15); color: #ffc107; }
.dark-scheme .wss-tax-item { color: rgba(255,255,255,0.85); }
.dark-scheme .wss-tax-item:hover { background: rgba(255,255,255,0.07); }
.dark-scheme .wss-tag { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.15); color: rgba(255,255,255,0.8); }
.dark-scheme .wss-tag:hover { background: rgba(255,255,255,0.15); color: #fff; }

.dark-scheme .wss-hot-panel {
    background: var(--woodmart-drop-background, #1c1c2e);
    border-color: rgba(255,255,255,0.1);
}
.dark-scheme .wss-hot-header { color: rgba(255,255,255,0.5); }
.dark-scheme .wss-hot-panel .wss-hot-tag {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.14);
    color: rgba(255,255,255,0.8);
}
.dark-scheme .wss-hot-panel .wss-hot-tag:hover {
    background: rgba(255,255,255,0.18);
    color: #fff;
    border-color: rgba(255,255,255,0.25);
}
.dark-scheme .wss-tax-badge {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.14);
    color: rgba(255,255,255,0.8);
}
.dark-scheme .wss-tax-badge:hover {
    background: rgba(255,255,255,0.18);
    color: #fff;
    border-color: rgba(255,255,255,0.25);
}
