/* Bilgi asistanı (sohbet kutusu). Tema renkleri: sarı #ffbb00, koyu #171717. */
.chatbot {
  --cb-accent: #ffbb00;
  --cb-accent-dark: #e6a800;
  --cb-dark: #171717;
  --cb-text: #292b2c;
  --cb-muted: #6c757d;
  --cb-bg: #f5f5f3;
  --cb-line: #e4e4e0;
  font-family: 'Poppins', sans-serif;
}

/* Açma düğmesi: WhatsApp düğmesinin üstünde. */
.chatbot__launcher {
  position: fixed;
  right: 20px;
  bottom: 175px;
  z-index: 1050;
  width: 60px;
  height: 60px;
  border: 0;
  border-radius: 50%;
  background: var(--cb-accent);
  color: var(--cb-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .22);
  cursor: pointer;
  transition: transform .2s ease, background-color .2s ease;
}
.chatbot__launcher:hover { background: var(--cb-accent-dark); transform: scale(1.05); }
.chatbot__launcher:focus-visible { outline: 3px solid var(--cb-dark); outline-offset: 3px; }
.chatbot__launcher::after {
  /* Dikkat çekmek için yumuşak dalga; sohbet açıldıktan sonra durur. */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--cb-accent);
  animation: cb-pulse 2.4s ease-out infinite;
}
.chatbot.is-open .chatbot__launcher::after,
.chatbot.was-opened .chatbot__launcher::after { animation: none; display: none; }
.chatbot__icon-close { display: none; }
.chatbot.is-open .chatbot__icon-open { display: none; }
.chatbot.is-open .chatbot__icon-close { display: block; }

@keyframes cb-pulse {
  0% { transform: scale(1); opacity: .8; }
  100% { transform: scale(1.5); opacity: 0; }
}

.chatbot__teaser {
  position: fixed;
  right: 92px;
  bottom: 182px;
  z-index: 1050;
  max-width: 230px;
  padding: 12px 30px 12px 14px;
  background: #fff;
  color: var(--cb-text);
  font-size: 14px;
  line-height: 1.45;
  border-radius: 12px 12px 2px 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .16);
  animation: cb-in .35s ease;
}
.chatbot__teaser[hidden] { display: none; }
.chatbot__teaser-close {
  position: absolute;
  top: 4px;
  right: 6px;
  border: 0;
  background: none;
  color: var(--cb-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.chatbot__panel {
  position: fixed;
  /* Masaüstünde düğme sütununun solunda, sabit başlığın (z-index 1030) üstünde açılır. */
  right: 96px;
  bottom: 20px;
  z-index: 1051;
  width: 370px;
  height: min(620px, calc(100vh - 40px));
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .25);
  animation: cb-in .25s ease;
}
.chatbot__panel[hidden] { display: none; }

@keyframes cb-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.chatbot__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 12px 14px 16px;
  background: var(--cb-dark);
  color: #fff;
}
.chatbot__avatar {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--cb-accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.chatbot__avatar img { width: 26px; height: 26px; object-fit: contain; }
.chatbot__title { flex: 1; min-width: 0; line-height: 1.3; }
.chatbot__title strong { display: block; font-family: 'Montserrat', sans-serif; font-size: 15px; font-weight: 700; }
.chatbot__status { display: block; font-size: 12px; color: #bdbdbd; }
.chatbot__status::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: #25d366;
  vertical-align: 1px;
}
.chatbot__restart,
.chatbot__close {
  flex: none;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.chatbot__restart:hover,
.chatbot__close:hover { background: rgba(255, 255, 255, .12); }

.chatbot__progress { height: 3px; background: #2c2c2c; }
.chatbot__progress span { display: block; height: 100%; width: 0; background: var(--cb-accent); transition: width .35s ease; }

.chatbot__messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  background: var(--cb-bg);
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}

.chatbot__msg {
  max-width: 85%;
  padding: 9px 13px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--cb-text);
  word-wrap: break-word;
  animation: cb-in .2s ease;
}
.chatbot__msg--bot { align-self: flex-start; background: #fff; border-radius: 4px 14px 14px 14px; box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
.chatbot__msg--user { align-self: flex-end; background: var(--cb-accent); color: var(--cb-dark); border-radius: 14px 4px 14px 14px; font-weight: 500; }
.chatbot__msg--info {
  align-self: stretch;
  max-width: none;
  background: #fff8e1;
  border-left: 4px solid var(--cb-accent);
  border-radius: 6px;
}
.chatbot__msg--info strong { display: block; margin-bottom: 2px; }
.chatbot__msg--error { align-self: stretch; max-width: none; background: #fdecea; color: #a12622; border-radius: 6px; }

.chatbot__typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.chatbot__typing i { width: 7px; height: 7px; border-radius: 50%; background: #b5b5b5; animation: cb-dot 1s infinite ease-in-out; }
.chatbot__typing i:nth-child(2) { animation-delay: .15s; }
.chatbot__typing i:nth-child(3) { animation-delay: .3s; }
@keyframes cb-dot { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-4px); opacity: 1; } }

.chatbot__summary { list-style: none; margin: 6px 0 0; padding: 0; font-size: 13px; }
.chatbot__summary li { display: flex; gap: 8px; padding: 5px 0; border-top: 1px solid var(--cb-line); }
.chatbot__summary li:first-child { border-top: 0; }
.chatbot__summary span { flex: none; width: 82px; color: var(--cb-muted); }
.chatbot__summary b { font-weight: 600; }

/* Alt kısım: her adımda değişen yanıt alanı. */
.chatbot__composer { padding: 12px; background: #fff; border-top: 1px solid var(--cb-line); }
.chatbot__composer:empty { display: none; }

.chatbot__form { display: flex; gap: 8px; }
.chatbot__input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--cb-line);
  border-radius: 22px;
  font-size: 15px;
  color: var(--cb-text);
  background: #fff;
}
.chatbot__input:focus { outline: 0; border-color: var(--cb-accent); box-shadow: 0 0 0 3px rgba(255, 187, 0, .25); }
.chatbot__input[aria-invalid="true"] { border-color: #d93025; }
textarea.chatbot__input { display: block; width: 100%; height: 64px; padding: 10px 14px; border-radius: 12px; resize: none; }
.chatbot__send {
  flex: none;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--cb-accent);
  color: var(--cb-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.chatbot__send:hover { background: var(--cb-accent-dark); }
.chatbot__hint { margin: 6px 4px 0; font-size: 12px; line-height: 1.45; color: var(--cb-muted); }
.chatbot__hint--error { color: #d93025; }
.chatbot__hint a { color: inherit; text-decoration: underline; }

.chatbot__choices { display: flex; flex-wrap: wrap; gap: 8px; }
.chatbot__choice {
  flex: 1 1 auto;
  padding: 11px 14px;
  border: 1.5px solid var(--cb-dark);
  border-radius: 22px;
  background: #fff;
  color: var(--cb-dark);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: background-color .15s ease;
}
.chatbot__choice:hover,
.chatbot__choice:focus-visible { background: var(--cb-accent); border-color: var(--cb-accent); outline: 0; }
.chatbot__choice small { display: block; font-weight: 400; font-size: 11.5px; color: var(--cb-muted); }

/* Ülke listesi: aranabilir. */
.chatbot__countries {
  max-height: 168px;
  overflow-y: auto;
  margin-top: 8px;
  border: 1px solid var(--cb-line);
  border-radius: 10px;
}
.chatbot__country {
  display: block;
  width: 100%;
  padding: 9px 14px;
  border: 0;
  border-top: 1px solid var(--cb-line);
  background: #fff;
  color: var(--cb-text);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.chatbot__country:first-child { border-top: 0; }
.chatbot__country:hover,
.chatbot__country:focus-visible { background: #fff8e1; outline: 0; }
.chatbot__empty { padding: 10px 14px; font-size: 13px; color: var(--cb-muted); }

/* Ürün seçimi: birden fazla seçilebilen kartlar. */
.chatbot__products { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chatbot__product { position: relative; margin: 0; cursor: pointer; }
.chatbot__product input { position: absolute; opacity: 0; pointer-events: none; }
.chatbot__product-box {
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1.5px solid var(--cb-line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.chatbot__product-box img { width: 100%; height: 56px; object-fit: cover; background: var(--cb-bg); }
.chatbot__product-box .chatbot__product-placeholder {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cb-bg);
  color: var(--cb-muted);
  font-size: 22px;
  font-weight: 700;
}
.chatbot__product-name { padding: 7px 28px 8px 9px; font-size: 12.5px; font-weight: 600; line-height: 1.3; color: var(--cb-text); }
.chatbot__product-box::after {
  content: "";
  position: absolute;
  right: 7px;
  bottom: 9px;
  width: 16px;
  height: 16px;
  border: 1.5px solid #c4c4c0;
  border-radius: 4px;
  background: #fff center / 11px no-repeat;
}
.chatbot__product input:checked + .chatbot__product-box { border-color: var(--cb-accent); box-shadow: 0 0 0 2px var(--cb-accent); }
.chatbot__product input:checked + .chatbot__product-box::after {
  border-color: var(--cb-accent);
  background-color: var(--cb-accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 6.5 5 9l5-6' fill='none' stroke='%23171717' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.chatbot__product input:focus-visible + .chatbot__product-box { outline: 2px solid var(--cb-dark); outline-offset: 2px; }

.chatbot__other { margin-top: 8px; }
.chatbot__other[hidden] { display: none; }

.chatbot__primary {
  display: block;
  width: 100%;
  margin-top: 10px;
  height: 46px;
  border: 0;
  border-radius: 23px;
  background: var(--cb-dark);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s ease;
}
.chatbot__primary:hover { background: #000; }
.chatbot__primary:disabled { opacity: .45; cursor: not-allowed; }
.chatbot__secondary {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 6px;
  border: 0;
  background: none;
  color: var(--cb-muted);
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
}

.chatbot__whatsapp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  border-radius: 23px;
  background: #25d366;
  color: #fff !important;
  font-weight: 600;
  font-size: 15px;
}

@media (max-width: 575px) {
  .chatbot__launcher { right: 16px; bottom: 170px; width: 54px; height: 54px; }
  .chatbot__teaser { right: 80px; bottom: 175px; }
  .chatbot__panel {
    right: 0;
    left: 0;
    bottom: 0;
    width: auto;
    height: 100%;
    max-height: none;
    border-radius: 0;
  }
  /* Panel tam ekranken açma düğmesini gizle; kapatma başlıktaki düğmeyle yapılır. */
  .chatbot.is-open .chatbot__launcher,
  .chatbot.is-open .chatbot__teaser { display: none; }
  body.chatbot-locked { overflow: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  .chatbot *, .chatbot *::after { animation: none !important; transition: none !important; }
}
