/* Sohbet kutusu — td.css değişkenlerini kullanır */
.chat { position: fixed; right: 20px; bottom: 20px; z-index: 60; font-family: var(--font-body); display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.chat[hidden] { display: none; }
.chat__fab {
  width: 58px; height: 58px; border: 0; border-radius: 50%; cursor: pointer; color: #fff;
  background: var(--gradient); box-shadow: 0 14px 34px -10px rgba(122, 44, 255, .75);
  display: grid; place-items: center; transition: transform .2s ease;
}
.chat__fab:hover { transform: translateY(-2px) scale(1.04); }
.chat__fab svg { width: 26px; height: 26px; grid-area: 1 / 1; }
.chat__wa {
  width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: #25d366;
  box-shadow: 0 14px 34px -10px rgba(37, 211, 102, .7); transition: transform .2s ease;
}
.chat__wa:hover { transform: translateY(-2px) scale(1.04); }
.chat__wa svg { width: 28px; height: 28px; }
.chat__ic-close { display: none; }
.chat.is-open .chat__ic-open { display: none; }
.chat.is-open .chat__ic-close { display: block; }

.chat__panel {
  position: absolute; right: 0; bottom: calc(100% + 12px); width: min(380px, calc(100vw - 32px)); height: min(560px, calc(100vh - 120px));
  display: flex; flex-direction: column; overflow: hidden; border-radius: 22px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 30px 70px -20px rgba(16, 12, 46, .45);
}
.chat__panel[hidden] { display: none; }
.chat__head { padding: 16px 20px; background: var(--ink); color: #fff; display: grid; gap: 2px; }
.chat__head span { font-size: var(--fs-xs); color: var(--muted-dark); }

.chat__log { flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 10px; background: var(--paper); }
.chat__msg { max-width: 86%; padding: 10px 14px; border-radius: 16px; font-size: var(--fs-sm); line-height: 1.5; overflow-wrap: anywhere; }
.chat__msg--bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat__msg--me { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 4px; }
.chat__msg a { color: var(--accent); font-weight: 600; }

.chat__actions { padding: 12px 14px 14px; border-top: 1px solid var(--line); background: var(--surface); display: flex; flex-wrap: wrap; gap: 8px; max-height: 46%; overflow-y: auto; }
.chat__opt {
  padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  font: inherit; font-size: var(--fs-sm); font-weight: 500; color: var(--ink); cursor: pointer; text-decoration: none;
  transition: border-color .2s ease, background-color .2s ease;
}
.chat__opt:hover { border-color: var(--accent); }
.chat__opt--primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.chat__opt--ghost { color: var(--muted); }

.chat__form { display: grid; gap: 8px; width: 100%; }
.chat__form input, .chat__form textarea {
  width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); font: inherit; font-size: var(--fs-sm); background: var(--paper);
}
.chat__form input:focus, .chat__form textarea:focus { outline: none; border-color: var(--accent); }
.chat__form .chat__hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.chat__form button[type="submit"] { justify-self: start; }
.chat__err { color: #c0243c; font-size: var(--fs-xs); }

@media (max-width: 640px) {
  .chat { right: 14px; bottom: 14px; }
}
@media (prefers-reduced-motion: reduce) { .chat__fab { transition: none; } }
