/* ============================================
   AI Chat Widget - Prestige Horizon
   ============================================ */

.chat-widget-bubble {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a3a5c 0%, #2d6a9f 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9999;
  box-shadow: 0 4px 20px rgba(26, 58, 92, 0.4);
  transition: all 0.3s ease;
  border: none;
  outline: none;
}

.chat-widget-bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(26, 58, 92, 0.5);
}

.chat-widget-bubble i {
  font-size: 24px;
  transition: transform 0.3s ease;
}

.chat-widget-bubble.open i {
  transform: rotate(90deg);
}

.chat-widget-bubble .bubble-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: #C5A55A;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

/* Chat Window */
.chat-widget-window {
  position: fixed;
  bottom: 96px;
  left: 24px;
  width: 400px;
  height: 580px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.18);
  z-index: 9998;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: chatSlideUp 0.3s ease;
  font-family: 'Inter', -apple-system, sans-serif;
}

.chat-widget-window.open {
  display: flex;
}

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

/* Chat Header */
.chat-header {
  background: linear-gradient(135deg, #1a3a5c 0%, #2d6a9f 100%);
  color: #fff;
  padding: 16px 18px;
  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.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

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

.chat-header-info h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}

.chat-header-info span {
  font-size: 12px;
  opacity: 0.8;
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-header-info .online-dot {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  display: inline-block;
}

.chat-lang-select {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
}

.chat-lang-select option {
  color: #1a1a2e;
  background: #fff;
}

.chat-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
}

.chat-close:hover {
  color: #fff;
}

/* ── Voice Bar — prominent "Tap to Speak" button ── */
.chat-voice-bar {
  padding: 10px 16px 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #fff;
}

/* Voice conversation mode toggle (phone icon) */
.chat-voice-conv-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid #1a3a5c;
  background: #fff;
  color: #1a3a5c;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}
.chat-voice-conv-btn:hover {
  background: #1a3a5c;
  color: #fff;
}

.chat-voice-speak-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #1a3a5c, #2d6a9f);
  color: #fff;
  border: none;
  border-radius: 28px;
  padding: 11px 28px 11px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(26,58,92,0.3);
  transition: transform 0.15s, box-shadow 0.15s;
  overflow: hidden;
}

.chat-voice-speak-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(26,58,92,0.4);
}

.chat-voice-speak-btn:active {
  transform: translateY(0);
}

.chat-voice-speak-btn.listening {
  background: linear-gradient(135deg, #b71c1c, #e53935);
  box-shadow: 0 4px 15px rgba(229,57,53,0.4);
}

/* Pulsing ring around mic icon when listening */
.mic-ring {
  position: absolute;
  left: 18px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.5);
  opacity: 0;
}

.chat-voice-speak-btn.listening .mic-ring {
  animation: mic-ring-pulse 1.2s ease-out infinite;
}

@keyframes mic-ring-pulse {
  0%   { transform: scale(0.8); opacity: 0.8; }
  100% { transform: scale(1.8); opacity: 0; }
}

.mic-label {
  font-size: 14px;
  letter-spacing: 0.3px;
}

/* ── Voice Overlay — shown while listening ── */
.chat-voice-overlay {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px 16px 16px;
  background: linear-gradient(180deg, #f0f7ff, #fff);
  border-top: 1px solid #e3f0ff;
}

.chat-voice-overlay.active {
  display: flex;
}

/* Animated sound waves */
.voice-waves {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 40px;
}

.voice-waves span {
  display: block;
  width: 5px;
  border-radius: 3px;
  background: #1a3a5c;
  animation: wave-bounce 0.8s ease-in-out infinite;
}

.voice-waves span:nth-child(1) { height: 12px; animation-delay: 0s; }
.voice-waves span:nth-child(2) { height: 28px; animation-delay: 0.1s; }
.voice-waves span:nth-child(3) { height: 40px; animation-delay: 0.2s; background: #C5A55A; }
.voice-waves span:nth-child(4) { height: 28px; animation-delay: 0.3s; }
.voice-waves span:nth-child(5) { height: 12px; animation-delay: 0.4s; }

@keyframes wave-bounce {
  0%, 100% { transform: scaleY(0.4); opacity: 0.6; }
  50%       { transform: scaleY(1);   opacity: 1; }
}

.voice-hint {
  margin: 0;
  font-size: 13px;
  color: #1a3a5c;
  font-weight: 500;
}

.voice-cancel-btn {
  background: none;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 5px 16px;
  font-size: 12px;
  color: #888;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.voice-cancel-btn:hover {
  border-color: #e53935;
  color: #e53935;
}

/* Messages Area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8f9fa;
}

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

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

.chat-messages::-webkit-scrollbar-thumb {
  background: #d0d0d0;
  border-radius: 10px;
}

/* Message Bubbles */
.chat-msg {
  display: flex;
  gap: 8px;
  max-width: 85%;
  animation: msgFadeIn 0.3s ease;
}

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

.chat-msg.bot {
  align-self: flex-start;
}

.chat-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  margin-top: 2px;
}

.chat-msg.bot .chat-msg-avatar {
  background: linear-gradient(135deg, #1a3a5c, #2d6a9f);
  color: #fff;
}

.chat-msg.user .chat-msg-avatar {
  background: #C5A55A;
  color: #fff;
}

.chat-msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.chat-msg.bot .chat-msg-bubble {
  background: #fff;
  color: #1a1a2e;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.chat-msg.user .chat-msg-bubble {
  background: linear-gradient(135deg, #1a3a5c, #2d6a9f);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-msg-time {
  font-size: 10px;
  opacity: 0.5;
  margin-top: 4px;
  display: block;
}

/* Typing Indicator */
.typing-indicator {
  display: none;
  align-self: flex-start;
  padding: 10px 18px;
  background: #fff;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.typing-indicator.visible {
  display: flex;
  gap: 4px;
  align-items: center;
}

.typing-dot {
  width: 7px;
  height: 7px;
  background: #b0b0b0;
  border-radius: 50%;
  animation: typingBounce 1.4s infinite;
}

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

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

/* Quick Replies */
.chat-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
  background: #f8f9fa;
}

.quick-reply-btn {
  padding: 6px 14px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  font-size: 12px;
  font-family: inherit;
  color: #1a3a5c;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.quick-reply-btn:hover {
  background: #1a3a5c;
  color: #fff;
  border-color: #1a3a5c;
}

/* Input Area */
.chat-input-area {
  padding: 12px 16px;
  background: #fff;
  border-top: 1px solid #f0f0f0;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-shrink: 0;
}

.chat-input-area textarea {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  max-height: 80px;
  min-height: 40px;
  line-height: 1.4;
  transition: border-color 0.2s;
}

.chat-input-area textarea:focus {
  border-color: #1a3a5c;
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #C5A55A, #8B6914);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chat-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(197, 165, 90, 0.4);
}

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

/* Powered By */
.chat-powered {
  text-align: center;
  padding: 6px;
  font-size: 10px;
  color: #aaa;
  background: #fff;
  flex-shrink: 0;
}

/* Responsive */
@media (max-width: 480px) {
  .chat-widget-window {
    left: 8px;
    right: 8px;
    bottom: 80px;
    width: auto;
    height: calc(100vh - 120px);
    max-height: 600px;
  }

  .chat-widget-bubble {
    bottom: 16px;
    left: 16px;
    width: 54px;
    height: 54px;
  }
}
