/* Canli destek widget'i.
   Renk, kose yaricapi ve tipografi sitenin kendi CSS degiskenlerinden alinir
   (--primary, --radius, --light, --form, --dark) — tema degisirse widget da uyar. */

.sd-kok {
  --sd-siyah: var(--primary, #000);
  --sd-kenar: rgba(0, 0, 0, .09);
  --sd-cam: rgba(255, 255, 255, .72);
  --sd-golge: 0 24px 60px -12px rgba(0, 0, 0, .28), 0 8px 20px -8px rgba(0, 0, 0, .12);
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9998;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
  /* Kok kapsayici gorunmez alaniyla altindaki sayfa ogelerinin tiklanmasini
     engellememeli; tiklama yalnizca butona ve acik panele gider. */
  pointer-events: none;
}

.sd-kok > * { pointer-events: auto; }

/* ---- acma butonu ---- */
.sd-buton {
  position: relative;
  width: 58px;
  height: 58px;
  border: none;
  border-radius: var(--radius, 0);
  background: var(--sd-siyah);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .45);
  transition: transform .25s cubic-bezier(.16, 1, .3, 1), box-shadow .25s ease;
}
.sd-buton:hover { transform: translateY(-3px); box-shadow: 0 16px 36px -8px rgba(0, 0, 0, .5); }
.sd-buton:focus-visible { outline: 2px solid var(--sd-siyah); outline-offset: 3px; }
.sd-buton svg { width: 25px; height: 25px; }
.sd-buton .sd-kapat-ikon { display: none; }
.sd-kok.sd-acik .sd-buton .sd-kapat-ikon { display: block; }
.sd-kok.sd-acik .sd-buton .sd-sohbet-ikon { display: none; }

.sd-rozet {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: #dc2626;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  box-shadow: 0 0 0 2px #fff;
}
.sd-rozet[hidden] { display: none; }

/* ---- panel ---- */
.sd-panel {
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 130px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--sd-kenar);
  border-radius: var(--radius, 0);
  background: var(--sd-cam);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  box-shadow: var(--sd-golge);
  opacity: 0;
  transform: translateY(14px) scale(.97);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity .28s ease, transform .28s cubic-bezier(.16, 1, .3, 1);
}
.sd-kok.sd-acik .sd-panel { opacity: 1; transform: none; pointer-events: auto; }

/* backdrop-filter desteklenmiyorsa okunurlugu koru */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .sd-panel { background: rgba(255, 255, 255, .97); }
}

/* ---- baslik ---- */
.sd-baslik {
  padding: 16px 18px;
  background: rgba(0, 0, 0, .92);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}
.sd-logo {
  width: 38px; height: 38px;
  border: 1px solid rgba(255, 255, 255, .28);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 600; letter-spacing: .5px;
}
.sd-baslik-metin { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sd-magaza { font-size: 14px; font-weight: 600; letter-spacing: .4px; }
.sd-durum { font-size: 11.5px; color: rgba(255, 255, 255, .72); display: flex; align-items: center; gap: 6px; }
.sd-nokta {
  width: 7px; height: 7px; border-radius: 50%; background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, .6);
  animation: sd-nabiz 2.4s infinite;
}
@keyframes sd-nabiz {
  0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, .55); }
  70%  { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* ---- mesajlar ---- */
.sd-akis {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
}
.sd-akis::-webkit-scrollbar { width: 5px; }
.sd-akis::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, .18); }

.sd-hos {
  text-align: center;
  color: var(--dark, #777);
  font-size: 12.5px;
  line-height: 1.6;
  padding: 22px 12px;
  border: 1px dashed var(--sd-kenar);
}
.sd-hos b { color: var(--sd-siyah); font-weight: 600; }

.sd-mesaj {
  max-width: 82%;
  padding: 10px 13px;
  font-size: 13.5px;
  line-height: 1.55;
  word-wrap: break-word;
  white-space: pre-wrap;
  animation: sd-gir .3s cubic-bezier(.16, 1, .3, 1);
}
@keyframes sd-gir { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.sd-musteri {
  align-self: flex-end;
  background: var(--sd-siyah);
  color: #fff;
}
.sd-yonetici {
  align-self: flex-start;
  background: rgba(255, 255, 255, .9);
  color: var(--sd-siyah);
  border: 1px solid var(--sd-kenar);
}
.sd-kim { font-size: 10.5px; letter-spacing: .4px; text-transform: uppercase; opacity: .55; margin-bottom: 3px; }
.sd-saat { font-size: 10px; opacity: .5; margin-top: 4px; text-align: end; }

.sd-yaziyor { align-self: flex-start; display: flex; gap: 4px; padding: 12px 14px; background: rgba(255,255,255,.9); border: 1px solid var(--sd-kenar); }
.sd-yaziyor span { width: 6px; height: 6px; border-radius: 50%; background: var(--dark, #777); animation: sd-zipla 1.3s infinite; }
.sd-yaziyor span:nth-child(2) { animation-delay: .18s; }
.sd-yaziyor span:nth-child(3) { animation-delay: .36s; }
@keyframes sd-zipla { 0%,60%,100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-4px); } }

/* ---- giris ---- */
.sd-alt { flex: 0 0 auto; border-top: 1px solid var(--sd-kenar); background: rgba(255, 255, 255, .6); }
.sd-ad-satir { padding: 10px 12px 0; }
.sd-ad-satir input { width: 100%; }
.sd-form { display: flex; align-items: flex-end; gap: 8px; padding: 12px; }

.sd-kok input[type="text"], .sd-kok textarea {
  width: 100%;
  border: 1px solid var(--form, #e5e7eb);
  border-radius: var(--form-radius, 0);
  background: #fff;
  padding: 10px 12px;
  font: inherit;
  font-size: 13.5px;
  color: var(--sd-siyah);
  resize: none;
  transition: border-color .18s ease;
}
.sd-kok input[type="text"]:focus, .sd-kok textarea:focus { outline: none; border-color: var(--sd-siyah); }
.sd-kok textarea { max-height: 96px; line-height: 1.5; }

.sd-gonder {
  flex: 0 0 auto;
  width: 42px; height: 42px;
  border: none;
  border-radius: var(--radius, 0);
  background: var(--sd-siyah);
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .18s ease;
}
.sd-gonder:disabled { opacity: .35; cursor: not-allowed; }
.sd-gonder svg { width: 17px; height: 17px; }

.sd-dipnot { padding: 0 12px 10px; font-size: 10.5px; color: var(--dark, #777); text-align: center; letter-spacing: .2px; }

/* ---- mobil: tam ekran ---- */
@media (max-width: 640px) {
  .sd-kok { right: 16px; bottom: 16px; }
  .sd-panel {
    position: fixed;
    inset: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border: none;
    transform-origin: center;
  }
  .sd-kok.sd-acik .sd-buton { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .sd-panel, .sd-buton, .sd-mesaj { transition-duration: .01ms; animation: none; }
  .sd-nokta, .sd-yaziyor span { animation: none; }
}
