/* ── Chat Widget ───────────────────────────────────────────────────────────── */

.cw-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #06b6d4, #0891b2);
  border: none;
  cursor: pointer;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(6, 182, 212, 0.45);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.cw-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 32px rgba(6, 182, 212, 0.6);
}
.cw-fab svg { color: #fff; pointer-events: none; }

.cw-fab-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid #0f0f0f;
  font-family: 'Inter', sans-serif;
}
.cw-fab-badge.visible { display: flex; }

/* ── Window ──────────────────────────────────────────────────────────────────  */

.cw-window {
  position: fixed;
  bottom: 96px;
  right: 28px;
  width: 360px;
  height: 520px;
  background: #1a1a1a;
  border: 1px solid #27272a;
  border-radius: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  overflow: hidden;
}
.cw-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ── Header ──────────────────────────────────────────────────────────────────  */

.cw-header {
  padding: 14px 18px;
  border-bottom: 1px solid #27272a;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #1f1f1f;
  flex-shrink: 0;
}
.cw-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #06b6d4, #9b59b6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.cw-header-info { flex: 1; min-width: 0; }
.cw-header-name {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  font-family: 'Inter', sans-serif;
}
.cw-header-status {
  font-size: 11px;
  color: #10b981;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 1px;
  font-family: 'Inter', sans-serif;
}
.cw-header-status::before {
  content: '';
  width: 6px;
  height: 6px;
  background: #10b981;
  border-radius: 50%;
  flex-shrink: 0;
}
.cw-header-close {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #71717a;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.cw-header-close:hover { background: #2a2a2a; color: #fff; }

/* ── Pre-chat form ────────────────────────────────────────────────────────────  */

.cw-prechat {
  flex: 1;
  padding: 24px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}
.cw-prechat h4 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  font-family: 'Inter', sans-serif;
}
.cw-prechat p {
  font-size: 13px;
  color: #a1a1aa;
  line-height: 1.6;
  font-family: 'Inter', sans-serif;
  margin-top: -6px;
}
.cw-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cw-field label {
  font-size: 12px;
  font-weight: 500;
  color: #a1a1aa;
  font-family: 'Inter', sans-serif;
}
.cw-input {
  width: 100%;
  padding: 10px 13px;
  background: #111;
  border: 1px solid #27272a;
  border-radius: 10px;
  color: #fff;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.cw-input:focus { border-color: #06b6d4; }
.cw-input::placeholder { color: #3f3f46; }

.cw-submit {
  width: 100%;
  padding: 11px;
  background: #06b6d4;
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 4px;
}
.cw-submit:hover { background: #0891b2; }

/* ── Messages area ───────────────────────────────────────────────────────────  */

.cw-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}
.cw-msgs::-webkit-scrollbar { width: 3px; }
.cw-msgs::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 9999px; }

.cw-msg {
  display: flex;
  flex-direction: column;
  max-width: 80%;
}
.cw-msg.visitor { align-self: flex-end; align-items: flex-end; }
.cw-msg.admin   { align-self: flex-start; align-items: flex-start; }

.cw-bubble {
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
  font-family: 'Inter', sans-serif;
}
.cw-msg.visitor .cw-bubble {
  background: #06b6d4;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.cw-msg.admin .cw-bubble {
  background: #2a2a2a;
  color: #e4e4e7;
  border-bottom-left-radius: 4px;
}
.cw-msg-time {
  font-size: 10px;
  color: #52525b;
  margin-top: 3px;
  padding: 0 3px;
  font-family: 'Inter', sans-serif;
}

.cw-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #3f3f46;
  font-size: 13px;
  text-align: center;
  gap: 10px;
  font-family: 'Inter', sans-serif;
  padding: 20px;
}

/* ── Footer / input ──────────────────────────────────────────────────────────  */

.cw-footer {
  padding: 10px 14px 14px;
  border-top: 1px solid #27272a;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}
.cw-footer-input {
  flex: 1;
  padding: 10px 13px;
  background: #111;
  border: 1px solid #27272a;
  border-radius: 12px;
  color: #fff;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  outline: none;
  resize: none;
  max-height: 90px;
  line-height: 1.5;
  transition: border-color 0.15s;
}
.cw-footer-input:focus { border-color: #06b6d4; }
.cw-footer-input::placeholder { color: #3f3f46; }

.cw-send {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 10px;
  background: #06b6d4;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.cw-send:hover { background: #0891b2; }
.cw-send:disabled { background: #27272a; color: #52525b; cursor: not-allowed; }

.cw-closed-notice {
  padding: 12px 16px;
  background: #1f1f1f;
  border-top: 1px solid #27272a;
  font-size: 12px;
  color: #71717a;
  text-align: center;
  font-family: 'Inter', sans-serif;
  flex-shrink: 0;
}

@media (max-width: 420px) {
  .cw-window { width: calc(100vw - 24px); right: 12px; }
  .cw-fab    { right: 16px; bottom: 20px; }
}
