/* ===================================================
   ELIZA MODAL — eliza-modal.css
   Neuro-retro terminal aesthetic — Brainwave-JCP 2026
   =================================================== */

/* ---------- TRIGGER BUTTON (FAB) ---------- */
.eliza-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9000;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b7ff0, #3ecfa0);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 24px rgba(139,127,240,0.45);
  transition: transform .25s ease, box-shadow .25s ease;
  outline: none;
}

.eliza-fab:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 8px 32px rgba(139,127,240,0.55);
}

.eliza-fab:active { transform: scale(0.96); }

.eliza-fab svg {
  width: 26px;
  height: 26px;
  color: #fff;
}

.eliza-fab-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(62,207,160,0.4);
  animation: elizaPulse 2.5s ease-in-out infinite;
}

@keyframes elizaPulse {
  0%, 100% { transform: scale(1);    opacity: .6; }
  50%       { transform: scale(1.18); opacity: 0; }
}

.eliza-fab-label {
  position: absolute;
  bottom: 68px;
  right: 0;
  background: rgba(13,15,20,0.92);
  border: 1px solid rgba(255,255,255,0.1);
  color: #e8eaf0;
  font-size: 12px;
  font-family: 'DM Mono', monospace;
  padding: 5px 12px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}

.eliza-fab:hover .eliza-fab-label { opacity: 1; }

/* ---------- OVERLAY ---------- */
.eliza-overlay {
  position: fixed;
  inset: 0;
  z-index: 9100;
  background: rgba(5,7,12,0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}

.eliza-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* ---------- MODAL WINDOW ---------- */
.eliza-modal {
  width: 420px;
  max-width: calc(100vw - 40px);
  height: 620px;
  max-height: calc(100vh - 120px);
  background: #0d0f14;
  border: 1px solid rgba(139,127,240,0.35);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(62,207,160,0.08),
    0 24px 80px rgba(0,0,0,0.7),
    0 0 60px rgba(139,127,240,0.12);
  transform: translateY(30px) scale(0.97);
  transition: transform .35s cubic-bezier(.22,.97,.58,1);
}

.eliza-overlay.open .eliza-modal {
  transform: translateY(0) scale(1);
}

/* ---------- HEADER ---------- */
.eliza-header {
  background: linear-gradient(135deg, rgba(139,127,240,0.15), rgba(62,207,160,0.08));
  border-bottom: 1px solid rgba(255,255,255,0.07);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.eliza-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b7ff0, #3ecfa0);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

.eliza-avatar svg { width: 18px; height: 18px; color: #fff; }

.eliza-status-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 9px;
  height: 9px;
  background: #3ecfa0;
  border-radius: 50%;
  border: 2px solid #0d0f14;
}

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

.eliza-name {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  color: #e8eaf0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.eliza-badge {
  font-size: 9px;
  background: rgba(62,207,160,0.15);
  color: #3ecfa0;
  border: 1px solid rgba(62,207,160,0.25);
  padding: 1px 7px;
  border-radius: 999px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.eliza-subtitle {
  font-size: 11px;
  color: #5a6080;
  font-family: 'DM Mono', monospace;
  margin-top: 2px;
}

.eliza-header-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.eliza-icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: #9aa0b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
  font-size: 13px;
}

.eliza-icon-btn:hover { background: rgba(255,255,255,0.1); color: #e8eaf0; }
.eliza-icon-btn svg { width: 14px; height: 14px; }

/* ---------- LANG SELECTOR ---------- */
.eliza-lang-bar {
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.eliza-lang-bar::-webkit-scrollbar { display: none; }

.lang-label {
  font-size: 10px;
  font-family: 'DM Mono', monospace;
  color: #5a6080;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.lang-btn {
  font-size: 10px;
  font-family: 'DM Mono', monospace;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.1);
  background: transparent;
  color: #9aa0b8;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all .15s;
}

.lang-btn:hover { border-color: rgba(139,127,240,0.4); color: #8b7ff0; }
.lang-btn.active { background: rgba(139,127,240,0.15); border-color: rgba(139,127,240,0.4); color: #8b7ff0; }

/* ---------- MESSAGES AREA ---------- */
.eliza-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(139,127,240,0.2) transparent;
}

.eliza-messages::-webkit-scrollbar { width: 4px; }
.eliza-messages::-webkit-scrollbar-thumb { background: rgba(139,127,240,0.2); border-radius: 2px; }

/* System message */
.msg-system {
  text-align: center;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: #3a3f58;
  letter-spacing: 0.04em;
  padding: 4px 0;
}

/* Message row */
.msg-row {
  display: flex;
  gap: 9px;
  align-items: flex-end;
}

.msg-row.user { flex-direction: row-reverse; }

.msg-avatar-sm {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-family: 'DM Mono', monospace;
  font-weight: 500;
}

.msg-row.eliza .msg-avatar-sm {
  background: linear-gradient(135deg, #8b7ff0, #3ecfa0);
  color: #fff;
}

.msg-row.user .msg-avatar-sm {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  color: #9aa0b8;
}

.msg-bubble {
  max-width: 78%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.65;
}

.msg-row.eliza .msg-bubble {
  background: #171b25;
  border: 1px solid rgba(255,255,255,0.07);
  border-bottom-left-radius: 4px;
  color: #c8cce0;
}

.msg-row.user .msg-bubble {
  background: rgba(139,127,240,0.18);
  border: 1px solid rgba(139,127,240,0.25);
  border-bottom-right-radius: 4px;
  color: #e8eaf0;
}

.msg-bubble p { margin-bottom: .45rem; }
.msg-bubble p:last-child { margin-bottom: 0; }

.msg-bubble ol, .msg-bubble ul {
  padding-left: 1.2rem;
  margin: .4rem 0;
}

.msg-bubble li { margin-bottom: .3rem; }

.msg-bubble strong { color: #e8eaf0; font-weight: 500; }

/* Suggested questions */
.msg-suggestions {
  margin-top: .75rem;
  padding-top: .6rem;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sugg-btn {
  background: rgba(62,207,160,0.06);
  border: 1px solid rgba(62,207,160,0.18);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 11px;
  color: #3ecfa0;
  cursor: pointer;
  text-align: left;
  font-family: 'Outfit', sans-serif;
  transition: background .15s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sugg-btn::before { content: '↗'; font-size: 10px; opacity: .7; }
.sugg-btn:hover { background: rgba(62,207,160,0.12); }

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 4px 0;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #5a6080;
  animation: typingDot 1.2s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: .2s; }
.typing-dot:nth-child(3) { animation-delay: .4s; }

@keyframes typingDot {
  0%, 80%, 100% { transform: scale(.7); opacity: .4; }
  40%           { transform: scale(1);  opacity: 1; }
}

/* ---------- INPUT AREA ---------- */
.eliza-input-area {
  border-top: 1px solid rgba(255,255,255,0.07);
  padding: 12px 14px;
  flex-shrink: 0;
  background: rgba(0,0,0,0.2);
}

.eliza-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.eliza-textarea {
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  color: #e8eaf0;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  padding: 9px 12px;
  resize: none;
  min-height: 40px;
  max-height: 100px;
  line-height: 1.5;
  outline: none;
  transition: border-color .2s;
  overflow-y: auto;
}

.eliza-textarea:focus { border-color: rgba(139,127,240,0.4); }
.eliza-textarea::placeholder { color: #3a3f58; }

.eliza-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #8b7ff0, #3ecfa0);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform .15s, opacity .15s;
}

.eliza-send-btn:hover { transform: scale(1.05); }
.eliza-send-btn:active { transform: scale(0.95); }
.eliza-send-btn:disabled { opacity: .35; cursor: default; }
.eliza-send-btn svg { width: 16px; height: 16px; color: #fff; }

.eliza-mic-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .15s;
  color: #9aa0b8;
}

.eliza-mic-btn:hover { background: rgba(240,112,96,0.1); border-color: rgba(240,112,96,0.3); color: #f07060; }
.eliza-mic-btn.recording { background: rgba(240,112,96,0.15); border-color: rgba(240,112,96,0.5); color: #f07060; animation: micPulse 1s ease infinite; }
.eliza-mic-btn svg { width: 15px; height: 15px; }

@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240,112,96,0.3); }
  50%       { box-shadow: 0 0 0 8px rgba(240,112,96,0); }
}

/* Voice reading indicator */
.eliza-voice-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  height: 20px;
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}

.eliza-voice-bar.active {
  opacity: 1;
  pointer-events: all;
}

.voice-wave {
  display: flex;
  gap: 2px;
  align-items: center;
}

.voice-bar-item {
  width: 3px;
  height: 14px;
  background: #3ecfa0;
  border-radius: 2px;
  animation: voiceWave 0.8s ease-in-out infinite;
}

.voice-bar-item:nth-child(2) { animation-delay: .1s; height: 20px; }
.voice-bar-item:nth-child(3) { animation-delay: .2s; height: 10px; }
.voice-bar-item:nth-child(4) { animation-delay: .3s; height: 18px; }
.voice-bar-item:nth-child(5) { animation-delay: .15s; height: 12px; }

@keyframes voiceWave {
  0%, 100% { transform: scaleY(.5); }
  50%       { transform: scaleY(1); }
}

.voice-stop-btn {
  font-size: 10px;
  font-family: 'DM Mono', monospace;
  color: #5a6080;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color .15s;
}

.voice-stop-btn:hover { color: #f07060; }

/* ---------- FOOTER CREDITS ---------- */
.eliza-footer {
  text-align: center;
  padding: 6px;
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  color: #2a2f44;
  border-top: 1px solid rgba(255,255,255,0.04);
  flex-shrink: 0;
}

/* ---------- RESPONSIVE MOBILE ---------- */
@media (max-width: 480px) {
  .eliza-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .eliza-modal {
    width: 100%;
    max-width: 100%;
    height: 92vh;
    max-height: 92vh;
    border-radius: 18px 18px 0 0;
    border-bottom: none;
    transform: translateY(100%);
  }

  .eliza-overlay.open .eliza-modal {
    transform: translateY(0);
  }

  .eliza-fab {
    bottom: 16px;
    right: 16px;
  }
}
