/* ==========================================================================
   AmorfBil AudioBot — canlı destek sohbeti (yüzen pencere)
   Panel temasıyla uyumlu; harici bağımlılık yok.
   ========================================================================== */

.lc-root {
  position: fixed;
  right: 22px;
  bottom: calc(22px + var(--lc-offset, 0px));
  z-index: 1200;
  font-family: inherit;
}

/* ------------------------------------------------------------------ başlatıcı */
.lc-launcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px 13px 14px;
  border: 1px solid color-mix(in srgb, var(--brand, #7c5cff) 60%, transparent);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand, #7c5cff), var(--brand-2, #22d3ee));
  color: #fff;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
  cursor: pointer;
  box-shadow: 0 16px 38px color-mix(in srgb, var(--brand, #7c5cff) 42%, transparent), 0 4px 14px rgba(0, 0, 0, 0.28);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}
.lc-launcher:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
  box-shadow: 0 20px 46px color-mix(in srgb, var(--brand, #7c5cff) 50%, transparent), 0 6px 18px rgba(0, 0, 0, 0.32);
}
.lc-launcher:active { transform: translateY(0); }
.lc-launcher:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.lc-launcher-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
}
.lc-launcher-icon svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.lc-launcher-text { white-space: nowrap; }

/* Giriş ekranında formu kapatmamak için yalnızca simge gösterilir. */
.lc-root.lc-compact {
  right: 8px;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px) + var(--lc-offset, 0px));
}
.lc-root.lc-compact .lc-launcher {
  width: 44px;
  height: 44px;
  padding: 0;
  gap: 0;
  justify-content: center;
  border-radius: 50%;
}
.lc-root.lc-compact .lc-launcher-text { display: none; }
.lc-root.lc-compact .lc-launcher-icon { width: 30px; height: 30px; background: transparent; }

.lc-badge {
  position: absolute;
  top: -6px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 2px solid var(--bg, #070a18);
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 3px 10px rgba(239, 68, 68, 0.5);
}
.lc-badge.hidden { display: none; }

/* ---------------------------------------------------------------------- panel */
.lc-panel {
  position: absolute;
  right: 0;
  bottom: 66px;
  width: min(384px, calc(100vw - 32px));
  max-height: min(640px, calc(100dvh - 118px - var(--lc-offset, 0px)));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid var(--line-strong, rgba(148, 163, 184, 0.3));
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel-solid, #12172b) 96%, #fff 4%), var(--panel-solid, #12172b));
  box-shadow: 0 34px 80px rgba(3, 5, 18, 0.55), 0 8px 24px rgba(3, 5, 18, 0.35);
  backdrop-filter: blur(18px);
  animation: lcIn 0.22s ease-out;
  transform-origin: bottom right;
}
.lc-panel.hidden { display: none; }

@keyframes lcIn {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------------------------------------------------------------------- başlık */
.lc-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 14px 16px;
  border-bottom: 1px solid var(--line, rgba(148, 163, 184, 0.16));
  background:
    radial-gradient(120% 150% at 0% 0%, color-mix(in srgb, var(--brand, #7c5cff) 30%, transparent), transparent 62%),
    linear-gradient(135deg, color-mix(in srgb, var(--brand, #7c5cff) 18%, transparent), transparent);
}
.lc-avatar {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand, #7c5cff), var(--brand-2, #22d3ee));
  color: #fff;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--brand, #7c5cff) 38%, transparent);
}
.lc-avatar svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.lc-head-copy { flex: 1 1 auto; min-width: 0; }
.lc-head-copy strong {
  display: block;
  color: var(--text, #f8fafc);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lc-head-copy span {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  color: var(--muted, #a5b4d0);
  font-size: 10.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lc-dot {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok, #34d399);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok, #34d399) 18%, transparent);
}
.lc-icon-btn {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  border: 1px solid var(--line, rgba(148, 163, 184, 0.16));
  background: color-mix(in srgb, var(--text, #f8fafc) 6%, transparent);
  color: var(--muted, #a5b4d0);
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  transition: background 0.16s, color 0.16s;
}
.lc-icon-btn:hover { background: color-mix(in srgb, var(--text, #f8fafc) 12%, transparent); color: var(--text, #f8fafc); }
.lc-icon-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.lc-icon-btn.hidden { display: none; }

/* ------------------------------------------------------------------------ gövde */
.lc-body { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.lc-chat-view {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}
.lc-chat-view.hidden,
.lc-list-view.hidden { display: none; }

.lc-messages {
  flex: 1 1 auto;
  min-height: 190px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
}
.lc-messages::-webkit-scrollbar { width: 7px; }
.lc-messages::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: color-mix(in srgb, var(--text, #f8fafc) 16%, transparent);
}

.lc-row { display: flex; flex-direction: column; align-items: flex-start; max-width: 86%; }
.lc-row.is-mine { align-self: flex-end; align-items: flex-end; }
.lc-msg {
  padding: 9px 12px;
  border-radius: 14px 14px 14px 5px;
  font-size: 12.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text, #f8fafc);
  background: color-mix(in srgb, var(--text, #f8fafc) 7%, transparent);
  border: 1px solid var(--line, rgba(148, 163, 184, 0.16));
}
.lc-row.is-mine .lc-msg {
  border-radius: 14px 14px 5px 14px;
  border-color: transparent;
  background: linear-gradient(135deg, var(--brand, #7c5cff), color-mix(in srgb, var(--brand, #7c5cff) 55%, var(--brand-2, #22d3ee)));
  color: #fff;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--brand, #7c5cff) 26%, transparent);
}
.lc-meta {
  margin-top: 4px;
  padding: 0 2px;
  color: var(--dim, #6b7a99);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.1px;
}

/* karşılama kartı */
.lc-intro {
  margin: auto;
  padding: 18px 16px;
  text-align: center;
  color: var(--muted, #a5b4d0);
  font-size: 12px;
  line-height: 1.6;
}
.lc-intro-ico {
  width: 46px;
  height: 46px;
  margin: 0 auto 10px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--brand, #7c5cff) 16%, transparent);
  color: var(--brand-2, #22d3ee);
}
.lc-intro-ico svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.lc-intro strong {
  display: block;
  margin-bottom: 5px;
  color: var(--text, #f8fafc);
  font-size: 14px;
  font-weight: 700;
}
.lc-intro p { margin: 0; }
.lc-intro ul {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
  text-align: left;
  font-size: 11.5px;
}
.lc-intro li { display: flex; gap: 7px; align-items: flex-start; }
.lc-intro li::before {
  content: '•';
  color: var(--ok, #34d399);
  font-weight: 800;
}
.lc-empty {
  margin: auto;
  padding: 26px 18px;
  text-align: center;
  color: var(--dim, #6b7a99);
  font-size: 12px;
  line-height: 1.6;
}
.lc-empty strong { display: block; margin-bottom: 4px; color: var(--muted, #a5b4d0); font-size: 13px; }

.lc-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 14px 8px;
  padding: 9px 11px;
  border-radius: 11px;
  border: 1px solid color-mix(in srgb, var(--warn, #fbbf24) 32%, transparent);
  background: color-mix(in srgb, var(--warn, #fbbf24) 12%, transparent);
  color: var(--muted, #a5b4d0);
  font-size: 11px;
}
.lc-banner button {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--brand, #7c5cff) 45%, transparent);
  background: color-mix(in srgb, var(--brand, #7c5cff) 18%, transparent);
  color: var(--text, #f8fafc);
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
}
.lc-banner button:hover { background: color-mix(in srgb, var(--brand, #7c5cff) 28%, transparent); }

/* ------------------------------------------------------------------- yazma alanı */
.lc-composer {
  flex: 0 0 auto;
  padding: 10px 12px 8px;
  border-top: 1px solid var(--line, rgba(148, 163, 184, 0.16));
  background: color-mix(in srgb, var(--panel-solid, #12172b) 80%, transparent);
}
.lc-composer.hidden { display: none; }
.lc-name {
  width: 100%;
  height: 36px;
  margin-bottom: 8px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line-strong, rgba(148, 163, 184, 0.3));
  background: color-mix(in srgb, var(--bg, #070a18) 72%, transparent);
  color: var(--text, #f8fafc);
  font-family: inherit;
  font-size: 12.5px;
}
.lc-name.hidden { display: none; }
.lc-name::placeholder { color: var(--dim, #6b7a99); }
.lc-name:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--brand, #7c5cff) 70%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand, #7c5cff) 16%, transparent);
}
/* Ad + e-posta alanları (yalnızca ziyaretçi sohbet başlatırken). */
.lc-fields {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 8px;
  margin-bottom: 8px;
}
.lc-fields.hidden { display: none; }
.lc-fields .lc-name { margin-bottom: 0; }
@media (max-width: 480px) {
  .lc-fields { grid-template-columns: 1fr; }
}
.lc-input-row { display: flex; align-items: flex-end; gap: 8px; }
.lc-input {
  flex: 1 1 auto;
  min-height: 42px;
  max-height: 118px;
  resize: none;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--line-strong, rgba(148, 163, 184, 0.3));
  background: color-mix(in srgb, var(--bg, #070a18) 72%, transparent);
  color: var(--text, #f8fafc);
  font-family: inherit;
  font-size: 12.5px;
  line-height: 1.45;
}
.lc-input::placeholder { color: var(--dim, #6b7a99); }
.lc-input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--brand, #7c5cff) 70%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand, #7c5cff) 16%, transparent);
}
.lc-send {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand, #7c5cff), var(--brand-2, #22d3ee));
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--brand, #7c5cff) 34%, transparent);
  transition: filter 0.16s, transform 0.16s;
}
.lc-send:hover { filter: brightness(1.08); }
.lc-send:active { transform: scale(0.96); }
.lc-send:disabled { opacity: 0.55; cursor: default; filter: none; transform: none; }
.lc-send svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lc-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 14px 10px;
  color: var(--dim, #6b7a99);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.lc-foot button {
  border: 0;
  background: none;
  padding: 0;
  color: var(--dim, #6b7a99);
  font-family: inherit;
  font-size: 9.5px;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}
.lc-foot button:hover { color: var(--text, #f8fafc); }
.lc-foot.hidden { display: none; }

/* ------------------------------------------------------------ yönetici listesi */
.lc-list-view {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}
.lc-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px 8px;
  color: var(--muted, #a5b4d0);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.1px;
  text-transform: uppercase;
}
.lc-list-head button {
  border: 1px solid var(--line, rgba(148, 163, 184, 0.16));
  background: color-mix(in srgb, var(--text, #f8fafc) 5%, transparent);
  color: var(--muted, #a5b4d0);
  border-radius: 8px;
  padding: 4px 8px;
  font-family: inherit;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: none;
  cursor: pointer;
}
.lc-list-head button:hover { background: color-mix(in srgb, var(--text, #f8fafc) 10%, transparent); }
.lc-admin-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scrollbar-width: thin;
}
.lc-conv {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.lc-conv:hover { background: color-mix(in srgb, var(--text, #f8fafc) 6%, transparent); }
.lc-conv.is-active {
  background: color-mix(in srgb, var(--brand, #7c5cff) 14%, transparent);
  border-color: color-mix(in srgb, var(--brand, #7c5cff) 34%, transparent);
}
.lc-conv-avatar {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--brand, #7c5cff) 20%, transparent);
  color: var(--brand-2, #22d3ee);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}
.lc-conv-main { flex: 1 1 auto; min-width: 0; }
.lc-conv-main strong {
  display: block;
  color: var(--text, #f8fafc);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lc-conv-main small {
  display: block;
  margin-top: 1px;
  color: var(--dim, #6b7a99);
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lc-conv-meta {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.lc-conv-meta time { color: var(--dim, #6b7a99); font-size: 9px; font-weight: 600; }
.lc-conv-meta .lc-badge {
  position: static;
  border: 0;
  min-width: 17px;
  height: 17px;
  font-size: 9px;
  box-shadow: none;
}
.lc-conv.is-closed .lc-conv-main strong { color: var(--muted, #a5b4d0); }
.lc-conv.is-closed .lc-conv-main small::before { content: 'kapalı · '; color: var(--warn, #fbbf24); }

/* ------------------------------------------------------------------- açık tema */
:root[data-theme='light'] .lc-panel {
  background: linear-gradient(180deg, #ffffff, #f7f9ff);
  box-shadow: 0 30px 70px rgba(15, 23, 42, 0.18), 0 8px 22px rgba(15, 23, 42, 0.10);
}
:root[data-theme='light'] .lc-launcher { box-shadow: 0 14px 30px rgba(124, 92, 255, 0.30), 0 4px 12px rgba(15, 23, 42, 0.12); }
:root[data-theme='light'] .lc-badge { border-color: #fff; }
:root[data-theme='light'] .lc-msg {
  background: #f2f5fb;
  border-color: rgba(15, 23, 42, 0.08);
  color: #0f172a;
}
:root[data-theme='light'] .lc-row.is-mine .lc-msg { color: #fff; }
:root[data-theme='light'] .lc-name,
:root[data-theme='light'] .lc-input {
  background: #fff;
  border-color: rgba(15, 23, 42, 0.16);
  color: #0f172a;
}
:root[data-theme='light'] .lc-foot { color: #64748b; }

/* ---------------------------------------------------------------------- mobil */
@media (max-width: 640px) {
  .lc-root {
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px) + var(--lc-offset, 0px));
  }
  .lc-launcher { padding: 12px 15px 12px 12px; font-size: 12px; }
  .lc-launcher-text { display: none; }
  .lc-launcher-icon { width: 28px; height: 28px; }
  .lc-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 86dvh;
    border-radius: 20px 20px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    transform-origin: bottom center;
  }
  .lc-messages { padding-bottom: 12px; }
  .lc-composer { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
  .lc-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
}

@media (prefers-reduced-motion: reduce) {
  .lc-panel { animation: none; }
  .lc-launcher,
  .lc-send { transition: none; }
}
