/**
 * J.A.R.V.I.S. AI Assistant - Tony Stark Arc Reactor HUD Styles
 * Cybernetic Sci-Fi Glassmorphism & High-Tech HUD Styling
 */

:root {
  --jarvis-cyan: #00f0ff;
  --jarvis-cyan-glow: rgba(0, 240, 255, 0.45);
  --jarvis-blue: #0284c7;
  --jarvis-gold: #f59e0b;
  --jarvis-gold-glow: rgba(245, 158, 11, 0.4);
  --jarvis-dark: #070d18;
  --jarvis-card: rgba(13, 22, 38, 0.92);
  --jarvis-border: rgba(0, 240, 255, 0.22);
}

/* ═══════════════════════════════════════════════════════════════
   1. FLOATING ARC REACTOR TRIGGER BUTTON
═══════════════════════════════════════════════════════════════ */
.jarvis-floating-trigger {
  position: fixed;
  bottom: 24px;
  right: 90px;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* Arc Reactor Body */
.arc-reactor-btn {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: radial-gradient(circle at center, #0f1c2e 0%, #060b13 85%);
  border: 2px solid rgba(0, 240, 255, 0.5);
  box-shadow: 
    0 0 15px var(--jarvis-cyan-glow),
    0 8px 24px rgba(0, 0, 0, 0.6),
    inset 0 0 12px rgba(0, 240, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  overflow: visible;
  padding: 0;
}

.arc-reactor-btn:hover {
  transform: translateY(-3px) scale(1.08);
  border-color: #00f0ff;
  box-shadow: 
    0 0 28px rgba(0, 240, 255, 0.85),
    0 0 50px rgba(0, 240, 255, 0.35),
    inset 0 0 18px rgba(0, 240, 255, 0.6);
}

/* Rotating Outer Tech Ring */
.arc-ring-outer {
  position: absolute;
  top: -6px;
  left: -6px;
  right: -6px;
  bottom: -6px;
  border-radius: 50%;
  border: 1.5px dashed rgba(0, 240, 255, 0.55);
  animation: arcSpinClockwise 12s linear infinite;
  pointer-events: none;
}

/* Pulsing Middle Energy Ring */
.arc-ring-pulse {
  position: absolute;
  top: -12px;
  left: -12px;
  right: -12px;
  bottom: -12px;
  border-radius: 50%;
  border: 1px solid rgba(0, 240, 255, 0.4);
  animation: arcBreathingPulse 3s ease-in-out infinite;
  pointer-events: none;
}

/* Core Arc Crystal & Coils */
.arc-core-wrap {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: radial-gradient(circle at center, #ffffff 15%, #00f0ff 65%, #0369a1 100%);
  box-shadow: 0 0 16px #00f0ff, inset 0 0 6px #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: arcCoreGlow 2.5s ease-in-out infinite alternate;
}

.arc-core-inner-triangle {
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 12px solid #ffffff;
  filter: drop-shadow(0 0 4px #00f0ff);
  transform: rotate(180deg);
  opacity: 0.9;
}

/* Online Status Dot Badge */
.arc-status-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #070d18;
  box-shadow: 0 0 8px #10b981;
  animation: statusPulse 2s infinite;
}

/* Floating AI Tooltip / Callout */
.jarvis-tooltip-chip {
  position: absolute;
  right: 68px;
  white-space: nowrap;
  background: rgba(7, 13, 24, 0.92);
  border: 1px solid rgba(0, 240, 255, 0.35);
  color: #e0f2fe;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45), 0 0 15px rgba(0, 240, 255, 0.2);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  animation: tooltipFloat 4s ease-in-out infinite;
  transition: opacity 0.3s ease;
}

.jarvis-tooltip-chip i {
  color: #00f0ff;
  font-size: 0.95rem;
}

/* ═══════════════════════════════════════════════════════════════
   2. J.A.R.V.I.S. HOLOGRAPHIC HUD CONSOLE MODAL
═══════════════════════════════════════════════════════════════ */
.jarvis-hud-modal {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 410px;
  max-width: calc(100vw - 32px);
  height: 620px;
  max-height: calc(100vh - 120px);
  background: var(--jarvis-card);
  border: 1px solid var(--jarvis-border);
  border-radius: 22px;
  box-shadow: 
    0 24px 64px rgba(0, 0, 0, 0.7),
    0 0 40px rgba(0, 240, 255, 0.18),
    inset 0 1px 1px rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(24px) scale(0.95);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  color: #f1f5f9;
  font-family: inherit;
}

.jarvis-hud-modal.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Tech Corner Markers */
.jarvis-hud-modal::before,
.jarvis-hud-modal::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: #00f0ff;
  pointer-events: none;
  z-index: 10;
  opacity: 0.75;
}
.jarvis-hud-modal::before {
  top: 10px;
  left: 10px;
  border-top: 2px solid #00f0ff;
  border-left: 2px solid #00f0ff;
}
.jarvis-hud-modal::after {
  bottom: 10px;
  right: 10px;
  border-bottom: 2px solid #00f0ff;
  border-right: 2px solid #00f0ff;
}

/* ─── HUD Topbar Header ─── */
.jarvis-hud-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: rgba(7, 13, 24, 0.85);
  border-bottom: 1px solid rgba(0, 240, 255, 0.18);
  position: relative;
  z-index: 5;
}

.jarvis-hud-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.jarvis-mini-reactor {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 10%, #00f0ff 60%, #0284c7 100%);
  box-shadow: 0 0 12px #00f0ff;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: arcCoreGlow 2s infinite alternate;
}

.jarvis-hud-info h3 {
  font-size: 0.96rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.5px;
}

.jarvis-hud-info h3 span {
  color: #00f0ff;
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.6);
}

.jarvis-hud-status {
  font-size: 0.72rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 1px;
}

.jarvis-hud-status .live-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
  display: inline-block;
  animation: statusPulse 1.8s infinite;
}

/* HUD Controls on Header */
.jarvis-hud-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.jarvis-ctrl-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.95rem;
}

.jarvis-ctrl-btn:hover {
  background: rgba(0, 240, 255, 0.15);
  border-color: #00f0ff;
  color: #ffffff;
  transform: translateY(-1px);
}

.jarvis-ctrl-btn.voice-active {
  color: #00f0ff;
  border-color: rgba(0, 240, 255, 0.5);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
}

/* ─── Audio Waveform Visualizer ─── */
.jarvis-waveform-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 28px;
  background: rgba(3, 7, 18, 0.6);
  border-bottom: 1px solid rgba(0, 240, 255, 0.1);
  padding: 0 16px;
}

.wave-bar {
  width: 3px;
  height: 4px;
  border-radius: 3px;
  background: rgba(0, 240, 255, 0.35);
  transition: height 0.15s ease, background-color 0.2s ease;
}

.jarvis-waveform-bar.speaking .wave-bar {
  background: #00f0ff;
  box-shadow: 0 0 6px #00f0ff;
  animation: waveActive 0.8s ease-in-out infinite alternate;
}

.jarvis-waveform-bar.speaking .wave-bar:nth-child(2n) { animation-delay: 0.1s; }
.jarvis-waveform-bar.speaking .wave-bar:nth-child(3n) { animation-delay: 0.2s; }
.jarvis-waveform-bar.speaking .wave-bar:nth-child(4n) { animation-delay: 0.3s; }
.jarvis-waveform-bar.speaking .wave-bar:nth-child(5n) { animation-delay: 0.4s; }

/* ─── Chat Messages Area ─── */
.jarvis-messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.jarvis-messages-container::-webkit-scrollbar {
  width: 5px;
}
.jarvis-messages-container::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.15);
}
.jarvis-messages-container::-webkit-scrollbar-thumb {
  background: rgba(0, 240, 255, 0.25);
  border-radius: 4px;
}
.jarvis-messages-container::-webkit-scrollbar-thumb:hover {
  background: #00f0ff;
}

/* Message Item Layout */
.jarvis-msg {
  display: flex;
  gap: 10px;
  max-width: 90%;
  animation: msgFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.jarvis-msg.ai-msg {
  align-self: flex-start;
}

.jarvis-msg.user-msg {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.jarvis-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

.jarvis-msg.ai-msg .jarvis-avatar {
  background: radial-gradient(circle, #00f0ff 30%, #0369a1 100%);
  color: #070d18;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
  font-weight: 800;
}

.jarvis-msg.user-msg .jarvis-avatar {
  background: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
}

/* Chat Bubbles */
.jarvis-bubble {
  padding: 12px 15px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.55;
  position: relative;
  word-break: break-word;
}

.jarvis-msg.ai-msg .jarvis-bubble {
  background: rgba(18, 30, 49, 0.85);
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-top-left-radius: 4px;
  color: #e2e8f0;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
}

.jarvis-msg.user-msg .jarvis-bubble {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border-top-right-radius: 4px;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.3);
}

/* AI Executive Summary Highlight Box */
.jarvis-summary-box {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(0, 240, 255, 0.08);
  border-left: 3px solid #00f0ff;
  font-size: 0.82rem;
  color: #bae6fd;
  display: flex;
  align-items: flex-start;
  gap: 7px;
}

.jarvis-summary-box i {
  color: #00f0ff;
  font-size: 1rem;
  margin-top: 2px;
  flex-shrink: 0;
}

/* AI Action CTA Button */
.jarvis-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 6px 14px;
  border-radius: 20px;
  background: linear-gradient(135deg, #00f0ff 0%, #0284c7 100%);
  color: #070d18 !important;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
  transition: all 0.25s;
}

.jarvis-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.7);
  color: #000000 !important;
}

/* Typing Hologram Scanner Indicator */
.jarvis-typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: rgba(18, 30, 49, 0.85);
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-radius: 12px;
  color: #00f0ff;
  font-size: 0.78rem;
  font-weight: 500;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.2);
}

.jarvis-typing-dots {
  display: flex;
  gap: 3px;
}

.jarvis-typing-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #00f0ff;
  animation: typingDot 1.4s infinite ease-in-out both;
}
.jarvis-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.jarvis-typing-dots span:nth-child(2) { animation-delay: -0.16s; }

/* ─── Quick Prompts Chips Bar ─── */
.jarvis-prompts-bar {
  padding: 8px 14px;
  background: rgba(7, 13, 24, 0.7);
  border-top: 1px solid rgba(0, 240, 255, 0.12);
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
}

.jarvis-prompts-bar::-webkit-scrollbar {
  height: 3px;
}
.jarvis-prompts-bar::-webkit-scrollbar-thumb {
  background: rgba(0, 240, 255, 0.3);
  border-radius: 3px;
}

.jarvis-prompt-chip {
  padding: 5px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(0, 240, 255, 0.22);
  color: #bae6fd;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  user-select: none;
}

.jarvis-prompt-chip:hover {
  background: rgba(0, 240, 255, 0.15);
  border-color: #00f0ff;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
  transform: translateY(-1px);
}

/* ─── Bottom Chat Input Dock ─── */
.jarvis-input-dock {
  padding: 12px 14px;
  background: rgba(7, 13, 24, 0.95);
  border-top: 1px solid rgba(0, 240, 255, 0.18);
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

/* Microphone Button (Speech-to-Text) */
.jarvis-mic-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(0, 240, 255, 0.3);
  color: #00f0ff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.15rem;
  transition: all 0.25s;
  flex-shrink: 0;
  position: relative;
}

.jarvis-mic-btn:hover {
  background: rgba(0, 240, 255, 0.2);
  border-color: #00f0ff;
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.5);
  transform: scale(1.05);
}

/* Active Recording State for Mic */
.jarvis-mic-btn.recording {
  background: #ef4444 !important;
  border-color: #f87171 !important;
  color: #ffffff !important;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.8) !important;
  animation: micPulse 1.2s infinite;
}

/* Text Input Field */
.jarvis-text-input {
  flex: 1;
  background: rgba(18, 30, 49, 0.9);
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: 20px;
  padding: 10px 16px;
  color: #f8fafc;
  font-size: 0.86rem;
  outline: none;
  transition: all 0.25s;
}

.jarvis-text-input::placeholder {
  color: #64748b;
  font-size: 0.82rem;
}

.jarvis-text-input:focus {
  border-color: #00f0ff;
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.35);
  background: rgba(24, 38, 60, 0.95);
}

/* Send Button */
.jarvis-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00f0ff 0%, #0284c7 100%);
  border: none;
  color: #070d18;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.25s;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
}

.jarvis-send-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.8);
}

.jarvis-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* ═══════════════════════════════════════════════════════════════
   3. ANIMATION KEYFRAMES
═══════════════════════════════════════════════════════════════ */
@keyframes arcSpinClockwise {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes arcBreathingPulse {
  0% { transform: scale(1); opacity: 0.35; }
  50% { transform: scale(1.15); opacity: 0.75; }
  100% { transform: scale(1); opacity: 0.35; }
}

@keyframes arcCoreGlow {
  0% { box-shadow: 0 0 10px #00f0ff, inset 0 0 4px #ffffff; }
  100% { box-shadow: 0 0 22px #00f0ff, inset 0 0 8px #ffffff; }
}

@keyframes statusPulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes tooltipFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes waveActive {
  0% { height: 4px; }
  100% { height: 20px; }
}

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

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

@keyframes micPulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* ═══════════════════════════════════════════════════════════════
   4. RESPONSIVE MOBILE TWEAKS
═══════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .jarvis-floating-trigger {
    bottom: 20px;
    right: 84px;
  }
  
  .arc-reactor-btn {
    width: 52px;
    height: 52px;
  }

  .jarvis-tooltip-chip {
    display: none; /* Hide floating text on mobile to avoid overcrowding */
  }

  .jarvis-hud-modal {
    right: 12px;
    left: 12px;
    bottom: 84px;
    width: auto;
    max-width: none;
    height: 75vh;
    max-height: 580px;
    border-radius: 18px;
  }
}
