/* Donen gradyanin acisi. @property olmadan ozel ozellikler
   animasyonlanamaz; <angle> olarak tanimlayinca aci canlandirilabilir. */
@property --sam-angle {
  syntax: "<angle>";
  initial-value: 0turn;
  inherits: false;
}

/* Sam - lodos.io site asistanı widget'ı.
   Sitenin tasarım dilini izler (--c-primary/--c-ink/--c-parchment).
   Emoji yok; ikonlar inline SVG. */

.sam-w {
  --sam-w: 384px;
  --sam-h: 540px;
  /* Sam kimlik rengi - mor gradyan (marka isteği). Sitenin mavi
     primary'sinden bilinçli olarak ayrı: Sam ayrı bir kimlik. */
  --sam-grad: linear-gradient(135deg, #a855f7 0%, #6366f1 100%);
  --sam-accent: #7c3aed;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9000;
  font-family: inherit;
}

/* ── kapalı durum: buton ─────────────────────────────────────────── */
.sam-w__fab {
  display: none;
  position: relative;
  /* NOT: overflow: hidden KALDIRILDI - ::after ile disa yayilan isik
     kirpilmamali. Halka (::before) inset:0 oldugu icin zaten tasmaz.
     isolation: isolate DE KALDIRILDI: stacking context yaratip z-index:-1
     olan isigi butonun kutusuna kirpiyordu (Safari'de dikdortgen kenar). */
  align-items: center;
  gap: 9px;
  height: 48px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--sam-grad);
  color: #fff;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.30), 0 0 18px rgba(34, 211, 238, 0.12);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.sam-w__fab:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(124, 58, 237, 0.38), 0 0 24px rgba(34, 211, 238, 0.18); }

/* Dönen gradyan ışık halkası (pembe → mor → mavi → cyan) - butonun İÇ kenarında döner, dışına taşmaz.
   Teknik: ::before pill ile tam aynı alanı kaplar, içi conic-gradient (tek
   parlak yay) ve mask ile ORTASI OYULUR - böylece yalnızca ince bir halka
   görünür. Pill `overflow: hidden` olduğu için taşma da imkânsız.
   Halkayı döndürmek yayın pill'in etrafında dolaşması demek.
   `inherit` sayesinde pill yarıçapı değişse halka da uyar. */
.sam-w__fab::before {
  content: "";
  position: absolute;
  inset: 0;                        /* buton sınırının İÇİNDE kalır */
  border-radius: inherit;
  padding: 2px;                    /* halka kalınlığı */
  background: conic-gradient(
    from var(--sam-angle),
    #ec4899 0%,      /* pembe */
    #a855f7 22%,     /* purple */
    #8b5cf6 42%,     /* violet */
    #3b82f6 62%,     /* mavi */
    #22d3ee 78%,     /* cyan */
    #a855f7 92%,     /* purple - dongu kapanisi */
    #ec4899 100%     /* pembeye donus: dikissiz */
  );
  /* content-box'ı dışarıda bırakıp farkı alıyoruz → donut */
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  animation: sam-orbit 2.6s linear infinite;
  pointer-events: none;
}
/* Disa yayilan yumusak isik: halkanin AYNISI, buyutulmus + bulanik.
   z-index:-1 ile butonun arkasinda durur, tiklamayi engellemez. */
.sam-w__fab::after {
  content: "";
  position: absolute;
  /* Blur ciktisi elemanin KENDI kutusunda kalir; bu yuzden eleman blur
     yaricapindan BUYUK olmali, yoksa Safari kenari duz keser. */
  inset: -18px;
  z-index: -1;
  /* Safari: sozde elemanlarda `border-radius: inherit` guvenilir degil -
     bulanik isik DIKDORTGEN kaliyordu. Yaricap acikca veriliyor.
     (Chromium ve Firefox ikisinde de dogru cizim yapiyordu.) */
  border-radius: 999px;
  background: conic-gradient(
    from var(--sam-angle),
    #ec4899 0%, #a855f7 22%, #8b5cf6 42%,
    #3b82f6 62%, #22d3ee 78%, #a855f7 92%, #ec4899 100%
  );
  -webkit-filter: blur(14px);
          filter: blur(14px);
  /* Safari kirpmayi kendi katmaninda yapsin - kose artiklarini onler. */
  -webkit-transform: translateZ(0);
          transform: translateZ(0);
  /* Kenarlara dogru sonumlenme: hicbir tarayicida duz kesim gorunmesin. */
  -webkit-mask-image: radial-gradient(closest-side, #000 55%, transparent 100%);
          mask-image: radial-gradient(closest-side, #000 55%, transparent 100%);
  opacity: 0.55;
  animation: sam-orbit 2.6s linear infinite;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.sam-w__fab:hover::after { opacity: 0.8; }
@media (prefers-reduced-motion: reduce) {
  .sam-w__fab::after { animation: none; }
}

@keyframes sam-orbit { to { --sam-angle: 1turn; } }
/* Hareket hassasiyeti: halka durur ama görünür kalır (sabit bir parlaklık). */
@media (prefers-reduced-motion: reduce) {
  .sam-w__fab::before { animation: none; }
}
.sam-w.is-closed .sam-w__fab { display: inline-flex; }
.sam-w.is-closed .sam-w__panel { display: none; }

/* ── panel ───────────────────────────────────────────────────────── */
.sam-w__panel {
  width: var(--sam-w);
  height: var(--sam-h);
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  /* Kenarlik saydam; iki katmanli arka plan ile boyaniyor:
     padding-box  -> panelin kendi rengi (icerik alani)
     border-box   -> donen gradyan (yalnizca kenarlik seridinde gorunur) */
  border: 1.5px solid transparent;
  background:
    linear-gradient(var(--c-canvas, #fff), var(--c-canvas, #fff)) padding-box,
    conic-gradient(
      from var(--sam-angle),
      #ec4899 0%, #a855f7 22%, #8b5cf6 42%,
      #3b82f6 62%, #22d3ee 78%, #a855f7 92%, #ec4899 100%
    ) border-box;
  border-radius: 18px;
  overflow: hidden;
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.16),
    0 2px 8px rgba(0, 0, 0, 0.06),
    0 0 26px rgba(139, 92, 246, 0.18);
  /* Acilis animasyonu + surekli donen aci birlikte calisir. */
  animation: sam-in 0.22s ease-out, sam-orbit 2.6s linear infinite;
}
@keyframes sam-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .sam-w__panel { animation: none; }
  .sam-w__fab { transition: none; }
}

.sam-w__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 12px 16px;
  border-bottom: 1px solid var(--c-divider, #f0f0f0);
  background: var(--c-pearl, #fafafc);
}
.sam-w__titles { flex: 1 1 auto; min-width: 0; }
/* Baslik marka gradyaninda; acik panelde ikon KULLANILMIYOR (istek). */
.sam-w__title {
  font-size: 15px; font-weight: 700; line-height: 1.2; letter-spacing: -0.015em;
  background: var(--sam-grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: var(--sam-accent);
}
.sam-w__sub { font-size: 11.5px; color: var(--c-ink-48, #7a7a7a); margin-top: 2px; }
.sam-w__icon-btn {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--c-ink-48, #7a7a7a);
  cursor: pointer;
}
.sam-w__icon-btn:hover { background: rgba(0,0,0,0.05); color: var(--c-ink, #1d1d1f); }

/* ── mesajlar ────────────────────────────────────────────────────── */
.sam-w__log {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 14px 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sam-w__log::-webkit-scrollbar { width: 6px; }
.sam-w__log::-webkit-scrollbar-thumb { background: #e2e2e6; border-radius: 3px; }

.sam-w__msg {
  max-width: 86%;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
}
/* Kullanıcı mesajı düz metin → satır sonları korunmalı.
   Bot mesajı BLOK HTML (p/ul/table) → pre-wrap olmamalı. */
.sam-w__msg--me { white-space: pre-wrap; }
/* Tablolu yanıtlar dar balona sığmaz - bot balonu genişleyebilir. */
.sam-w__msg--bot { max-width: 96%; }
.sam-w__msg--bot {
  align-self: flex-start;
  background: var(--c-parchment, #f5f5f7);
  color: var(--c-ink, #1d1d1f);
  border-bottom-left-radius: 5px;
}
.sam-w__msg--me {
  align-self: flex-end;
  background: var(--sam-grad);
  color: #fff;
  border-bottom-right-radius: 5px;
}
.sam-w__msg a { color: inherit; text-decoration: underline; }
.sam-w__msg strong { font-weight: 650; }

/* yazıyor göstergesi */
.sam-w__typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: 11px 13px;
  background: var(--c-parchment, #f5f5f7); border-radius: 14px; border-bottom-left-radius: 5px; }
.sam-w__typing i { width: 6px; height: 6px; border-radius: 50%; background: #b9b9c0;
  animation: sam-blink 1.1s infinite ease-in-out; }
.sam-w__typing i:nth-child(2) { animation-delay: 0.18s; }
.sam-w__typing i:nth-child(3) { animation-delay: 0.36s; }
@keyframes sam-blink { 0%, 80%, 100% { opacity: 0.35; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sam-w__typing i { animation: none; } }

/* ── başlangıç önerileri ─────────────────────────────────────────── */
.sam-w__chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 14px 10px; }
.sam-w__chip {
  border: 1px solid var(--c-divider, #f0f0f0);
  background: #fff;
  color: var(--c-ink-80, #333);
  font-size: 12px;
  padding: 6px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.sam-w__chip:hover { border-color: var(--sam-accent, #7c3aed); color: var(--sam-accent, #7c3aed); }

/* ── giriş ───────────────────────────────────────────────────────── */
.sam-w__form {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--c-divider, #f0f0f0);
  background: #fff;
}
.sam-w__input {
  flex: 1 1 auto;
  min-height: 38px; max-height: 110px;
  padding: 9px 12px;
  border: 1px solid #e4e4e8;
  border-radius: 12px;
  font: inherit; font-size: 13.5px; line-height: 1.4;
  color: var(--c-ink, #1d1d1f);
  resize: none;
  outline: none;
}
.sam-w__input:focus { border-color: var(--sam-accent, #7c3aed); box-shadow: 0 0 0 3px rgba(124,58,237,0.14); }
.sam-w__send {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 11px;
  background: var(--sam-grad); color: #fff;
  cursor: pointer;
}
.sam-w__send:disabled { opacity: 0.45; cursor: default; }
.sam-w__foot { padding: 0 14px 10px; font-size: 10.5px; color: var(--c-ink-48, #7a7a7a); text-align: center; }

/* ── mobil: alt sayfa ────────────────────────────────────────────── */
@media (max-width: 520px) {
  .sam-w { right: 12px; left: 12px; bottom: 12px; }
  .sam-w__panel { width: auto; height: min(72vh, 520px); }
}

/* ── lead kartı - sohbet işe yaradıktan sonra, kapatılabilir ─────── */
.sam-w__lead {
  align-self: stretch;
  border: 1px solid #ece9fd;
  background: linear-gradient(180deg, #faf8ff 0%, #ffffff 100%);
  border-radius: 14px;
  padding: 12px 13px 11px;
}
.sam-w__lead-head { display: flex; align-items: center; gap: 8px; }
.sam-w__lead-title {
  flex: 1 1 auto; font-size: 13px; font-weight: 650;
  background: var(--sam-grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: var(--sam-accent);
}
.sam-w__lead-x {
  flex: 0 0 auto; width: 22px; height: 22px; border: 0; border-radius: 6px;
  background: transparent; color: var(--c-ink-48, #7a7a7a);
  font-size: 17px; line-height: 1; cursor: pointer;
}
.sam-w__lead-x:hover { background: rgba(0,0,0,0.05); color: var(--c-ink, #1d1d1f); }
.sam-w__lead-text { font-size: 12px; color: var(--c-ink-80, #333); margin-top: 3px; line-height: 1.45; }
.sam-w__lead-row { display: flex; gap: 6px; margin-top: 9px; }
.sam-w__lead-input {
  flex: 1 1 auto; min-width: 0; height: 34px; padding: 0 10px;
  border: 1px solid #e4e0f7; border-radius: 9px;
  font: inherit; font-size: 12.5px; color: var(--c-ink, #1d1d1f); outline: none;
}
.sam-w__lead-input:focus { border-color: var(--sam-accent, #7c3aed); box-shadow: 0 0 0 3px rgba(124,58,237,0.12); }
.sam-w__lead-btn {
  flex: 0 0 auto; height: 34px; padding: 0 14px; border: 0; border-radius: 9px;
  background: var(--sam-grad); color: #fff; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.sam-w__lead-btn:disabled { opacity: 0.5; cursor: default; }
.sam-w__lead-note { font-size: 10.5px; color: var(--c-ink-48, #7a7a7a); margin-top: 7px; line-height: 1.4; }

/* ── model çıktısındaki Markdown blokları ────────────────────────── */
.sam-w__msg--bot p { margin: 0 0 8px; }
.sam-w__msg--bot p:last-child { margin-bottom: 0; }
.sam-w__msg--bot ul,
.sam-w__msg--bot ol { margin: 0 0 8px; padding-left: 18px; }
.sam-w__msg--bot li { margin: 2px 0; }
.sam-w__msg--bot hr {
  border: 0; border-top: 1px solid #e3e3e8; margin: 9px 0;
}
.sam-w__msg--bot code {
  background: #ececf1; padding: 1px 4px; border-radius: 4px;
  font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.sam-w__h {
  font-size: 12.5px; font-weight: 700; letter-spacing: -0.01em;
  color: var(--sam-accent, #7c3aed);
  margin: 2px 0 6px;
}

/* Tablo - panel dar olduğu için KENDİ İÇİNDE yatay kayar; sayfa kaymaz. */
.sam-w__tw {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 0 8px;
  border: 1px solid #e6e6ec;
  border-radius: 9px;
  background: #fff;
}
.sam-w__tw::-webkit-scrollbar { height: 6px; }
.sam-w__tw::-webkit-scrollbar-thumb { background: #d7d7de; border-radius: 3px; }
.sam-w__tw table { border-collapse: collapse; width: max-content; min-width: 100%; font-size: 12px; }
.sam-w__tw th,
.sam-w__tw td {
  padding: 6px 9px;
  text-align: left;
  border-bottom: 1px solid #f0f0f4;
  white-space: nowrap;
}
.sam-w__tw th {
  background: #faf8ff;
  font-weight: 650;
  color: var(--sam-accent, #7c3aed);
  border-bottom-color: #e9e4fb;
}
.sam-w__tw tr:last-child td { border-bottom: 0; }

/* ── puanlama kartı ──────────────────────────────────────────────── */
.sam-w__stars { display: flex; gap: 2px; margin-top: 9px; }
.sam-w__star {
  width: 30px; height: 30px; padding: 0; border: 0;
  background: transparent; color: #c9c6d6; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 7px;
  transition: color 0.12s ease, transform 0.12s ease;
}
.sam-w__star:hover { transform: scale(1.08); }
/* Seçili yıldız: marka moru + dolgu */
.sam-w__star.on { color: #7c3aed; }
.sam-w__star.on svg path { fill: currentColor; }
.sam-w__rate-note {
  width: 100%;
  margin-top: 9px;
  padding: 8px 10px;
  border: 1px solid #e4e0f7;
  border-radius: 9px;
  font: inherit; font-size: 12.5px; line-height: 1.45;
  color: var(--c-ink, #1d1d1f);
  resize: none;
  outline: none;
  box-sizing: border-box;
}
.sam-w__rate-note:focus { border-color: var(--sam-accent, #7c3aed); box-shadow: 0 0 0 3px rgba(124,58,237,0.12); }
.sam-w__rate .sam-w__lead-row { justify-content: flex-end; }
@media (prefers-reduced-motion: reduce) { .sam-w__star:hover { transform: none; } }
