/**
 * Global Batarya Chatbot - Tasarım Stilleri
 * Modern, Temiz, Responsive Tasarım Esasları ve Özel Animasyonlar
 */

:root {
    --primary-color: #696cff;
    --primary-hover: #5f61e8;
    --bg-light: #f8f9ff;
    --text-dark: #384551;
    --text-muted: #8592a3;
    --border-color: #eceef1;
    --white: #ffffff;
    --shadow-sm: 0 2px 6px rgba(105, 108, 255, 0.15);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);
    --whatsapp-color: #25D366;
    --whatsapp-hover: #20ba5a;
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Genel Kapsayıcı Ayarları */
#gb-chatbot-container {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Tetikleyici Buton Tasarımı (YENİ KAPSÜL TASARIM) */
#gb-chat-toggle-btn {
    width: auto;
    height: 56px;
    padding: 0 24px 0 20px;
    background: #2b3440; 
    border-radius: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    transition: var(--transition-smooth);
    position: relative;
    color: var(--white);
}

/* CSS İle "Canlı Destek" Yazısı Ekleme */
#gb-chat-toggle-btn::after {
    content: "Canlı Destek";
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

#gb-chat-toggle-btn:hover {
    transform: translateY(-3px);
    background: #384551;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

#gb-chat-toggle-btn svg {
    width: 24px;
    height: 24px;
}

/* Bildirim Sinyali (Kapsüle Göre Uyarlandı) */
.gb-badge-pulse {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    background: #ff3e1d;
    border-radius: 50%;
    border: 2px solid var(--white);
    animation: gbPulse 2s infinite;
}

@keyframes gbPulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 62, 29, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(255, 62, 29, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 62, 29, 0); }
}

@keyframes gbPulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 62, 29, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(255, 62, 29, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 62, 29, 0); }
}

/* Sohbet Penceresi */
#gb-chat-window {
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 120px);
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    display: none; /* JS ile esnek yapıya (flex) geçirilir */
    flex-direction: column;
    overflow: hidden;
    position: absolute;
    bottom: 80px;
    right: 0;
    border: 1px solid var(--border-color);
    transition: var(--transition-smooth);
    opacity: 0;
    transform: translateY(20px);
}

#gb-chat-window.active {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

/* Başlık Çubuğu */
#gb-chat-header {
    background: var(--primary-color);
    color: var(--white);
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.gb-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.gb-avatar-container {
    position: relative;
    width: 38px;
    height: 38px;
}

.gb-avatar-text {
    width: 100%;
    height: 100%;
    background-color: var(--white);
    background-image: url('https://www.globalbatarya.com.tr/images/global-batarya-teknik-servis-ai-destek.png');
    background-size: 65%; /* cover yerine 75% yaptık, logonun etrafında boşluk kalacak */
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 50%;
    color: transparent;
}

.gb-status-indicator {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
}

.gb-status-indicator.online { background: #71dd37; }

.gb-brand-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
}

.gb-brand-subtitle {
    margin: 2px 0 0 0;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
}

#gb-close-btn {
    background: transparent;
    border: none;
    color: var(--white);
    font-size: 26px;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
    transition: var(--transition-smooth);
    padding: 4px;
}

#gb-close-btn:hover { opacity: 1; transform: scale(1.1); }

/* Mesaj Alanı Akışı */
#gb-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: var(--bg-light);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Mesaj Blok Mimarisi */
.gb-message-row {
    display: flex;
    width: 100%;
}

.bot-row { justify-content: flex-start; }
.user-row { justify-content: flex-end; }

.gb-message-block {
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 85%;
    font-size: 13.5px;
    line-height: 1.55;
    word-wrap: break-word;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.bot-block {
    background: var(--white);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
    border-top-left-radius: 4px;
}

.user-block {
    background: var(--primary-color);
    color: var(--white);
    border-top-right-radius: 4px;
}

/* İçerik Düzenlemeleri (Markdown Desteği İçin) */
.gb-message-block p { margin: 0 0 8px 0; }
.gb-message-block p:last-child { margin-bottom: 0; }
.gb-message-block ul, .gb-message-block ol { margin: 4px 0; padding-left: 20px; }
.gb-message-block li { margin-bottom: 4px; }
.gb-message-block strong { font-weight: 600; color: inherit; }

/* Dinamik Yönlendirme Butonları Tasarımı */
.gb-whatsapp, .gb-service {
    display: block;
    text-align: center;
    padding: 12px 16px;
    margin-top: 10px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    transition: var(--transition-smooth);
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.gb-whatsapp {
    background: var(--whatsapp-color);
    color: var(--white) !important;
    border: 1px solid var(--whatsapp-hover);
}
.gb-whatsapp:hover {
    background: var(--whatsapp-hover);
    transform: translateY(-2px);
}

.gb-service {
    background: var(--primary-color);
    color: var(--white) !important;
    border: 1px solid var(--primary-hover);
}
.gb-service:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

/* Özel Hata Bloğu Tasarımı */
.error-block {
    background: #ffebe6;
    color: #ff3e1d;
    border: 1px solid #ffc4b8;
}

/* Yazıyor Animasyonu (Three Dots Loading) */
.gb-typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
}

.gb-typing-indicator span {
    width: 7px;
    height: 7px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: gbBounce 1.4s infinite ease-in-out both;
}

.gb-typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.gb-typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes gbBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

/* Alt Bölüm ve Giriş Alanı */
#gb-chat-footer {
    padding: 12px 16px;
    background: var(--white);
    border-top: 1px solid var(--border-color);
}

.gb-input-wrapper {
    display: flex;
    align-items: flex-end;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 6px 10px;
    transition: var(--transition-smooth);
}

.gb-input-wrapper:focus-within {
    border-color: var(--primary-color);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(105, 108, 255, 0.15);
}

#gb-user-textarea {
    flex: 1;
    border: none;
    background: transparent;
    padding: 6px 4px;
    resize: none;
    outline: none;
    font-size: 13.5px;
    color: var(--text-dark);
    max-height: 100px;
    line-height: 1.4;
}

#gb-send-btn {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    margin-left: 6px;
    flex-shrink: 0;
}

#gb-send-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

#gb-send-btn svg { width: 16px; height: 16px; transform: rotate(0deg); }

.gb-footer-copyright {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 8px;
    letter-spacing: 0.3px;
}

/* Özel Scrollbar Tasarımı */
#gb-chat-messages::-webkit-scrollbar { width: 5px; }
#gb-chat-messages::-webkit-scrollbar-track { background: transparent; }
#gb-chat-messages::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.1); border-radius: 10px; }
#gb-chat-messages::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.2); }

/* Tam Uyumluluk (Responsive) Tasarım */
@media (max-width: 480px) {
    #gb-chatbot-container { bottom: 15px; right: 15px; }
    #gb-chat-window {
        width: calc(100vw - 30px);
        height: 450px; /* Mobil için sabit ve ideal bir yükseklik */
        max-height: 75vh; /* Ekranın yüzde 75'inden fazlasını kaplamasını engeller */
        bottom: 75px;
    }
}


/* Dönen halka animasyonu */
.gb-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3; /* Dış halka rengi */
    border-top: 3px solid #007bff; /* Dönen kısmın rengi (mavi) */
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


/* YENİ: Hazır Mesaj Butonları (Quick Replies) Tasarımı */
.gb-quick-replies-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px 10px;
    margin-top: 5px;
}

.gb-quick-reply-btn {
    background: #ffffff;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: var(--transition-smooth);
    box-shadow: 0 2px 4px rgba(105, 108, 255, 0.05);
    width: fit-content;
    max-width: 100%;
}

.gb-quick-reply-btn:hover {
    background: var(--primary-color);
    color: var(--white);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(105, 108, 255, 0.15);
}