/* ZFS Product Booster — Yapay Zeka sohbet paneli */

.zfspb-ai-panel {
    width: 320px;
    max-width: calc(100vw - 36px);
    height: 420px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(23, 19, 16, .18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 12px;
}
/* KRİTİK: yukarıdaki "display: flex", tarayıcının [hidden] özniteliği
   için varsayılan "display: none" kuralını ezer (ikisi de aynı
   özgüllükte, sonra gelen kazanır) — bu satır olmadan panel.hidden =
   true ayarlansa bile panel EKRANDA KALIR. Kapatma butonunun
   çalışmamasının kök nedeni buydu. */
.zfspb-ai-panel[hidden] {
    display: none;
}
.zfspb-fab--left .zfspb-ai-panel { align-self: flex-start; }

.zfspb-ai-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    background: #171310;
    color: #fff;
    flex: 0 0 auto;
}
.zfspb-ai-head-title {
    flex: 1;
    font-weight: 600;
    font-size: 14px;
}
.zfspb-ai-back,
.zfspb-ai-close {
    border: none !important;
    background: transparent !important;
    padding: 4px !important;
    cursor: pointer;
    display: flex;
    color: #fff;
}
.zfspb-ai-back svg,
.zfspb-ai-close svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.zfspb-ai-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f7f6f4;
}

.zfspb-ai-msg { display: flex; }
.zfspb-ai-msg--assistant { justify-content: flex-start; }
.zfspb-ai-msg--user { justify-content: flex-end; }

.zfspb-ai-bubble {
    max-width: 82%;
    padding: 8px 12px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}
.zfspb-ai-msg--assistant .zfspb-ai-bubble {
    background: #fff;
    border: 1px solid #e6e3de;
    border-bottom-left-radius: 4px;
    color: #23201c;
}
.zfspb-ai-msg--user .zfspb-ai-bubble {
    background: #171310;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.zfspb-ai-typing .zfspb-ai-bubble {
    color: #999;
    font-style: italic;
}

.zfspb-ai-products {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.zfspb-ai-product-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid #e6e3de;
    border-radius: 12px;
    padding: 8px;
    text-decoration: none !important;
    max-width: 82%;
}
.zfspb-ai-product-img {
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border-radius: 8px;
    object-fit: cover;
    background: #f0efec;
}
.zfspb-ai-product-img--empty {
    display: block;
}
.zfspb-ai-product-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.zfspb-ai-product-name {
    font-size: 12.5px;
    font-weight: 600;
    color: #23201c;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.zfspb-ai-product-price {
    font-size: 12.5px;
    font-weight: 700;
    color: #171310;
}
.zfspb-ai-product-stock {
    font-size: 11px;
    color: #4c7a3d;
}
.zfspb-ai-product-stock--out {
    color: #c0392b;
}

.zfspb-ai-form {
    flex: 0 0 auto;
    display: flex;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid #eee;
    background: #fff;
}
.zfspb-ai-input {
    flex: 1;
    border: 1px solid #ddd !important;
    border-radius: 20px !important;
    padding: 8px 14px !important;
    font-size: 13.5px !important;
    outline: none;
}
.zfspb-ai-input:focus { border-color: #171310 !important; }

.zfspb-ai-send {
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    border: none !important;
    border-radius: 50% !important;
    background: #171310 !important;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0 !important;
}
.zfspb-ai-send svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.zfspb-ai-send:disabled { opacity: .5; cursor: default; }

@media (max-width: 420px) {
    .zfspb-ai-panel { width: calc(100vw - 24px); }
}

/* Sepete ekleme sonucu kutusu */
.zfspb-ai-cart-box {
    max-width: 82%;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.zfspb-ai-cart-box.is-success {
    background: #f0f9f0;
    border: 1px solid #b8dfb8;
    color: #1e5c1e;
}
.zfspb-ai-cart-box.is-error {
    background: #fff8f0;
    border: 1px solid #e6c9a0;
    color: #7a4a10;
}
.zfspb-ai-cart-actions {
    display: flex;
    gap: 8px;
}
.zfspb-ai-cart-btn {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none !important;
    background: #fff;
    border: 1px solid #171310;
    color: #171310 !important;
}
.zfspb-ai-cart-btn--primary {
    background: #171310;
    color: #fff !important;
}
