/* --- AKKIN CHATBOT (WEGPT) NİHAİ TASARIM - DÜZELTİLMİŞ --- */

/* Font yükleme */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --wegpt-primary-color: #4CAF50; /* Ana Renk: Koyu Yeşil */
    --wegpt-background-color: #f3f4f6;
    --wegpt-text-primary: #1f2937;
    --wegpt-text-secondary: #6b7280;
    --wegpt-user-bubble-bg: var(--wegpt-primary-color);
    --wegpt-agent-bubble-bg: #ffffff;
    --wegpt-font-family: 'Inter', system-ui, sans-serif;
}

* { 
    box-sizing: border-box; 
    font-family: var(--wegpt-font-family);
}

#chat-widget-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; }
#chat-bubble { width: 60px; height: 60px; background-color: var(--wegpt-primary-color); color: white; border-radius: 50%; display: flex; justify-content: center; align-items: center; cursor: pointer; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); transition: transform 0.2s ease-in-out; }
#chat-bubble:hover { transform: scale(1.1); }
#chat-window { width: 370px; max-height: 70vh; min-height: 250px; position: absolute; bottom: 80px; right: 0; background-color: var(--wegpt-background-color); border-radius: 16px; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1); display: flex; flex-direction: column; overflow: hidden; transform-origin: bottom right; transition: transform 0.3s ease, opacity 0.3s ease; }
#chat-window.hidden { transform: scale(0); opacity: 0; pointer-events: none; }

/* HEADER */
.chat-header { background: linear-gradient(to right, var(--wegpt-primary-color), #81C784); color: white; padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.chat-header-title { display: flex; align-items: center; }
.chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 12px;
    background-image: url('https://akkin.net.tr/assets/chatlogo.png'); 
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: white; /* Şeffaf logolar için */
    border: 1px solid rgba(255,255,255,0.2);
}
.chat-header-text h4 { margin: 0; font-size: 1.1rem; font-weight: 600; }
.chat-header-text p { margin: 0; font-size: 0.8rem; opacity: 0.9; }
#close-chat { background: none; border: none; color: white; font-size: 24px; cursor: pointer; opacity: 0.8; }

/* FORMS */
#pre-chat-form { padding: 20px; text-align: center; }
#pre-chat-form p { color: var(--wegpt-text-secondary); margin-bottom: 16px; }
#start-chat-form input { width: 100%; padding: 12px; border: 1px solid #d1d5db; border-radius: 8px; margin-bottom: 12px; box-sizing: border-box; }
#start-chat-form button { width: 100%; padding: 12px; background-color: var(--wegpt-primary-color); color: white; border: none; border-radius: 8px; cursor: pointer; font-size: 1rem; font-weight: 500; transition: background-color 0.2s ease; }
#start-chat-form button:hover { background-color: #43A047; }

/* MESSAGE AREA */
#chat-area { display: flex; flex-direction: column; flex-grow: 1; overflow: hidden; }
#messages-list {
     flex-grow: 1;
    padding: 16px;
    overflow-y: auto;    /* flex-direction: column-reverse; satırı buradan kaldırıldı */
    scroll-behavior: smooth; /* Kaydırma daha doğal */
}
.message-container { display: flex; flex-direction: column; margin-bottom: 16px; }
.message { padding: 10px 16px; border-radius: 20px; max-width: 85%; word-wrap: break-word; line-height: 1.5; position: relative; }
.message-sender { font-size: 0.8rem; font-weight: 600; margin-bottom: 4px; }
.message-content { font-size: 0.95rem; }
.message-timestamp { font-size: 0.7rem; text-align: right; margin-top: 5px; }

/* Saat damgası */
.message.user .message-timestamp { color: rgba(255, 255, 255, 0.7); }
.message.admin .message-timestamp, .message.ai .message-timestamp { color: var(--wegpt-text-secondary); }

/* USER MESSAGES (RIGHT) */
.message-container.user { align-items: flex-end; }
.message.user { background-color: var(--wegpt-user-bubble-bg); color: white; border-bottom-right-radius: 5px; }

/* ADMIN/AI MESSAGES (LEFT) */
.message-container.admin, .message-container.ai { align-items: flex-start; }
.message.admin, .message.ai { background-color: var(--wegpt-agent-bubble-bg); color: var(--wegpt-text-primary); border-bottom-left-radius: 5px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.message.admin .message-sender { color: var(--wegpt-primary-color); }
.message.ai .message-sender { color: #1f2937; }

/* EVENT MESSAGES */
.message-container.event { justify-content: center; align-items: center; width: 100%; text-align: center; font-size: 0.75rem; color: var(--wegpt-text-secondary); font-style: italic; margin: 10px 0; }
.message-container.event .message-event-text { background-color: #e0e0e0; padding: 5px 10px; border-radius: 10px; display: inline-block; }

/* --- HOŞ GELDİNİZ MESAJ BALONCUĞU STİLLERİ (GELİŞTİRİLMİŞ TASARIM) --- */

#welcome-bubble {
    position: absolute;
    bottom: 90px; /* Ana baloncuktan biraz yukarıda */
    right: 0;
    width: 300px;
    background-color: #ffffff;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center; /* İkon ve metni dikeyde hizala */
    gap: 12px; /* İkon ve metin arası boşluk */
    transform-origin: bottom right;
    transition: opacity 0.4s ease, transform 0.4s ease;
    opacity: 0;
    transform: translateY(10px); /* Aşağıdan yukarıya animasyon için */
    pointer-events: none;
    cursor: pointer;
}

/* Konuşma balonu oku */
#welcome-bubble::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 25px;
    border-width: 10px;
    border-style: solid;
    border-color: #ffffff transparent transparent transparent;
}

#welcome-bubble.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.welcome-bubble-avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-color, #3b82f6); /* Ana rengi kullanır */
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.welcome-bubble-content {
    font-size: 0.9rem;
    color: #374151;
    line-height: 1.5;
}

.welcome-bubble-content strong {
    color: #111827;
}

#close-welcome-bubble {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}
#close-welcome-bubble:hover {
    color: #374151;
}
.welcome-bubble-avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    /* Arka plan rengi yerine resim URL'si eklendi */
    background-image: url('https://akkin.net.tr/assets/chatlogo.png');
    background-size: cover; /* Resmi alana sığdırır */
    background-position: center; /* Resmi ortalar */
}
/* TYPING INDICATOR */
#typing-indicator { display: flex; align-items: center; margin: 0 0 10px 20px; height: 20px; }
#typing-indicator span { height: 8px; width: 8px; margin: 0 2px; background-color: #9ca3af; border-radius: 50%; display: inline-block; animation: typing-bounce 1.4s infinite ease-in-out both; }
#typing-indicator span:nth-of-type(1) { animation-delay: -0.32s; }
#typing-indicator span:nth-of-type(2) { animation-delay: -0.16s; }
@keyframes typing-bounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1.0); } }

/* MESSAGE INPUT AREA */
#message-form { display: flex; align-items: center; padding: 12px; background-color: #fff; border-top: 1px solid #e5e7eb; }
#message-input { flex-grow: 1; border: none; background: transparent; padding: 8px; font-size: 1rem; outline: none; }
#message-form button { background: none; border: none; cursor: pointer; padding: 8px; color: var(--wegpt-primary-color); }
#message-form button:disabled { color: #9ca3af; cursor: not-allowed; }

.hidden { display: none !important; }
