/* ═══════════════════════════════════════════════════════
   CHAT — Floating Widget + Full-screen View
   ═══════════════════════════════════════════════════════ */

/* ── Shared message styles ────────────────────────────── */
.chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.55;
  word-wrap: break-word;
}
.chat-msg ul { margin: 4px 0; padding-left: 16px; }
.chat-msg li { margin: 2px 0; }
.chat-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
  color: white;
  border-bottom-right-radius: 4px;
}
.chat-msg-assistant {
  align-self: flex-start;
  background: var(--input-bg, #252540);
  color: var(--text, #e0e0e0);
  border-bottom-left-radius: 4px;
}
.chat-event-id {
  color: #818CF8;
  cursor: pointer;
  font-size: 0.72rem;
  opacity: 0.7;
}
.chat-event-id:hover { opacity: 1; text-decoration: underline; }

/* Typing dots */
.chat-typing { padding: 12px 16px; }
.chat-dots { display: flex; gap: 4px; }
.chat-dots span {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text2, #888);
  animation: chatBounce 1.2s infinite;
}
.chat-dots span:nth-child(2) { animation-delay: 0.2s; }
.chat-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes chatBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Send button (shared) */
.chat-send {
  width: 40px; height: 40px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
  color: white; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: transform 0.15s;
}
.chat-send:hover { transform: scale(1.08); }

/* ══════════════════════════════════════════════════════
   FLOATING CHAT (mini widget on Agenda/Map views)
   ══════════════════════════════════════════════════════ */
.chat-fab {
  position: fixed; bottom: 20px; right: 20px;
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
  border: none; color: white; font-size: 24px; cursor: pointer;
  box-shadow: 0 4px 16px rgba(99,102,241,0.4);
  z-index: 1000; transition: transform 0.2s, opacity 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.chat-fab:hover { transform: scale(1.1); }
.chat-fab.hidden { opacity: 0; pointer-events: none; transform: scale(0.8); }

.chat-panel {
  position: fixed; bottom: 20px; right: 20px;
  width: 380px; height: 520px;
  background: var(--card-bg, #1a1a2e);
  border: 1px solid var(--border, #2a2a4a);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  z-index: 1001; display: flex; flex-direction: column;
  opacity: 0; transform: translateY(20px) scale(0.95);
  pointer-events: none; transition: opacity 0.25s, transform 0.25s;
}
.chat-panel.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

.chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border, #2a2a4a);
}
.chat-title { font-size: 0.95rem; font-weight: 700; color: var(--text, #e0e0e0); }
.chat-close {
  background: none; border: none; color: var(--text2, #888);
  font-size: 1.4rem; cursor: pointer; padding: 0 4px; line-height: 1;
}
.chat-close:hover { color: var(--text, #e0e0e0); }

.chat-messages {
  flex: 1; overflow-y: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
}

.chat-input-area {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border, #2a2a4a);
}
.chat-input {
  flex: 1; border: 1px solid var(--border, #2a2a4a); border-radius: 12px;
  background: var(--input-bg, #252540); color: var(--text, #e0e0e0);
  padding: 10px 14px; font-size: 0.85rem; font-family: inherit;
  resize: none; outline: none; max-height: 100px; line-height: 1.4;
}
.chat-input:focus { border-color: #6366F1; }
.chat-input::placeholder { color: var(--text2, #888); }

/* ══════════════════════════════════════════════════════
   FULL-SCREEN CHAT VIEW (dedicated tab)
   ══════════════════════════════════════════════════════ */
.chat-view-wrap {
  display: none;
  flex-direction: column;
  height: 100%;
  width: 100%;
}
.chat-view-wrap.active { display: flex; }

.chat-view-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  padding: 0;
}

/* Header */
.chat-view-header {
  padding: 24px 20px 16px;
  text-align: center;
}
.chat-view-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.chat-view-title h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text, #e0e0e0);
  margin: 0;
}
.chat-view-icon { font-size: 1.4rem; }
.chat-view-subtitle {
  margin: 8px 0 0;
  font-size: 0.82rem;
  color: var(--text2, #888);
  line-height: 1.4;
}

/* Messages */
.chat-view-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-view-messages .chat-msg {
  max-width: 75%;
  font-size: 0.92rem;
}

/* Suggestions */
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0;
  justify-content: center;
}
.chat-suggestion {
  background: var(--input-bg, #252540);
  border: 1px solid var(--border, #2a2a4a);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 0.82rem;
  color: var(--text, #e0e0e0);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-family: inherit;
}
.chat-suggestion:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: #6366F1;
}

/* Input area */
.chat-view-input-area {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 20px 20px;
  border-top: 1px solid var(--border, #2a2a4a);
  background: var(--card-bg, #1a1a2e);
}
.chat-view-input {
  flex: 1;
  border: 1px solid var(--border, #2a2a4a);
  border-radius: 16px;
  background: var(--input-bg, #252540);
  color: var(--text, #e0e0e0);
  padding: 12px 18px;
  font-size: 0.92rem;
  font-family: inherit;
  resize: none;
  outline: none;
  max-height: 120px;
  line-height: 1.45;
}
.chat-view-input:focus { border-color: #6366F1; }
.chat-view-input::placeholder { color: var(--text2, #888); }
.chat-view-send { width: 44px; height: 44px; }

/* ── Mobile overrides ─────────────────────────────────── */
@media (max-width: 768px) {
  .chat-panel {
    bottom: 0; right: 0; left: 0;
    width: 100%; height: 100%;
    border-radius: 0; max-height: 100dvh;
  }
  .chat-fab {
    bottom: 16px; right: 16px;
    width: 50px; height: 50px; font-size: 20px;
  }
  .chat-view-header { padding: 16px 16px 12px; }
  .chat-view-messages { padding: 0 12px 12px; }
  .chat-view-input-area { padding: 10px 12px 16px; }
  .chat-view-messages .chat-msg { max-width: 90%; }
  /* Prevent iOS zoom on input focus */
  .chat-input,
  .chat-view-input { font-size: 16px; }
}
