/* ── Chat Widget ──────────────────────────────────────────────────────────── */

.sk-chat {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

/* Toggle button */
.sk-chat__toggle {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #1a56db;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(26, 86, 219, 0.45);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  color: #fff;
  margin-left: auto;
}
.sk-chat__toggle:hover {
  transform: scale(1.07);
  box-shadow: 0 6px 24px rgba(26, 86, 219, 0.55);
}
.sk-chat__toggle svg { display: block; transition: opacity 0.2s, transform 0.2s; }
.sk-chat__toggle .icon-close { position: absolute; opacity: 0; transform: rotate(-90deg) scale(0.7); }
.sk-chat--open .sk-chat__toggle .icon-chat  { opacity: 0; transform: rotate(90deg) scale(0.7); }
.sk-chat--open .sk-chat__toggle .icon-close { opacity: 1; transform: rotate(0) scale(1); }

/* Badge */
.sk-chat__badge {
  position: absolute;
  top: 0;
  right: 0;
  width: 14px;
  height: 14px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid #fff;
}

/* Window */
.sk-chat__win {
  position: absolute;
  bottom: 68px;
  right: 0;
  width: 340px;
  max-height: 520px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.sk-chat--open .sk-chat__win {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Header */
.sk-chat__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: #1a56db;
  color: #fff;
  flex-shrink: 0;
}
.sk-chat__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sk-chat__header-info { flex: 1; }
.sk-chat__header-name { font-weight: 600; font-size: 14px; }
.sk-chat__header-status { font-size: 12px; opacity: 0.85; display: flex; align-items: center; gap: 4px; }
.sk-chat__header-status::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
}
.sk-chat__close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  opacity: 0.75;
  line-height: 1;
  font-size: 20px;
  transition: opacity 0.15s;
}
.sk-chat__close:hover { opacity: 1; }

/* Start view */
.sk-chat__start {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sk-chat__start p {
  margin: 0 0 4px;
  color: #374151;
}
.sk-chat__start-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #d1d5db;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.sk-chat__start-input:focus { border-color: #1a56db; }
.sk-chat__start-btn {
  padding: 10px 20px;
  background: #1a56db;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.sk-chat__start-btn:hover { background: #1648c0; }
.sk-chat__start-btn:disabled { opacity: 0.6; cursor: default; }

/* Chat view */
.sk-chat__view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* Messages log */
.sk-chat__log {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scroll-behavior: smooth;
}
.sk-chat__log::-webkit-scrollbar { width: 4px; }
.sk-chat__log::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

/* Messages */
.sk-chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 78%;
}
.sk-chat-msg--visitor {
  align-self: flex-end;
  align-items: flex-end;
}
.sk-chat-msg--admin {
  align-self: flex-start;
  align-items: flex-start;
}
.sk-chat-bubble {
  padding: 8px 12px;
  border-radius: 14px;
  word-break: break-word;
  font-size: 13.5px;
  line-height: 1.45;
}
.sk-chat-msg--visitor .sk-chat-bubble {
  background: #1a56db;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.sk-chat-msg--admin .sk-chat-bubble {
  background: #f3f4f6;
  color: #111827;
  border-bottom-left-radius: 4px;
}
.sk-chat-time {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 3px;
  padding: 0 2px;
}

/* Typing indicator */
.sk-chat__typing {
  padding: 0 14px 8px;
  font-size: 12px;
  color: #9ca3af;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sk-chat__typing-dots {
  display: flex;
  gap: 3px;
}
.sk-chat__typing-dots span {
  width: 5px;
  height: 5px;
  background: #9ca3af;
  border-radius: 50%;
  animation: sk-chat-dot 1.2s infinite ease-in-out;
}
.sk-chat__typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.sk-chat__typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes sk-chat-dot {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
  40%            { transform: scale(1);   opacity: 1;   }
}

/* Input area */
.sk-chat__input-area {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 10px 12px 12px;
  border-top: 1px solid #f0f0f0;
  flex-shrink: 0;
}
.sk-chat__text {
  flex: 1;
  padding: 9px 12px;
  border: 1.5px solid #d1d5db;
  border-radius: 10px;
  font-size: 13.5px;
  resize: none;
  outline: none;
  max-height: 90px;
  line-height: 1.4;
  font-family: inherit;
  transition: border-color 0.15s;
}
.sk-chat__text:focus { border-color: #1a56db; }
.sk-chat__send {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  background: #1a56db;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: background 0.15s;
}
.sk-chat__send:hover { background: #1648c0; }

/* Mobile */
@media (max-width: 480px) {
  .sk-chat { bottom: 80px; right: 14px; }
  .sk-chat__win { width: calc(100vw - 28px); right: 0; }
}
