/* ===== CHAT WIDGET ===== */
#chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: 'Inter', sans-serif;
}

#chat-toggle {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a56db, #3b82f6);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 20px rgba(26, 86, 219, 0.45);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

#chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(26, 86, 219, 0.55);
}

#chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 11px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}

#chat-badge.show { display: flex; }

#chat-box {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 340px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  max-height: 520px;
}

#chat-box.open { display: flex; }

#chat-header {
  background: linear-gradient(135deg, #1a56db, #3b82f6);
  color: white;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.chat-header-info h4 {
  font-size: 0.92rem;
  font-weight: 700;
  margin: 0 0 2px;
}

.chat-status {
  font-size: 0.72rem;
  opacity: 0.85;
  display: flex;
  align-items: center;
  gap: 5px;
}

.chat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  display: inline-block;
}

#chat-start {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#chat-start p {
  font-size: 0.85rem;
  color: #6b7280;
  margin: 0;
  line-height: 1.5;
}

#chat-start input {
  padding: 10px 14px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
}

#chat-start input:focus {
  border-color: #1a56db;
}

#chat-start button {
  padding: 11px;
  background: linear-gradient(135deg, #1a56db, #3b82f6);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  transition: opacity 0.2s;
}

#chat-start button:hover { opacity: 0.9; }

#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 220px;
  max-height: 300px;
}

.chat-msg {
  max-width: 80%;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 0.84rem;
  line-height: 1.5;
  word-break: break-word;
}

.chat-msg.visitor {
  background: #eff6ff;
  color: #1e3a5f;
  align-self: flex-end;
  border-bottom-right-radius: 3px;
}

.chat-msg.admin {
  background: linear-gradient(135deg, #1a56db, #3b82f6);
  color: white;
  align-self: flex-start;
  border-bottom-left-radius: 3px;
}

.chat-msg-time {
  font-size: 0.68rem;
  opacity: 0.6;
  margin-top: 3px;
  display: block;
}

.chat-typing {
  font-size: 0.78rem;
  color: #9ca3af;
  font-style: italic;
  padding: 0 16px 8px;
  display: none;
}

#chat-input-area {
  display: flex;
  border-top: 1px solid #f3f4f6;
  padding: 10px 12px;
  gap: 8px;
  align-items: center;
}

#chat-input {
  flex: 1;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 0.84rem;
  outline: none;
  transition: border-color 0.2s;
  resize: none;
}

#chat-input:focus { border-color: #1a56db; }

#chat-send {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #1a56db;
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  transition: background 0.2s;
}

#chat-send:hover { background: #1d4ed8; }

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
  #chat-box { width: calc(100vw - 32px); right: -8px; }
  #chat-widget { bottom: 16px; right: 16px; }
}
