/* ═══════════════════════════════════════════════════════════════
   SENTINEL AI — TACTICAL CHATBOT v2.0
   Military AI boot sequence with typing effects
   ═══════════════════════════════════════════════════════════════ */

/* === CHATBOT TRIGGER (floating button) === */
.chatbot-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid rgba(124, 58, 237, 0.4);
  background: linear-gradient(135deg, rgba(12, 12, 26, 0.95), rgba(30, 17, 69, 0.9));
  backdrop-filter: blur(16px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(168, 85, 247, 0.9);
  box-shadow: 0 4px 24px rgba(124, 58, 237, 0.2),
              0 0 0 1px rgba(124, 58, 237, 0.1);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.3s ease,
              border-color 0.3s ease;
  will-change: transform;
}
.chatbot-trigger:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 32px rgba(124, 58, 237, 0.35),
              0 0 0 1px rgba(124, 58, 237, 0.3);
  border-color: rgba(168, 85, 247, 0.6);
}
.chatbot-trigger svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* Pulse animation */
.chatbot-trigger.pulse::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid rgba(124, 58, 237, 0.3);
  animation: chatbotPulse 3s ease-out infinite;
}
@keyframes chatbotPulse {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* === CHATBOT WINDOW === */
.chatbot-window {
  position: fixed;
  bottom: 92px;
  right: 24px;
  z-index: 9999;
  width: 380px;
  height: 560px;
  border-radius: 16px;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, opacity;
  background: linear-gradient(170deg, #0d0d1a 0%, #080812 50%, #0a0a16 100%);
  border: 1px solid rgba(124, 58, 237, 0.2);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6),
              0 0 1px rgba(124, 58, 237, 0.3),
              inset 0 1px 0 rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;
}
.chatbot-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Subtle scan line effect */
.chatbot-window::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(168, 85, 247, 0.15), transparent);
  animation: scanlineMove 4s linear infinite;
  pointer-events: none;
  z-index: 100;
}
@keyframes scanlineMove {
  0% { top: 0; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* === CHATBOT HEADER === */
.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: rgba(12, 12, 26, 0.95);
  border-bottom: 1px solid rgba(124, 58, 237, 0.12);
  flex-shrink: 0;
}
.chatbot-status {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chatbot-status svg {
  width: 28px;
  height: 28px;
  fill: rgba(168, 85, 247, 0.8);
}
.chatbot-status-info {
  display: flex;
  flex-direction: column;
}
.chatbot-status-title {
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 0.85rem;
  font-weight: 600;
  color: #f0f0f8;
  letter-spacing: 0.5px;
}
.chatbot-status-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.5rem;
  color: #10b981;
  letter-spacing: 1px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 4px;
}
.chatbot-status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #10b981;
  animation: statusDotPulse 2s ease-in-out infinite;
}
@keyframes statusDotPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.7; }
}

.chatbot-close {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid rgba(124, 58, 237, 0.15);
  background: rgba(124, 58, 237, 0.05);
  color: rgba(168, 85, 247, 0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.chatbot-close:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
  transform: rotate(90deg);
}
.chatbot-close svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
}

/* === CHATBOT MESSAGES === */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: rgba(124, 58, 237, 0.2) transparent;
}
.chatbot-messages::-webkit-scrollbar { width: 4px; }
.chatbot-messages::-webkit-scrollbar-track { background: transparent; }
.chatbot-messages::-webkit-scrollbar-thumb { background: rgba(124, 58, 237, 0.2); border-radius: 2px; }

/* === MESSAGE STYLES === */
.message {
  display: flex;
  gap: 10px;
  animation: messageIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
  transform: translateY(8px);
}
@keyframes messageIn {
  to { opacity: 1; transform: translateY(0); }
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(124, 58, 237, 0.1);
  border: 1px solid rgba(124, 58, 237, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.message-avatar svg {
  width: 18px;
  height: 18px;
  fill: rgba(168, 85, 247, 0.7);
}

.message-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.message-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  word-wrap: break-word;
}

/* Bot messages */
.message.bot .message-bubble {
  background: rgba(124, 58, 237, 0.08);
  border: 1px solid rgba(124, 58, 237, 0.12);
  color: #d0d0e0;
  border-bottom-left-radius: 4px;
}

/* Boot sequence messages (terminal style) */
.message.boot .message-bubble {
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.08);
  color: rgba(16, 185, 129, 0.9);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.5px;
  border-radius: 6px;
}

/* Typing text animation (character by character) */
.typing-text {
  display: inline-block;
}
.typing-text::after {
  content: '▊';
  animation: cursorBlink 0.8s step-end infinite;
  color: rgba(16, 185, 129, 0.6);
}
@keyframes cursorBlink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* User messages */
.message.user {
  flex-direction: row-reverse;
}
.message.user .message-avatar {
  background: rgba(6, 182, 212, 0.1);
  border-color: rgba(6, 182, 212, 0.15);
}
.message.user .message-avatar svg {
  fill: rgba(6, 182, 212, 0.7);
}
.message.user .message-content {
  align-items: flex-end;
}
.message.user .message-bubble {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(6, 182, 212, 0.15));
  border: 1px solid rgba(124, 58, 237, 0.2);
  color: #f0f0f8;
  border-bottom-right-radius: 4px;
}

.message-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.55rem;
  color: rgba(96, 96, 128, 0.5);
  letter-spacing: 0.5px;
  padding: 0 4px;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
}
.typing-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(168, 85, 247, 0.5);
  animation: typingBounce 1.4s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* === CHATBOT INPUT === */
.chatbot-input {
  padding: 12px 14px;
  background: rgba(8, 8, 18, 0.95);
  border-top: 1px solid rgba(124, 58, 237, 0.1);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.chatbot-input input {
  flex: 1;
  background: rgba(124, 58, 237, 0.05);
  border: 1px solid rgba(124, 58, 237, 0.12);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
  color: #f0f0f8;
  outline: none;
  transition: border-color 0.2s ease;
}
.chatbot-input input::placeholder { color: rgba(96, 96, 128, 0.5); }
.chatbot-input input:focus { border-color: rgba(124, 58, 237, 0.35); }
.chatbot-input input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chatbot-input button {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(124, 58, 237, 0.2);
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(6, 182, 212, 0.1));
  color: rgba(168, 85, 247, 0.7);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.chatbot-input button:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.25), rgba(6, 182, 212, 0.2));
  border-color: rgba(124, 58, 237, 0.4);
  color: #a855f7;
  transform: scale(1.05);
}
.chatbot-input button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.chatbot-input button svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* === RESPONSIVE === */
@media (max-width: 480px) {
  .chatbot-window {
    right: 8px;
    bottom: 80px;
    width: calc(100vw - 16px);
    height: 70vh;
    max-height: 560px;
    border-radius: 12px;
  }
  .chatbot-trigger {
    bottom: 16px;
    right: 16px;
    width: 50px;
    height: 50px;
  }
  .chatbot-trigger svg {
    width: 20px;
    height: 20px;
  }
}

/* === SPLASH INTRO SCREEN === */
.chatbot-splash {
  position: absolute;
  inset: 0;
  z-index: 200;
  background: linear-gradient(170deg, #0d0d1a 0%, #080812 50%, #0a0a16 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  gap: 24px;
}
.splash-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.splash-logo svg {
  filter: drop-shadow(0 0 12px rgba(139, 92, 246, 0.3));
  animation: splashLogoIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
  transform: scale(0.8);
}
@keyframes splashLogoIn {
  to { opacity: 1; transform: scale(1); }
}
.splash-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  font-weight: 700;
  color: #f0f0f8;
  letter-spacing: 2px;
  margin-top: 4px;
}
.splash-version {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  color: rgba(168, 85, 247, 0.5);
  letter-spacing: 1px;
}
.splash-logs {
  width: 100%;
  max-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.splash-log-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  line-height: 1.4;
}
.splash-log-time {
  color: rgba(128, 128, 160, 0.6);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.splash-log-check {
  color: #10b981;
  flex-shrink: 0;
}
.splash-log-text {
  color: rgba(192, 192, 216, 0.8);
}
.splash-log-final .splash-log-text {
  color: #10b981;
  font-weight: 600;
}
.splash-log-final .splash-log-check {
  color: #10b981;
  text-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}
.splash-status {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  color: rgba(128, 128, 160, 0.5);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  text-align: center;
  min-height: 16px;
  transition: color 0.3s ease;
}
.splash-status-granted {
  color: #10b981 !important;
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
  font-weight: 600;
  letter-spacing: 2px;
}
.splash-progress {
  width: 160px;
  height: 2px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  overflow: hidden;
}
.splash-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #8B5CF6, #3B82F6);
  border-radius: 2px;
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* === TYPING DOTS (for bot thinking) === */
.typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
}
.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(168, 85, 247, 0.5);
  animation: typingBounce 1.4s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* === BOT MESSAGE (new format from JS) === */
.bot-message {
  display: flex;
  gap: 10px;
  animation: messageIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.bot-message .message-icon {
  flex-shrink: 0;
  margin-top: 2px;
}
.bot-message .message-content {
  flex: 1;
  min-width: 0;
}
.bot-message .message-content strong {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: #f0f0f8;
  letter-spacing: 0.3px;
  margin-bottom: 6px;
}
.bot-message .message-content p {
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 0.8rem;
  line-height: 1.6;
  color: #c0c0d8;
  word-wrap: break-word;
}
.bot-message .message-content p strong {
  display: inline;
  font-size: inherit;
  color: #f0f0f8;
  margin-bottom: 0;
}

/* === USER MESSAGE (new format) === */
.user-message {
  display: flex;
  justify-content: flex-end;
  animation: messageIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.user-message .message-content {
  max-width: 80%;
}
.user-message .message-content p {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(6, 182, 212, 0.12));
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: 12px 12px 4px 12px;
  padding: 10px 14px;
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #f0f0f8;
}

/* Boot messages (old format, kept for compat) */
.boot-message {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: rgba(16, 185, 129, 0.8);
  line-height: 1.5;
  letter-spacing: 0.3px;
  white-space: pre-line;
}
.boot-message.final {
  color: #10b981;
  font-weight: 600;
}
