/* ============== AI CHATBOT WIDGET ============== */
.chat-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--purple-dim));
  border: none;
  color: #14263D;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(201, 165, 90, 0.35);
  z-index: 95;
  transition: all 0.3s var(--ease-bounce);
  animation: chatPulse 2.5s ease-in-out infinite;
}
.chat-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 40px rgba(201, 165, 90, 0.4);
}
.chat-launcher i {
  transition: transform 0.3s var(--ease);
}
.chat-launcher.open {
  background: linear-gradient(135deg, var(--bg3), var(--bg2));
  animation: none;
}
.chat-launcher.open i {
  transform: rotate(180deg);
}
.chat-tooltip {
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: rgba(8, 19, 32, 0.96);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--text);
  font-size: 12.5px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease);
  font-weight: 400;
}
.chat-launcher:hover .chat-tooltip {
  opacity: 1;
}
.chat-launcher.open .chat-tooltip { display: none; }
.chat-dot-indicator {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--cyan);
  border: 2px solid var(--bg);
  box-shadow: 0 0 10px var(--cyan);
}

@keyframes chatPulse {
  0%, 100% { box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(10, 37, 64, 0); }
  50% { box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3), 0 0 0 12px rgba(10, 37, 64, 0); }
}

/* CHAT PANEL */
.chat-panel {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 140px);
  background: rgba(8, 19, 32, 0.97);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid rgba(201, 165, 90, 0.25);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(201, 165, 90, 0.08);
  z-index: 94;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transform-origin: bottom right;
  transition: all 0.3s var(--ease-bounce);
}
.chat-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.chat-header {
  padding: 1.25rem 1.25rem 1rem;
  background: linear-gradient(135deg, rgba(201, 165, 90, 0.18), rgba(107, 39, 55, 0.06));
  border-bottom: 1px solid var(--glass-border);
  position: relative;
  flex-shrink: 0;
}
.chat-header-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.625rem;
}
.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 16px;
  font-weight: 700;
  color: #08080c;
  flex-shrink: 0;
  box-shadow: 0 0 20px rgba(201, 165, 90, 0.3);
}
.chat-title {
  flex: 1;
}
.chat-title strong {
  display: block;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text);
}
.chat-title span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--cyan);
  font-weight: 400;
  margin-top: 1px;
}
.chat-title span::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  animation: pulse 2s ease-in-out infinite;
}
.chat-close {
  background: transparent;
  border: none;
  color: var(--text2);
  cursor: pointer;
  font-size: 20px;
  padding: 4px;
  border-radius: 6px;
  transition: all 0.15s var(--ease);
}
.chat-close:hover {
  color: var(--text);
  background: var(--glass);
}
.chat-header p {
  font-size: 12.5px;
  color: var(--text2);
  font-weight: 300;
  line-height: 1.55;
}

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  scrollbar-width: thin;
  scrollbar-color: var(--glass-border-strong) transparent;
}
.chat-body::-webkit-scrollbar { width: 6px; }
.chat-body::-webkit-scrollbar-thumb {
  background: var(--glass-border-strong);
  border-radius: 3px;
}
.chat-msg {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  animation: msgIn 0.3s var(--ease);
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.chat-msg.user {
  flex-direction: row-reverse;
}
.chat-msg-avatar {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}
.chat-msg.ai .chat-msg-avatar {
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  color: #08080c;
  font-family: 'Playfair Display', serif;
  font-style: italic;
}
.chat-msg.user .chat-msg-avatar {
  background: linear-gradient(135deg, var(--purple), var(--purple-dim));
  color: #14263D;
}
.chat-msg-bubble {
  padding: 0.75rem 1rem;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  max-width: 80%;
  font-weight: 400;
}
.chat-msg.ai .chat-msg-bubble {
  background: rgba(245, 237, 220, 0.08);
  border: 1px solid rgba(245, 237, 220, 0.12);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.chat-msg.user .chat-msg-bubble {
  background: linear-gradient(135deg, var(--purple), var(--purple-dim));
  color: #14263D;
  border-bottom-right-radius: 4px;
}

.chat-typing {
  display: flex;
  gap: 4px;
  padding: 0.875rem 1rem;
}
.chat-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text3);
  animation: typingDot 1.4s ease-in-out infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingDot {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

.chat-suggested {
  padding: 0 1.25rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.chat-sugg-label {
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text3);
  font-weight: 500;
  margin-bottom: 0.375rem;
}
.chat-sugg {
  text-align: left;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text2);
  font-family: 'DM Sans', sans-serif;
  font-size: 12.5px;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}
.chat-sugg:hover {
  background: var(--glass-strong);
  color: var(--text);
  border-color: var(--glass-border-strong);
}

.chat-input-area {
  padding: 1rem 1.25rem 1.25rem;
  border-top: 1px solid var(--glass-border);
  background: rgba(245, 237, 220, 0.03);
  flex-shrink: 0;
}
.chat-input-wrap {
  display: flex;
  gap: 0.5rem;
  background: rgba(245, 237, 220, 0.06);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  transition: border-color 0.2s var(--ease);
}
.chat-input-wrap:focus-within {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(201, 165, 90, 0.18);
}
.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  outline: none;
  padding: 0.4rem 0.5rem;
  resize: none;
  max-height: 100px;
  font-weight: 400;
}
.chat-input::placeholder { color: var(--text3); }
.chat-send {
  background: linear-gradient(135deg, var(--purple), var(--purple-dim));
  border: none;
  color: #14263D;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.15s var(--ease);
  flex-shrink: 0;
}
.chat-send:hover {
  transform: translateX(2px);
}
.chat-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}
.chat-disclaimer {
  font-size: 10.5px;
  color: var(--text3);
  text-align: center;
  margin-top: 0.5rem;
  font-weight: 300;
  line-height: 1.4;
}

@media (max-width: 500px) {
  .chat-panel {
    bottom: 88px;
    right: 12px;
    left: 12px;
    width: auto;
    height: calc(100vh - 120px);
    max-width: none;
  }
  .chat-launcher {
    width: 54px;
    height: 54px;
    bottom: 18px;
    right: 18px;
    font-size: 24px;
  }
}
