/* Webchat Roma AI — Dark Theme (matching landing) */
:root {
  --wc-primary: #4f6ef7;
  --wc-primary-hover: #3d5ce0;
  --wc-bg-msg-user: #4f6ef7;
  --wc-bg-msg-bot: #1a2248;
  --wc-text-user: #ffffff;
  --wc-text-bot: #e2e8f0;
  --wc-bg-chat: #0a0f26;
  --wc-bg-header: #0a0f26;
  --wc-bg-input: #111836;
  --wc-border: rgba(79,110,247,0.15);
  --wc-shadow: 0 8px 32px rgba(0,0,0,0.4);
  --wc-radius: 18px;
  --wc-radius-sm: 12px;
  --wc-font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --wc-accent: #00e5bf;
}

#roma-webchat-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--wc-primary);
  border: none;
  cursor: pointer;
  box-shadow: var(--wc-shadow);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
#roma-webchat-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 40px rgba(79,110,247,0.35);
}
#roma-webchat-btn svg {
  width: 28px;
  height: 28px;
  color: white;
}

#roma-webchat {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 600px;
  max-height: calc(100vh - 140px);
  background: var(--wc-bg-chat);
  border: 1px solid var(--wc-border);
  border-radius: 20px;
  box-shadow: var(--wc-shadow);
  z-index: 9998;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--wc-font);
  animation: wc-slide-up 0.3s ease;
}
#roma-webchat.open {
  display: flex;
}

@keyframes wc-slide-up {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header */
.wc-header {
  background: var(--wc-bg-header);
  color: #f1f5f9;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--wc-border);
}
.wc-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--wc-primary), var(--wc-accent));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 20px;
}
.wc-avatar svg {
  width: 24px;
  height: 24px;
  color: white;
}
.wc-header-info {
  flex: 1;
  min-width: 0;
}
.wc-header-info strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: #f1f5f9;
}
.wc-header-info span {
  display: block;
  font-size: 12px;
  opacity: 0.7;
  margin-top: 1px;
  color: var(--wc-accent);
}
.wc-close-btn {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.wc-close-btn:hover { opacity: 1; color: #f1f5f9; }

/* Messages */
.wc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--wc-bg-chat);
}
.wc-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: var(--wc-radius);
  font-size: 14px;
  line-height: 1.5;
  animation: wc-msg-in 0.3s ease;
  word-wrap: break-word;
}
@keyframes wc-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.wc-msg-bot {
  align-self: flex-start;
  background: var(--wc-bg-msg-bot);
  color: var(--wc-text-bot);
  border: 1px solid rgba(79,110,247,0.1);
  border-bottom-left-radius: 4px;
}
.wc-msg-user {
  align-self: flex-end;
  background: var(--wc-bg-msg-user);
  color: var(--wc-text-user);
  border-bottom-right-radius: 4px;
}
.wc-msg-time {
  font-size: 10px;
  opacity: 0.5;
  margin-top: 4px;
  text-align: right;
  color: #94a3b8;
}

/* Input */
.wc-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--wc-border);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--wc-bg-chat);
  flex-shrink: 0;
}
.wc-input {
  flex: 1;
  border: 1px solid rgba(79,110,247,0.2);
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 14px;
  font-family: var(--wc-font);
  outline: none;
  transition: border-color 0.2s;
  resize: none;
  max-height: 80px;
  line-height: 1.4;
  background: var(--wc-bg-input);
  color: #f1f5f9;
}
.wc-input:focus {
  border-color: var(--wc-primary);
}
.wc-input::placeholder {
  color: #64748b;
}
.wc-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--wc-primary);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}
.wc-send-btn:hover {
  background: var(--wc-primary-hover);
}
.wc-send-btn svg {
  width: 18px;
  height: 18px;
}

/* Typing indicator */
.wc-typing {
  align-self: flex-start;
  display: flex;
  gap: 5px;
  padding: 12px 16px;
  background: var(--wc-bg-msg-bot);
  border-radius: var(--wc-radius);
  border: 1px solid rgba(79,110,247,0.1);
  border-bottom-left-radius: 4px;
  animation: wc-msg-in 0.3s ease;
}
.wc-typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
  animation: wc-typing-bounce 1.4s ease infinite;
}
.wc-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.wc-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes wc-typing-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* Responsive */
@media (max-width: 480px) {
  #roma-webchat {
    bottom: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }
  #roma-webchat-btn {
    bottom: 16px;
    right: 16px;
  }
}
