/* ==========================================================================
   Widget maketi (sohbet penceresi gorseli)
   Tek kaynak: hem pazarlama ana sayfasinin hero'su hem de panelin widget
   ayar sayfasindaki canli onizleme bu dosyayi yukler. Isaretleme de ortaktir:
   src/views/partials/widget-preview.njk

   Vurgu rengi --wd-accent uzerinden gelir; panelde satir ici deger ile
   (kullanicinin sectigi renk) ezilir. Baska hicbir yerde renk sabitlenmez.
   ========================================================================== */

.widget-demo {
  --wd-accent: var(--c-primary);
  position: relative;
  width: 100%;
  max-width: 400px;
  margin-inline: auto;
  padding-bottom: 72px; /* launcher icin yer */
}

.widget-demo__win {
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-2);
  overflow: hidden;
}

.widget-demo__bar {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2);
  background: var(--wd-accent);
  color: #fff;
}
.widget-demo__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.16);
  flex: none;
}
.widget-demo__avatar svg { width: 22px; height: 22px; }
.widget-demo__id { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.widget-demo__id strong {
  font-family: var(--ff-head);
  font-size: var(--fs-sm);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.widget-demo__status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  color: rgba(255, 255, 255, 0.85);
}

.widget-demo__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-2);
  background: var(--c-bg-alt);
}

.bubble {
  max-width: 88%;
  padding: 10px 14px;
  font-size: var(--fs-sm);
  line-height: 1.5;
  border-radius: var(--r-lg);
  overflow-wrap: anywhere;
}
.bubble--visitor {
  align-self: flex-end;
  background: var(--wd-accent);
  color: #fff;
  border-bottom-right-radius: var(--r-sm);
}
.bubble--ai {
  background: var(--c-bg);
  color: var(--c-text);
  border: 1px solid var(--c-border);
  border-bottom-left-radius: var(--r-sm);
}

.widget-demo__input {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 12px var(--s-2);
  border-top: 1px solid var(--c-border);
  background: var(--c-bg);
  font-size: var(--fs-sm);
  color: var(--c-text-3);
}
.widget-demo__input span:first-child { flex: 1 1 auto; }
.widget-demo__send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: var(--c-bg-alt);
  color: var(--wd-accent);
  flex: none;
}
.widget-demo__send svg { width: 18px; height: 18px; }

/* --- "ekibe ileteyim mi?" teklifi onizlemesi (akilli mod, yalnizca panel) --- */
.widget-demo__offer {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
}
.widget-demo__offer[hidden] { display: none; }
.widget-demo__chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
}
.widget-demo__chip {
  padding: 6px 12px;
  border: 1px solid var(--wd-accent);
  border-radius: 999px;
  background: var(--c-bg);
  color: var(--c-text);
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
}
.widget-demo__chip + .widget-demo__chip { border-color: var(--c-border); color: var(--c-text-2); }

/* --- cevrimdisi iletisim formu onizlemesi (yalnizca panel) --- */
.widget-demo__form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 var(--s-2) var(--s-2);
  padding: var(--s-2);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  background: var(--c-bg);
}
.widget-demo__form[hidden] { display: none; }
.widget-demo__form-text {
  font-size: var(--fs-xs);
  line-height: 1.5;
  color: var(--c-text-2);
}
.widget-demo__field {
  display: block;
  padding: 8px 12px;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  background: var(--c-bg-alt);
  color: var(--c-text-3);
  font-size: var(--fs-xs);
}
.widget-demo__consent {
  display: block;
  padding-left: 24px;
  position: relative;
  font-size: var(--fs-xs);
  line-height: 1.5;
  color: var(--c-text-2);
}
.widget-demo__consent::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1px;
  width: 16px;
  height: 16px;
  border: 1px solid var(--c-border);
  border-radius: 4px;
}
.widget-demo__formbtn {
  align-self: flex-start;
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--wd-accent);
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: 600;
}

.widget-demo__brand {
  padding: 8px var(--s-2);
  border-top: 1px solid var(--c-border);
  background: var(--c-bg);
  color: var(--c-text-3);
  font-size: var(--fs-xs);
  text-align: center;
}

.widget-demo__launcher {
  position: absolute;
  right: 0;
  bottom: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--r-full);
  background: var(--wd-accent);
  color: #fff;
  box-shadow: var(--sh-2);
}
.widget-demo__launcher svg { width: 26px; height: 26px; }
.widget-demo__launcher .dot-online {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  border: 2px solid #fff;
}

/* Konum: sag (varsayilan) / sol. Sadece launcher ve balonlarin hizasi degisir. */
.widget-demo[data-position='left'] .widget-demo__launcher { right: auto; left: 0; }

.dot-online {
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
  background: var(--c-accent);
  flex: none;
}

/* Panelde renk degisimi anlik yansiyor; gecis yumusak olsun diye kisa bir
   animasyon var. Hareketi azaltilmis tercihte tamamen kapatilir. */
.widget-demo__bar,
.widget-demo__launcher,
.bubble--visitor,
.widget-demo__send {
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

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