/* Chat label */
#chat-label {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 224px;
  background: white;
  border-radius: 14px;
  box-shadow: 0 4px 24px rgba(0,0,0,.13);
  border: 1px solid #e8e8e4;
  z-index: 9997;
  font-family: 'Plus Jakarta Sans', sans-serif;
  overflow: hidden;
}
#chat-label.hidden { display: none; }
#chat-label.minimal #chat-label-body { display: none; }
#chat-label-body {
  padding: 14px 16px 12px;
  cursor: pointer;
}
#chat-label-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
#chat-label-badge {
  background: #2d5be3;
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: .4px;
  flex-shrink: 0;
}
#chat-label-title {
  font-size: 13px;
  font-weight: 600;
  color: #0d0d0d;
  line-height: 1.3;
}
#chat-label-dismiss {
  background: none;
  border: none;
  color: #bbb;
  cursor: pointer;
  font-size: 15px;
  padding: 0 0 0 6px;
  line-height: 1;
  margin-left: auto;
  flex-shrink: 0;
}
#chat-label-dismiss:hover { color: #555; }
#chat-label-desc {
  font-size: 12px;
  color: #666;
  margin: 0;
  line-height: 1.45;
}
#chat-label-cta {
  display: block;
  font-size: 12px;
  color: #2d5be3;
  font-weight: 500;
  padding: 9px 16px 11px;
  border-top: 1px solid #f0f0ec;
  text-decoration: none;
}
#chat-label-cta:hover { background: #f7f7f5; }
#chat-label-cta::after { content: ' \203A'; }

@media (prefers-reduced-motion: reduce) {
  #chat-label { transition: none; }
}

/* Chat bubble */
#chat-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  background: #2d5be3;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  box-shadow: 0 4px 20px rgba(45,91,227,.4);
  z-index: 9999;
  transition: transform .2s, box-shadow .2s;
}
#chat-bubble:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(45,91,227,.5); }

@media (prefers-reduced-motion: reduce) {
  #chat-bubble { transition: none; }
}

#chat-unread {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

/* Chat window */
#chat-window {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 340px;
  max-height: 480px;
  background: #fafaf8;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,.15);
  display: none;
  flex-direction: column;
  z-index: 9998;
  border: 1px solid #e8e8e4;
  font-family: 'Plus Jakarta Sans', sans-serif;
  overflow: hidden;
}
#chat-window.open { display: flex; }

/* Header */
#chat-header {
  background: #0d0d0d;
  color: white;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
#chat-avatar {
  width: 36px;
  height: 36px;
  background: #2d5be3;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}
#chat-name { font-size: 14px; font-weight: 500; }
#chat-status { font-size: 11px; color: #22c55e; margin-top: 1px; }
#chat-close {
  margin-left: auto;
  background: none;
  border: none;
  color: rgba(255,255,255,.5);
  cursor: pointer;
  font-size: 16px;
  padding: 0;
  line-height: 1;
}
#chat-close:hover { color: white; }

/* Messages */
#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.msg {
  max-width: 80%;
  padding: 10px 13px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
}
.msg.bot {
  background: #f4f4f0;
  color: #0d0d0d;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.msg.user {
  background: #2d5be3;
  color: white;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}
.msg.typing {
  background: #f4f4f0;
  color: #888;
  font-style: italic;
  align-self: flex-start;
}

/* Input */
#chat-input-wrap {
  padding: 12px;
  border-top: 1px solid #e8e8e4;
  display: flex;
  gap: 8px;
}
#chat-input {
  flex: 1;
  border: 1px solid #e8e8e4;
  border-radius: 100px;
  padding: 9px 14px;
  font-size: 14px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  outline: none;
  background: white;
  color: #0d0d0d;
}
#chat-input::placeholder { color: #aaa; }
#chat-input:focus { border-color: #2d5be3; }
#chat-send {
  width: 36px;
  height: 36px;
  background: #2d5be3;
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .2s;
  flex-shrink: 0;
}
#chat-send:hover { opacity: .85; }
#chat-send:disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 400px) {
  #chat-window { width: calc(100vw - 32px); right: 16px; }
  #chat-bubble { right: 16px; bottom: 16px; }
  #chat-label { right: 16px; width: calc(100vw - 32px); }
}
