/* ============================================================
   LIVE-CHAT.CSS — Luxury Hospitality ERP | Live Chat Widget
   Floating chat widget with premium styling
   ============================================================ */

/* ── Chat Button (Floating) ── */
.chat-button {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 950;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold, #d4af37), var(--gold-light, #f0d060));
  color: var(--navy, #0a1628);
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(212, 175, 55, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  transition: all 0.3s ease;
  animation: chatPulse 2s ease infinite;
}

.chat-button:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 12px 36px rgba(212, 175, 55, 0.5);
}

.chat-button:active {
  transform: scale(0.95);
}

.chat-button .chat-icon { display: flex; }
.chat-button .chat-close-icon { display: none; }
.chat-button.active .chat-icon { display: none; }
.chat-button.active .chat-close-icon { display: flex; }

@keyframes chatPulse {
  0%, 100% { box-shadow: 0 8px 28px rgba(212, 175, 55, 0.4); }
  50% { box-shadow: 0 8px 40px rgba(212, 175, 55, 0.6); }
}

.chat-button .unread-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 22px;
  height: 22px;
  border-radius: 50px;
  background: var(--danger, #ef4444);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
  animation: badgePop 0.3s ease;
}

@keyframes badgePop {
  0% { transform: scale(0); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* ── Chat Popup Panel ── */
.chat-popup {
  position: fixed;
  bottom: 100px;
  right: 28px;
  z-index: 949;
  width: 380px;
  height: 560px;
  max-height: calc(100vh - 160px);
  background: var(--white, #ffffff);
  border-radius: 16px;
  box-shadow: 0 16px 60px rgba(0, 0, 0, 0.2);
  display: none;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-popup.open {
  display: flex;
  transform: translateY(0);
  opacity: 1;
}

/* ── Chat Header ── */
.chat-header {
  background: linear-gradient(135deg, var(--navy, #0a1628), var(--navy-light, #132044));
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold, #d4af37), var(--gold-light, #f0d060));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--navy, #0a1628);
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

.chat-header-info { flex: 1; min-width: 0; }

.chat-header-info h4 {
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  margin: 0 0 2px;
}

.chat-header-info .chat-status {
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-header-info .chat-status.online { color: var(--success, #10b981); }
.chat-header-info .chat-status.offline { color: var(--text-light, #9ca3af); }

.chat-status-dot {
  width: 7px; height: 7px; border-radius: 50%; display: inline-block;
}

.chat-status.online .chat-status-dot {
  background: var(--success, #10b981);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.chat-status.offline .chat-status-dot { background: var(--text-light, #9ca3af); }

.chat-header-actions { display: flex; gap: 4px; }

.chat-header-actions button {
  width: 34px; height: 34px; border-radius: 8px; border: none;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.chat-header-actions button:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* ── Chat Messages Area ── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: var(--off-white, #f8f7f4);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-messages::-webkit-scrollbar { width: 5px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb {
  background: var(--text-light, #9ca3af);
  border-radius: 3px;
}

.chat-messages .chat-date-separator {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-light, #9ca3af);
  margin: 8px 0;
  position: relative;
}

.chat-messages .chat-date-separator::before,
.chat-messages .chat-date-separator::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 30%;
  height: 1px;
  background: var(--light-grey, #e8e6e1);
}

.chat-messages .chat-date-separator::before { left: 0; }
.chat-messages .chat-date-separator::after { right: 0; }

.chat-messages .typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  background: #e0ddd5;
  border-radius: 16px;
  align-self: flex-start;
  margin-bottom: 4px;
}

.chat-messages .typing-indicator span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-light, #9ca3af);
  animation: typingBounce 1.4s ease infinite;
}

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

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

/* ── Message Bubbles ── */
.chat-message {
  max-width: 80%;
  display: flex;
  flex-direction: column;
  animation: messageSlide 0.3s ease;
}

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

.chat-message.customer { align-self: flex-end; align-items: flex-end; }
.chat-message.receptionist { align-self: flex-start; align-items: flex-start; }

.chat-message .bubble {
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 0.88rem;
  line-height: 1.5;
  word-wrap: break-word;
  position: relative;
}

.chat-message.customer .bubble {
  background: linear-gradient(135deg, var(--gold, #d4af37), var(--gold-light, #f0d060));
  color: var(--navy, #0a1628);
  border-bottom-right-radius: 4px;
}

.chat-message.receptionist .bubble {
  background: #fff;
  color: var(--text-dark, #1a1a2e);
  border: 1px solid var(--light-grey, #e8e6e1);
  border-bottom-left-radius: 4px;
}

.chat-message .bubble .message-time {
  font-size: 0.65rem; opacity: 0.6; margin-top: 4px; display: block; text-align: right;
}

.chat-message.customer .bubble .message-time { color: var(--navy, #0a1628); }

.chat-message .message-sender {
  font-size: 0.7rem; font-weight: 600; margin-bottom: 4px; padding: 0 4px;
}

.chat-message.receptionist .message-sender { color: var(--navy, #0a1628); }

/* ── Pre-Chat Form ── */
.chat-pre-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  background: var(--off-white, #f8f7f4);
  text-align: center;
}

.chat-pre-form .pre-form-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, rgba(212,175,55,0.12), rgba(212,175,55,0.06));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; color: var(--gold, #d4af37); margin-bottom: 16px;
}

.chat-pre-form h3 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.2rem; color: var(--navy, #0a1628); margin-bottom: 6px;
}

.chat-pre-form p {
  font-size: 0.85rem; color: var(--text-light, #6b7280);
  margin-bottom: 24px; max-width: 280px;
}

.chat-pre-form .form-group { width: 100%; text-align: left; margin-bottom: 14px; }

.chat-pre-form .form-group label {
  display: block; font-size: 0.78rem; font-weight: 600;
  margin-bottom: 4px; color: var(--text-dark, #1a1a2e);
}

.chat-pre-form .form-group input,
.chat-pre-form .form-group select {
  width: 100%; padding: 10px 14px;
  border: 2px solid var(--light-grey, #e8e6e1); border-radius: 8px;
  font-family: 'Inter', sans-serif; font-size: 0.88rem;
  color: var(--text-dark, #1a1a2e); background: #fff;
  transition: all 0.3s ease;
}

.chat-pre-form .form-group input:focus,
.chat-pre-form .form-group select:focus {
  outline: none; border-color: var(--gold, #d4af37);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.12);
}

.chat-pre-form .btn-gold { width: 100%; justify-content: center; padding: 12px; margin-top: 4px; }

/* ── Chat Input Area ── */
.chat-input-area {
  display: flex; align-items: flex-end; gap: 10px;
  padding: 14px 16px; background: #fff;
  border-top: 1px solid var(--light-grey, #e8e6e1); flex-shrink: 0;
}

.chat-input-area textarea {
  flex: 1; border: none; border-radius: 10px;
  padding: 10px 14px; font-family: 'Inter', sans-serif;
  font-size: 0.88rem; resize: none; max-height: 100px; min-height: 20px;
  background: var(--off-white, #f8f7f4);
  color: var(--text-dark, #1a1a2e); line-height: 1.5;
  transition: all 0.2s ease;
}

.chat-input-area textarea:focus {
  outline: none; background: #fff;
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.15);
}

.chat-input-area textarea::placeholder { color: var(--text-light, #9ca3af); }

.chat-input-area .chat-send-btn {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold, #d4af37), var(--gold-light, #f0d060));
  color: var(--navy, #0a1628); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; transition: all 0.2s ease;
  flex-shrink: 0;
}

.chat-input-area .chat-send-btn:hover {
  transform: scale(1.08); box-shadow: 0 4px 16px rgba(212, 175, 55, 0.4);
}

.chat-input-area .chat-send-btn:active { transform: scale(0.95); }
.chat-input-area .chat-send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ── Mobile Responsive ── */
@media (max-width: 576px) {
  .chat-button {
    bottom: 16px; right: 16px; width: 52px; height: 52px; font-size: 1.2rem;
  }

  .chat-popup {
    bottom: 0; right: 0; left: 0;
    width: 100%; height: 100%;
    max-height: 100vh;
    border-radius: 0;
    border: none;
  }

  .chat-popup.open {
    border-radius: 0;
  }

  .chat-header {
    border-radius: 0;
    padding: 14px 16px;
  }

  .chat-messages {
    padding: 14px;
  }

  .chat-input-area {
    padding: 10px 12px;
  }

  .chat-pre-form {
    padding: 24px 20px;
  }
}
