/* ==========================================================================
   Custom AI Chatbot Widget - Frontend CSS (Elfsight Style)
   ========================================================================== */

#custom-ai-chatbot-container {
    position: fixed;
    bottom: 24px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
    box-sizing: border-box;
}

#custom-ai-chatbot-container * {
    box-sizing: border-box;
}

#custom-ai-chatbot-container.position-right {
    right: 24px;
}

#custom-ai-chatbot-container.position-left {
    left: 24px;
}

/* --------------------------------------------------------------------------
   Yüzen Tetikleyici Buton (Launcher Button)
   -------------------------------------------------------------------------- */
#custom-ai-chatbot-trigger {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--ai-chatbot-primary, #4F46E5);
    color: #ffffff;
    border: none;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2), 0 4px 10px rgba(79, 70, 229, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
    outline: none;
}

#custom-ai-chatbot-trigger:hover {
    transform: scale(1.08);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.25), 0 6px 15px rgba(79, 70, 229, 0.4);
}

#custom-ai-chatbot-trigger:active {
    transform: scale(0.95);
}

/* --------------------------------------------------------------------------
   Chat Penceresi (Window Container)
   -------------------------------------------------------------------------- */
#custom-ai-chatbot-window {
    position: absolute;
    bottom: 75px;
    width: 370px;
    max-width: calc(100vw - 32px);
    height: 540px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: customAiChatbotSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

#custom-ai-chatbot-container.position-right #custom-ai-chatbot-window {
    right: 0;
}

#custom-ai-chatbot-container.position-left #custom-ai-chatbot-window {
    left: 0;
}

@keyframes customAiChatbotSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* --------------------------------------------------------------------------
   Chat Header
   -------------------------------------------------------------------------- */
.chatbot-header {
    background: var(--ai-chatbot-primary, #4F46E5);
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.chatbot-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chatbot-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chatbot-avatar .avatar-icon {
    font-size: 22px;
}

.chatbot-title-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chatbot-title {
    font-weight: 700;
    font-size: 16px;
    line-height: 1.2;
}

.chatbot-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 3px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: #10B981;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4);
}

#custom-ai-chatbot-close {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
    padding: 0 4px;
}

#custom-ai-chatbot-close:hover {
    opacity: 1;
}

/* --------------------------------------------------------------------------
   Mesaj Akışı
   -------------------------------------------------------------------------- */
.chatbot-messages {
    flex: 1;
    padding: 18px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: #F9FAFB;
    scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar {
    width: 5px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
}

.message {
    display: flex;
    max-width: 85%;
}

.message-content {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.bot-message {
    align-self: flex-start;
}

.bot-message .message-content {
    background: #ffffff;
    color: #1F2937;
    border: 1px solid #E5E7EB;
    border-top-left-radius: 4px;
}

.user-message {
    align-self: flex-end;
}

.user-message .message-content {
    background: var(--ai-chatbot-primary, #4F46E5);
    color: #ffffff;
    border-top-right-radius: 4px;
}

/* --------------------------------------------------------------------------
   Hızlı Başlangıç Soruları (Starters)
   -------------------------------------------------------------------------- */
.chatbot-starters {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
}

.starter-btn {
    background: #ffffff;
    border: 1px solid #E5E7EB;
    color: var(--ai-chatbot-primary, #4F46E5);
    padding: 9px 14px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.starter-btn:hover {
    background: var(--ai-chatbot-primary, #4F46E5);
    color: #ffffff;
    border-color: var(--ai-chatbot-primary, #4F46E5);
    transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   Yazıyor İndikatörü
   -------------------------------------------------------------------------- */
.chatbot-typing {
    padding: 10px 18px;
    background: #F9FAFB;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chatbot-typing span {
    width: 7px;
    height: 7px;
    background-color: #9CA3AF;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.chatbot-typing span:nth-child(1) { animation-delay: -0.32s; }
.chatbot-typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* --------------------------------------------------------------------------
   Giriş Formu
   -------------------------------------------------------------------------- */
.chatbot-input-area {
    padding: 12px 16px;
    background: #ffffff;
    border-top: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    gap: 8px;
}

#custom-ai-chatbot-input {
    flex: 1;
    border: 1px solid #E5E7EB;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    background: #F9FAFB;
}

#custom-ai-chatbot-input:focus {
    border-color: var(--ai-chatbot-primary, #4F46E5);
    background: #ffffff;
}

#custom-ai-chatbot-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--ai-chatbot-primary, #4F46E5);
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background-color 0.2s;
    flex-shrink: 0;
}

#custom-ai-chatbot-send-btn:hover {
    transform: scale(1.05);
}

.chatbot-footer {
    padding: 6px 0;
    text-align: center;
    background: #F9FAFB;
    border-top: 1px solid #F3F4F6;
    font-size: 11px;
    color: #9CA3AF;
}

/* Mobil Uyumlu Tasarım */
@media (max-width: 480px) {
    #custom-ai-chatbot-window {
        width: calc(100vw - 32px);
        height: 80vh;
        bottom: 75px;
    }
}
