:root {
  --chat-primary: #AD0F22;
  --chat-secondary: #FF433C;
  --chat-accent: #FFC250;
  --chat-bg: #060606;
  --chat-surface: #1a1a1a;
  --chat-surface-light: #2a2a2a;
  --chat-text: #FFE9B4;
  --chat-text-light: #ffffff;
  --chat-text-muted: #999999;
  --chat-border: rgba(255, 233, 180, 0.15);
}

/* Floating Button */
.chat-toggle-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--chat-primary), var(--chat-secondary));
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(173, 15, 34, 0.4);
  z-index: 9999;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: chatPulse 3s ease-in-out infinite;
}

.chat-toggle-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(173, 15, 34, 0.6);
}

.chat-toggle-btn svg {
  width: 28px;
  height: 28px;
  fill: #ffffff;
  transition: transform 0.3s ease;
}

.chat-toggle-btn .chat-icon-close {
  display: none;
}

.chat-toggle-btn.active .chat-icon-open {
  display: none;
}

.chat-toggle-btn.active .chat-icon-close {
  display: block;
}

.chat-toggle-btn.active {
  animation: none;
}

/* Notification Badge */
.chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: var(--chat-accent);
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--chat-bg);
  animation: badgePop 0.3s ease;
}

.chat-badge.visible {
  display: flex;
}

/* Chat Container */
.chat-container {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  height: 520px;
  background: var(--chat-bg);
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9998;
  border: 1px solid var(--chat-border);
  animation: chatFadeIn 0.3s ease;
}

.chat-container.open {
  display: flex;
}

/* Header */
.chat-header {
  background: linear-gradient(135deg, var(--chat-primary), var(--chat-secondary));
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.chat-header-avatar img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

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

.chat-header-name {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  line-height: 1.2;
}

.chat-header-status {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 5px;
}

.chat-header-status::before {
  content: '';
  width: 7px;
  height: 7px;
  background: #4ade80;
  border-radius: 50%;
  display: inline-block;
}

.chat-header-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-header-close svg {
  width: 20px;
  height: 20px;
  fill: rgba(255, 255, 255, 0.8);
  transition: fill 0.2s;
}

.chat-header-close:hover svg {
  fill: #ffffff;
}

/* Messages Area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--chat-surface-light) transparent;
}

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

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--chat-surface-light);
  border-radius: 10px;
}

/* Message Bubbles */
.chat-message {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  animation: messageIn 0.3s ease;
  word-wrap: break-word;
}

.chat-message-user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--chat-primary), var(--chat-secondary));
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.chat-message-bot {
  align-self: flex-start;
  background: var(--chat-surface);
  color: var(--chat-text);
  border-bottom-left-radius: 4px;
}

.chat-message-bot a {
  color: var(--chat-accent);
  text-decoration: underline;
}

.chat-message-bot a:hover {
  color: #ffffff;
}

.chat-message-bot strong {
  color: var(--chat-text-light);
}

.chat-message-bot ul,
.chat-message-bot ol {
  margin: 6px 0;
  padding-left: 18px;
}

.chat-message-bot li {
  margin-bottom: 3px;
}

/* Typing Indicator */
.chat-typing {
  display: none;
  align-self: flex-start;
  background: var(--chat-surface);
  padding: 12px 18px;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  gap: 5px;
  align-items: center;
}

.chat-typing.visible {
  display: flex;
}

.chat-typing-dot {
  width: 7px;
  height: 7px;
  background: var(--chat-text-muted);
  border-radius: 50%;
  animation: typingBounce 1.4s ease-in-out infinite;
}

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

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

/* Quick Buttons */
.chat-quick-buttons {
  padding: 8px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}

.chat-quick-btn {
  background: transparent;
  border: 1px solid var(--chat-accent);
  color: var(--chat-accent);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.chat-quick-btn:hover {
  background: rgba(255, 194, 80, 0.15);
  color: #ffffff;
}

/* Input Area */
.chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--chat-border);
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  background: var(--chat-surface);
  border: 1px solid var(--chat-border);
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--chat-text-light);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  max-height: 100px;
  line-height: 1.4;
  transition: border-color 0.2s;
}

.chat-input::placeholder {
  color: var(--chat-text-muted);
}

.chat-input:focus {
  border-color: var(--chat-accent);
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--chat-primary), var(--chat-secondary));
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s, opacity 0.2s;
}

.chat-send-btn:hover {
  transform: scale(1.1);
}

.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.chat-send-btn svg {
  width: 18px;
  height: 18px;
  fill: #ffffff;
}

/* Animations */
@keyframes chatPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(173, 15, 34, 0.4); }
  50% { box-shadow: 0 4px 30px rgba(173, 15, 34, 0.7); }
}

@keyframes chatFadeIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes messageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

@keyframes badgePop {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

/* Responsive - Mobile Full Screen */
@media (max-width: 480px) {
  .chat-container {
    bottom: 0;
    right: 0;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    border: none;
  }

  .chat-toggle-btn {
    bottom: 16px;
    right: 16px;
    width: 56px;
    height: 56px;
  }

  .chat-toggle-btn svg {
    width: 24px;
    height: 24px;
  }
}
