﻿/* Trident Secure — Chat UI Styles */

/* ─── SHARED CHAT COMPONENTS ─────────────────── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.chat-message { display: flex; flex-direction: column; max-width: 82%; }
.chat-message--user { align-self: flex-end; align-items: flex-end; }
.chat-message--ai   { align-self: flex-start; align-items: flex-start; }

.chat-bubble {
  padding: 0.75rem 1rem;
  border-radius: 14px;
  font-size: 0.875rem;
  line-height: 1.6;
}
.chat-message--user .chat-bubble {
  background: var(--accent-gold);
  color: var(--bg-primary);
  border-bottom-right-radius: 4px;
}
.chat-message--ai .chat-bubble {
  background: var(--bg-surface-2);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-bottom-left-radius: 4px;
}
.chat-message--ai .chat-bubble strong { color: var(--accent-gold); }
.chat-message--ai .chat-bubble a { color: var(--accent-gold); text-decoration: underline; }
.chat-message--ai .chat-bubble ul,
.chat-message--ai .chat-bubble ol { padding-left: 1.2rem; margin: 0.4rem 0; }
.chat-message--ai .chat-bubble li { margin: 0.25rem 0; }
.chat-message--ai .chat-bubble code {
  background: var(--bg-primary);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent-gold);
}
.chat-message--ai .chat-bubble p { margin: 0.35rem 0; }
.chat-message--ai .chat-bubble p:first-child { margin-top: 0; }
.chat-message--ai .chat-bubble p:last-child { margin-bottom: 0; }

/* Typing dots */
.chat-typing .chat-bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0.85rem 1.1rem;
  min-width: 52px;
}
.chat-typing .chat-bubble span {
  width: 7px; height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typingBounce 1.2s infinite;
}
.chat-typing .chat-bubble span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing .chat-bubble span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* Action buttons (yes/no handoff) */
.chat-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}
.chat-action-btn {
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.2s;
}
.chat-action-btn--primary { background: var(--accent-gold); color: var(--bg-primary); }
.chat-action-btn--secondary { background: var(--bg-surface-2); color: var(--text-muted); border: 1px solid var(--border-subtle); }
.chat-action-btn:hover { opacity: 0.85; }
.chat-action-btn:disabled { cursor: not-allowed; }

/* Suggestion chips */
.chat-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 99px;
  padding: 0.55rem 1rem;
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  text-align: left;
}
.chat-chip:hover { border-color: var(--accent-gold); background: rgba(212,175,55,0.06); color: var(--accent-gold); }

/* Related follow-up chips (below AI answers) */
.chat-related {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
}
.chat-chip--related {
  background: transparent;
  border: 1px solid rgba(212,175,55,0.25);
  color: var(--accent-gold);
  font-size: 0.76rem;
  padding: 0.3rem 0.65rem;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-family: inherit;
}
.chat-chip--related:hover { background: rgba(212,175,55,0.1); border-color: var(--accent-gold); }
.chat-chip--related:disabled { opacity: 0.4; cursor: default; }

/* Input bar */
.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1rem;
  border-top: 1px solid var(--border-subtle);
  position: relative;
}
.chat-input {
  flex: 1;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  color: var(--text-primary);
  font-size: 0.88rem;
  font-family: var(--font-sans);
  outline: none;
  resize: none;
  transition: border-color 0.2s;
}
.chat-input:focus { border-color: var(--accent-gold); }
.chat-input::placeholder { color: var(--text-muted); }
.chat-send-btn {
  width: 38px; height: 38px;
  background: var(--accent-gold);
  color: var(--bg-primary);
  border: none;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}
.chat-send-btn:hover { background: var(--accent-gold-hover); }
.chat-send-btn svg { width: 16px; height: 16px; }

/* Suggest button + dropdown */
.chat-suggest-area {
  position: relative;
  flex-shrink: 0;
}
.chat-suggest-btn {
  display: none;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 0.4rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.2s, color 0.2s;
}
.chat-suggest-btn:hover { border-color: var(--accent-gold); color: var(--accent-gold); }
.chat-suggest-btn svg { width: 14px; height: 14px; }
.chat-suggest-list {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 240px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 20;
  overflow: hidden;
}
.chat-suggest-list.open { display: block; }
.chat-suggest-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.7rem 1rem;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.chat-suggest-item:last-child { border-bottom: none; }
.chat-suggest-item:hover { background: rgba(212,175,55,0.06); color: var(--text-primary); }

/* ─── FULL PAGE CHAT (contact.html) ──────────── */
.chat-full {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  height: 560px;
  overflow: hidden;
}
.chat-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  flex-shrink: 0;
}
.chat-header-avatar {
  width: 38px; height: 38px;
  background: rgba(212,175,55,0.1);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent-gold);
  flex-shrink: 0;
}
.chat-header-avatar svg { width: 18px; height: 18px; }
.chat-header-info { flex: 1; }
.chat-header-name { font-weight: 700; font-size: 0.92rem; }
.chat-header-status {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.chat-header-status .online-dot {
  width: 6px; height: 6px;
  background: #5ecf80;
  border-radius: 50%;
}
.chat-header-badge {
  background: rgba(212,175,55,0.1);
  border: 1px solid var(--border);
  color: var(--accent-gold);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

/* Empty state */
.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  text-align: center;
}
.chat-empty-icon {
  width: 52px; height: 52px;
  background: rgba(212,175,55,0.1);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent-gold);
  margin-bottom: 1rem;
}
.chat-empty-icon svg { width: 24px; height: 24px; }
.chat-empty h4 { font-size: 0.95rem; margin-bottom: 0.35rem; }
.chat-empty p { font-size: 0.82rem; margin-bottom: 1.5rem; }
.chat-empty-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  max-width: 520px;
}

/* ─── FLOATING WIDGET ─────────────────────────── */
#trident-widget {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
}
.widget-panel {
  width: 360px;
  height: 480px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
  display: none;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  animation: widgetOpen 0.2s ease forwards;
}
.widget-panel.open { display: flex; }
@keyframes widgetOpen {
  from { opacity: 0; transform: scale(0.92) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.widget-panel .chat-header { padding: 0.875rem 1rem; }
.widget-panel .chat-messages { padding: 1rem; gap: 0.6rem; }
.widget-panel .chat-bubble { font-size: 0.83rem; padding: 0.65rem 0.875rem; }
.widget-panel .chat-empty { padding: 1rem; }
.widget-panel .chat-empty-icon { width: 40px; height: 40px; margin-bottom: 0.75rem; }
.widget-panel .chat-empty h4 { font-size: 0.88rem; }
.widget-panel .chat-empty p { font-size: 0.78rem; margin-bottom: 1rem; }
.widget-panel .chat-empty-chips { gap: 0.4rem; }
.widget-panel .chat-chip { font-size: 0.78rem; padding: 0.4rem 0.75rem; }
.widget-panel .chat-input-bar { padding: 0.75rem; }
.widget-panel .chat-input { font-size: 0.82rem; padding: 0.55rem 0.8rem; }

.widget-close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.2s;
}
.widget-close:hover { color: var(--text-primary); }
.widget-close svg { width: 16px; height: 16px; }

.widget-toggle {
  width: 52px; height: 52px;
  background: var(--accent-gold);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(212,175,55,0.35);
  transition: background 0.2s, transform 0.2s;
  position: relative;
  flex-shrink: 0;
}
.widget-toggle:hover { background: var(--accent-gold-hover); transform: scale(1.05); }
.widget-toggle svg { width: 22px; height: 22px; color: var(--bg-primary); }
.widget-toggle-icon--close { display: none; }

.widget-badge {
  position: absolute;
  top: -3px; right: -3px;
  width: 18px; height: 18px;
  background: #e05555;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-primary);
}

/* ─── RESPONSIVE ──────────────────────────────── */
@media (max-width: 480px) {
  #trident-widget { bottom: 1rem; right: 1rem; }
  .widget-panel { width: calc(100vw - 2rem); height: 440px; }
  .chat-full { height: 480px; }
}
