/* ItemFix — Canlı Destek Widget (tawk.to benzeri) */

.lc-root {
  --lc-color: #2563EB;
  --lc-radius: 16px;
  position: fixed;
  bottom: 24px;
  z-index: 9998;
  font-family: var(--font-body, system-ui, sans-serif);
}
.lc-root--right { right: 24px; }
.lc-root--left { left: 24px; }

.lc-fab {
  width: 58px;
  height: 58px;
  border-radius: 999px;
  border: none;
  background: var(--lc-color);
  color: #fff;
  box-shadow: 0 8px 28px rgba(37, 99, 235, 0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.lc-fab:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(37, 99, 235, 0.4); }
.lc-fab .ui-icon { color: #fff; }

.lc-fab-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lc-panel {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: min(380px, calc(100vw - 32px));
  height: min(520px, calc(100vh - 120px));
  background: var(--bg-elevated, #fff);
  border: 1px solid var(--border, rgba(0,0,0,.08));
  border-radius: var(--lc-radius);
  box-shadow: var(--shadow-lg, 0 16px 40px rgba(0,0,0,.12));
  flex-direction: column;
  overflow: hidden;
}
.lc-panel[hidden],
.lc-root:not(.is-open) .lc-panel {
  display: none !important;
}
.lc-root.is-open .lc-panel {
  display: flex;
}
.lc-root--left .lc-panel { right: auto; left: 0; }

.lc-panel-header {
  background: var(--lc-color);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.lc-panel-header-info strong { display: block; font-size: 1rem; }
.lc-panel-header-info small { opacity: 0.9; font-size: 0.78rem; }
.lc-status {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #4ade80;
  margin-left: 6px;
  vertical-align: middle;
}
.lc-status.is-offline { background: #fbbf24; }
.lc-panel-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.85;
  padding: 4px 8px;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}
.lc-panel-close:hover { opacity: 1; }

.lc-prechat, .lc-chat {
  flex: 1;
  flex-direction: column;
  min-height: 0;
}
.lc-prechat[hidden],
.lc-chat[hidden] {
  display: none !important;
}
.lc-panel.lc-mode-prechat .lc-prechat {
  display: flex;
}
.lc-panel.lc-mode-prechat .lc-chat {
  display: none !important;
}
.lc-panel.lc-mode-chat .lc-prechat {
  display: none !important;
}
.lc-panel.lc-mode-chat .lc-chat {
  display: flex;
}
.lc-prechat { padding: 16px; gap: 12px; overflow: auto; }
.lc-prechat-text { margin: 0; color: var(--text-secondary, #666); font-size: 0.9rem; }
.lc-field { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; }
.lc-field input {
  padding: 10px 12px;
  border: 1px solid var(--border, #ddd);
  border-radius: 10px;
  background: var(--bg-input, #fff);
  color: var(--text-primary, #111);
}

.lc-chat { min-height: 0; }
.lc-messages, .lc-admin-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--brand-ground, #f5f5f5);
}
[data-theme="dark"] .lc-messages,
[data-theme="dark"] .lc-admin-messages {
  background: var(--bg-base, #121212);
}

.lc-msg {
  max-width: 85%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.45;
  word-break: break-word;
}
.lc-msg--visitor {
  align-self: flex-end;
  background: var(--lc-color);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.lc-msg--admin {
  align-self: flex-start;
  background: var(--bg-elevated, #fff);
  color: var(--text-primary, #111);
  border: 1px solid var(--border, #e5e5e5);
  border-bottom-left-radius: 4px;
}
.lc-msg--system {
  align-self: center;
  background: transparent;
  color: var(--text-secondary, #64748b);
  font-size: 0.8rem;
  max-width: 100%;
  width: 100%;
  text-align: center;
  padding: 6px 0;
  border: none;
  box-shadow: none;
}
.lc-msg--join {
  margin: 10px 0;
}
.lc-join-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.18);
  color: var(--text-primary, #1e293b);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.01em;
}
.lc-join-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
  flex-shrink: 0;
}
[data-theme="dark"] .lc-join-line {
  background: rgba(37, 99, 235, 0.18);
  border-color: rgba(96, 165, 250, 0.28);
  color: #e2e8f0;
}
.lc-msg time {
  display: block;
  margin-top: 4px;
  font-size: 0.68rem;
  opacity: 0.7;
}
.lc-msg--system time,
.lc-msg--join time {
  display: none;
}

.lc-compose, .lc-admin-compose {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--border, #eee);
  background: var(--bg-elevated, #fff);
  align-items: flex-end;
}
.lc-compose textarea, .lc-admin-compose textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--border, #ddd);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--bg-input, #fff);
  color: var(--text-primary, #111);
}
.lc-btn {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
}
.lc-btn-primary { background: var(--lc-color); color: #fff; }
.lc-btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.lc-root.is-open .lc-fab-icon-open { display: none; }
.lc-root.is-open .lc-fab-icon-close { display: block !important; font-size: 1.6rem; }

@media (max-width: 640px) {
  .lc-root { bottom: 16px; right: 16px; left: auto; }
  .lc-panel {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    bottom: 0;
    border-radius: 0;
  }
  .lc-root.lc-hide-mobile { display: none; }
}

/* Admin inbox */
.lc-admin-wrap { height: calc(100vh - 120px); min-height: 520px; display: flex; flex-direction: column; }
.lc-admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.lc-admin-title { margin: 0; font-size: 1.35rem; }
.lc-admin-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-elevated);
  min-height: 0;
}
.lc-admin-sessions {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  background: var(--bg-surface);
}
.lc-admin-session {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  padding: 12px 14px;
  cursor: pointer;
  color: inherit;
}
.lc-admin-session:hover { background: var(--bg-surface-hover); }
.lc-admin-session.is-active { background: rgba(37, 99, 235, 0.08); border-left: 3px solid #2563EB; }
.lc-admin-session strong { display: block; font-size: 0.92rem; }
.lc-admin-session small { color: var(--text-muted); font-size: 0.75rem; }
.lc-admin-session-preview {
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lc-admin-session-meta {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.lc-admin-chat { display: flex; flex-direction: column; min-height: 0; }
.lc-admin-chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  padding: 2rem;
  text-align: center;
}
.lc-admin-chat-empty-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.lc-admin-chat-active { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.lc-admin-chat-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.lc-admin-chat-actions { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 900px) {
  .lc-admin-layout { grid-template-columns: 1fr; }
  .lc-admin-sessions { max-height: 220px; border-right: none; border-bottom: 1px solid var(--border); }
}

/* DM baloncukları — FAB üstünde */
.lc-dm-bubbles {
  position: absolute;
  bottom: 72px;
  right: 0;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  align-items: flex-end;
  z-index: 2;
  pointer-events: none;
}
.lc-root--left .lc-dm-bubbles { right: auto; left: 0; align-items: flex-start; }
.lc-dm-bubbles[hidden] { display: none !important; }
.lc-dm-bubble {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 200px;
  padding: 6px 10px 6px 6px;
  background: #fff;
  color: #0f172a;
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.18);
  text-decoration: none;
  border: 1px solid rgba(15, 23, 42, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}
.lc-dm-bubble:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(15, 23, 42, 0.22); }
.lc-dm-bubble.has-unread { border-color: #2563EB; }
.lc-dm-bubble-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #2563EB;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.lc-dm-bubble-name {
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
}
.lc-dm-bubble-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
[data-theme="dark"] .lc-dm-bubble {
  background: #161d27;
  color: #eef2f7;
  border-color: rgba(255,255,255,0.08);
}
