/* ============================================
   MANDELSON.CO — Chat Widget Styles
   ============================================ */

/* --- FAB (Floating Action Button) --- */
.chat-fab {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  z-index: var(--z-modal);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.3);
  transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.chat-fab:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
  box-shadow: 0 6px 28px rgba(37, 99, 235, 0.4);
}

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

.chat-fab.is-open i {
  transform: none;
}

/* --- Chat Panel --- */
.chat-panel {
  position: fixed;
  bottom: calc(var(--space-xl) + 70px);
  right: var(--space-xl);
  z-index: var(--z-modal);
  width: 400px;
  max-height: 560px;
  background: rgba(250, 250, 248, 0.95);
  backdrop-filter: blur(40px) saturate(1.8);
  -webkit-backdrop-filter: blur(40px) saturate(1.8);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transform-origin: bottom right;
  transition: opacity 0.01s, visibility 0.01s;
}

.chat-panel.is-open {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}

/* --- Panel Header --- */
.chat-header {
  padding: var(--space-sm) var(--space-lg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chat-header__left {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.chat-header__title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-primary);
}

.chat-header__status {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.chat-header__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #16A34A;
}

.chat-header__actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.chat-header__btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.chat-header__btn:hover {
  background: var(--bg-light-alt);
  color: var(--text-primary);
}

/* --- Pre-Chat Form --- */
.chat-prechat {
  padding: var(--space-xl) var(--space-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1;
}

.chat-prechat__greeting {
  font-family: 'Space Grotesk', sans-serif;
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.chat-prechat__sub {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-xl);
}

.chat-prechat__topics {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  width: 100%;
}

.chat-topic-btn {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-light);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: var(--text-sm);
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.chat-topic-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.chat-topic-btn i {
  font-size: 18px;
  flex-shrink: 0;
}

.chat-topic-btn--booking {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.chat-topic-btn--booking:hover {
  background: var(--accent);
  color: white;
}

/* --- Chat Messages Area --- */
.chat-messages {
  flex: 1 1 0;
  overflow-y: auto;
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  min-height: 0;
  max-height: 380px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 2px;
}

/* --- Message Bubbles --- */
.chat-msg {
  max-width: 85%;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-lg);
  font-size: var(--text-xs);
  line-height: 1.55;
  word-wrap: break-word;
}

.chat-msg--user {
  align-self: flex-end;
  background: var(--accent);
  color: white;
  border-bottom-right-radius: var(--radius-sm);
}

.chat-msg--assistant {
  align-self: flex-start;
  background: var(--bg-light-alt);
  color: var(--text-primary);
  border-bottom-left-radius: var(--radius-sm);
}

.chat-msg--system {
  align-self: center;
  background: transparent;
  color: var(--text-muted);
  font-size: var(--text-xs);
  text-align: center;
  padding: var(--space-xs) var(--space-md);
}

.chat-msg--assistant a {
  color: var(--accent);
  text-decoration: underline;
}

/* --- Booking buttons in chat --- */
.chat-booking-btn {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 6px;
  margin: 8px 0 10px;
  padding: 8px 14px;
  background: var(--accent);
  color: white !important;
  text-decoration: none !important;
  border-radius: var(--radius-md);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: background 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
}

.chat-booking-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.chat-booking-btn i {
  font-size: 13px;
}

/* --- Typing Indicator --- */
.chat-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: var(--space-sm) var(--space-md);
  align-self: flex-start;
}

.chat-typing__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: chatTyping 1.4s ease-in-out infinite;
}

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

@keyframes chatTyping {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* --- Input Area --- */
.chat-input-area {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border);
  display: flex;
  gap: var(--space-sm);
  align-items: flex-end;
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  font-family: 'Inter', sans-serif;
  font-size: var(--text-xs);
  padding: var(--space-sm) var(--space-md);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-light);
  color: var(--text-primary);
  outline: none;
  resize: none;
  max-height: 80px;
  line-height: 1.5;
  transition: border-color 0.2s ease;
}

.chat-input:focus {
  border-color: var(--accent);
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.chat-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease, transform 0.2s ease;
}

.chat-send-btn:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

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

/* --- Footer Counter --- */
.chat-footer {
  padding: var(--space-xs) var(--space-lg) var(--space-sm);
  text-align: center;
  font-size: var(--text-xs);
  color: var(--text-muted);
  flex-shrink: 0;
}

/* --- Mobile --- */
@media (max-width: 640px) {
  .chat-fab {
    bottom: var(--space-lg);
    right: var(--space-lg);
    width: 48px;
    height: 48px;
  }

  .chat-fab i {
    font-size: 20px;
  }

  .chat-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-height: calc(100vh - 60px);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    transform-origin: bottom center;
  }

  /* Prevent iOS zoom on input focus — must be >= 16px */
  .chat-input {
    font-size: 16px;
  }
}

/* --- Hide chat elements when lightbox is open --- */
.lightbox-open .chat-fab,
.lightbox-open .chat-panel {
  display: none;
}
