/* ==========================================================================
   SUPREME ASSISTANT - LUXURY CONSULAR & VISA AI ASSISTANT STYLING
   Brand: Supreme Visas | Supreme Assistant
   Integrates seamlessly with Hallmark Theme (Light & Dark)
   ========================================================================== */

/* --- Floating Container --- */
#supreme-assistant-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: var(--font-sans, 'Inter Tight', sans-serif);
}

/* --- Proactive Prompt Bubble / Toast --- */
.assistant-proactive-toast {
  position: absolute;
  bottom: 74px;
  right: 0;
  width: 300px;
  background: rgba(18, 19, 24, 0.96);
  border: 1px solid rgba(197, 160, 89, 0.35);
  border-radius: 18px;
  box-shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.6), 0 0 20px rgba(197, 160, 89, 0.15);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: assistantFadeSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: all 0.3s ease;
  z-index: 10000;
  color: #ffffff;
}

[data-theme="light"] .assistant-proactive-toast {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(197, 160, 89, 0.4);
  box-shadow: 0 16px 36px -8px rgba(0, 0, 0, 0.2);
  color: #121316;
}

.assistant-proactive-toast.hidden {
  display: none !important;
}

.toast-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toast-brand-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #D4AF37;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.toast-close-btn {
  background: none;
  border: none;
  color: #9CA3AF;
  cursor: pointer;
  padding: 2px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  font-size: 16px;
  line-height: 1;
}

.toast-close-btn:hover {
  color: #ffffff;
}

.toast-body {
  font-size: 12px;
  line-height: 1.45;
  color: #E5E7EB;
  font-weight: 500;
}

[data-theme="light"] .toast-body {
  color: #374151;
}

.toast-cta-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 2px;
}

.toast-cta-btn {
  background: linear-gradient(135deg, #C5A059 0%, #9A7B38 100%);
  color: #0E0F13;
  border: none;
  padding: 5px 13px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(197, 160, 89, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
}

.toast-cta-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(197, 160, 89, 0.45);
}

/* --- Floating Launch Bar (Pinterest / Framer Style) --- */
.assistant-launch-bar {
  display: flex;
  align-items: center;
  position: relative;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Hide launcher cleanly when chat modal is open */
#supreme-assistant-widget.chat-is-open .assistant-launch-bar {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.9) translateY(12px);
}

/* Luxury Pill-Shaped Launcher Button with Animated Border Beam */
.assistant-launcher-btn {
  position: relative;
  height: 52px;
  padding: 1.5px; /* Border beam stroke width */
  border-radius: 9999px;
  background: transparent;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  overflow: hidden;
  box-shadow: 0 12px 32px -4px rgba(0, 0, 0, 0.7), 0 0 24px -2px rgba(212, 175, 55, 0.35);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.assistant-launcher-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 16px 42px -4px rgba(0, 0, 0, 0.8), 0 0 32px 2px rgba(212, 175, 55, 0.55);
}

.assistant-launcher-btn:active {
  transform: scale(0.97);
}

/* Rotating Conic Border Beam (Framer / UI Motion Style) */
.assistant-launcher-btn .btn-beam-rotator {
  position: absolute;
  top: -150%;
  left: -50%;
  width: 200%;
  height: 400%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    transparent 260deg,
    rgba(212, 175, 55, 0.2) 290deg,
    rgba(245, 158, 11, 0.8) 330deg,
    #FFF8DC 355deg,
    transparent 360deg
  );
  animation: borderBeamSpin 3.2s linear infinite;
  pointer-events: none;
  z-index: 1;
}

/* Inner Pill Surface */
.assistant-launcher-btn .btn-inner-pill {
  position: relative;
  z-index: 2;
  height: 49px;
  padding: 0 22px 0 16px;
  border-radius: 9999px;
  background: linear-gradient(135deg, #181920 0%, #0E0F14 100%);
  display: flex;
  align-items: center;
  gap: 10px;
  color: #FFFFFF;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.12);
}

[data-theme="light"] .assistant-launcher-btn .btn-inner-pill {
  background: linear-gradient(135deg, #1C1D24 0%, #121318 100%);
}

/* Sparkle Diamond Stars (Twinkling Animation) */
.btn-sparkle-group {
  position: relative;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sparkle-star {
  position: absolute;
  display: block;
}

.sparkle-main {
  width: 17px;
  height: 17px;
  color: #F59E0B;
  animation: starTwinkleMain 2.4s ease-in-out infinite;
}

.sparkle-sub-1 {
  top: -1px;
  right: -3px;
  width: 8px;
  height: 8px;
  color: #FDE68A;
  animation: starTwinkleSub 2.4s ease-in-out infinite 0.7s;
}

.sparkle-sub-2 {
  bottom: 0px;
  left: -2px;
  width: 6px;
  height: 6px;
  color: #FFFFFF;
  animation: starTwinkleSub 2.4s ease-in-out infinite 1.4s;
}

/* Launcher Button Text */
.btn-launcher-text {
  font-family: var(--font-heading, 'Plus Jakarta Sans', sans-serif);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #FFFFFF;
  white-space: nowrap;
}

/* --- Main Chat Window Modal --- */
.assistant-chat-window {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 395px;
  max-width: calc(100vw - 32px);
  height: min(600px, calc(100vh - 48px));
  background: rgba(14, 15, 19, 0.98);
  border: 1px solid rgba(197, 160, 89, 0.3);
  border-radius: 24px;
  box-shadow: 0 24px 64px -12px rgba(0, 0, 0, 0.75), 0 0 28px rgba(197, 160, 89, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: bottom right;
  z-index: 10001;
}

[data-theme="light"] .assistant-chat-window {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(197, 160, 89, 0.35);
  box-shadow: 0 24px 64px -12px rgba(0, 0, 0, 0.25), 0 0 20px rgba(197, 160, 89, 0.12);
}

.assistant-chat-window.hidden {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: scale(0.93) translateY(20px) !important;
}

/* --- Compact Luxury Chat Header --- */
.chat-window-header {
  padding: 12px 18px;
  background: linear-gradient(135deg, #16171E 0%, #101116 100%);
  border-bottom: 1px solid rgba(197, 160, 89, 0.2);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  height: 52px;
}

[data-theme="light"] .chat-window-header {
  background: linear-gradient(135deg, #1C1D24 0%, #121318 100%);
  border-bottom-color: rgba(197, 160, 89, 0.25);
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-header-sparkle {
  color: #F59E0B;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.5));
}

.chat-header-title {
  font-family: var(--font-heading, 'Plus Jakarta Sans', sans-serif);
  font-size: 14px;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.verified-badge {
  display: inline-flex;
  color: #38BDF8;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-icon-btn {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #E5E7EB;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s, color 0.2s;
}

.chat-icon-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  transform: scale(1.06);
}

/* --- Chat Messages Area (Fixed Scroll Container) --- */
.chat-window-messages {
  flex: 1;
  min-height: 0; /* Critical for flex scroll */
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #0A0A0D;
  scroll-behavior: smooth;
}

[data-theme="light"] .chat-window-messages {
  background: #F9FAFB;
}

/* Custom Sleek Scrollbar */
.chat-window-messages::-webkit-scrollbar {
  width: 5px;
}

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

.chat-window-messages::-webkit-scrollbar-thumb {
  background: rgba(197, 160, 89, 0.35);
  border-radius: 9999px;
}

.chat-window-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(197, 160, 89, 0.7);
}

/* --- Welcome Card (Minimal, Compact, No Heavy Crest) --- */
.assistant-welcome-card {
  background: rgba(22, 23, 29, 0.85);
  border: 1px solid rgba(197, 160, 89, 0.2);
  border-radius: 18px;
  padding: 14px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  margin-bottom: 2px;
}

[data-theme="light"] .assistant-welcome-card {
  background: #ffffff;
  border-color: rgba(18, 19, 22, 0.08);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

.welcome-title {
  font-family: var(--font-heading, 'Plus Jakarta Sans', sans-serif);
  font-size: 13.5px;
  font-weight: 700;
  color: #FDFBF7;
  margin-bottom: 3px;
}

[data-theme="light"] .welcome-title {
  color: #111827;
}

.welcome-desc {
  font-size: 11.5px;
  color: #9CA3AF;
  line-height: 1.45;
}

[data-theme="light"] .welcome-desc {
  color: #4B5563;
}

/* Quick Suggestion Chips */
.quick-chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  justify-content: center;
}

.chip-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(197, 160, 89, 0.25);
  border-radius: 9999px;
  padding: 5px 11px;
  font-size: 11px;
  font-weight: 600;
  color: #E5E7EB;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

[data-theme="light"] .chip-btn {
  background: #F3F4F6;
  border-color: rgba(18, 19, 22, 0.1);
  color: #1F2937;
}

.chip-btn:hover {
  background: rgba(197, 160, 89, 0.15);
  border-color: #D4AF37;
  color: #D4AF37;
  transform: translateY(-1px);
}

/* --- Message Rows --- */
.msg-row {
  display: flex;
  gap: 8px;
  max-width: 90%;
  animation: msgFadeIn 0.25s ease forwards;
}

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

.msg-row.assistant {
  align-self: flex-start;
}

.msg-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #C5A059 0%, #9A7B38 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0E0F13;
  flex-shrink: 0;
  margin-top: 2px;
  box-shadow: 0 2px 6px rgba(197, 160, 89, 0.3);
}

.msg-bubble {
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 12.5px;
  line-height: 1.5;
  word-break: break-word;
}

.msg-row.user .msg-bubble {
  background: linear-gradient(135deg, #C8102E 0%, #8B0000 100%);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 14px rgba(200, 16, 46, 0.25);
}

.msg-row.assistant .msg-bubble {
  background: #15161C;
  color: #E5E7EB;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .msg-row.assistant .msg-bubble {
  background: #ffffff;
  color: #1F2937;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* Action Buttons inside Assistant Bubble */
.bubble-action-buttons {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.bubble-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
}

.bubble-btn-wa-hotline {
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(37, 211, 102, 0.25);
}

.bubble-btn-book {
  background: linear-gradient(135deg, #C5A059 0%, #9A7B38 100%);
  color: #0E0F13;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(197, 160, 89, 0.25);
}

.bubble-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

/* Typing Indicator */
.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 2px;
}

.typing-dot {
  width: 5px;
  height: 5px;
  background: #D4AF37;
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
.typing-dot:nth-child(3) { animation-delay: 0s; }

/* --- Chat Input Area --- */
.chat-window-input-bar {
  padding: 10px 14px 12px;
  background: #111217;
  border-top: 1px solid rgba(197, 160, 89, 0.15);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

[data-theme="light"] .chat-window-input-bar {
  background: #ffffff;
  border-top-color: rgba(0, 0, 0, 0.08);
}

.chat-input-field {
  flex: 1;
  padding: 9px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(197, 160, 89, 0.2);
  border-radius: 9999px;
  font-family: var(--font-sans, 'Inter Tight', sans-serif);
  font-size: 12.5px;
  color: #ffffff;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

[data-theme="light"] .chat-input-field {
  background: #F3F4F6;
  border-color: rgba(0, 0, 0, 0.1);
  color: #111827;
}

.chat-input-field:focus {
  border-color: #D4AF37;
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

.chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #C5A059 0%, #9A7B38 100%);
  border: none;
  color: #0E0F13;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(197, 160, 89, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
}

.chat-send-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 16px rgba(197, 160, 89, 0.45);
}

.chat-send-btn:active {
  transform: scale(0.96);
}

/* --- Keyframe Animations --- */
@keyframes borderBeamSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes starTwinkleMain {
  0%, 100% { transform: scale(1); opacity: 1; filter: drop-shadow(0 0 4px rgba(245, 158, 11, 0.7)); }
  50% { transform: scale(0.85); opacity: 0.65; filter: drop-shadow(0 0 1px rgba(245, 158, 11, 0.2)); }
}

@keyframes starTwinkleSub {
  0%, 100% { transform: scale(0.7); opacity: 0.4; }
  50% { transform: scale(1.2); opacity: 1; filter: drop-shadow(0 0 5px rgba(253, 230, 138, 0.9)); }
}

@keyframes assistantFadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* --- Mobile Responsiveness --- */
@media (max-width: 640px) {
  #supreme-assistant-widget {
    bottom: 16px;
    right: 16px;
  }
  .assistant-proactive-toast {
    width: calc(100vw - 32px);
    right: 0;
    bottom: 68px;
  }
  .assistant-chat-window {
    width: calc(100vw - 24px);
    right: 12px;
    bottom: 16px;
    height: min(580px, calc(100vh - 32px));
    border-radius: 20px;
  }
  .assistant-launcher-btn {
    height: 48px;
  }
  .assistant-launcher-btn .btn-inner-pill {
    height: 45px;
    padding: 0 18px 0 14px;
  }
  .btn-launcher-text {
    font-size: 13px;
  }
}
