/* ═══════════════════════════════════════════════
   AzaKit AI Asistan — Sohbet Widget Stilleri
   ═══════════════════════════════════════════════ */

/* Değişkenler PHP tarafından :root'a enjekte edilir */

/* ── Konteyner ── */
#azakit-chat-container {
    position: fixed !important;
    bottom: 24px !important;
    z-index: 999999 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    box-sizing: border-box !important;
    width: auto !important;
    height: auto !important;
}
#azakit-chat-container * {
    box-sizing: border-box !important;
}
#azakit-chat-container.azakit-right {
    right: 24px !important;
}
#azakit-chat-container.azakit-left {
    left: 24px !important;
}

/* ── Sohbet Balonu ── */
#azakit-chat-bubble {
    width: var(--azakit-bubble-size, 62px) !important;
    height: var(--azakit-bubble-size, 62px) !important;
    min-width: var(--azakit-bubble-size, 62px) !important;
    min-height: var(--azakit-bubble-size, 62px) !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 50% !important;
    background: var(--azakit-bubble-color, #6C3CE1) !important;
    border: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 6px 20px rgba(108,60,225,0.4), 0 2px 6px rgba(0,0,0,0.15) !important;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s !important;
    position: relative !important;
    animation: azakitBounce 2.5s ease infinite;
    animation-delay: 3s;
}
#azakit-chat-bubble:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 8px 28px rgba(108,60,225,0.5) !important;
}
#azakit-chat-bubble.azakit-bubble-active {
    animation: none !important;
    transform: scale(1) !important;
}
.azakit-bubble-icon {
    width: 28px !important;
    height: 28px !important;
    color: #fff !important;
}

@keyframes azakitBounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-8px); }
    60% { transform: translateY(-4px); }
}

/* ── Sohbet Penceresi ── */
#azakit-chat-window {
    position: absolute !important;
    bottom: calc(var(--azakit-bubble-size, 62px) + 16px) !important;
    width: var(--azakit-chat-width, 420px) !important;
    height: var(--azakit-chat-height, 600px) !important;
    background: var(--azakit-chat-bg, #FFFFFF) !important;
    border-radius: var(--azakit-border-radius, 20px) !important;
    box-shadow: 0 24px 64px rgba(0,0,0,0.18), 0 8px 24px rgba(0,0,0,0.1), 0 2px 8px rgba(0,0,0,0.06) !important;
    flex-direction: column !important;
    overflow: hidden !important;
    opacity: 0;
    transform: translateY(20px) scale(0.94);
    transition: opacity 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    z-index: 1000000 !important;
    border: 1px solid rgba(0,0,0,0.06) !important;
}
.azakit-right #azakit-chat-window {
    right: 0 !important;
}
.azakit-left #azakit-chat-window {
    left: 0 !important;
}
#azakit-chat-window.azakit-window-open {
    opacity: 1 !important;
    transform: translateY(0) scale(1) !important;
}

/* ── Başlık ── */
#azakit-chat-header {
    background: var(--azakit-header-bg, #6C3CE1) !important;
    color: var(--azakit-header-text, #FFFFFF) !important;
    padding: 16px 18px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-shrink: 0 !important;
    border-radius: var(--azakit-border-radius, 20px) var(--azakit-border-radius, 20px) 0 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    position: relative !important;
    overflow: hidden !important;
}
#azakit-chat-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: rgba(255,255,255,0.06);
    border-radius: 50%;
    pointer-events: none;
}
.azakit-header-info {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    position: relative;
}
.azakit-header-avatar {
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    border: 2px solid rgba(255,255,255,0.4) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2) !important;
}
.azakit-header-avatar-default {
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    background: rgba(255,255,255,0.18) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 2px solid rgba(255,255,255,0.3) !important;
}
.azakit-header-avatar-default svg {
    width: 22px !important;
    height: 22px !important;
    color: rgba(255,255,255,0.9) !important;
    display: block !important;
}
.azakit-header-text {
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
}
.azakit-header-name {
    font-weight: 700 !important;
    font-size: 15px !important;
    line-height: 1.2 !important;
    margin: 0 !important;
    letter-spacing: -0.01em !important;
}
.azakit-header-status {
    font-size: 12px !important;
    opacity: 0.85 !important;
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    margin: 0 !important;
}
.azakit-status-dot {
    width: 7px !important;
    height: 7px !important;
    border-radius: 50% !important;
    background: #4ADE80 !important;
    display: inline-block !important;
    box-shadow: 0 0 6px rgba(74,222,128,0.8) !important;
    animation: azakitPulse 2s infinite !important;
}
@keyframes azakitPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.85); }
}
#azakit-chat-close {
    width: 34px !important;
    height: 34px !important;
    border-radius: 50% !important;
    border: none !important;
    background: rgba(255,255,255,0.15) !important;
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.2s, transform 0.2s;
    padding: 0 !important;
    margin: 0 !important;
    position: relative;
}
#azakit-chat-close:hover {
    background: rgba(255,255,255,0.28) !important;
    transform: rotate(90deg);
}
#azakit-chat-close svg {
    width: 18px !important;
    height: 18px !important;
    color: var(--azakit-header-text, #FFFFFF) !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* ── Mesaj Alanı ── */
#azakit-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
    background: var(--azakit-chat-bg, #FFFFFF);
}
#azakit-chat-messages::-webkit-scrollbar {
    width: 4px;
}
#azakit-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}
#azakit-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
}
#azakit-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.18);
}

/* ── Mesaj Balonları ── */
.azakit-message {
    display: flex;
    gap: 8px;
    max-width: 88%;
    animation: azakitMsgIn 0.25s ease;
}
@keyframes azakitMsgIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.azakit-message-visitor {
    align-self: flex-end;
    flex-direction: row-reverse;
}
.azakit-message-ai,
.azakit-message-admin {
    align-self: flex-start;
}

/* Avatar */
.azakit-msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}
.azakit-message-visitor .azakit-msg-avatar {
    background: var(--azakit-user-bubble, #6C3CE1);
    box-shadow: 0 2px 6px rgba(108,60,225,0.3);
}
.azakit-message-ai .azakit-msg-avatar,
.azakit-message-admin .azakit-msg-avatar {
    background: #EEF0F8;
}
.azakit-msg-avatar svg {
    width: 16px;
    height: 16px;
}
.azakit-message-visitor .azakit-msg-avatar svg {
    color: #fff;
}
.azakit-message-ai .azakit-msg-avatar svg,
.azakit-message-admin .azakit-msg-avatar svg {
    color: #6B7280;
}
.azakit-msg-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* Balon */
.azakit-msg-bubble {
    padding: 11px 15px;
    border-radius: 18px;
    position: relative;
    word-break: break-word;
    line-height: 1.55;
}
.azakit-message-visitor .azakit-msg-bubble {
    background: var(--azakit-user-bubble, #6C3CE1);
    color: var(--azakit-user-text, #FFFFFF);
    border-bottom-right-radius: 5px;
    box-shadow: 0 2px 10px rgba(108,60,225,0.25);
}
.azakit-message-ai .azakit-msg-bubble {
    background: var(--azakit-ai-bubble, #F3F4F6);
    color: var(--azakit-ai-text, #1F2937);
    border-bottom-left-radius: 5px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.azakit-message-admin .azakit-msg-bubble {
    background: #FFFBEB;
    color: #92400E;
    border: 1px solid #FDE68A;
    border-bottom-left-radius: 5px;
}
.azakit-msg-text {
    font-size: 14px;
    line-height: 1.55;
}
.azakit-msg-text a {
    color: inherit;
    text-decoration: underline;
    text-decoration-style: dotted;
}
.azakit-msg-time {
    font-size: 10px;
    opacity: 0.5;
    margin-top: 5px;
    text-align: right;
}
.azakit-admin-label {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    color: #D97706;
    background: #FEF3C7;
    padding: 1px 6px;
    border-radius: 4px;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Link Buton */
.azakit-msg-link-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 7px 18px;
    background: var(--azakit-bubble-color, #6C3CE1);
    color: #fff !important;
    text-decoration: none !important;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 600;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    letter-spacing: 0.01em;
}
.azakit-msg-link-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108,60,225,0.3);
    opacity: 0.92;
}
.azakit-msg-secondary {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0,0,0,0.09);
    font-size: 14px;
    opacity: 1;
    font-style: normal;
    font-weight: 500;
    line-height: 1.55;
    color: var(--azakit-ai-text, #1F2937);
}
.azakit-msg-secondary-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 7px 18px;
    background: var(--azakit-bubble-color, #6C3CE1);
    color: #fff !important;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 600;
    font-style: normal;
    text-decoration: none !important;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    letter-spacing: 0.01em;
}
.azakit-msg-secondary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108,60,225,0.3);
    opacity: 0.92;
}

/* ── Yazıyor Göstergesi ── */
#azakit-typing-indicator {
    padding: 4px 16px 10px;
    flex-shrink: 0;
}
.azakit-typing-bubble {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--azakit-ai-bubble, #F3F4F6);
    color: var(--azakit-ai-text, #1F2937);
    padding: 9px 16px;
    border-radius: 18px;
    border-bottom-left-radius: 5px;
    font-size: 13px;
    animation: azakitMsgIn 0.25s ease;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.azakit-typing-text {
    font-style: italic;
    opacity: 0.7;
    font-size: 13px;
}
.azakit-typing-dots {
    display: flex;
    gap: 4px;
}
.azakit-typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--azakit-bubble-color, #6C3CE1);
    opacity: 0.4;
    animation: azakitDotPulse 1.4s infinite;
}
.azakit-typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}
.azakit-typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}
@keyframes azakitDotPulse {
    0%, 60%, 100% { opacity: 0.3; transform: scale(1); }
    30% { opacity: 1; transform: scale(1.3); }
}

/* ── Giriş Alanı ── */
#azakit-chat-input-area {
    padding: 12px 14px !important;
    border-top: 1px solid rgba(0,0,0,0.07) !important;
    display: flex !important;
    align-items: flex-end !important;
    gap: 6px !important;
    background: var(--azakit-chat-bg, #FFFFFF) !important;
    flex-shrink: 0 !important;
    min-height: 60px !important;
    box-sizing: border-box !important;
}
.azakit-input-wrapper {
    flex: 1 !important;
    display: flex !important;
    align-items: center !important;
}
#azakit-message-input {
    width: 100%;
    border: 1.5px solid #E5E7EB;
    border-radius: 22px !important;
    padding: 9px 16px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    height: 40px !important;
    min-height: 40px !important;
    max-height: 130px !important;
    margin: 0 !important;
    line-height: 1.4;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #F9FAFB !important;
    box-sizing: border-box !important;
    overflow: hidden;
    color: #1F2937;
}
#azakit-message-input:focus {
    border-color: var(--azakit-bubble-color, #6C3CE1) !important;
    background: #fff !important;
    box-shadow: 0 0 0 3.5px rgba(108,60,225,0.1) !important;
}
#azakit-message-input::placeholder {
    color: #9CA3AF !important;
}

/* Butonlar */
.azakit-input-btn {
    width: 38px !important;
    height: 38px !important;
    border-radius: 50% !important;
    border: none !important;
    background: transparent;
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #9CA3AF;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s, transform 0.15s;
    padding: 0 !important;
    margin: 0 !important;
}
.azakit-input-btn:hover {
    color: var(--azakit-bubble-color, #6C3CE1);
    background: #F3F4F6;
    transform: scale(1.08);
}
.azakit-input-btn svg {
    width: 20px !important;
    height: 20px !important;
    display: block !important;
    position: static !important;
    visibility: visible !important;
    opacity: 1 !important;
}
.azakit-send-btn {
    background: var(--azakit-bubble-color, #6C3CE1) !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(108,60,225,0.3) !important;
}
.azakit-send-btn:hover {
    opacity: 0.9;
    color: #fff !important;
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(108,60,225,0.4) !important;
}
.azakit-send-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none !important;
}
.azakit-recording {
    color: #EF4444 !important;
    background: rgba(239,68,68,0.08) !important;
    animation: azakitRecordPulse 1.5s infinite;
}
@keyframes azakitRecordPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { transform: scale(1.12); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* ── Bildirim Balonu ── */
#azakit-notify-bubble {
    position: absolute;
    bottom: calc(var(--azakit-bubble-size, 62px) + 14px);
    right: 0;
    width: 290px;
    background: #fff;
    border-radius: 18px 18px 4px 18px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.06);
    padding: 14px 36px 14px 14px;
    cursor: pointer;
    z-index: 999998;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: azakitNotifyIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.azakit-left #azakit-notify-bubble {
    right: auto;
    left: 0;
    border-radius: 18px 18px 18px 4px;
}
@keyframes azakitNotifyIn {
    from { opacity: 0; transform: translateY(16px) scale(0.92); }
    to   { opacity: 1; transform: translateY(0)    scale(1);    }
}
#azakit-notify-bubble.azakit-notify-out {
    animation: azakitNotifyOut 0.35s ease forwards;
}
@keyframes azakitNotifyOut {
    to { opacity: 0; transform: translateY(10px) scale(0.94); }
}
.azakit-notify-avatar {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    background: var(--azakit-bubble-color, #6C3CE1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.azakit-notify-avatar svg {
    width: 18px;
    height: 18px;
    color: #fff;
    stroke: #fff;
}
.azakit-notify-text {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.5;
    color: #1F2937;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    padding-top: 6px;
}
.azakit-notify-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    border: none;
    background: #F3F4F6;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6B7280;
    padding: 0;
    line-height: 1;
    transition: background 0.15s;
}
.azakit-notify-close:hover {
    background: #E5E7EB;
    color: #374151;
}

/* ── Mobil Uyumluluk — aşağıdaki genişletilmiş blokta ele alındı ── */

/* ── Mesaj içi linkler (tıklanabilir ve görünür) ── */
.azakit-msg-text a,
.azakit-inline-link {
    color: var(--azakit-bubble-color, #6C3CE1) !important;
    text-decoration: underline !important;
    text-decoration-thickness: 1.5px !important;
    text-underline-offset: 2px !important;
    font-weight: 600 !important;
    word-break: break-all !important;
    transition: opacity 0.15s !important;
    cursor: pointer !important;
}
.azakit-msg-text a:hover,
.azakit-inline-link:hover {
    opacity: 0.72 !important;
    text-decoration-thickness: 2px !important;
}
.azakit-message-visitor .azakit-msg-text a,
.azakit-message-visitor .azakit-inline-link {
    color: rgba(255,255,255,0.95) !important;
    text-decoration-color: rgba(255,255,255,0.6) !important;
}

/* ── Genel Mesaj Alanı Geliştirmeleri ── */
#azakit-chat-header {
    flex-wrap: nowrap !important;
    overflow: visible !important;
}
.azakit-header-info {
    flex: 1 !important;
    min-width: 0 !important;
    overflow: hidden !important;
}
.azakit-header-name {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* ── Mobil: Header buton taşmaları önleme ── */
@media (max-width: 520px) {
    #azakit-chat-container {
        bottom: 14px;
    }
    #azakit-chat-container.azakit-right {
        right: 14px;
    }
    #azakit-chat-container.azakit-left {
        left: 14px;
    }
    #azakit-chat-window {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 100% !important;
        border-radius: 0 !important;
        max-height: 100dvh;
    }
    .azakit-header-avatar {
        width: 32px !important;
        height: 32px !important;
    }
    .azakit-header-avatar-default {
        width: 32px !important;
        height: 32px !important;
    }
    .azakit-header-name {
        font-size: 13px !important;
    }
}

/* AzaKit eklemeleri */
.azakit-privacy-note {
    margin: 0;
    padding: 6px 14px 10px;
    font-size: 11px;
    color: #9ca3af;
    text-align: center;
    flex-shrink: 0;
}