/**
 * assets/css/chatbot.css
 * Enterprise Styling for Enjoy Holiday Hub AI Travel Assistant
 */

/* 1. Floating Chat Trigger Button */
.ehh-chatbot-trigger {
  position: fixed;
  bottom: 25px;
  right: 25px;
  z-index: 99999;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), bottom 0.3s ease;
}

/* Adjust position when a bottom sticky bar (like Round Trip bar) is present */
body.has-rt-sticky-bar .ehh-chatbot-trigger,
body:has(#ehhRoundTripBar) .ehh-chatbot-trigger,
body:has(.ehh-roundtrip-sticky-bar) .ehh-chatbot-trigger,
body.has-bottom-bar .ehh-chatbot-trigger {
  bottom: 95px !important;
  right: 25px !important;
  z-index: 1050 !important;
}

body.has-rt-sticky-bar .ehh-chatbot-badge,
body:has(#ehhRoundTripBar) .ehh-chatbot-badge,
body:has(.ehh-roundtrip-sticky-bar) .ehh-chatbot-badge,
body.has-bottom-bar .ehh-chatbot-badge,
body.has-rt-sticky-bar .ehh-chatbot-trigger:hover .ehh-chatbot-badge,
body:has(#ehhRoundTripBar) .ehh-chatbot-trigger:hover .ehh-chatbot-badge,
body:has(.ehh-roundtrip-sticky-bar) .ehh-chatbot-trigger:hover .ehh-chatbot-badge,
body.has-bottom-bar .ehh-chatbot-trigger:hover .ehh-chatbot-badge {
  display: none !important;
  opacity: 0 !important;
  max-width: 0 !important;
  pointer-events: none !important;
}

body.has-rt-sticky-bar .ehh-chatbot-window,
body:has(#ehhRoundTripBar) .ehh-chatbot-window,
body:has(.ehh-roundtrip-sticky-bar) .ehh-chatbot-window,
body.has-bottom-bar .ehh-chatbot-window {
  bottom: 100px !important;
  right: 20px !important;
  max-height: calc(100vh - 120px) !important;
}

@media (max-width: 768px) {
  body.has-rt-sticky-bar .ehh-chatbot-trigger,
  body:has(#ehhRoundTripBar) .ehh-chatbot-trigger,
  body:has(.ehh-roundtrip-sticky-bar) .ehh-chatbot-trigger,
  body.has-bottom-bar .ehh-chatbot-trigger {
    bottom: 140px !important;
    right: 15px !important;
  }
  body.has-rt-sticky-bar .ehh-chatbot-window,
  body:has(#ehhRoundTripBar) .ehh-chatbot-window,
  body:has(.ehh-roundtrip-sticky-bar) .ehh-chatbot-window,
  body.has-bottom-bar .ehh-chatbot-window {
    bottom: 140px !important;
    max-height: calc(100vh - 160px) !important;
  }
}

.ehh-chatbot-trigger:hover {
  transform: translateY(-4px) scale(1.03);
}

.ehh-chatbot-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #14213D 0%, #1e3a8a 50%, #E72E2E 100%);
  box-shadow: 0 8px 20px rgba(20, 33, 61, 0.3), 0 0 0 3px rgba(231, 46, 46, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-size: 20px;
  position: relative;
  transition: all 0.3s ease;
}

.ehh-chatbot-btn .online-indicator {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  background: #10B981;
  border: 2.5px solid #FFFFFF;
  border-radius: 50%;
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Non-intrusive badge: compact and sleek, slides out gracefully on hover */
.ehh-chatbot-badge {
  background: #FFFFFF;
  color: #14213D;
  padding: 0;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(20, 33, 61, 0.08);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  max-width: 0;
  opacity: 0;
  transform: translateX(10px) scale(0.95);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  pointer-events: none;
}

.ehh-chatbot-trigger:hover .ehh-chatbot-badge {
  opacity: 1 !important;
  max-width: 260px !important;
  padding: 8px 14px !important;
  transform: translateX(0) scale(1) !important;
  pointer-events: auto !important;
}

.ehh-chatbot-badge.badge-collapsed {
  opacity: 0 !important;
  max-width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  pointer-events: none !important;
  transform: translateX(10px) scale(0.9) !important;
}

.ehh-chatbot-badge i {
  color: #E72E2E;
}

.ehh-badge-close {
  background: none;
  border: none;
  color: #94A3B8;
  font-size: 16px;
  line-height: 1;
  padding: 0 0 0 4px;
  margin-left: 2px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  transition: all 0.2s ease;
}

.ehh-badge-close:hover {
  color: #E72E2E;
  background: rgba(231, 46, 46, 0.1);
}

/* 2. Chatbot Window */
.ehh-chatbot-window {
  position: fixed;
  bottom: 95px;
  right: 25px;
  width: 400px;
  max-width: calc(100vw - 30px);
  height: 620px;
  max-height: calc(100vh - 120px);
  background: #FFFFFF;
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(226, 232, 240, 0.8);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 100000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ehh-chatbot-window.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Top Header */
.ehh-chat-header {
  background: linear-gradient(135deg, #14213D 0%, #1e293b 100%);
  color: #FFFFFF;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #E72E2E;
}

.ehh-chat-header-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ehh-chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #FFFFFF;
  padding: 3px;
  border: 2px solid #E72E2E;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #E72E2E;
  overflow: hidden;
}

.ehh-chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.ehh-chat-title-wrap h6 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  gap: 5px;
}

.ehh-chat-title-wrap small {
  font-size: 11px;
  color: #94A3B8;
  display: flex;
  align-items: center;
  gap: 4px;
}

.ehh-chat-title-wrap small .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10B981;
  display: inline-block;
}

.ehh-chat-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ehh-lang-toggle-btn {
  background: rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 14px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ehh-lang-toggle-btn:hover {
  background: #E72E2E;
  border-color: #E72E2E;
}

.ehh-chat-icon-btn {
  background: transparent;
  border: none;
  color: #94A3B8;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  transition: all 0.2s ease;
}

.ehh-chat-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
}

/* 3. Messages Body */
.ehh-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #F8FAFC;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.ehh-msg-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 90%;
  animation: fadeIn 0.3s ease;
}

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

.ehh-msg-row.customer {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.ehh-msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-line;
  position: relative;
}

.ehh-msg-row.bot .ehh-msg-bubble {
  background: #FFFFFF;
  color: #1E293B;
  border: 1px solid #E2E8F0;
  border-top-left-radius: 3px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.ehh-msg-row.customer .ehh-msg-bubble {
  background: #E72E2E;
  color: #FFFFFF;
  border-top-right-radius: 3px;
  box-shadow: 0 4px 12px rgba(231, 46, 46, 0.25);
}

.ehh-msg-time {
  font-size: 10px;
  color: #94A3B8;
  margin-top: 3px;
  text-align: right;
}

/* 4. Rich Cards & Interactive Elements */
.ehh-quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.ehh-chip-btn {
  background: #FFFFFF;
  color: #14213D;
  border: 1px solid #CBD5E1;
  border-radius: 16px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ehh-chip-btn:hover {
  background: #E72E2E;
  color: #FFFFFF;
  border-color: #E72E2E;
}

/* Flight Results Card */
.ehh-flight-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 12px;
  margin-top: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
  transition: border-color 0.2s ease;
}

.ehh-flight-card:hover {
  border-color: #E72E2E;
}

.ehh-flight-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #F1F5F9;
}

.ehh-flight-airline {
  font-weight: 700;
  font-size: 13px;
  color: #14213D;
}

.ehh-flight-timing-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.ehh-time-box {
  text-align: center;
}

.ehh-time-box .time {
  font-size: 15px;
  font-weight: 800;
  color: #0F172A;
}

.ehh-time-box .city {
  font-size: 11px;
  color: #64748B;
}

.ehh-duration-bar {
  text-align: center;
  flex: 1;
  padding: 0 10px;
}

.ehh-duration-bar .dur {
  font-size: 10px;
  color: #64748B;
  display: block;
}

.ehh-duration-bar .line {
  height: 2px;
  background: #CBD5E1;
  position: relative;
  margin: 4px 0;
}

.ehh-duration-bar .stops {
  font-size: 10px;
  color: #10B981;
  font-weight: 600;
}

.ehh-flight-price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}

.ehh-flight-price {
  font-size: 16px;
  font-weight: 800;
  color: #E72E2E;
}

.ehh-book-cta-btn {
  background: #14213D;
  color: #FFFFFF;
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ehh-book-cta-btn:hover {
  background: #E72E2E;
  color: #FFFFFF;
}

/* Hotel & Tour Cards */
.ehh-item-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  overflow: hidden;
  margin-top: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
}

.ehh-item-card img {
  width: 100%;
  height: 110px;
  object-fit: cover;
}

.ehh-item-body {
  padding: 10px;
}

.ehh-item-title {
  font-size: 13px;
  font-weight: 700;
  color: #14213D;
  margin-bottom: 4px;
}

.ehh-item-meta {
  font-size: 11px;
  color: #64748B;
  margin-bottom: 8px;
}

/* Status Card */
.ehh-status-card {
  background: #FFFFFF;
  border: 1.5px solid #E2E8F0;
  border-radius: 12px;
  padding: 12px;
  margin-top: 8px;
}

.ehh-status-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.ehh-status-badge.warning {
  background: #FEF3C7;
  color: #92400E;
}

.ehh-status-badge.success {
  background: #D1FAE5;
  color: #065F46;
}

/* Handover Card */
.ehh-handover-card {
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-radius: 12px;
  padding: 12px;
  margin-top: 8px;
  text-align: center;
}

.ehh-wa-btn {
  background: #25D366;
  color: #FFFFFF;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.ehh-wa-btn:hover {
  background: #1EBE5D;
  color: #FFFFFF;
}

/* 5. Input Area */
.ehh-chat-footer {
  padding: 10px 14px;
  background: #FFFFFF;
  border-top: 1px solid #E2E8F0;
}

.ehh-chat-input-wrap {
  display: flex;
  align-items: center;
  background: #F1F5F9;
  border: 1px solid #CBD5E1;
  border-radius: 24px;
  padding: 4px 6px 4px 14px;
  transition: all 0.2s ease;
}

.ehh-chat-input-wrap:focus-within {
  border-color: #E72E2E;
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(231, 46, 46, 0.1);
}

.ehh-chat-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 13px;
  color: #1E293B;
  outline: none;
  padding: 6px 0;
  resize: none;
  height: 32px;
  max-height: 80px;
}

.ehh-chat-send-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #E72E2E;
  border: none;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
  margin-left: 6px;
}

.ehh-chat-send-btn:hover {
  background: #14213D;
  transform: scale(1.05);
}

.ehh-chat-brand-note {
  text-align: center;
  font-size: 10px;
  color: #94A3B8;
  margin-top: 6px;
}

/* Responsive for Mobile */
@media (max-width: 576px) {
  .ehh-chatbot-trigger {
    bottom: 20px;
    right: 20px;
  }
  .ehh-chatbot-window {
    bottom: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
  }
}
