/* =======================================
   BIART CHAT • SCOPED R7 FINAL
   - Sadece .biart-chat altında çalışır
   - Tema ile çakışmaz (body/html dokunulmaz)
   - iOS safe-area, 100dvh, sticky input
   - Kenar duble çizgi sorunları giderildi
   ======================================= */

/* -------- Tema Değişkenleri -------- */
.biart-chat {
  --bg:       #0b0b0b;   /* kart arka planı */
  --surface:  #121212;   /* mesaj alanı / balon zemin */
  --border:   #262626;   /* bileşen sınırları */
  --ink:      #ffffff;   /* ana metin */
  --muted:    #bdbdbd;   /* açıklama / dipnot */
  --ink-soft: #e6e6e6;   /* asistan balonu metni */
  --user-bubble: #15181d;/* kullanıcı balonu */
  --accent:   #ffffff;   /* buton çerçevesi/rengi (istersen marka rengi) */
}

/* Açık tema gerekiyorsa kapsayıcıya .biart-chat--light ekle */
.biart-chat.biart-chat--light {
  --bg:       #ffffff;
  --surface:  #fafafa;
  --border:   #e5e7eb;
  --ink:      #111827;
  --muted:    #6b7280;
  --ink-soft: #1f2937;
  --user-bubble: #f3f4f6;
  --accent:   #111827;
}

/* Sadece bileşen içi reset */
.biart-chat, .biart-chat * { box-sizing: border-box; }
.biart-chat { overscroll-behavior: contain; }

/* ---------- KART / PENCERE ---------- */
.biart-chat__window{
  width: clamp(320px, 96vw, 720px);
  margin: 16px auto;
  padding: 16px;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 0;
  box-shadow: 0 8px 28px rgba(0,0,0,.35);

  display: flex;
  flex-direction: column;
  /* mobilde görünür yükseklik */
  min-height: calc(100dvh - 32px);
}

/* ---------- BAŞLIK SATIRI ---------- */
.biart-chat__header{
  display:flex; align-items:center; justify-content:space-between;
  gap:12px; margin-bottom:12px; background:transparent; padding:0; border:0;
}
.biart-chat__brand{ display:flex; align-items:center; gap:10px; min-width:0; }
.biart-chat__logo{
  width:24px; height:24px; object-fit:contain; border-radius:0;
  filter: invert(1) brightness(1.8); /* siyah logo görünür kalsın */
  flex:0 0 24px;
}
.biart-chat__title{
  margin:0; font-weight:700; font-size:18px; letter-spacing:.2px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; color:var(--ink);
}

/* ---------- SIFIRLA ---------- */
.biart-chat__reset{
  background:transparent; color:var(--accent); border:1px solid var(--accent);
  padding:10px 14px; font-size:14px; border-radius:0; cursor:pointer; transition:.18s ease;
  min-height:44px;
}
.biart-chat__reset:hover{ background:var(--accent); color:var(--bg); }

/* ---------- MESAJ ALANI ---------- */
/* Not: Burada ikinci bir çerçeve KULLANMIYORUZ (tema ile duble çizgi olmasın) */
.biart-chat__messages{
  flex:1 1 auto;
  min-height: 40svh;
  background: var(--surface);
  border: 0;                      /* <-- duble sınır engellendi */
  padding: 12px;
  border-radius: 0;
  overflow-y: auto;
  margin-bottom: 12px;

  word-wrap: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  color: var(--ink);
}

/* Balonlar */
.biart-chat__msg{ display:flex; gap:10px; margin:10px 0; }
.biart-chat__msg--user{ justify-content:flex-end; }
.biart-chat__bubble{
  max-width: 92%;               /* mobilde daha geniş görünsün */
  padding: 10px 12px;
  border-radius: 0;
  font-size: 15px; line-height: 1.5;
  border: 1px solid var(--border);
}
.biart-chat__msg--ai   .biart-chat__bubble{ background: var(--surface);   color: var(--ink-soft); }
.biart-chat__msg--user .biart-chat__bubble{ background: var(--user-bubble); color: var(--ink); }
.biart-chat__bubble code{
  background: rgba(255,255,255,.06);
  padding: 2px 6px; border-radius: 0;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}

/* ---------- GİRİŞ SATIRI ---------- */
.biart-chat__input{
  position: sticky; bottom: 0;
  display:flex; gap:10px;
  margin-top:auto; padding: 10px 0 10px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  z-index: 5;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}
.biart-chat__input textarea{
  flex:1; min-height:44px; resize:none;
  background: color-mix(in oklab, var(--bg), #000 10%);
  color:var(--ink);
  border:1px solid var(--border); border-radius:0;
  padding:10px 12px; font-size:16px; /* iOS zoom fix */
}
.biart-chat__send{
  background:transparent; color:var(--accent);
  border:1px solid var(--accent); border-radius:0;
  min-width:100px; padding:10px 14px; font-weight:700; cursor:pointer; transition:.18s ease;
  min-height:44px;
}
.biart-chat__send:hover{ background:var(--accent); color:var(--bg); }
.biart-chat__send:disabled{ opacity:.6; cursor:not-allowed; }

/* ---------- DİPNOT ---------- */
.biart-chat__footnote{
  margin-top:8px; background:transparent; border:0;
  font-size:13px; color:var(--muted); padding:0;
}

/* ---------- YÜZEN LAUNCHER (opsiyonel) ---------- */
.biart-chat--floating .biart-chat__window{
  position:fixed; right:16px; bottom:84px;
  width:min(420px,96vw); height:min(80dvh,640px);
  margin:0; padding:16px; z-index:99999;
}
.biart-launcher{
  position:fixed; right:16px; bottom:16px; z-index:99999;
  background:var(--bg); color:var(--accent); border:1px solid var(--accent);
  padding:12px 16px; border-radius:0; font-weight:800; cursor:pointer;
  box-shadow:0 14px 32px rgba(0,0,0,.22);
  min-height:44px;
}

/* ---------- Responsive ---------- */
@media (max-width: 992px){
  .biart-chat__window{ padding:14px; }
}
@media (max-width: 768px){
  .biart-chat__header{ flex-direction:column; align-items:flex-start; gap:8px; }
  .biart-chat__title{ font-size:16px; }
  .biart-chat__reset{ align-self:flex-end; }
  .biart-chat__send{ min-width:88px; font-size:14px; padding:10px; }
}
@media (max-width: 480px){
  .biart-chat__title{ font-size:15px; }
}
