/* =============================================
   CHAT WIDGET — Hor1zen Portfolio
   Colour scheme: warm orange / orange-red (matches site palette)
   --orange-yellow-crayola : hsl(28,  100%, 58%)
   --vegas-gold             : hsl(14,  90%,  52%)
   ============================================= */

/* ---- Floating toggle button ---- */
#chat-toggle {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, hsl(28, 100%, 62%) 0%, hsl(10, 100%, 50%) 100%);
  box-shadow: 0 8px 30px hsla(14, 90%, 52%, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  outline: none;
}

#chat-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 40px hsla(14, 90%, 52%, 0.7);
}

#chat-toggle svg {
  width: 26px;
  height: 26px;
  fill: #fff;
  transition: transform 0.3s ease;
}

#chat-toggle.open svg.icon-chat {
  display: none;
}

#chat-toggle:not(.open) svg.icon-close {
  display: none;
}

/* Notification dot */
#chat-toggle .notif-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 12px;
  height: 12px;
  background: hsl(45, 100%, 60%);
  border-radius: 50%;
  border: 2px solid hsl(0, 0%, 7%);
  animation: pulse-dot 1.6s infinite;
}

@keyframes pulse-dot {

  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.35);
    opacity: 0.7;
  }
}

/* ---- Chat window wrapper ---- */
#chat-window {
  position: fixed;
  bottom: 98px;
  right: 28px;
  z-index: 9998;
  width: 360px;
  max-height: 540px;
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: hsl(240, 2%, 12%);
  border: 1px solid hsla(28, 100%, 58%, 0.25);
  box-shadow:
    0 20px 60px hsla(0, 0%, 0%, 0.55),
    0 0 0 1px hsla(255, 255, 255, 0.04);
  transform-origin: bottom right;
  transform: scale(0.85) translateY(24px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.25s ease;
}

#chat-window.visible {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ---- Header ---- */
.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: linear-gradient(135deg,
      hsla(14, 90%, 22%, 0.85) 0%,
      hsl(240, 2%, 12%) 100%);
  border-bottom: 1px solid hsla(28, 100%, 58%, 0.18);
  flex-shrink: 0;
}

.chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid hsl(28, 100%, 58%);
}

.chat-header-info {
  flex: 1;
}

.chat-header-name {
  color: hsl(0, 0%, 98%);
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0;
}

.chat-header-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: 'Poppins', sans-serif;
  font-size: 11px;
  color: hsl(0, 0%, 84%);
  margin-top: 2px;
}

.chat-header-status::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: hsl(120, 60%, 55%);
  box-shadow: 0 0 6px hsl(120, 60%, 55%);
}

.chat-header-close {
  background: none;
  border: none;
  color: hsl(0, 0%, 70%);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  transition: color 0.2s, background 0.2s;
}

.chat-header-close:hover {
  color: hsl(0, 0%, 98%);
  background: hsla(255, 255, 255, 0.06);
}

/* ---- Messages area ---- */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: hsla(28, 100%, 58%, 0.35);
  border-radius: 4px;
}

/* Message bubbles */
.chat-msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  animation: msg-in 0.3s ease both;
}

@keyframes msg-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-msg.bot {
  flex-direction: row;
}

.chat-msg.user {
  flex-direction: row-reverse;
}

.chat-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1.5px solid hsl(28, 100%, 58%);
}

.chat-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 16px;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  line-height: 1.55;
  color: hsl(0, 0%, 98%);
}

.chat-msg.bot .chat-bubble {
  background: hsla(28, 100%, 58%, 0.12);
  border: 1px solid hsla(28, 100%, 58%, 0.25);
  border-bottom-left-radius: 4px;
}

.chat-msg.user .chat-bubble {
  background: linear-gradient(135deg, hsl(28, 100%, 58%), hsl(10, 100%, 50%));
  border-bottom-right-radius: 4px;
  color: #fff;
}

/* Typing indicator */
.chat-msg.typing .chat-bubble {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 12px 16px;
}

.chat-msg.typing .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: hsl(28, 100%, 62%);
  animation: bounce-dot 1.2s infinite;
}

.chat-msg.typing .dot:nth-child(2) {
  animation-delay: 0.2s;
}

.chat-msg.typing .dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes bounce-dot {

  0%,
  80%,
  100% {
    transform: translateY(0);
  }

  40% {
    transform: translateY(-6px);
  }
}

/* ---- Quick reply chips ---- */
.chat-quick-replies {
  padding: 8px 16px 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  flex-shrink: 0;
  border-top: 1px solid hsla(255, 255, 255, 0.04);
}

.qr-chip {
  background: hsla(28, 100%, 58%, 0.12);
  border: 1px solid hsla(28, 100%, 58%, 0.35);
  color: hsl(28, 100%, 70%);
  font-family: 'Poppins', sans-serif;
  font-size: 11.5px;
  padding: 5px 11px;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s;
  white-space: nowrap;
}

.qr-chip:hover {
  background: hsla(28, 100%, 58%, 0.30);
  border-color: hsl(28, 100%, 65%);
  color: #fff;
  transform: translateY(-1px);
}

/* ---- Input area ---- */
.chat-input-area {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid hsla(255, 255, 255, 0.06);
  flex-shrink: 0;
  background: hsla(255, 255, 255, 0.02);
}

#chat-input {
  flex: 1;
  background: hsla(255, 255, 255, 0.07);
  border: 1px solid hsla(28, 100%, 58%, 0.22);
  border-radius: 24px;
  padding: 9px 16px;
  color: hsl(0, 0%, 98%);
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  outline: none;
  transition: border-color 0.25s;
}

#chat-input::placeholder {
  color: hsl(0, 0%, 50%);
}

#chat-input:focus {
  border-color: hsl(28, 100%, 58%);
}

#chat-send {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, hsl(28, 100%, 62%), hsl(10, 100%, 50%));
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

#chat-send:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 14px hsla(14, 90%, 52%, 0.55);
}

#chat-send svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
  #chat-window {
    right: 12px;
    bottom: 90px;
    width: calc(100vw - 24px);
  }

  #chat-toggle {
    right: 16px;
    bottom: 20px;
  }
}