/* ═══════════════════════════════════════════════════════════════════════
   ORION AI — CONSOLA JARVIS C-LEVEL ULTRA-PRO
   Holographic HUD | Executive BI | Premium Glassmorphism
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── FONTS ─────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;700&display=swap');

/* ─── CSS VARIABLES ─────────────────────────────────────────────────── */
:root {
  --j-bg-deep:       #f8fafc;
  --j-bg-surface:    #ffffff;
  --j-bg-panel:      #ffffff;
  --j-bg-card:       #f1f5f9;
  --j-bg-glass:      rgba(255, 255, 255, 0.95);
  --j-border:        rgba(0, 0, 0, 0.08);
  --j-border-glow:   rgba(99, 102, 241, 0.3);
  --j-cyan:          #0ea5e9;
  --j-cyan-dim:      #0284c7;
  --j-cyan-muted:    rgba(14, 165, 233, 0.1);
  --j-indigo:        #6366f1;
  --j-violet:        #8b5cf6;
  --j-emerald:       #10b981;
  --j-rose:          #f43f5e;
  --j-amber:         #f59e0b;
  --j-gold:          #eab308;
  --j-text-primary:  #1e293b;
  --j-text-secondary:#475569;
  --j-text-muted:    #94a3b8;
  --j-scanline-alpha:0; /* Disabled scanlines */
  --j-transition:    cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
  --j-bg-deep:       #020408;
  --j-bg-surface:    #050d1a;
  --j-bg-panel:      #081121;
  --j-bg-card:       #0d1b2e;
  --j-bg-glass:      rgba(8, 17, 33, 0.85);
  --j-border:        rgba(56, 182, 255, 0.12);
  --j-border-glow:   rgba(56, 182, 255, 0.35);
  --j-text-primary:  #e2e8f0;
  --j-text-secondary:#94a3b8;
  --j-text-muted:    #475569;
}

/* ─── DRAWER CONTAINER ──────────────────────────────────────────────── */
#jarvis-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 440px;
  height: 100vh;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  background: var(--j-bg-surface);
  border-right: 1px solid var(--j-border);
  box-shadow: 20px 0 50px rgba(0,0,0,0.1);
  transform: translate3d(-100%, 0, 0);
  transition: transform 0.45s var(--j-transition), opacity 0.3s ease;
  opacity: 0;
  visibility: hidden;
  font-family: 'Outfit', sans-serif;
  overflow: hidden;
}

#jarvis-drawer.open {
  transform: translate3d(0, 0, 0);
  opacity: 1;
  visibility: visible;
}

/* Holographic scanline overlay - DISABLED */
#jarvis-drawer::before {
  display: none;
}

/* Right border accent (moved from left) */
#jarvis-drawer::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 3px;
  height: 100%;
  background: linear-gradient(
    180deg,
    var(--j-indigo) 0%,
    var(--j-cyan) 100%
  );
  opacity: 0.8;
  z-index: 1;
}

/* ─── SETTINGS MODAL ────────────────────────────────────────────────── */
.j-settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: j-fade-in 0.2s ease;
}

.j-settings-modal {
  background: var(--j-bg-surface);
  border: 1px solid var(--j-border);
  border-radius: 16px;
  width: 90%;
  max-width: 360px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
  overflow: hidden;
  font-family: 'Outfit', sans-serif;
}

.j-settings-header {
  padding: 16px 20px;
  background: var(--j-bg-deep);
  border-bottom: 1px solid var(--j-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.j-settings-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--j-text-primary);
}

.j-settings-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.j-setting-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.j-setting-item label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--j-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.j-setting-item select {
  width: 100%;
  padding: 10px;
  background: var(--j-bg-deep);
  border: 1px solid var(--j-border);
  border-radius: 8px;
  color: var(--j-text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
}

.j-header-btn {
  background: transparent;
  border: none;
  color: var(--j-text-muted);
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.j-header-btn:hover {
  background: var(--j-bg-deep);
  color: var(--j-indigo);
}

@keyframes j-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ─── HEADER HUD ────────────────────────────────────────────────────── */
#jarvis-header {
  position: relative;
  z-index: 10;
  padding: 0 20px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--j-bg-surface);
  border-bottom: 1px solid var(--j-border);
  flex-shrink: 0;
}

/* Corner brackets decoration */
#jarvis-header::before,
#jarvis-header::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
}
#jarvis-header::before {
  top: 8px;
  left: 8px;
  border-top: 1.5px solid var(--j-cyan);
  border-left: 1.5px solid var(--j-cyan);
  opacity: 0.7;
}
#jarvis-header::after {
  top: 8px;
  right: 8px;
  border-top: 1.5px solid var(--j-cyan);
  border-right: 1.5px solid var(--j-cyan);
  opacity: 0.7;
}

.j-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.j-logo-ring {
  position: relative;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.j-logo-ring svg {
  position: absolute;
  inset: 0;
  animation: j-spin 8s linear infinite;
}

.j-logo-ring .j-logo-icon {
  position: absolute;
  inset: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  animation: none;
  background: radial-gradient(circle, rgba(56,182,255,0.2) 0%, transparent 70%);
  border-radius: 50%;
}

@keyframes j-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.j-header-titles {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.j-header-name {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--j-cyan);
  text-transform: uppercase;
  line-height: 1;
  text-shadow: 0 0 20px rgba(56, 182, 255, 0.5);
}

.j-header-sub {
  font-size: 0.6rem;
  color: var(--j-text-muted);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-family: 'JetBrains Mono', monospace;
  margin-top: 2px;
}

/* ─── LOGO & BRANDING ───────────────────────────────────────────────── */
.j-logo-pro {
  width: 32px;
  height: 32px;
  color: var(--j-indigo);
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.4));
}

.j-header-name {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--j-text-primary);
  line-height: 1.1;
}

.j-header-sub {
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--j-indigo);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.8;
}

.j-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.j-header-status {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 20px;
  padding: 3px 10px;
}

.j-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--j-emerald);
  box-shadow: 0 0 8px var(--j-emerald);
  animation: j-pulse-dot 2s ease-in-out infinite;
}

@keyframes j-pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.7); }
}

.j-status-text {
  font-size: 0.6rem;
  color: var(--j-emerald);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}

.j-close-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--j-border);
  color: var(--j-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1rem;
  line-height: 1;
}

.j-close-btn:hover {
  background: rgba(244, 63, 94, 0.15);
  border-color: var(--j-rose);
  color: var(--j-rose);
}

/* ─── SPHERE VISUALIZER ─────────────────────────────────────────────── */
#jarvis-sphere-zone {
  position: relative;
  flex-shrink: 0;
  height: 0;
  overflow: hidden;
  background: radial-gradient(circle at center, var(--j-bg-card) 0%, var(--j-bg-deep) 100%);
  transition: height 0.45s var(--j-transition), opacity 0.3s ease;
  opacity: 0;
  z-index: 5;
}

#jarvis-sphere-zone.active {
  height: 200px;
  opacity: 1;
}

#jarvis-sphere-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#jarvis-sphere-glow {
  position: absolute;
  width: 140px;
  height: 140px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: none;
  filter: blur(20px);
  background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
  transition: background 0.5s;
}

.j-sphere-hud {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 20px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(0deg, var(--j-bg-surface) 0%, transparent 100%);
  pointer-events: none;
  z-index: 3;
}

#jarvis-state-label {
  font-size: 0.62rem;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--j-cyan);
  text-shadow: 0 0 12px rgba(56, 182, 255, 0.6);
  font-weight: 700;
  transition: all 0.3s;
}

.j-sphere-metrics {
  display: flex;
  gap: 16px;
}

.j-sphere-metric {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.j-sphere-metric-val {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--j-cyan-dim);
  font-family: 'JetBrains Mono', monospace;
}

.j-sphere-metric-lbl {
  font-size: 0.48rem;
  color: var(--j-text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ─── CONTEXT BAR ───────────────────────────────────────────────────── */
#jarvis-context-bar {
  position: relative;
  z-index: 5;
  flex-shrink: 0;
  padding: 8px 16px;
  background: rgba(56, 182, 255, 0.04);
  border-bottom: 1px solid var(--j-border);
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
}

#jarvis-context-bar .j-ctx-icon {
  width: 16px;
  height: 16px;
  color: var(--j-cyan-dim);
  flex-shrink: 0;
}

#jarvis-context-text {
  font-size: 0.72rem;
  color: var(--j-text-muted);
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── QUICK BI CARDS ROW ────────────────────────────────────────────── */
#jarvis-bi-strip {
  flex-shrink: 0;
  z-index: 5;
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  background: var(--j-bg-deep);
  border-bottom: 1px solid var(--j-border);
  overflow-x: auto;
  scrollbar-width: none;
}
#jarvis-bi-strip::-webkit-scrollbar { display: none; }

.j-bi-card {
  flex-shrink: 0;
  min-width: 96px;
  background: var(--j-bg-surface);
  border: 1px solid var(--j-border);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.j-bi-card::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--j-accent-color, var(--j-cyan));
  opacity: 0.6;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s;
}

.j-bi-card:hover::before {
  transform: scaleX(1);
}

.j-bi-card:hover {
  border-color: var(--j-indigo);
  background: #fff;
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.05);
}

.j-bi-card-value {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--j-text-primary);
  line-height: 1;
  margin-bottom: 3px;
  font-family: 'JetBrains Mono', monospace;
}

.j-bi-card-label {
  font-size: 0.58rem;
  color: var(--j-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1.2;
}

.j-bi-card-delta {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 4px;
  font-size: 0.6rem;
  font-weight: 700;
}

.j-bi-card-delta.positive { color: var(--j-emerald); }
.j-bi-card-delta.negative { color: var(--j-rose); }
.j-bi-card-delta.neutral  { color: var(--j-text-muted); }

/* ─── MESSAGES FEED ─────────────────────────────────────────────────── */
#jarvis-feed {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 5;
  position: relative;
  scroll-behavior: smooth;
  background: var(--j-bg-surface);
}

#jarvis-feed::-webkit-scrollbar {
  width: 4px;
}
#jarvis-feed::-webkit-scrollbar-track {
  background: transparent;
}
#jarvis-feed::-webkit-scrollbar-thumb {
  background: rgba(56, 182, 255, 0.2);
  border-radius: 2px;
}
#jarvis-feed::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 182, 255, 0.4);
}

/* ─── MESSAGE BUBBLES ───────────────────────────────────────────────── */
.j-msg {
  display: flex;
  flex-direction: column;
  animation: j-msg-in 0.35s var(--j-transition) forwards;
  opacity: 0;
  transform: translateY(10px);
}

@keyframes j-msg-in {
  to { opacity: 1; transform: translateY(0); }
}

.j-msg.user {
  align-items: flex-end;
}

.j-msg.ai {
  align-items: flex-start;
}

.j-msg-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
  padding: 0 4px;
}

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

.j-msg-avatar {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.j-msg.ai .j-msg-avatar {
  background: var(--j-bg-card);
  border: 1px solid var(--j-indigo);
  color: var(--j-indigo);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.5rem;
}

.j-msg.user .j-msg-avatar {
  background: linear-gradient(135deg, #4338ca, #6366f1);
  border: none;
  color: white;
}

.j-msg-sender {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.j-msg.ai .j-msg-sender  { color: var(--j-text-secondary); }
.j-msg.user .j-msg-sender { color: var(--j-indigo); }

.j-msg-time {
  font-size: 0.55rem;
  color: var(--j-text-muted);
  font-family: 'JetBrains Mono', monospace;
  margin-left: auto;
}

.j-msg.user .j-msg-time {
  margin-left: 0;
  margin-right: auto;
}

/* Bubble */
.j-bubble {
  max-width: 95%;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 0.83rem;
  line-height: 1.65;
  position: relative;
}

.j-msg.user .j-bubble {
  background: linear-gradient(135deg, #4338ca 0%, #6366f1 100%);
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.j-msg.ai .j-bubble {
  background: var(--j-bg-card);
  border: 1px solid var(--j-border);
  color: var(--j-text-primary);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* Thinking typing cursor */
.j-typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--j-cyan);
  margin-left: 2px;
  vertical-align: middle;
  animation: j-blink 0.8s step-end infinite;
}

@keyframes j-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ─── MARKDOWN RENDERING IN BUBBLES ─────────────────────────────────── */
.j-bubble h1, .j-bubble h2, .j-bubble h3 {
  color: var(--j-cyan);
  font-weight: 800;
  margin: 12px 0 6px;
  letter-spacing: -0.02em;
}
.j-bubble h1 { font-size: 1.05rem; border-bottom: 1px solid var(--j-border); padding-bottom: 4px; }
.j-bubble h2 { font-size: 0.95rem; }
.j-bubble h3 { font-size: 0.87rem; color: var(--j-indigo); }

.j-bubble p {
  margin: 0 0 8px;
}
.j-bubble p:last-child { margin-bottom: 0; }

.j-bubble ul, .j-bubble ol {
  padding-left: 1.2em;
  margin: 6px 0;
}

.j-bubble li {
  margin-bottom: 3px;
  color: var(--j-text-secondary);
}

.j-bubble strong {
  color: var(--j-text-primary);
  font-weight: 700;
}

.j-bubble em {
  color: var(--j-cyan-dim);
  font-style: italic;
}

.j-bubble code {
  background: rgba(56, 182, 255, 0.1);
  border: 1px solid rgba(56, 182, 255, 0.2);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--j-cyan);
}

.j-bubble pre {
  background: rgba(2, 4, 8, 0.8);
  border: 1px solid var(--j-border);
  border-radius: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  margin: 8px 0;
}

.j-bubble pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.75rem;
  color: var(--j-text-primary);
}

/* GFM-style tables */
.j-bubble table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 0.77rem;
  border-radius: 8px;
  overflow: hidden;
}

.j-bubble thead {
  background: rgba(56, 182, 255, 0.08);
}

.j-bubble th {
  padding: 7px 10px;
  text-align: left;
  font-weight: 700;
  color: var(--j-cyan);
  border-bottom: 1px solid var(--j-border-glow);
  letter-spacing: 0.05em;
  font-size: 0.7rem;
  text-transform: uppercase;
}

.j-bubble td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(56, 182, 255, 0.06);
  color: var(--j-text-secondary);
}

.j-bubble tr:last-child td {
  border-bottom: none;
}

.j-bubble tr:hover td {
  background: rgba(56, 182, 255, 0.04);
  color: var(--j-text-primary);
}

/* GFM Alert blocks */
.j-alert {
  border-radius: 8px;
  padding: 10px 12px;
  margin: 8px 0;
  border-left: 3px solid;
  font-size: 0.78rem;
}

.j-alert.note {
  background: rgba(56, 182, 255, 0.06);
  border-color: var(--j-cyan);
  color: var(--j-cyan-dim);
}

.j-alert.tip {
  background: rgba(16, 185, 129, 0.06);
  border-color: var(--j-emerald);
  color: rgba(16, 185, 129, 0.8);
}

.j-alert.warning {
  background: rgba(245, 158, 11, 0.06);
  border-color: var(--j-amber);
  color: rgba(245, 158, 11, 0.8);
}

.j-alert.important {
  background: rgba(167, 139, 250, 0.06);
  border-color: var(--j-violet);
  color: var(--j-violet);
}

.j-alert.caution {
  background: rgba(244, 63, 94, 0.06);
  border-color: var(--j-rose);
  color: rgba(244, 63, 94, 0.8);
}

.j-alert-title {
  font-weight: 800;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Horizontal rule */
.j-bubble hr {
  border: none;
  border-top: 1px solid var(--j-border);
  margin: 10px 0;
}

/* ─── SUGGESTIONS / QUICK ACTIONS ───────────────────────────────────── */
#jarvis-suggestions {
  flex-shrink: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 14px;
  background: var(--j-bg-surface);
  border-top: 1px solid var(--j-border);
  min-height: 0;
}

.j-suggestion-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  background: var(--j-bg-card);
  border: 1px solid var(--j-border);
  border-radius: 20px;
  color: var(--j-text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.j-suggestion-chip:hover {
  background: var(--j-bg-deep);
  border-color: var(--j-indigo);
  color: var(--j-indigo);
  transform: translateY(-1px);
}

/* ─── INPUT BAR ─────────────────────────────────────────────────────── */
#jarvis-input-bar {
  flex-shrink: 0;
  z-index: 5;
  background: var(--j-bg-surface);
  border-top: 1px solid var(--j-border);
  padding: 12px 14px;
}

.j-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

#jarvis-text-input {
  flex: 1;
  background: var(--j-bg-deep);
  border: 1px solid var(--j-border);
  border-radius: 12px;
  padding: 11px 14px;
  color: var(--j-text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 0.84rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  caret-color: var(--j-indigo);
}

#jarvis-text-input::placeholder {
  color: var(--j-text-muted);
  font-size: 0.8rem;
}

#jarvis-text-input:focus {
  border-color: rgba(56, 182, 255, 0.4);
  box-shadow: 0 0 0 3px rgba(56, 182, 255, 0.1);
}

/* Icon action buttons */
.j-action-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--j-border);
  color: var(--j-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.j-action-btn:hover {
  border-color: var(--j-border-glow);
  color: var(--j-cyan);
  background: rgba(56, 182, 255, 0.06);
}

.j-action-btn.active-tts {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.4);
  color: var(--j-emerald);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}

.j-action-btn.listening {
  background: rgba(244, 63, 94, 0.12) !important;
  border-color: var(--j-rose) !important;
  color: var(--j-rose) !important;
  box-shadow: 0 0 16px rgba(244, 63, 94, 0.35) !important;
  animation: j-pulse-listening 1.2s ease-in-out infinite !important;
}

@keyframes j-pulse-listening {
  0%, 100% { box-shadow: 0 0 16px rgba(244, 63, 94, 0.35); }
  50%       { box-shadow: 0 0 28px rgba(244, 63, 94, 0.6); }
}

.j-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #4338ca, #6366f1);
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.j-send-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.45);
  background: linear-gradient(135deg, #4f46e5, #818cf8);
}

.j-send-btn:active {
  transform: translateY(0);
}

/* Status strip below input */
.j-input-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 7px;
  padding: 0 2px;
}

.j-voice-mode-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--j-text-muted);
  font-family: 'JetBrains Mono', monospace;
  transition: color 0.3s;
}

.j-voice-mode-badge.active {
  color: var(--j-emerald);
}

.j-voice-waveform {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 14px;
}

.j-wave-bar {
  width: 2.5px;
  background: var(--j-text-muted);
  border-radius: 2px;
  height: 4px;
  transition: background 0.3s;
}

.j-voice-mode-badge.active .j-wave-bar {
  background: var(--j-emerald);
  animation: j-wave-anim 0.8s ease-in-out infinite;
}

.j-wave-bar:nth-child(2) { animation-delay: 0.1s; }
.j-wave-bar:nth-child(3) { animation-delay: 0.2s; }
.j-wave-bar:nth-child(4) { animation-delay: 0.15s; }
.j-wave-bar:nth-child(5) { animation-delay: 0.05s; }

@keyframes j-wave-anim {
  0%, 100% { height: 3px; }
  50%       { height: 12px; }
}

.j-upload-btn-small {
  font-size: 0.6rem;
  color: var(--j-text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: color 0.2s;
}

.j-upload-btn-small:hover {
  color: var(--j-cyan);
}

/* ─── FAB BUTTON ────────────────────────────────────────────────────── */
#jarvis-fab {
  position: fixed;
  bottom: 28px;
  left: 28px;
  z-index: 9990;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--j-bg-surface);
  border: 1px solid var(--j-border);
  box-shadow: 0 10px 25px rgba(0,0,0,0.1), 0 0 0 4px rgba(99, 102, 241, 0.05);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  color: var(--j-indigo);
  overflow: visible;
}

.j-fab-icon {
  width: 28px;
  height: 28px;
  transition: transform 0.4s var(--j-transition);
  z-index: 2;
}

#jarvis-fab:hover {
  transform: scale(1.08) rotate(5deg);
  border-color: var(--j-indigo);
  color: var(--j-cyan);
  box-shadow: 0 15px 35px rgba(99, 102, 241, 0.2);
}

#jarvis-fab:hover .j-fab-icon {
  transform: rotate(-10deg) scale(1.1);
}

#jarvis-fab::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--j-indigo), var(--j-cyan));
  z-index: -1;
  opacity: 0;
  transition: opacity 0.4s;
}

#jarvis-fab:hover::before {
  opacity: 0.15;
}

  position: absolute;
  inset: -1px;
  border-radius: 17px;
  background: conic-gradient(from 0deg, var(--j-cyan), var(--j-indigo), var(--j-violet), var(--j-cyan));
  opacity: 0;
  transition: opacity 0.3s;
  z-index: -1;
}

#jarvis-fab:hover::before {
  opacity: 0.5;
  animation: j-fab-rotate 2s linear infinite;
}

@keyframes j-fab-rotate {
  to { transform: rotate(360deg); }
}

#jarvis-fab:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(56, 182, 255, 0.3);
}

#jarvis-fab svg {
  transition: transform 0.3s;
  filter: drop-shadow(0 0 6px rgba(56, 182, 255, 0.6));
}

#jarvis-fab:hover svg {
  transform: scale(1.1);
}

/* FAB pulse ring */
#jarvis-fab::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 20px;
  border: 1px solid rgba(56, 182, 255, 0.3);
  animation: j-fab-pulse 3s ease-in-out infinite;
}

@keyframes j-fab-pulse {
  0%   { transform: scale(1); opacity: 0.5; }
  50%  { transform: scale(1.15); opacity: 0; }
  100% { transform: scale(1); opacity: 0.5; }
}

/* ─── LOADING DOTS ──────────────────────────────────────────────────── */
.j-thinking-dots {
  display: inline-flex;
  gap: 4px;
  padding: 10px 14px;
}

.j-thinking-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--j-cyan-dim);
  animation: j-dot-bounce 1.2s ease-in-out infinite;
}

.j-thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.j-thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes j-dot-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-8px); }
}

/* ─── RESPONSIVE ────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #jarvis-drawer { width: 100vw; }
}

/* ─── UTILITY ───────────────────────────────────────────────────────── */
.j-hidden { display: none !important; }

/* ─── ENTITY ACTION CARDS ───────────────────────────────────────────── */
.j-entity-card {
  border: 1px solid var(--entity-color, var(--j-cyan));
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  overflow: hidden;
  animation: j-entity-in 0.4s var(--j-transition) forwards;
}

@keyframes j-entity-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.j-entity-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px 10px;
  background: linear-gradient(135deg, rgba(var(--entity-color, #38b6ff), 0.1) 0%, transparent 100%);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.j-entity-icon-wrap {
  font-size: 1.8rem;
  line-height: 1;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
}

.j-entity-card-info {
  flex: 1;
  min-width: 0;
}

.j-entity-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--entity-color, var(--j-cyan));
  line-height: 1.2;
  margin-bottom: 2px;
}

.j-entity-desc {
  font-size: 0.75rem;
  color: var(--j-text-secondary);
  line-height: 1.4;
}

.j-entity-fields {
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.j-entity-fields-label {
  font-size: 0.62rem;
  color: var(--j-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}

.j-entity-fields-val {
  font-size: 0.76rem;
  color: var(--j-text-secondary);
  line-height: 1.5;
}

.j-entity-open-btn {
  width: 100%;
  padding: 11px 14px;
  background: linear-gradient(135deg, var(--entity-color, #38b6ff), color-mix(in srgb, var(--entity-color, #38b6ff) 70%, #000));
  border: none;
  color: white;
  font-family: 'Outfit', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  letter-spacing: 0.02em;
  transition: all 0.2s;
}

.j-entity-open-btn:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.j-entity-open-btn:active {
  transform: translateY(0);
  filter: brightness(0.95);
}

/* ─── SCROLLBAR GLOBAL ──────────────────────────────────────────────── */
#jarvis-drawer * {
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 182, 255, 0.15) transparent;
}

