/* === CHAT CONTAINER === */

/* === RTL (Arapça) DESTEĞİ === */
html[lang="ar"] .gtb-chat,
html[lang="ar"] .gtb-chat * {
  direction: rtl;
  text-align: right;
}

html[lang="ar"] .gtb-msg--user {
  margin-right: auto;
  margin-left: 0;
}

html[lang="ar"] .gtb-agent-meta {
  flex-direction: row-reverse;
}

html[lang="ar"] .gtb-agent-name {
  text-align: right;
}

html[lang="ar"] .gtb-chat__footer {
  flex-direction: row-reverse;
}

html[lang="ar"] .gtb-chat__footer input {
  text-align: right;
}

/* === GENEL TASARIM === */
.gtb-chat {
  position: fixed;
  right: 33px;
  bottom: 110px;
  width: 360px;
  max-width: 92vw;
  height: 520px;
  display: flex;
  flex-direction: column;
  background: #f28b00;
  border-radius: 20px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  overflow: hidden;
  opacity: 0;
  transform: translateY(10px) scale(0.96);
  pointer-events: none;
  transition: all .3s ease;
  z-index: 99999;
}

.gtb-chat.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* === HEADER === */
.gtb-chat__header {
  background: #f28b00;
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gtb-chat__title {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.2;
  margin-right: 10px;
  flex: 1;
}

.gtb-chat__min {
  background: transparent;
  color: #fff;
  border: none;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}

/* === BODY === */
.gtb-chat__body {
  flex: 1;
  padding: 16px 14px;
  overflow-y: auto;
  background: #f9fafb;
  scroll-behavior: smooth;
}

/* === FOOTER === */
.gtb-chat__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
}

.gtb-chat__footer input,
.gtb-chat__footer textarea {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 22px;
  padding: 11px 15px;
  font-size: 14px;
  outline: none;
  height: 45px;
  line-height: 1.4;
  font-family: inherit;
  resize: none;
  overflow-y: auto;
}

/* chat CSS dosyana ekle */
#gtb-ai-chat-root .gtb-chat__footer textarea {
  min-height: 45px !important;
  height: 45px !important;
  max-height: 120px;
  overflow-y: auto;
  resize: none;
  box-shadow: none;
  line-height: 1.4;
  word-wrap: break-word;
  white-space: pre-wrap;
  box-sizing: border-box;
}

.gtb-chat__footer button {
  flex-shrink: 0;
  background: #111827;
  color: #fff;
  border: none;
  border-radius: 22px;
  padding: 0 18px;
  height: 45px;
  font-weight: 500;
  cursor: pointer;
  transition: background .2s ease;
}
.gtb-chat__footer button:hover {
  background: #1f2937;
}

/* === LAUNCHER BUTTON === */
.gtb-chat__launcher {
  position: fixed;
  right: 38px;
  bottom: 35px;
  width: 56px;
  height: 56px;
  border-radius: 50%!important;
  background: #f28b00;
  color: #f28b00;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.25);
  transition: transform .25s ease, box-shadow .25s ease;
  z-index: 99990;
}

button.gtb-chat__launcher {
  border-radius: 50% !important;
}

.gtb-chat__launcher:hover {
  transform: translateY(-3px) scale(1.07);
  box-shadow: 0 12px 30px rgba(0,0,0,0.35);
}

/* Chat açıkken launcher gizle */
.gtb-chat.is-open + .gtb-chat__launcher {
  display: none !important;
}

/* === BOT MESAJLARI === */
.gtb-msg--bot {
  background: none;
  border: none;
  padding: 0;
  margin-bottom: 10px;
}

.gtb-agent-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  margin-left: 2px;
}

.gtb-agent-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
}

.gtb-agent-name {
  font-weight: 600;
  font-size: 13px;
  color: #111827;
}

.gtb-agent-bubble {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  padding: 10px 14px;
  color: #111827;
  display: inline-block;
  max-width: 95%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  white-space: pre-line;
  line-height: 1.5;
}

/* === USER MESAJLARI === */
.gtb-msg--user {
  background: #111827;
  color: #fff;
  margin-left: auto;
  margin-top: 12px;
  margin-bottom: 12px;
  border-radius: 16px;
  padding: 10px 14px;
  max-width: fit-content;
  line-height: 1.4;
  white-space: pre-line;
}

/* === TYPING INDICATOR — AVATARLI === */

.gtb-typing .typing-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border-radius: 16px;
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  width: fit-content;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.gtb-typing .typing-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
  opacity: 0.85;
}

.gtb-typing .typing-text {
  font-size: 13px;
  color: #4b5563;
}

.gtb-typing .dots {
  display: inline-flex;
  gap: 4px;
  margin-left: 3px;
}

.gtb-typing .dots i {
  width: 6px;
  height: 6px;
  background: #9ca3af;
  border-radius: 50%;
  display: block;
  animation: blink 1.2s infinite;
}

.gtb-typing .dots i:nth-child(2) { animation-delay: .2s; }
.gtb-typing .dots i:nth-child(3) { animation-delay: .4s; }

@keyframes blink {
  0%, 80%, 100% { opacity: .2; }
  40% { opacity: 1; }
}

/* === MOBİL / iOS SAFE AREA === */
@media (max-width: 768px) {
  .gtb-chat {
    position: fixed;
    top: env(safe-area-inset-top, 0px);
    right: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    max-width: 100vw;
    border-radius: 0;
    box-shadow: none;
    background: #f9fafb;
    padding-top: env(safe-area-inset-top, 0px);
  }

  .gtb-chat__body {
    padding-bottom: calc(140px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .gtb-chat__footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100000;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #e5e7eb;
    background: #fff;
  }

  .gtb-chat__launcher {
    display: none !important;
  }
}