/* AICyclone v2 — Chat Widget & Shared Utilities */

/* ── Shared: scroll reveal ────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Shared: nav state classes ────────────────────────────────────── */
.v2-nav-open { display: flex !important; flex-direction: column; }
.v2-nav-scrolled { border-bottom-color: rgba(143, 245, 255, 0.4) !important; }
.v2-nav-active { color: #8ff5ff !important; border-bottom: 2px solid #8ff5ff; }

/* ── Chat card buttons ────────────────────────────────────────────── */
.chat-btn-row {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.chat-btn {
  flex: 1;
  padding: 0.52rem 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 0;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.chat-btn[data-mode="text"] {
  background: rgba(143, 245, 255, 0.07);
  border: 1px solid rgba(143, 245, 255, 0.2);
  color: #8ff5ff;
}
.chat-btn[data-mode="text"]:hover {
  background: rgba(143, 245, 255, 0.14);
  border-color: #8ff5ff;
  box-shadow: 4px 4px 0px #005e64;
}
.chat-btn[data-mode="voice"] {
  background: rgba(0, 238, 252, 0.07);
  border: 1px solid rgba(0, 238, 252, 0.2);
  color: #00eefc;
}
.chat-btn[data-mode="voice"]:hover {
  background: rgba(0, 238, 252, 0.14);
  border-color: #00eefc;
  box-shadow: 4px 4px 0px #005e64;
}

/* ── Chat overlay & modal ─────────────────────────────────────────── */
#chat-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
#chat-modal {
  background: #131313;
  border: 1px solid #484847;
  border-radius: 0;
  box-shadow: 4px 4px 0px #005e64, 0 24px 64px rgba(0, 0, 0, 0.6);
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  overflow: hidden;
}

/* ── Chat header ──────────────────────────────────────────────────── */
.chat-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid #484847;
  flex-shrink: 0;
}
.chat-persona-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
  min-width: 0;
}
.chat-avatar-icon {
  width: 36px;
  height: 36px;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
#chat-persona-name {
  font-weight: 700;
  font-size: 0.95rem;
  font-family: 'Space Grotesk', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #ffffff;
}
.chat-mode-tabs {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
}
.chat-tab {
  padding: 0.3rem 0.7rem;
  background: transparent;
  border: 1px solid #484847;
  border-radius: 0;
  font-size: 0.875rem;
  font-weight: 700;
  color: #adaaaa;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Space Grotesk', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.chat-tab.active {
  background: #8ff5ff;
  color: #005d63;
  border-color: #8ff5ff;
  box-shadow: 2px 2px 0px #005e64;
  font-weight: 700;
}
.chat-tab:not(.active):hover {
  border-color: #8ff5ff;
  color: #8ff5ff;
  background: rgba(143, 245, 255, 0.08);
}
.chat-close {
  background: transparent;
  border: none;
  color: #adaaaa;
  font-size: 1rem;
  cursor: pointer;
  padding: 0.25rem 0.4rem;
  border-radius: 0;
  flex-shrink: 0;
  transition: color 0.2s;
}
.chat-close:hover { color: #ffffff; }

/* ── Chat body / text panel ───────────────────────────────────────── */
.chat-body { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
#chat-text-panel { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(143, 245, 255, 0.2) transparent;
}
.msg {
  max-width: 82%;
  padding: 0.6rem 0.9rem;
  border-radius: 0;
  font-size: 0.88rem;
  line-height: 1.55;
  word-break: break-word;
  font-family: 'Inter', sans-serif;
}
.msg-persona {
  align-self: flex-start;
  background: rgba(143, 245, 255, 0.06);
  border: 1px solid rgba(143, 245, 255, 0.15);
  border-bottom-left-radius: 0;
  color: #ffffff;
}
.msg-user {
  align-self: flex-end;
  background: rgba(0, 238, 252, 0.12);
  border: 1px solid rgba(0, 238, 252, 0.2);
  border-bottom-right-radius: 0;
  color: #ffffff;
}
.chat-input-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid #484847;
  flex-shrink: 0;
}
#chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid #484847;
  border-radius: 0;
  padding: 0.55rem 0.8rem;
  font-size: 0.88rem;
  color: #ffffff;
  resize: none;
  font-family: 'Inter', sans-serif;
  line-height: 1.4;
  transition: border-color 0.2s;
}
#chat-input:focus { outline: none; border-color: #8ff5ff; }
#chat-send {
  background: #8ff5ff;
  border: none;
  border-radius: 0;
  width: 40px;
  font-size: 1rem;
  color: #005d63;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.2s, transform 0.15s;
}
#chat-send:hover { opacity: 0.9; transform: translate(-2px, -2px); }

/* ── Voice panel ──────────────────────────────────────────────────── */
#chat-voice-panel {
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}
.voice-log {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(143, 245, 255, 0.2) transparent;
}
.voice-interim {
  min-height: 1.4rem;
  padding: 0 1rem 0.25rem;
  font-size: 0.875rem;
  color: #adaaaa;
  font-style: italic;
  text-align: center;
  font-family: 'Inter', sans-serif;
}
.voice-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1rem 1.5rem;
  border-top: 1px solid #484847;
  flex-shrink: 0;
}
.voice-status {
  font-size: 0.875rem;
  color: #adaaaa;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-family: 'Space Grotesk', sans-serif;
}
#voice-mic {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8ff5ff 0%, #00deec 100%);
  border: none;
  font-size: 1.7rem;
  cursor: pointer;
  box-shadow: 0 0 0 0 rgba(143, 245, 255, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}
#voice-mic:hover { transform: scale(1.06); }
#voice-mic.listening { animation: mic-pulse 1.2s ease-in-out infinite; }
#voice-mic.speaking {
  background: linear-gradient(135deg, #ff8c00, #ff4d4d);
  animation: mic-pulse-speak 1s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(143, 245, 255, 0.45); }
  50%       { box-shadow: 0 0 0 18px rgba(143, 245, 255, 0); }
}
@keyframes mic-pulse-speak {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 140, 0, 0.45); }
  50%       { box-shadow: 0 0 0 18px rgba(255, 140, 0, 0); }
}

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #chat-modal {
    max-width: 100%;
    max-height: 90vh;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
  }
  #chat-overlay { align-items: flex-end; padding: 0; }
}
