/* =========================================================
   CHATBOT WIDGET STYLING
   ========================================================= */

.chat-widget-container {
  position: fixed;
  bottom: 28px;
  right: 90px; /* Offset from the scroll-top button */
  z-index: 1000;
  font-family: 'Inter', -apple-system, sans-serif;
}

/* Floating Bubble Button */
.chat-fab-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--gold-gradient);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-gold);
  transition: all var(--transition-medium);
  color: var(--black);
}

.chat-fab-btn:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 8px 30px rgba(200, 166, 86, 0.55);
}

.chat-fab-btn.active {
  background: var(--black);
  color: var(--gold);
  border: 2px solid var(--gold);
}

/* Chat Window */
.chat-window {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 360px;
  height: 480px;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border: 1px solid rgba(200, 166, 86, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all var(--transition-medium);
  z-index: 1001;
}

.chat-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header */
.chat-header {
  background: var(--black);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--gold);
  color: var(--white);
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gold-gradient);
  color: var(--black);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.chat-header-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}

.chat-header-status {
  font-size: 0.75rem;
  color: #4ade80;
  display: block;
}

.chat-close-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  transition: color var(--transition-fast);
}

.chat-close-btn:hover {
  color: var(--gold);
}

/* Welcome Screen */
.chat-welcome-screen {
  padding: 24px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: calc(100% - 70px); /* Account for header */
  box-sizing: border-box;
}

.chat-welcome-logo {
  font-size: 2.2rem;
  margin-bottom: 8px;
  animation: float 3s ease-in-out infinite;
}

.chat-welcome-screen h3 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 6px;
}

.chat-welcome-screen p {
  font-size: 0.82rem;
  color: var(--gray-500);
  line-height: 1.4;
  margin-bottom: 16px;
}

.chat-welcome-screen form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-welcome-screen input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  background: var(--white);
  color: var(--black);
  box-sizing: border-box;
}

.chat-welcome-screen form button {
  padding: 10px 16px;
  font-size: 0.85rem;
  margin-top: 4px;
  cursor: pointer;
}

.chat-welcome-screen input:focus {
  outline: none;
  border-color: var(--gold);
}

/* Message Container */
.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--white-off);
}

/* Message Bubbles */
.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
}

.chat-msg-bubble {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  line-height: 1.45;
}

.chat-msg-time {
  font-size: 0.7rem;
  color: var(--gray-500);
  margin-top: 4px;
  padding: 0 4px;
}

/* Bot Message Bubble */
.msg-bot {
  align-self: flex-start;
}

.msg-bot .chat-msg-bubble {
  background: var(--white);
  color: var(--black);
  border-bottom-left-radius: 2px;
  box-shadow: var(--shadow-sm);
  border-left: 3px solid var(--gold);
}

/* User Message Bubble */
.msg-user {
  align-self: flex-end;
}

.msg-user .chat-msg-bubble {
  background: var(--gold-gradient);
  color: var(--black);
  border-bottom-right-radius: 2px;
  box-shadow: var(--shadow-sm);
  font-weight: 500;
}

/* Typing Indicator */
.chat-typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: var(--white);
  border-radius: var(--radius-md);
  align-self: flex-start;
  box-shadow: var(--shadow-sm);
  margin-top: 4px;
}

.chat-typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--gold);
  border-radius: 50%;
  animation: pulse 1.2s infinite ease-in-out;
}

.chat-typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

/* Input Footer */
.chat-footer {
  padding: 12px 16px;
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  display: flex;
  gap: 12px;
  align-items: center;
}

.chat-footer input {
  flex: 1;
  border: none;
  padding: 10px;
  font-size: 0.9rem;
  background: none;
  color: var(--black);
}

.chat-footer input:focus {
  outline: none;
}

.chat-send-btn {
  background: var(--gold-gradient);
  color: var(--black);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

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

/* Responsive adjustment */
@media (max-width: 480px) {
  .chat-widget-container {
    right: 20px;
    bottom: 20px;
  }
  .chat-window {
    width: calc(100vw - 40px);
    right: 0;
    height: 420px;
  }
}
