/* ============================================
   AI Chatbot Widget — sabit sağ alt yüzen sohbet
   ============================================ */

/* Floating button — WhatsApp'ın üstüne konumlanır */
.chatbot-fab {
    position: fixed;
    bottom: 92px;
    right: 22px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #6d28d9 0%, #4338ca 100%);
    color: #fff;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px -4px rgba(109,40,217,.55), 0 4px 8px rgba(0,0,0,.15);
    z-index: 998;
    transition: transform .2s var(--ease-out, ease), box-shadow .2s;
    cursor: pointer;
    border: none;
}
.chatbot-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 32px -4px rgba(109,40,217,.7);
}
.chatbot-fab:active { transform: scale(0.95); }

/* AI ikonu içinde robot SVG */
.chatbot-fab svg { width: 30px; height: 30px; }

/* Yanıp sönen pulse ring (ilk açılış) */
.chatbot-fab::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: linear-gradient(135deg, #a855f7 0%, #6366f1 100%);
    opacity: 0;
    z-index: -1;
    animation: chatPulse 3s ease-out infinite;
}
@keyframes chatPulse {
    0%   { transform: scale(0.95); opacity: 0; }
    50%  { transform: scale(1.15); opacity: .55; }
    100% { transform: scale(1.3);  opacity: 0; }
}

/* "AI" badge — küçük etiket */
.chatbot-fab-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--color-accent, #f59f0a);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    padding: 3px 6px;
    border-radius: 999px;
    letter-spacing: 0.04em;
    border: 2px solid #fff;
    line-height: 1;
}

/* Tooltip */
.chatbot-fab-tip {
    position: absolute;
    right: calc(100% + 14px);
    top: 50%;
    transform: translateY(-50%) translateX(8px);
    background: #1a1a1a;
    color: #fff;
    font-size: 12.5px;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
}
.chatbot-fab:hover .chatbot-fab-tip {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* Sohbet paneli */
.chatbot-panel {
    position: fixed;
    bottom: 92px;
    right: 22px;
    width: 380px;
    max-width: calc(100vw - 30px);
    height: 600px;
    max-height: calc(100vh - 110px);
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 24px 64px -12px rgba(15,23,42,.35), 0 8px 16px rgba(0,0,0,.1);
    display: none;
    flex-direction: column;
    z-index: 999;
    overflow: hidden;
    animation: chatSlideUp .25s ease-out both;
}
.chatbot-panel.open { display: flex; }
@keyframes chatSlideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Panel header */
.chatbot-head {
    background: linear-gradient(135deg, #6d28d9 0%, #4338ca 100%);
    color: #fff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.chatbot-head-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,.18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.chatbot-head-avatar svg { width: 22px; height: 22px; }
.chatbot-head-text { flex: 1; min-width: 0; }
.chatbot-head-text h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    color: #fff;
}
.chatbot-head-text p {
    margin: 2px 0 0;
    font-size: 11.5px;
    color: rgba(255,255,255,.85);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.chatbot-head-text p::before {
    content: '';
    width: 7px;
    height: 7px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
    animation: chatPulseGreen 2s ease-in-out infinite;
}
@keyframes chatPulseGreen {
    0%, 100% { opacity: 1; }
    50%      { opacity: .5; }
}
.chatbot-close {
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    flex-shrink: 0;
}
.chatbot-close:hover { background: rgba(255,255,255,.25); }

/* Mesaj listesi */
.chatbot-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px 14px;
    background: linear-gradient(180deg, #faf5ff 0%, #fff 50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.chatbot-body::-webkit-scrollbar { width: 6px; }
.chatbot-body::-webkit-scrollbar-track { background: transparent; }
.chatbot-body::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }

.chatbot-msg {
    max-width: 86%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    animation: msgIn .25s ease-out both;
}
@keyframes msgIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.chatbot-msg-bot {
    align-self: flex-start;
    background: #f1f5f9;
    color: var(--color-text, #0a0e1a);
    border-bottom-left-radius: 4px;
}
.chatbot-msg-user {
    align-self: flex-end;
    background: linear-gradient(135deg, #6d28d9 0%, #4338ca 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chatbot-msg p { margin: 0 0 6px; }
.chatbot-msg p:last-child { margin: 0; }
.chatbot-msg strong { font-weight: 700; }
.chatbot-msg a { color: #6d28d9; font-weight: 600; text-decoration: underline; }
.chatbot-msg-user a { color: #fff; }

/* Ürün kartları (AI önerileri) */
.chatbot-products {
    align-self: flex-start;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}
.chatbot-product-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1.5px solid var(--color-border, #e2e8f0);
    border-radius: 12px;
    padding: 8px 12px 8px 8px;
    text-decoration: none;
    color: var(--color-text, #0a0e1a);
    transition: border-color .15s, transform .15s, box-shadow .15s;
}
.chatbot-product-card:hover {
    border-color: #6d28d9;
    transform: translateX(2px);
    box-shadow: 0 4px 12px -2px rgba(109,40,217,.2);
}
.chatbot-product-img {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: #f8fafc;
    object-fit: contain;
    padding: 4px;
    flex-shrink: 0;
}
.chatbot-product-info { flex: 1; min-width: 0; }
.chatbot-product-info h4 {
    margin: 0;
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.chatbot-product-info small {
    color: var(--color-text-soft, #4a5469);
    font-size: 11px;
}
.chatbot-product-price {
    font-size: 13px;
    font-weight: 800;
    color: var(--color-primary, #c9302c);
    flex-shrink: 0;
}

/* Yazıyor… (typing indicator) */
.chatbot-typing {
    align-self: flex-start;
    background: #f1f5f9;
    padding: 10px 14px;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.chatbot-typing span {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typingDot 1.4s infinite ease-in-out;
}
.chatbot-typing span:nth-child(2) { animation-delay: .2s; }
.chatbot-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes typingDot {
    0%, 60%, 100% { opacity: .3; transform: translateY(0); }
    30%           { opacity: 1;  transform: translateY(-4px); }
}

/* Hızlı sorular (quick replies) */
.chatbot-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.chatbot-quick button {
    padding: 7px 12px;
    background: #fff;
    border: 1.5px solid #ddd6fe;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    color: #6d28d9;
    cursor: pointer;
    transition: all .15s;
}
.chatbot-quick button:hover {
    background: #6d28d9;
    color: #fff;
    border-color: #6d28d9;
}

/* Footer (input alanı) */
.chatbot-foot {
    padding: 12px 14px;
    border-top: 1px solid var(--color-border, #e2e8f0);
    background: #fff;
    flex-shrink: 0;
}
.chatbot-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    border: 1.5px solid transparent;
    border-radius: 999px;
    padding: 4px 4px 4px 16px;
    transition: border-color .15s, background .15s;
}
.chatbot-input-wrap:focus-within {
    border-color: #6d28d9;
    background: #fff;
}
.chatbot-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font: inherit;
    font-size: 14px;
    padding: 8px 0;
    color: var(--color-text, #0a0e1a);
    min-width: 0;
}
.chatbot-input::placeholder { color: #94a3b8; }
.chatbot-send {
    background: linear-gradient(135deg, #6d28d9 0%, #4338ca 100%);
    color: #fff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: opacity .15s, transform .15s;
    flex-shrink: 0;
}
.chatbot-send:disabled { opacity: .4; cursor: not-allowed; }
.chatbot-send:not(:disabled):hover { transform: scale(1.05); }
.chatbot-send svg { width: 16px; height: 16px; }

.chatbot-foot-note {
    margin: 6px 0 0;
    font-size: 10.5px;
    color: var(--color-text-soft, #4a5469);
    text-align: center;
}

/* Mobil */
@media (max-width: 480px) {
    .chatbot-fab { bottom: 80px; right: 16px; width: 54px; height: 54px; }
    .chatbot-fab svg { width: 26px; height: 26px; }
    .chatbot-panel {
        right: 8px;
        left: 8px;
        bottom: 80px;
        width: auto;
        max-width: none;
        height: calc(100vh - 100px);
    }
    .chatbot-fab-tip { display: none; }
}
