:root {
  --chat-primary: #003D64;
  --chat-secondary: #009B93;
  --chat-accent: #4BE0F0;
  --chat-bg: #0a1628;
  --chat-surface: #111d33;
  --chat-surface-light: #1a2a45;
  --chat-text: #e2e8f0;
  --chat-text-muted: #94a3b8;
  --chat-border: rgba(75, 224, 240, 0.15);
  --chat-user-bg: linear-gradient(135deg, #009B93, #003D64);
  --chat-bot-bg: #111d33;
}

/* 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;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 61, 100, 0.4);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.chat-toggle-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(0, 61, 100, 0.5);
}

.chat-toggle-btn svg {
  width: 28px;
  height: 28px;
  fill: #ffffff;
  transition: transform 0.3s ease;
}

.chat-toggle-btn.active svg.chat-icon { display: none; }
.chat-toggle-btn:not(.active) svg.close-icon { display: none; }

/* Notification Badge */
.chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: #ef4444;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  animation: pulse 2s infinite;
}

.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;
  border: 1px solid var(--chat-border);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  animation: fadeIn 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-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.chat-avatar img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.chat-header-info {
  flex: 1;
}

.chat-header-name {
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
  margin: 0;
  line-height: 1.2;
}

.chat-header-status {
  font-size: 12px;
  color: var(--chat-accent);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.chat-header-status::before {
  content: '';
  width: 7px;
  height: 7px;
  background: #22c55e;
  border-radius: 50%;
  display: inline-block;
}

.chat-close-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background 0.2s;
}

.chat-close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Messages Area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(75, 224, 240, 0.2);
  border-radius: 4px;
}

/* Message Bubbles */
.chat-message {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
  animation: messageIn 0.3s ease;
  word-wrap: break-word;
}

.chat-message.bot {
  align-self: flex-start;
  background: var(--chat-bot-bg);
  color: var(--chat-text);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--chat-border);
}

.chat-message.user {
  align-self: flex-end;
  background: var(--chat-user-bg);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.chat-message a {
  color: var(--chat-accent);
  text-decoration: underline;
}

.chat-message strong {
  font-weight: 600;
}

.chat-message ul, .chat-message ol {
  margin: 4px 0;
  padding-left: 18px;
}

.chat-message li {
  margin: 2px 0;
}

/* Typing Indicator */
.chat-typing {
  align-self: flex-start;
  background: var(--chat-bot-bg);
  border: 1px solid var(--chat-border);
  padding: 12px 18px;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  display: none;
  gap: 5px;
  align-items: center;
}

.chat-typing.visible {
  display: flex;
}

.chat-typing span {
  width: 7px;
  height: 7px;
  background: var(--chat-text-muted);
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

/* Quick Buttons */
.chat-quick-buttons {
  padding: 8px 16px 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}

.chat-quick-btn {
  background: transparent;
  border: 1px solid var(--chat-border);
  color: var(--chat-accent);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.chat-quick-btn:hover {
  background: rgba(75, 224, 240, 0.1);
  border-color: var(--chat-accent);
}

/* 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: 20px;
  padding: 10px 16px;
  color: var(--chat-text);
  font-size: 13.5px;
  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.05);
}

.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.chat-send-btn svg {
  width: 18px;
  height: 18px;
  fill: #ffffff;
}

/* Animations */
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

@keyframes messageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive - Mobile */
@media (max-width: 480px) {
  .chat-container {
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    border: none;
  }

  .chat-toggle-btn {
    bottom: 16px;
    right: 16px;
    width: 56px;
    height: 56px;
  }

  .chat-toggle-btn svg {
    width: 24px;
    height: 24px;
  }
}
