/* ==========================================================================
   WOLF FAMILY — Canlı Destek widget'ı
   Özgün yeşil sohbet baloncuğu; WhatsApp logosu/yazısı kullanılmaz.
   ========================================================================== */
:root {
  --wf-sup-green: #2fbf71;
  --wf-sup-green-2: #1f9f5b;
  --wf-sup-ink: #0a1510;
  --wf-sup-bottom: calc(20px + env(safe-area-inset-bottom) + var(--wf-bottom-extra, 0px));
  --wf-sup-z: 9400;
}

.wf-sup-root {
  position: fixed;
  z-index: var(--wf-sup-z);
  right: 22px;
  bottom: var(--wf-sup-bottom);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  font-family: var(--font-body, 'Inter', sans-serif);
  color: var(--text, #f1f3f7);
  pointer-events: none;
}
.wf-sup-root.is-left { right: auto; left: 22px; align-items: flex-start; }
.wf-sup-root > * { pointer-events: auto; }

/* ------------------------------------------------------------ launcher */
.wf-sup-launch {
  position: relative;
  width: 58px; height: 58px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: radial-gradient(circle at 34% 28%, #4bd88b, var(--wf-sup-green) 52%, var(--wf-sup-green-2));
  color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 12px 30px rgba(20, 120, 70, 0.35), 0 0 0 5px rgba(47, 191, 113, 0.1);
  transition: transform 0.25s var(--ease, cubic-bezier(.22,1,.36,1)), box-shadow 0.25s;
}
.wf-sup-launch:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 16px 36px rgba(20, 120, 70, 0.42), 0 0 0 6px rgba(47, 191, 113, 0.14); }
.wf-sup-launch:active { transform: scale(0.96); }
.wf-sup-launch svg { width: 27px; height: 27px; }
.wf-sup-launch::before {
  content: '';
  position: absolute; inset: -5px; border-radius: 50%;
  border: 1px solid rgba(47, 191, 113, 0.5);
  animation: wfSupPulse 2.8s ease-out infinite;
  pointer-events: none;
}
.wf-sup-launch::after {
  content: '';
  position: absolute; right: 4px; top: 4px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--danger); border: 2px solid var(--bg);
  box-shadow: 0 0 8px rgba(var(--danger-rgb), 0.8);
  opacity: 0; transition: opacity 0.2s;
}
.wf-sup-root.has-unread .wf-sup-launch::after { opacity: 1; }
.wf-sup-badge {
  position: absolute; top: -3px; right: -4px;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px;
  display: none; place-items: center;
  background: var(--danger); color: #fff;
  font-size: 0.64rem; font-weight: 800; line-height: 1;
  border: 2px solid var(--bg);
  font-variant-numeric: tabular-nums;
}
.wf-sup-root.has-unread .wf-sup-badge { display: grid; }
@keyframes wfSupPulse {
  0% { transform: scale(0.92); opacity: 0.8; }
  70% { transform: scale(1.35); opacity: 0; }
  100% { transform: scale(1.35); opacity: 0; }
}

/* ---------------------------------------------------------------- hint */
.wf-sup-hint {
  position: relative;
  max-width: 230px;
  padding: 10px 30px 10px 12px;
  border-radius: 14px 14px 4px 14px;
  background: var(--surface-2, #141822);
  border: 1px solid var(--line-2, rgba(255,255,255,.14));
  color: var(--text, #f1f3f7);
  font-size: 0.78rem; line-height: 1.45;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  opacity: 0; transform: translateY(6px);
  transition: opacity 0.3s, transform 0.3s var(--ease, cubic-bezier(.22,1,.36,1));
}
.wf-sup-root.is-left .wf-sup-hint { border-radius: 14px 14px 14px 4px; }
.wf-sup-hint.is-on { opacity: 1; transform: none; }
.wf-sup-hint b { color: var(--wf-sup-green); }
.wf-sup-hint-close {
  position: absolute; top: 4px; right: 6px;
  width: 22px; height: 22px; border-radius: 50%;
  color: var(--faint, #626a79); font-size: 13px;
}
.wf-sup-hint-close:hover { color: var(--text); background: var(--line); }

/* --------------------------------------------------------------- panel */
.wf-sup-panel {
  position: fixed;
  z-index: calc(var(--wf-sup-z) + 1);
  right: 22px;
  bottom: var(--wf-sup-bottom);
  width: 360px;
  height: min(520px, calc(100dvh - 36px));
  max-height: calc(100dvh - 36px);
  display: flex; flex-direction: column;
  border-radius: 18px;
  overflow: hidden;
  background: var(--surface, #0f1117);
  border: 1px solid var(--line-2, rgba(255,255,255,.14));
  box-shadow: 0 26px 70px rgba(0,0,0,0.5), 0 0 0 1px rgba(47,191,113,0.12);
  opacity: 0; transform: translateY(14px) scale(0.98);
  visibility: hidden;
  transition: opacity 0.28s, transform 0.28s var(--ease, cubic-bezier(.22,1,.36,1)), visibility 0.28s;
  pointer-events: none;
}
.wf-sup-panel.is-open { opacity: 1; transform: none; visibility: visible; pointer-events: auto; }
.wf-sup-root.is-left .wf-sup-panel { right: auto; left: 22px; }

/* header */
.wf-sup-head {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 12px 12px 14px;
  background:
    radial-gradient(120% 160% at 8% 0%, rgba(255,255,255,0.16), transparent 52%),
    linear-gradient(135deg, var(--wf-sup-green), var(--wf-sup-green-2));
  color: #fff;
  flex: 0 0 auto;
}
.wf-sup-head::after {
  content: '';
  position: absolute; inset: auto 0 0 0; height: 1px;
  background: rgba(255,255,255,0.16);
}
.wf-sup-avatar {
  width: 38px; height: 38px; flex: 0 0 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.65);
  background: #0b1510;
}
.wf-sup-head-txt { flex: 1; min-width: 0; }
.wf-sup-head-txt b { display: block; font-family: var(--font-display, 'Sora', sans-serif); font-size: 0.9rem; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wf-sup-state { display: flex; align-items: center; gap: 5px; margin-top: 1px; color: rgba(255,255,255,0.82); font-size: 0.66rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wf-sup-state-dot { width: 6px; height: 6px; border-radius: 50%; background: #b6ffd6; box-shadow: 0 0 7px #b6ffd6; flex: 0 0 6px; }
.wf-sup-state.is-offline .wf-sup-state-dot { background: #ffd9a1; box-shadow: none; }
.wf-sup-state.is-typing { color: #eafff3; font-style: italic; }
.wf-sup-head-actions { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.wf-sup-hbtn {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  color: rgba(255,255,255,0.85);
  transition: background 0.2s, color 0.2s;
}
.wf-sup-hbtn:hover { background: rgba(255,255,255,0.16); color: #fff; }
.wf-sup-hbtn svg { width: 16px; height: 16px; }

/* body / doodle */
.wf-sup-body {
  position: relative;
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 12px 12px 8px;
  background-color: var(--bg-2, #0a0c11);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%232fbf71' stroke-opacity='.09' stroke-width='1.2'%3E%3Cpath d='M18 28c0-4 3-7 7-7h20c4 0 7 3 7 7v9c0 4-3 7-7 7H33l-6 5v-5h-2c-4 0-7-3-7-7v-9z'/%3E%3Cpath d='M74 72c0-5 4-9 9-9h16c5 0 9 4 9 9v8c0 5-4 9-9 9h-2v5l-6-5h-8c-5 0-9-4-9-9v-8z'/%3E%3Ccircle cx='30' cy='31' r='1.4'/%3E%3Ccircle cx='40' cy='31' r='1.4'/%3E%3Ccircle cx='35' cy='36' r='1.4'/%3E%3Cpath d='M88 78c3 0 5 2 5 4s-2 4-5 4-5-2-5-4 2-4 5-4z'/%3E%3Cpath d='M18 88l3 3 6-6M58 28l2 2 4-4'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: repeat;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
  overscroll-behavior: contain;
}
.wf-sup-body::-webkit-scrollbar { width: 6px; }
.wf-sup-body::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; }

.wf-sup-day { display: flex; justify-content: center; margin: 4px 0 10px; }
.wf-sup-day span {
  padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2, #141822); border: 1px solid var(--line);
  color: var(--faint, #626a79); font-size: 0.6rem; font-weight: 600;
  letter-spacing: 0.03em;
}
.wf-sup-msg { display: flex; margin: 0 0 7px; }
.wf-sup-msg.out { justify-content: flex-end; }
.wf-sup-msg.in { justify-content: flex-start; }
.wf-sup-bubble {
  position: relative;
  max-width: 82%;
  padding: 8px 11px 7px;
  border-radius: 13px;
  font-size: 0.8rem; line-height: 1.48;
  word-break: break-word;
  white-space: pre-wrap;
  box-shadow: 0 2px 5px rgba(0,0,0,0.12);
}
.wf-sup-msg.in .wf-sup-bubble {
  background: var(--surface-2, #141822);
  border: 1px solid var(--line);
  color: var(--text, #f1f3f7);
  border-bottom-left-radius: 4px;
}
.wf-sup-msg.in .wf-sup-bubble::after {
  content: '';
  position: absolute; left: -5px; bottom: 0;
  border: 5px solid transparent; border-right-color: var(--surface-2, #141822); border-bottom: 0;
}
.wf-sup-msg.out .wf-sup-bubble {
  background: linear-gradient(135deg, #56d68f, var(--wf-sup-green));
  color: #06170d;
  border-bottom-right-radius: 4px;
}
.wf-sup-msg.out .wf-sup-bubble::after {
  content: '';
  position: absolute; right: -5px; bottom: 0;
  border: 5px solid transparent; border-left-color: var(--wf-sup-green); border-bottom: 0;
}
.wf-sup-bubble a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.wf-sup-msg.out .wf-sup-bubble a { color: #063c21; }
.wf-sup-bubble img { display: block; max-width: 220px; max-height: 220px; border-radius: 10px; margin: 2px 0 4px; object-fit: cover; }
.wf-sup-bubble img + a { display: none; }
.wf-sup-meta {
  display: flex; align-items: center; justify-content: flex-end; gap: 4px;
  margin-top: 3px;
  font-size: 0.58rem; line-height: 1;
  opacity: 0.72;
}
.wf-sup-msg.in .wf-sup-meta { color: var(--faint); }
.wf-sup-msg.out .wf-sup-meta { color: #06452a; }
.wf-sup-tick { letter-spacing: -0.22em; font-weight: 700; }
.wf-sup-tick.is-read { color: #1677ff; }
.wf-sup-pending { opacity: 0.75; }
.wf-sup-msg.is-failed .wf-sup-bubble { background: rgba(var(--danger-rgb), 0.18); color: var(--text); border: 1px solid rgba(var(--danger-rgb), 0.5); }
.wf-sup-retry { margin-left: 6px; color: var(--accent); font-size: 0.62rem; font-weight: 700; text-decoration: underline; }

/* typing */
.wf-sup-typing { display: none; align-items: center; gap: 5px; margin: 2px 0 8px; }
.wf-sup-typing.is-on { display: flex; }
.wf-sup-typing-bubble {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 8px 11px; border-radius: 13px 13px 13px 4px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.wf-sup-typing-bubble i { width: 5px; height: 5px; border-radius: 50%; background: var(--faint); animation: wfSupTyping 1.2s ease-in-out infinite; }
.wf-sup-typing-bubble i:nth-child(2) { animation-delay: 0.15s; }
.wf-sup-typing-bubble i:nth-child(3) { animation-delay: 0.3s; }
@keyframes wfSupTyping { 0%, 60%, 100% { transform: translateY(0); opacity: 0.45; } 30% { transform: translateY(-3px); opacity: 1; } }

/* welcome / intro */
.wf-sup-note {
  display: flex; align-items: flex-start; gap: 6px;
  margin: 2px 0 9px; padding: 7px 9px;
  border-radius: 9px;
  background: rgba(47,191,113,0.08); border: 1px solid rgba(47,191,113,0.18);
  color: var(--dim, #99a1af); font-size: 0.64rem; line-height: 1.45;
}
.wf-sup-quick { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 10px; }
.wf-sup-quick button {
  padding: 5px 9px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line-2);
  color: var(--dim); font-size: 0.64rem; font-weight: 600;
  text-align: left; transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.wf-sup-quick button:hover { border-color: var(--wf-sup-green); color: var(--text); background: rgba(47,191,113,0.08); }
.wf-sup-intro {
  margin: 2px 0 10px; padding: 11px;
  border-radius: 12px;
  background: var(--surface, #0f1117); border: 1px solid var(--line-2);
  box-shadow: 0 6px 18px rgba(0,0,0,0.16);
}
.wf-sup-intro h3 { font-family: var(--font-display); font-size: 0.8rem; font-weight: 600; margin-bottom: 2px; }
.wf-sup-intro p { color: var(--faint); font-size: 0.64rem; line-height: 1.45; margin-bottom: 8px; }
.wf-sup-field { display: block; margin-bottom: 6px; }
.wf-sup-field span { display: block; margin-bottom: 3px; color: var(--faint); font-size: 0.58rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.wf-sup-field input {
  width: 100%; padding: 7px 9px; border-radius: 8px;
  background: var(--bg-2); border: 1px solid var(--line);
  color: var(--text); font-family: inherit; font-size: 0.74rem;
}
.wf-sup-field input:focus { outline: none; border-color: var(--wf-sup-green); box-shadow: 0 0 0 3px rgba(47,191,113,0.12); }
.wf-sup-field input.is-invalid { border-color: var(--danger); }
.wf-sup-intro-btn {
  width: 100%; margin-top: 2px; padding: 8px 10px;
  border-radius: 8px; background: linear-gradient(135deg, #4bd88b, var(--wf-sup-green));
  color: #06170d; font-size: 0.74rem; font-weight: 800;
}
.wf-sup-intro-err { margin-top: 5px; color: #f27b7b; font-size: 0.62rem; }
.wf-sup-offline { margin: 0 0 9px; color: #f2a25e; font-size: 0.64rem; line-height: 1.45; }

/* composer */
.wf-sup-compose {
  display: flex; align-items: flex-end; gap: 6px;
  padding: 8px 9px calc(8px + env(safe-area-inset-bottom));
  background: var(--surface, #0f1117);
  border-top: 1px solid var(--line);
  flex: 0 0 auto;
}
.wf-sup-emoji-wrap { position: relative; flex: 0 0 auto; }
.wf-sup-emoji-btn {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; color: var(--faint);
  font-size: 17px; line-height: 1;
}
.wf-sup-emoji-btn:hover { background: var(--surface-2); color: var(--text); }
.wf-sup-emojis {
  position: absolute; left: 0; bottom: 40px;
  display: none; grid-template-columns: repeat(5, 30px); gap: 3px;
  padding: 6px; border-radius: 11px;
  background: var(--surface-2); border: 1px solid var(--line-2);
  box-shadow: 0 10px 26px rgba(0,0,0,0.25);
  z-index: 3;
}
.wf-sup-emojis.is-open { display: grid; }
.wf-sup-emojis button { width: 30px; height: 30px; border-radius: 7px; font-size: 17px; line-height: 1; }
.wf-sup-emojis button:hover { background: var(--surface-3); }
.wf-sup-input {
  flex: 1; min-height: 34px; max-height: 90px;
  padding: 7px 9px; border-radius: 9px;
  background: var(--bg-2); border: 1px solid var(--line);
  color: var(--text); font-family: inherit; font-size: 0.78rem;
  line-height: 1.4; resize: none; overflow-y: auto;
}
.wf-sup-input:focus { outline: none; border-color: var(--wf-sup-green); box-shadow: 0 0 0 3px rgba(47,191,113,0.1); }
.wf-sup-send {
  width: 34px; height: 34px; flex: 0 0 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #4bd88b, var(--wf-sup-green));
  color: #06170d;
  transition: opacity 0.2s, transform 0.2s;
}
.wf-sup-send:disabled { opacity: 0.45; transform: none; }
.wf-sup-send svg { width: 16px; height: 16px; }
.wf-sup-compose-note { padding: 0 11px 7px; color: var(--faint); font-size: 0.56rem; text-align: center; background: var(--surface); }

/* footer status / error */
.wf-sup-alert {
  display: none;
  margin: 0 0 8px; padding: 7px 9px; border-radius: 8px;
  background: rgba(var(--danger-rgb), 0.1); border: 1px solid rgba(var(--danger-rgb), 0.28);
  color: #f2a0a0; font-size: 0.64rem; line-height: 1.45;
}
.wf-sup-alert.is-on { display: block; }
.wf-sup-alert button { margin-left: 6px; color: #fff; font-weight: 700; text-decoration: underline; }
.wf-sup-loading { display: flex; justify-content: center; padding: 8px 0; }
.wf-sup-loading i { width: 6px; height: 6px; margin: 0 2px; border-radius: 50%; background: var(--faint); animation: wfSupTyping 1.2s infinite; }
.wf-sup-loading i:nth-child(2) { animation-delay: .15s; }
.wf-sup-loading i:nth-child(3) { animation-delay: .3s; }

/* light theme */
html[data-theme="light"] .wf-sup-panel { background: #fff; }
html[data-theme="light"] .wf-sup-body { background-color: #f4f7f4; }
html[data-theme="light"] .wf-sup-msg.in .wf-sup-bubble { background: #fff; border-color: rgba(0,0,0,0.08); color: #1a201b; }
html[data-theme="light"] .wf-sup-msg.in .wf-sup-bubble::after { border-right-color: #fff; }
html[data-theme="light"] .wf-sup-msg.out .wf-sup-bubble { color: #06170d; }
html[data-theme="light"] .wf-sup-day span { background: #fff; }
html[data-theme="light"] .wf-sup-quick button { background: #fff; }
html[data-theme="light"] .wf-sup-intro { background: #fff; }
html[data-theme="light"] .wf-sup-compose, html[data-theme="light"] .wf-sup-compose-note { background: #fff; }
html[data-theme="light"] .wf-sup-typing-bubble { background: #fff; }
html[data-theme="light"] .wf-sup-launch::after { border-color: #f4f7f4; }
html[data-theme="light"] .wf-sup-badge { border-color: #f4f7f4; }

/* mobile bottom sheet */
@media (max-width: 640px) {
  .wf-sup-root { right: 14px; bottom: var(--wf-sup-bottom); }
  .wf-sup-root.is-left { left: 14px; right: auto; }
  .wf-sup-launch { width: 54px; height: 54px; }
  .wf-sup-panel {
    left: 0; right: 0;
    bottom: calc(var(--wf-bottom-extra, 0px) + env(safe-area-inset-bottom));
    width: 100%;
    height: min(82dvh, 640px);
    max-height: calc(100dvh - var(--wf-bottom-extra, 0px) - env(safe-area-inset-bottom) - 12px);
    border-radius: 18px 18px 0 0;
    border-left: 0; border-right: 0; border-bottom: 0;
  }
  .wf-sup-root.is-left .wf-sup-panel { left: 0; right: 0; }
  .wf-sup-head { padding-top: max(12px, env(safe-area-inset-top)); }
  .wf-sup-hint { max-width: min(240px, calc(100vw - 90px)); }
}

@media (max-width: 380px) {
  .wf-sup-bubble { max-width: 88%; }
  .wf-sup-root { right: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .wf-sup-launch::before, .wf-sup-typing-bubble i, .wf-sup-loading i { animation: none; }
  .wf-sup-panel, .wf-sup-launch, .wf-sup-hint { transition: none; }
  .wf-sup-launch:hover { transform: none; }
}
