/* izCloud AI destek asistanı widget'ı (izhost widget'ının izcloud tasarım diline uyarlaması; yapı ve ölçüler aynı).
   Tüm seçiciler .izw kökünün altında; site/panel CSS'i widget'ı bozmasın diye kök içinde sıfırlama yapılır.
   Belirteçler izcloud'un gerçek değişkenlerinden gelir; üç kabuk için ayrı eşleme var:
   - varsayılan (eski kabuk, auth, sepet, hata): izcloud-site.css --mk-* (marka #2563eb); koyu tema html[data-bs-theme=dark] ile değişir
   - body.shell-v2 (v2 tanıtım sayfaları): izcloud-ds.css --ds-* (marka #0465c1), yalnız açık tema
   - body.panel-v2 (müşteri paneli v2): izcloud-panel-v2.css --mk-* ve --pv-* (marka #3a90ce), yalnız açık tema
   Yazı tipi sayfanın gövde yazı tipidir (--bs-body-font-family: Plus Jakarta Sans / Outfit / Inter). Konum ve hizalar mantıksal
   özelliklerle yazıldı: dir=rtl sayfada başlatıcı ve panel sol altta durur. */

.izw {
  --izw-brand: var(--mk-brand, #2563eb); --izw-ink: var(--mk-brand, #2563eb); --izw-deep: var(--mk-brand-hover, #1d4ed8); --izw-link: var(--izw-deep);
  --izw-tint: var(--mk-brand-soft, #eff4ff); --izw-tint-line: var(--mk-line-strong, #d0d4db);
  --izw-bg: var(--mk-bg, #fff); --izw-alt: var(--mk-bg-alt, #f7f8fa); --izw-text: var(--mk-fg, #0e1116); --izw-text2: var(--mk-fg-2, #4a5260); --izw-muted: var(--mk-fg-3, #6b7280);
  --izw-line: var(--mk-line-strong, #d0d4db); --izw-line2: var(--mk-line, #e6e8ec); --izw-err: var(--mk-danger, #dc2626); --izw-warn: var(--mk-warn, #b45309);
  --izw-err-bg: #fdecec; --izw-err-line: #f3c6c6; --izw-tip-bg: #0f172a;
  --izw-r: 8px; --izw-r-sm: 6px;
  --izw-sh: 0 8px 24px rgba(14, 17, 22, .12); --izw-ease: cubic-bezier(.2, .8, .2, 1);
  --izw-font-d: var(--bs-body-font-family, system-ui, sans-serif); --izw-font-b: var(--bs-body-font-family, system-ui, sans-serif);
  /* Çerez kartının kapladığı alt yükseklik (JS yazar); başlatıcı ve panel onun üstüne çıkar */
  --izw-occ: 0px; --izw-gap: 24px; --izw-side: 24px;
  --izw-bottom: calc(max(var(--izw-gap), calc(var(--izw-occ) + 12px)) + env(safe-area-inset-bottom, 0px));
  position: static; display: block; margin: 0; padding: 0; border: 0; background: none;
  font: 400 14px/1.5 var(--izw-font-b); color: var(--izw-text); letter-spacing: normal; text-transform: none; text-align: start;
  -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased;
}
/* v2 tanıtım kabuğu (izcloud-ds.css) */
body.shell-v2 .izw {
  --izw-brand: var(--ds-blue); --izw-ink: var(--ds-blue); --izw-deep: var(--ds-blue-deep); --izw-link: var(--ds-blue-deep);
  --izw-tint: var(--ds-sky-100); --izw-tint-line: var(--ds-sky-200);
  --izw-bg: var(--ds-white); --izw-alt: var(--ds-sky-50); --izw-text: var(--ds-ink); --izw-text2: var(--ds-text); --izw-muted: var(--ds-muted);
  --izw-line: var(--ds-line); --izw-line2: var(--ds-line-soft); --izw-tip-bg: var(--ds-ink);
  --izw-r: var(--ds-r-md); --izw-r-sm: var(--ds-r-sm); --izw-sh: var(--ds-sh-strip);
  --izw-font-d: var(--ds-font); --izw-font-b: var(--ds-font);
}
/* Müşteri paneli v2 (izcloud-panel-v2.css) */
body.panel-v2 .izw {
  --izw-brand: var(--mk-brand); --izw-ink: var(--pv-brand-ink); --izw-deep: #175a8a; --izw-link: var(--pv-brand-ink);
  --izw-tint: var(--mk-brand-soft); --izw-tint-line: var(--pv-brand-100);
  --izw-bg: var(--mk-bg); --izw-alt: var(--mk-bg-alt); --izw-text: var(--mk-fg); --izw-text2: var(--mk-fg-2); --izw-muted: var(--mk-fg-3);
  --izw-line: var(--mk-line-strong); --izw-line2: var(--mk-line); --izw-err: var(--mk-danger); --izw-warn: var(--mk-warn);
  --izw-err-bg: var(--pv-err-bg); --izw-tip-bg: var(--mk-fg);
  --izw-r: var(--pv-r-md); --izw-r-sm: 8px; --izw-sh: var(--pv-sh-2);
}
/* Koyu tema: yalnız eski kabukta var (v2 ve panel sayfaları temayı açığa sabitler); site.css'in koyu --mk-* değerleri kullanılır */
:root[data-bs-theme="dark"] .izw {
  --izw-ink: #2563eb; --izw-deep: #1d4ed8; --izw-link: var(--mk-brand-hover, #60a5fa);
  --izw-err-bg: rgba(248, 113, 113, .12); --izw-err-line: rgba(248, 113, 113, .35); --izw-tip-bg: var(--mk-line-strong, #2d3440);
  --izw-sh: 0 8px 24px rgba(0, 0, 0, .5);
}
.izw, .izw *, .izw *::before, .izw *::after { box-sizing: border-box; }
.izw :where(div, span, section, header, form, p, time, strong, a, i) {
  margin: 0; padding: 0; border: 0; background: none; letter-spacing: inherit; text-transform: inherit; font-family: inherit; text-shadow: none;
}
.izw button, .izw textarea {
  font: inherit; color: inherit; margin: 0; letter-spacing: inherit; text-transform: none; text-shadow: none; box-shadow: none;
  -webkit-appearance: none; appearance: none; border-radius: 0; min-width: 0; min-height: 0; line-height: inherit; background: none; border: 0;
}
.izw button { cursor: pointer; }
.izw svg { display: block; flex: none; max-width: none; }
.izw [hidden] { display: none !important; }
.izw .izw-vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Odak halkası (yüksek karşıtlık kipinde saydam çizgi görünür kalır) */
.izw :focus { outline: none; }
.izw .izw-launch:focus-visible, .izw .izw-ib:focus-visible, .izw .izw-send:focus-visible, .izw .izw-btn:focus-visible {
  outline: 2px solid transparent; outline-offset: 2px; box-shadow: 0 0 0 2px var(--izw-bg), 0 0 0 4px var(--izw-brand);
}

/* Başlatıcı */
.izw .izw-launch {
  position: fixed; inset-inline-end: var(--izw-side); bottom: var(--izw-bottom); z-index: 1045;
  width: 56px; height: 56px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--izw-r); background: var(--izw-ink); color: #fff; box-shadow: var(--izw-sh);
  transition: background .12s;
}
.izw .izw-launch:hover { background: var(--izw-deep); }
.izw .izw-launch:focus-visible { box-shadow: 0 0 0 2px var(--izw-bg), 0 0 0 4px var(--izw-brand), var(--izw-sh); }
.izw .izw-bdg {
  position: absolute; top: -8px; inset-inline-end: -8px; padding: 4px 6px; border-radius: 9999px; background: var(--izw-bg); color: var(--izw-link);
  border: 1px solid var(--izw-tint-line); box-shadow: var(--izw-sh); font: 700 10.5px/1 var(--izw-font-b); letter-spacing: .04em;
}

/* Panel */
.izw .izw-panel {
  position: fixed; inset-inline-end: var(--izw-side); bottom: var(--izw-bottom); z-index: 1045;
  width: 380px; max-width: calc(100vw - 2 * var(--izw-side)); height: 600px; max-height: calc(100vh - var(--izw-bottom) - 24px);
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
  background: var(--izw-bg); border: 1px solid var(--izw-line); border-radius: var(--izw-r); box-shadow: var(--izw-sh);
}
.izw .izw-head { position: relative; display: flex; align-items: center; justify-content: space-between; flex: none; min-height: 60px; padding-block: 0; padding-inline: 16px 6px; border-bottom: 1px solid var(--izw-line2); background: var(--izw-bg); }
.izw .izw-id { display: flex; align-items: center; gap: 10px; min-width: 0; }
.izw .izw-av { width: 32px; height: 32px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--izw-r-sm); background: var(--izw-tint); color: var(--izw-ink); }
.izw .izw-tt { display: flex; align-items: center; gap: 8px; min-width: 0; }
.izw .izw-name { font: 700 14px/1.3 var(--izw-font-d); color: var(--izw-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.izw .izw-ai { flex: none; padding: 4px 8px; border-radius: 9999px; background: var(--izw-tint); color: var(--izw-link); border: 1px solid var(--izw-tint-line); font: 700 11px/1 var(--izw-font-b); letter-spacing: .04em; }
.izw .izw-ctl { display: flex; flex: none; }
.izw .izw-ib { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border-radius: var(--izw-r); color: var(--izw-text2); transition: background .12s, color .12s; }
.izw .izw-ib:hover { background: var(--izw-alt); color: var(--izw-text); }
.izw .izw-info { margin-inline-start: -4px; }

/* Bilgi ipucu balonu: üzerine gelince, odakta ya da dokunuşta (.open) */
.izw .izw-tip { position: static; }
.izw .izw-tipb {
  position: absolute; left: 12px; right: 12px; top: calc(100% - 2px); z-index: 5; padding: 10px 12px; border-radius: var(--izw-r-sm);
  background: var(--izw-tip-bg); color: #fff; box-shadow: var(--izw-sh); font-size: 12.5px; line-height: 1.45;
  opacity: 0; visibility: hidden; transform: translateY(-3px); pointer-events: none;
}
.izw .izw-tip:hover .izw-tipb, .izw .izw-tip:focus-within .izw-tipb, .izw .izw-tip.open .izw-tipb { opacity: 1; visibility: visible; transform: none; }

/* İleti günlüğü */
.izw .izw-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.izw .izw-log { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.izw .izw-sep { align-self: center; padding: 2px 0; color: var(--izw-muted); font: 600 11.5px/1.4 var(--izw-font-b); text-align: center; }
.izw .izw-m { display: flex; flex-direction: column; max-width: 84%; }
.izw .izw-m-a { align-self: flex-start; align-items: flex-start; }
.izw .izw-m-v { align-self: flex-end; align-items: flex-end; }
.izw .izw-m-s { align-self: center; align-items: center; max-width: 100%; }
.izw .izw-b { padding: 10px 12px; border-radius: var(--izw-r); line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; unicode-bidi: plaintext; text-align: start; }
.izw .izw-m-a .izw-b { background: var(--izw-alt); border: 1px solid var(--izw-line2); border-end-start-radius: 2px; }
.izw .izw-m-v .izw-b { background: var(--izw-ink); color: #fff; border-end-end-radius: 2px; }
.izw .izw-m-s .izw-b { padding: 2px 0; color: var(--izw-muted); font-size: 12.5px; text-align: center; }
.izw .izw-m-pend .izw-b { opacity: .7; }
.izw .izw-b a { color: var(--izw-link); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.izw .izw-m-v .izw-b a { color: #fff; }
.izw .izw-b a:focus-visible { outline: 2px solid transparent; box-shadow: 0 0 0 2px var(--izw-bg), 0 0 0 4px var(--izw-brand); border-radius: 2px; }
.izw .izw-t { margin: 4px 2px 0; color: var(--izw-muted); font-size: 11.5px; }
.izw .izw-typing { display: inline-flex; align-items: center; gap: 4px; padding: 14px 12px; color: var(--izw-text2); }
.izw .izw-typing i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .45; }

/* Şeritler ve alt alanlar */
.izw .izw-strip { display: flex; align-items: flex-start; gap: 8px; flex: none; padding: 10px 16px; background: var(--izw-err-bg); border-top: 1px solid var(--izw-err-line); color: var(--izw-err); font-size: 13px; font-weight: 500; }
.izw .izw-strip svg { margin-top: 2px; }
.izw .izw-confirm, .izw .izw-closed { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; flex: none; padding: 12px 16px; border-top: 1px solid var(--izw-line2); background: var(--izw-alt); }
.izw .izw-confirm-t, .izw .izw-closed-t { font-weight: 600; color: var(--izw-text2); }
.izw .izw-confirm-b { display: inline-flex; gap: 8px; }
.izw .izw-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: var(--izw-r); background: var(--izw-ink); color: #fff; font-weight: 600; transition: background .12s; }
.izw .izw-btn:hover { background: var(--izw-deep); }
.izw .izw-btn-ghost { background: var(--izw-bg); color: var(--izw-text); border: 1px solid var(--izw-line); }
.izw .izw-btn-ghost:hover { background: var(--izw-alt); }

/* Giriş alanı */
.izw .izw-foot { display: grid; grid-template-columns: 1fr 44px; grid-template-areas: "f s" "c c"; align-items: end; gap: 8px; flex: none; padding: 12px; border-top: 1px solid var(--izw-line2); background: var(--izw-bg); }
.izw .izw-field { grid-area: f; border: 1px solid var(--izw-line); border-radius: var(--izw-r); background: var(--izw-bg); transition: border-color .12s, box-shadow .12s; }
.izw .izw-field:focus-within { border-color: var(--izw-brand); box-shadow: 0 0 0 2px var(--izw-bg), 0 0 0 4px var(--izw-brand); }
.izw .izw-foot.is-lock .izw-field { background: var(--izw-alt); }
.izw .izw-field textarea { display: block; width: 100%; height: 44px; max-height: 120px; resize: none; padding: 10px 12px; line-height: 1.45; overflow-y: auto; }
.izw .izw-field textarea:focus-visible { outline: none; }
.izw .izw-field textarea::placeholder { color: var(--izw-muted); opacity: 1; }
.izw .izw-count { grid-area: c; padding-inline-end: 2px; color: var(--izw-muted); font-size: 11.5px; text-align: end; font-variant-numeric: tabular-nums; }
/* RTL: "0 / 2000" sayacı ters dizilmesin; satır sonu (fiziksel sol) hizası */
html[dir="rtl"] .izw .izw-count { direction: ltr; text-align: left; }
.izw .izw-count.warn { color: var(--izw-warn); font-weight: 600; }
.izw .izw-count.over { color: var(--izw-err); font-weight: 700; }
.izw .izw-send { grid-area: s; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border-radius: var(--izw-r); background: var(--izw-ink); color: #fff; transition: background .12s; }
.izw .izw-send:hover:not([disabled]) { background: var(--izw-deep); }
.izw .izw-send[disabled] { background: var(--izw-line); color: var(--izw-muted); cursor: not-allowed; }
.izw .izw-foot.is-lock textarea { cursor: not-allowed; }

/* Hareket (azaltılmışsa hiçbiri çalışmaz) */
@media (prefers-reduced-motion: no-preference) {
  .izw .izw-typing i { animation: izw-blip 1.2s infinite var(--izw-ease); }
  .izw .izw-typing i:nth-child(2) { animation-delay: .15s; }
  .izw .izw-typing i:nth-child(3) { animation-delay: .3s; }
  .izw .izw-panel { animation: izw-rise 220ms var(--izw-ease); }
  .izw .izw-tipb { transition: opacity .12s var(--izw-ease), transform .12s var(--izw-ease), visibility .12s; }
}
@keyframes izw-blip { 0%, 60%, 100% { opacity: .35; transform: none; } 30% { opacity: 1; transform: translateY(-2px); } }
@keyframes izw-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .izw *, .izw *::before, .izw *::after { animation: none !important; transition: none !important; } }

/* Mobil: tam ekran sayfa, güvenli alanlar */
@media (max-width: 640px) {
  .izw { --izw-gap: 16px; --izw-side: 16px; }
  .izw .izw-panel {
    inset: 0; width: auto; max-width: none; height: 100vh; height: 100dvh; max-height: none;
    border: 0; border-radius: 0; box-shadow: none; z-index: 1046; animation: none;
  }
  .izw .izw-head { padding-top: env(safe-area-inset-top, 0px); padding-inline-start: calc(16px + env(safe-area-inset-left, 0px)); padding-inline-end: calc(6px + env(safe-area-inset-right, 0px)); }
  .izw .izw-log { padding-left: calc(16px + env(safe-area-inset-left, 0px)); padding-right: calc(16px + env(safe-area-inset-right, 0px)); }
  .izw .izw-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); padding-left: calc(12px + env(safe-area-inset-left, 0px)); padding-right: calc(12px + env(safe-area-inset-right, 0px)); }
  .izw .izw-field textarea { font-size: 16px; }
  .izw .izw-m { max-width: 90%; }
}

/* Bildirim balonu (IzToast, sağ alt) ile çakışmama: LTR sayfada balon yığını başlatıcının üstünde başlar,
   geniş ekranda panel açıkken panelin soluna kayar. RTL'de widget solda olduğundan değişiklik gerekmez. */
html:not([dir="rtl"]):has(.izw-launch:not([hidden])) .iztoast-wrap { bottom: calc(max(24px, var(--izw-occ, 0px) + 12px) + 68px + env(safe-area-inset-bottom, 0px)); }
@media (max-width: 640px) { html:not([dir="rtl"]):has(.izw-launch:not([hidden])) .iztoast-wrap { bottom: calc(max(16px, var(--izw-occ, 0px) + 12px) + 68px + env(safe-area-inset-bottom, 0px)); } }
@media (min-width: 1100px) { html:not([dir="rtl"]):has(.izw-panel:not([hidden])) .iztoast-wrap { right: 420px; } }
