/*
 * answerr - Chat Viewport, Message Stream & Telemetry HUD Stylesheet
 * Centered conversational interface (ChatGPT / OpenWebUI / Gemini style)
 */

.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
  overflow: hidden;
  background: transparent;
}

/* Top Navigation Bar */
.chat-topbar {
  height: 60px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  z-index: 10;
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.model-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.model-sparkle {
  color: var(--cyan);
}

.wevv-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--emerald);
  font-family: var(--font-mono);
}

.lang-btn {
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.lang-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 12px var(--cyan-glow);
}

/* Main Message Scroll Area */
.chat-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  scroll-behavior: smooth;
  scroll-padding-bottom: 240px;
}

.chat-messages {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding-bottom: 240px;
}

/* Welcome Hero Screen */
.welcome-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin: auto;
  padding: 1.25rem 1rem;
  max-width: 720px;
  animation: fadeIn 0.4s ease;
}

.welcome-logo-pulse {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: radial-gradient(circle at 30% 30%, #38bdf8, #818cf8 60%, #c084fc);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 25px var(--cyan-glow);
  margin-bottom: 1rem;
  animation: pulse-wave 4s infinite ease-in-out;
}

@keyframes pulse-wave {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 12px var(--cyan-glow)); }
  50% { transform: scale(1.04); filter: drop-shadow(0 0 22px rgba(129, 140, 248, 0.45)); }
}

.welcome-logo-pulse img {
  width: 38px;
  height: 38px;
}

.welcome-title {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 60%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-subtitle {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 1.4rem;
  max-width: 580px;
}

.welcome-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.8rem;
}

.welcome-tag {
  background: rgba(15, 20, 34, 0.85);
  border: 1px solid var(--border-subtle);
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: var(--transition);
}

.welcome-tag:hover {
  border-color: var(--cyan);
  color: var(--text-main);
  transform: translateY(-1px);
}

.welcome-tag.highlight {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: var(--emerald);
}

.welcome-tag.cyan {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.35);
  color: var(--cyan);
}

/* Preset Cards Grid */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.75rem;
  width: 100%;
}

.preset-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  position: relative;
  overflow: hidden;
}

.preset-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0;
  transition: var(--transition);
}

.preset-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.preset-card:hover::before {
  opacity: 1;
}

.preset-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.preset-icon {
  font-size: 1.05rem;
}

.preset-category {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.preset-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

.preset-prompt-snippet {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Message Rows */
.message-row {
  display: flex;
  gap: 1rem;
  animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.message-row.user .message-avatar {
  background: linear-gradient(135deg, #6366f1, #818cf8);
  color: #ffffff;
}

.message-row.assistant .message-avatar {
  background: radial-gradient(circle at 30% 30%, #38bdf8, #6366f1);
  color: #ffffff;
  box-shadow: 0 0 12px var(--cyan-glow);
}

.message-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 100%;
}

.message-row.user .message-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
  color: var(--text-main);
  font-size: 0.96rem;
  line-height: 1.6;
  align-self: flex-start;
  max-width: 90%;
}

/* Pipeline Status Stepper */
.pipeline-status {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
  width: fit-content;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* wevv System-1 Telemetry HUD Card */
.wevv-hud-card {
  background: linear-gradient(145deg, #090e1a 0%, #0d1324 100%);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: 0 12px 32px -10px rgba(0, 0, 0, 0.8), 0 0 20px rgba(56, 189, 248, 0.08);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.hud-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.75rem;
}

.hud-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.hud-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.telemetry-pill {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.telemetry-pill.fast {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: var(--emerald);
}

.telemetry-pill.zero-mem {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: var(--cyan);
}

.hud-content-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 1.25rem;
  align-items: center;
}

@media (max-width: 600px) {
  .hud-content-grid {
    grid-template-columns: 1fr;
  }
}

.hud-canvas-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.fractal-canvas {
  width: 130px;
  height: 130px;
  border-radius: 12px;
  border: 1px solid var(--border-accent);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.2);
}

.canvas-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.hud-metrics {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.verdict-banner {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.verdict-banner.approved {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: var(--emerald);
}

.verdict-banner.denied {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: var(--rose);
}

.verdict-banner.routed {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: var(--cyan);
}

.verdict-banner.scored {
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.4);
  color: var(--amber);
}

.verdict-main {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.verdict-confidence {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  font-weight: 600;
}

.hud-quadrant-bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
}

.q-bar-col {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.q-progress {
  height: 6px;
  background: var(--bg-card);
  border-radius: 999px;
  overflow: hidden;
}

.q-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--indigo));
  border-radius: 999px;
  transition: width 0.5s ease;
}

/* Smart If-Statement Execution Snippet */
.hud-smart-code {
  background: rgba(7, 9, 14, 0.95);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.25rem;
}

.smart-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--cyan);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

.smart-code-snippet {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: #e2e8f0;
  word-break: break-all;
  line-height: 1.4;
}

.smart-code-snippet span.kw { color: #f43f5e; font-weight: 600; }
.smart-code-snippet span.fn { color: #38bdf8; }
.smart-code-snippet span.str { color: #a7f3d0; }

.btn-seed-download {
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: var(--transition);
}

.btn-seed-download:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(56, 189, 248, 0.08);
}

/* System-2 Interpretation Box */
.gemini-commentary-card {
  background: linear-gradient(145deg, rgba(17, 24, 39, 0.88) 0%, rgba(10, 15, 26, 0.96) 100%);
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: var(--radius-md);
  padding: 1.35rem 1.5rem;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-main);
  position: relative;
  box-shadow: 0 12px 32px -10px rgba(0, 0, 0, 0.7), 0 0 24px rgba(56, 189, 248, 0.05);
  backdrop-filter: blur(16px);
}

.gemini-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.9rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.gemini-header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.gemini-model-tag {
  color: #a5b4fc;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 6px;
  text-transform: none !important;
  letter-spacing: 0.03em;
}

.gemini-text {
  white-space: pre-wrap;
}

.gemini-text strong {
  color: #ffffff;
  font-weight: 600;
}

/* wevv Input Specification Box (Converted Question & State) */
.wevv-spec-box {
  background: rgba(5, 8, 14, 0.92);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.15rem;
  margin-bottom: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4) inset;
}

.spec-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--cyan);
  font-family: var(--font-mono);
  letter-spacing: 0.03em;
}

.spec-type-tag {
  background: rgba(129, 140, 248, 0.15);
  border: 1px solid rgba(129, 140, 248, 0.35);
  color: #a5b4fc;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 600;
  text-transform: none !important;
  letter-spacing: 0.02em;
}

.math-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.45rem;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 5px;
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  vertical-align: middle;
}

.zero-hallucination-banner {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-left: 3.5px solid var(--emerald);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.84rem;
  color: #f1f5f9;
  line-height: 1.5;
}

.zero-hallucination-banner .zh-shield {
  font-size: 1.2rem;
  flex-shrink: 0;
  filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.45));
}

.spec-state-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.spec-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 0.2rem 0.5rem;
  font-size: 0.74rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.spec-chip span.k { color: var(--text-muted); }
.spec-chip span.v { color: var(--text-main); font-weight: 600; }

.spec-details {
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
}

.spec-details summary {
  outline: none;
  user-select: none;
  color: var(--cyan);
  transition: var(--transition);
}

.spec-details summary:hover {
  text-decoration: underline;
}

.spec-json-pre {
  margin-top: 0.4rem;
  padding: 0.6rem;
  background: #05070b;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #94a3b8;
  overflow-x: auto;
  max-height: 140px;
}

/* Chat Input Bar Area */
.chat-input-wrapper {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.2rem 1.5rem 1.4rem;
  background: linear-gradient(to top, var(--bg-app) 78%, rgba(7, 9, 14, 0.88) 50%, transparent);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 20;
  pointer-events: none;
}

.chat-input-box {
  width: 100%;
  max-width: 860px;
  background: rgba(18, 24, 41, 0.92);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1.15rem;
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.6), 0 0 16px rgba(56, 189, 248, 0.06);
  backdrop-filter: blur(20px);
  transition: var(--transition);
  pointer-events: auto;
}

.chat-input-box:focus-within {
  border-color: var(--cyan);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.75), 0 0 25px rgba(56, 189, 248, 0.28);
}

.chat-textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  line-height: 1.5;
  max-height: 160px;
  min-height: 24px;
  resize: none;
  outline: none;
}

.chat-textarea::placeholder {
  color: var(--text-muted);
}

.btn-send {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  border: none;
  color: #07090e;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.btn-send:hover:not(:disabled) {
  filter: brightness(1.12);
  transform: scale(1.06);
  box-shadow: 0 0 20px var(--cyan-glow);
}

.btn-send:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  filter: grayscale(1);
}

.chat-disclaimer {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 0.55rem;
  text-align: center;
  pointer-events: auto;
}

.chat-disclaimer a {
  color: var(--cyan);
  text-decoration: none;
  font-weight: 500;
}

.chat-disclaimer a:hover {
  text-decoration: underline;
}
