/* ============================================================
   TTS CHATBOT WIDGET
   ============================================================ */

/* --- Floating toggle button --- */
#tts-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  font-family: 'Inter', sans-serif;
}

#tts-chat-toggle {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--gold);
  border: none;
  color: var(--navy);
  font-size: 1.35rem;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(201, 169, 110, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s, transform 0.2s, box-shadow 0.25s;
  position: relative;
}

#tts-chat-toggle:hover {
  background: var(--gold-light);
  transform: scale(1.07);
  box-shadow: 0 6px 28px rgba(201, 169, 110, 0.6);
}

/* Notification badge */
#tts-chat-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 18px;
  height: 18px;
  background: #e74c3c;
  color: #fff;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  pointer-events: none;
}

/* --- Chat panel --- */
#tts-chat-panel {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 360px;
  max-width: calc(100vw - 32px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(7, 26, 59, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-height: 540px;
}

#tts-chat-panel.tts-panel--open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* --- Header --- */
.tts-chat-header {
  background: var(--navy);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.tts-chat-header .chat-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  padding: 4px;
  flex-shrink: 0;
}

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

.chat-header-info .chat-name {
  display: block;
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.25;
}

.chat-header-info .chat-status {
  display: block;
  color: var(--gold-light);
  font-size: 0.72rem;
  line-height: 1.25;
  margin-top: 2px;
}

#tts-chat-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.65);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.2s;
  flex-shrink: 0;
}

#tts-chat-close:hover {
  color: #fff;
}

/* --- Messages area --- */
#tts-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

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

#tts-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

#tts-chat-messages::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

/* Message row */
.tts-msg {
  display: flex;
}

.tts-msg--bot {
  justify-content: flex-start;
}

.tts-msg--user {
  justify-content: flex-end;
}

/* Bubbles */
.tts-bubble {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 0.84rem;
  line-height: 1.55;
}

.tts-msg--bot .tts-bubble {
  background: #f0ede8;
  color: var(--navy);
  border-bottom-left-radius: 4px;
}

.tts-msg--user .tts-bubble {
  background: var(--gold);
  color: var(--navy);
  font-weight: 500;
  border-bottom-right-radius: 4px;
}

/* --- Quick reply chips --- */
#tts-quick-replies {
  padding: 4px 12px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  flex-shrink: 0;
}

.tts-qr-btn {
  background: transparent;
  border: 1.5px solid var(--gold);
  color: var(--navy);
  padding: 6px 13px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  font-family: 'Inter', sans-serif;
  line-height: 1.35;
  text-align: left;
}

.tts-qr-btn:hover {
  background: var(--gold);
  color: var(--navy);
}

/* --- Input row --- */
.tts-chat-input-row {
  display: flex;
  align-items: center;
  border-top: 1px solid var(--border);
  padding: 10px 12px;
  gap: 8px;
  flex-shrink: 0;
  background: #fff;
}

#tts-chat-input {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 24px;
  padding: 8px 14px;
  font-size: 0.83rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  color: var(--navy);
  background: var(--cream);
  transition: border-color 0.2s;
}

#tts-chat-input:focus {
  border-color: var(--gold);
}

#tts-chat-input::placeholder {
  color: #aaa;
}

#tts-chat-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gold);
  border: none;
  color: var(--navy);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
  flex-shrink: 0;
}

#tts-chat-send:hover {
  background: var(--gold-light);
  transform: scale(1.08);
}

/* --- Mobile --- */
@media (max-width: 480px) {
  #tts-chat-widget {
    bottom: 16px;
    right: 16px;
  }

  #tts-chat-panel {
    width: calc(100vw - 32px);
    right: 0;
    bottom: 66px;
    max-height: 70vh;
  }
}
