/* ── albom.az Chat Widget ── assets/css/chat-widget.css */

:root {
  --cw-primary: var(--primary, #1a56db);
  --cw-radius: 16px;
  --cw-shadow: 0 8px 32px rgba(0,0,0,0.18);
  --cw-z: 9800;
}

/* Float düyməsi */
.cw-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--cw-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  z-index: var(--cw-z);
  transition: transform .2s, box-shadow .2s;
  animation: cwPulse 2.5s infinite;
}
.cw-fab:hover { transform: scale(1.1); box-shadow: 0 6px 20px rgba(0,0,0,0.3); }
.cw-fab.open  { animation: none; background: #6b7280; }
@keyframes cwPulse {
  0%,100% { box-shadow: 0 4px 16px rgba(0,0,0,.25); }
  50%      { box-shadow: 0 4px 24px rgba(26,86,219,.55); }
}

/* Oxunmamış badge */
.cw-fab-badge {
  position: absolute;
  top: -2px; right: -2px;
  min-width: 18px; height: 18px;
  background: #ef4444;
  color: #fff; font-size: 10px; font-weight: 700;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
  border: 2px solid #fff;
  display: none;
}

/* Chat pəncərəsi */
.cw-window {
  position: fixed;
  bottom: 88px;
  right: 24px;
  width: 360px;
  max-height: 520px;
  background: #fff;
  border-radius: var(--cw-radius);
  box-shadow: var(--cw-shadow);
  z-index: var(--cw-z);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.85) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transform-origin: bottom right;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), opacity .2s;
}
.cw-window.visible {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}
@media (max-width: 480px) {
  .cw-window { right: 8px; left: 8px; width: auto; bottom: 80px; }
  .cw-fab    { bottom: 16px; right: 16px; }
}

/* Header */
.cw-header {
  background: var(--cw-primary);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.cw-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff; flex-shrink: 0; overflow: hidden;
}
.cw-avatar img { width:100%; height:100%; object-fit:cover; }
.cw-header-info { flex: 1; }
.cw-agent-name  { font-size: 14px; font-weight: 600; color: #fff; }
.cw-status-line { font-size: 11px; color: rgba(255,255,255,.75); display: flex; align-items: center; gap: 4px; margin-top: 1px; }
.cw-status-dot  { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; display: inline-block; }
.cw-status-dot.offline { background: #fbbf24; }
.cw-header-btns { display: flex; gap: 4px; }
.cw-hbtn { background: rgba(255,255,255,.15); border: none; color: #fff; width: 28px; height: 28px; border-radius: 6px; cursor: pointer; font-size: 15px; display: flex; align-items: center; justify-content: center; transition: .15s; }
.cw-hbtn:hover { background: rgba(255,255,255,.25); }

/* Mesajlar */
.cw-messages {
  flex: 1; overflow-y: auto; padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
  background: #f8fafc;
  scroll-behavior: smooth;
}
.cw-messages::-webkit-scrollbar { width: 4px; }
.cw-messages::-webkit-scrollbar-thumb { background: #dde; border-radius: 4px; }

.cw-msg { display: flex; flex-direction: column; max-width: 82%; }
.cw-msg.admin  { align-self: flex-start; }
.cw-msg.visitor{ align-self: flex-end;   }

.cw-bubble {
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}
.cw-msg.admin  .cw-bubble { background: #fff; color: #111; border-bottom-left-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.cw-msg.visitor .cw-bubble { background: var(--cw-primary); color: #fff; border-bottom-right-radius: 4px; }

.cw-msg-time { font-size: 10px; color: #9ca3af; margin-top: 3px; }
.cw-msg.visitor .cw-msg-time { text-align: right; }

/* Typing indicator */
.cw-typing .cw-bubble { display: flex; gap: 4px; align-items: center; padding: 12px 16px; }
.cw-typing .cw-bubble span {
  width: 7px; height: 7px; border-radius: 50%;
  background: #9ca3af; animation: cwDot .9s infinite;
}
.cw-typing .cw-bubble span:nth-child(2) { animation-delay: .15s; }
.cw-typing .cw-bubble span:nth-child(3) { animation-delay: .30s; }
@keyframes cwDot { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-5px)} }

/* Giriş formu (ilk açıldıqda) */
.cw-intro {
  padding: 16px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
  flex-shrink: 0;
}
.cw-intro p { font-size: 12px; color: #6b7280; margin-bottom: 10px; }
.cw-intro input {
  width: 100%; padding: 8px 12px; border: 1.5px solid #e5e7eb;
  border-radius: 8px; font-size: 13px; margin-bottom: 8px;
  outline: none; font-family: inherit;
}
.cw-intro input:focus { border-color: var(--cw-primary); }
.cw-intro-btn {
  width: 100%; padding: 10px; background: var(--cw-primary);
  color: #fff; border: none; border-radius: 8px;
  font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
}

/* Input area */
.cw-input-area {
  padding: 10px 12px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
  display: flex; gap: 8px; align-items: flex-end;
  flex-shrink: 0;
}
.cw-input {
  flex: 1; border: 1.5px solid #e5e7eb; border-radius: 10px;
  padding: 8px 12px; font-size: 13px; outline: none;
  resize: none; max-height: 80px; font-family: inherit;
  line-height: 1.5; color: #111;
}
.cw-input:focus { border-color: var(--cw-primary); }
.cw-send {
  width: 36px; height: 36px; background: var(--cw-primary);
  border: none; border-radius: 10px; color: #fff;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 17px; flex-shrink: 0; transition: .15s;
}
.cw-send:hover { opacity: .9; transform: scale(1.05); }
.cw-send:disabled { opacity: .5; cursor: default; transform: none; }

/* Offline mesaj */
.cw-offline-notice {
  background: #fffbeb; border-top: 1px solid #fcd34d;
  padding: 10px 14px; font-size: 12px; color: #92400e;
  display: flex; align-items: flex-start; gap: 6px; flex-shrink: 0;
}

/* Bağlandı ekranı */
.cw-closed-screen {
  padding: 2rem 1rem; text-align: center; flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
}
.cw-closed-screen i { font-size: 40px; color: #9ca3af; }
.cw-closed-screen p { font-size: 13px; color: #6b7280; }
.cw-new-chat-btn {
  margin-top: 8px; padding: 8px 18px;
  background: var(--cw-primary); color: #fff; border: none;
  border-radius: 8px; font-size: 13px; cursor: pointer; font-family: inherit;
}
