/* Canlı destek penceresi (assets/js/chat.js). Konum: "yukarı çık" roketinin (.to-top, 58 px) solunda.
   Roket görünmüyorken başlatıcı köşeye kayar; mobilde çerez bildirimi açıkken roketle birlikte yukarı çıkar. */
.ps-chat-launcher {
  position: fixed; right: 24px; bottom: 24px; z-index: 45;
  width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; padding: 0;
  color: #fff; border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(135deg, var(--blue, #2f6bff), var(--pink, #ff4fa3));
  box-shadow: var(--icon-shadow, 0 10px 30px rgba(0, 0, 0, 0.5));
  transition: right 0.5s cubic-bezier(.2,.8,.2,1), bottom 0.5s cubic-bezier(.2,.8,.2,1), transform 0.3s;
}
body:has(.to-top.show) .ps-chat-launcher { right: calc(24px + 58px + 12px); }
.ps-chat-launcher:hover { transform: translateY(-3px); }
.ps-chat-launcher:focus-visible { outline: 2px solid var(--cyan, #38c8ff); outline-offset: 4px; }
.ps-chat-badge[hidden] { display: none; }
.ps-chat-launcher svg { width: 28px; height: 28px; fill: currentColor; }
.ps-chat-launcher svg circle { fill: var(--blue, #2f6bff); }
.ps-chat-launcher.is-open svg { transform: scale(0.92); }
.ps-chat-dot {
  position: absolute; right: 3px; bottom: 3px; width: 14px; height: 14px; border-radius: 50%;
  background: #8b93b5; border: 2.5px solid var(--bg, #060a1c);
}
.ps-chat-launcher.is-online .ps-chat-dot { background: #22c55e; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6); animation: psChatPulse 2.2s infinite; }
@keyframes psChatPulse { 70% { box-shadow: 0 0 0 9px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }
.ps-chat-badge {
  position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  display: grid; place-items: center; font: 700 12px/1 "Inter", system-ui, sans-serif; color: #fff; background: #ef4444; border: 2px solid var(--bg, #060a1c);
}

.ps-chat-box {
  position: fixed; right: 24px; bottom: 96px; z-index: 47; width: min(380px, calc(100vw - 32px)); height: min(560px, calc(100vh - 130px));
  display: flex; flex-direction: column; overflow: hidden; border-radius: 20px;
  background: var(--menu-bg, rgba(6, 10, 28, 0.97)); color: var(--text, #eef1ff); border: 1px solid var(--border, rgba(255,255,255,.09));
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.6); font-family: "Inter", system-ui, sans-serif;
  animation: psChatIn 0.35s cubic-bezier(.2,.8,.2,1);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.ps-chat-box[hidden] { display: none; }
@keyframes psChatIn { from { opacity: 0; transform: translateY(16px) scale(0.98); } }
.ps-chat-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 14px 16px; border-bottom: 1px solid var(--border, rgba(255,255,255,.09)); background: linear-gradient(120deg, rgba(47, 107, 255, 0.18), rgba(255, 79, 163, 0.12)); }
.ps-chat-head img { border-radius: 10px; flex: none; }
.ps-chat-who { flex: 1; min-width: 0; display: grid; gap: 2px; }
.ps-chat-who b { font-family: "Sora", "Inter", sans-serif; font-size: 0.98rem; }
.ps-chat-state { display: flex; align-items: center; gap: 6px; font-size: 0.74rem; color: var(--muted, #9aa3c7); }
.ps-chat-state i { width: 8px; height: 8px; border-radius: 50%; background: #8b93b5; flex: none; }
.ps-chat-box.is-online .ps-chat-state i { background: #22c55e; }
.ps-chat-end { border: 1px solid var(--border, rgba(255,255,255,.12)); background: transparent; color: var(--muted, #9aa3c7); font: 600 0.74rem "Inter", sans-serif; padding: 6px 10px; border-radius: 9px; cursor: pointer; }
.ps-chat-end:hover { color: #ef4444; border-color: rgba(239, 68, 68, 0.5); }
.ps-chat-x { width: 34px; height: 34px; border-radius: 10px; border: 0; background: transparent; color: var(--muted, #9aa3c7); cursor: pointer; display: grid; place-items: center; flex: none; }
.ps-chat-x:hover { background: rgba(255, 255, 255, 0.08); color: var(--text, #fff); }
.ps-chat-x svg, .ps-chat-send svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.ps-chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; }
.ps-msg { display: flex; flex-direction: column; max-width: 84%; gap: 3px; }
.ps-msg-body { padding: 9px 13px; border-radius: 16px; font-size: 0.9rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.ps-msg-name { font-size: 0.7rem; color: var(--muted, #9aa3c7); padding-left: 4px; font-weight: 600; }
.ps-msg-time { font-size: 0.66rem; color: var(--muted, #9aa3c7); padding: 0 4px; }
.ps-msg-admin { align-self: flex-start; }
.ps-msg-admin .ps-msg-body { background: var(--surface-2, rgba(255, 255, 255, 0.07)); border: 1px solid var(--border, rgba(255,255,255,.09)); border-bottom-left-radius: 5px; }
.ps-msg-visitor { align-self: flex-end; align-items: flex-end; }
.ps-msg-visitor .ps-msg-body { background: linear-gradient(135deg, var(--blue, #2f6bff), #5b5bff); color: #fff; border-bottom-right-radius: 5px; }
.ps-msg-system { align-self: center; max-width: 92%; }
.ps-msg-system .ps-msg-body { background: transparent; color: var(--muted, #9aa3c7); font-size: 0.78rem; text-align: center; padding: 4px 8px; }

.ps-chat-start { padding: 12px 14px 14px; display: grid; gap: 8px; border-top: 1px solid var(--border, rgba(255,255,255,.09)); }
.ps-chat-start[hidden], .ps-chat-send[hidden], .ps-chat-closed[hidden] { display: none; }
.ps-chat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ps-chat-box input, .ps-chat-box textarea {
  width: 100%; box-sizing: border-box; font: 0.88rem/1.4 "Inter", system-ui, sans-serif; color: var(--text, #eef1ff);
  background: var(--field-bg, rgba(255, 255, 255, 0.05)); border: 1px solid var(--border, rgba(255,255,255,.12)); border-radius: 12px; padding: 10px 12px; resize: none;
}
.ps-chat-box input:focus, .ps-chat-box textarea:focus { outline: none; border-color: var(--cyan, #38c8ff); }
.ps-chat-hp { position: absolute !important; left: -9999px !important; width: 1px !important; height: 1px !important; opacity: 0; }
.ps-chat-go { border: 0; border-radius: 12px; padding: 11px; cursor: pointer; font: 700 0.9rem "Inter", sans-serif; color: #fff; background: linear-gradient(120deg, var(--blue, #2f6bff), var(--pink, #ff4fa3)); }
.ps-chat-go:disabled { opacity: 0.6; cursor: wait; }
.ps-chat-err { margin: 0; color: #f87171; font-size: 0.8rem; }
.ps-chat-note { margin: 0; color: var(--muted, #9aa3c7); font-size: 0.68rem; line-height: 1.4; }
.ps-chat-note a { color: var(--cyan, #38c8ff); }
.ps-chat-send { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px 12px; border-top: 1px solid var(--border, rgba(255,255,255,.09)); }
.ps-chat-send textarea { flex: 1; min-height: 42px; max-height: 120px; }
.ps-chat-send button { flex: none; width: 42px; height: 42px; border-radius: 12px; border: 0; cursor: pointer; color: #fff; background: var(--blue, #2f6bff); display: grid; place-items: center; }
.ps-chat-closed { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--border, rgba(255,255,255,.09)); font-size: 0.82rem; color: var(--muted, #9aa3c7); }
.ps-chat-new { border: 0; border-radius: 10px; padding: 9px 12px; cursor: pointer; font: 700 0.8rem "Inter", sans-serif; color: #fff; background: var(--blue, #2f6bff); }

@media (max-width: 760px) {
  .ps-chat-launcher { right: 16px; bottom: 16px; width: 52px; height: 52px; }
  body:has(.to-top.show) .ps-chat-launcher { right: calc(16px + 52px + 10px); }
  body.cookie-open .ps-chat-launcher { bottom: calc(var(--cookie-h, 0px) + 28px); }
  .ps-chat-box { right: 8px; left: 8px; bottom: 80px; width: auto; height: min(560px, calc(100vh - 100px)); border-radius: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .ps-chat-launcher, .ps-chat-box { transition: none; animation: none; }
  .ps-chat-launcher.is-online .ps-chat-dot { animation: none; }
}
