/* ==========================================================
   AI SEARCH WIDGET - FRONTEND
========================================================== */

.smt-ais-widget {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    font-family: inherit;
}

/* Input row */
.smt-ais-input-wrap {
    display: flex;
    align-items: center;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
    background: #fff;
    overflow: hidden;
    transition: border-color .2s, box-shadow .2s;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.smt-ais-input-wrap:focus-within {
    border-color: #4e8cff;
    box-shadow: 0 0 0 4px rgba(78,140,255,.12), 0 4px 16px rgba(0,0,0,.08);
}

.smt-ais-input {
    flex: 1;
    border: none !important;
    outline: none !important;
    padding: 14px 18px;
    font-size: 16px;
    background: transparent;
    color: #1f2937;
    min-width: 0;
}

.smt-ais-input::placeholder { color: #9ca3af; }

/* Filter chips */
.smt-ais-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    min-height: 0;
}

.smt-ais-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 12.5px;
    font-weight: 500;
    text-transform: capitalize;
}

.smt-ais-chip-kw { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }

.smt-ais-chip-attribute {
    background: #fffaf2;
    color: #7c4f32;
    border-color: #ead9c2;
    font-weight: 600;
    text-transform: none;
}

/* Clarification */
.smt-ais-clarify {
    margin-top: 12px;
    background: #fffaf2;
    border: 1px solid #ead9c2;
    border-left: 3px solid #a4775f;
    border-radius: 8px;
    padding: 14px 16px;
    font-size: 14px;
    color: #4e3429;
}

.smt-ais-clarify-label,
.smt-ais-clarify-question,
.smt-ais-clarify-hint {
    display: block;
}

.smt-ais-clarify-label {
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.smt-ais-clarify-question {
    font-size: 15px;
    line-height: 1.45;
}

.smt-ais-clarify-hint {
    margin-top: 8px;
    color: #80695e;
    font-size: 12px;
    line-height: 1.4;
}

.smt-ais-clarify-answer {
    display: inline-block;
    margin: 6px 4px 0 0;
    padding: 4px 12px;
    background: #fff;
    border: 1px solid #fbbf24;
    border-radius: 999px;
    cursor: pointer;
    font-size: 13px;
    transition: background .15s;
}

.smt-ais-clarify-answer:hover { background: #fef3c7; }

/* Loading */
.smt-ais-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 0;
    font-size: 14px;
    color: #6b7280;
}

.smt-ais-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #e5e7eb;
    border-top-color: #4e8cff;
    border-radius: 50%;
    animation: smtAisSpin .7s linear infinite;
    flex-shrink: 0;
}

@keyframes smtAisSpin { to { transform: rotate(360deg); } }

/* Fallback note */
.smt-ais-fallback-note {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: #f9fafb;
    border-radius: 8px;
    border-left: 3px solid #d1d5db;
}

.smt-ais-fallback-note::before {
    content: "\1F4A1"; /* 💡 - themes can override via CSS without touching JS. */
    margin-right: 6px;
}

/* No results */
.smt-ais-no-results {
    padding: 24px 0;
    text-align: center;
    font-size: 15px;
    color: #6b7280;
}

/* Error */
.smt-ais-error {
    padding: 12px 16px;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    color: #b91c1c;
    font-size: 14px;
    margin-top: 10px;
}

/* Results grid */
.smt-ais-results { margin-top: 16px; }

.smt-ais-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

/* Product card */
.smt-ais-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow .2s, transform .15s;
}

.smt-ais-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,.1);
    transform: translateY(-2px);
}

.smt-ais-card-img-link {
    display: block;
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: #f9fafb;
}

.smt-ais-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s ease;
}

.smt-ais-card:hover .smt-ais-card-img { transform: scale(1.04); }

.smt-ais-stock-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0,0,0,.55);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

.smt-ais-card-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.smt-ais-card-brand {
    color: #6b7280;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.smt-ais-card-name {
    font-weight: 600;
    font-size: 13.5px;
    color: #1f2937;
    text-decoration: none;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.smt-ais-card-name:hover { color: #4e8cff; }

.smt-ais-card-stars {
    font-size: 13px;
    color: #f59e0b;
    display: flex;
    align-items: center;
    gap: 4px;
}

.smt-ais-rating-count { color: #9ca3af; font-size: 12px; }

.smt-ais-card-price { font-size: 14px; font-weight: 700; color: #111827; }
.smt-ais-card-price ins { text-decoration: none; color: #dc2626; }
.smt-ais-card-price del { font-size: 12px; color: #9ca3af; font-weight: 400; }

.smt-ais-card-actions { margin-top: auto; }

.smt-ais-atc-btn,
.smt-ais-view-btn {
    display: block;
    width: 100%;
    text-align: center;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
    text-decoration: none;
}

.smt-ais-atc-btn {
    background: #4e8cff;
    color: #fff !important;
    border: none;
}

.smt-ais-atc-btn:hover { background: #3a7be0; }

.smt-ais-view-btn {
    background: #f3f4f6;
    color: #374151 !important;
    border: 1px solid #e5e7eb;
}

.smt-ais-view-btn:hover { background: #e5e7eb; }

/* Responsive */
@media (max-width: 480px) {
    .smt-ais-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .smt-ais-input { font-size: 15px; padding: 12px 14px; }
}
