/* SN Security AI Terminal - Hacker Theme */

.sn-chatbot-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: 'Courier New', 'Share Tech Mono', monospace;
  font-size: 14px;
}

.sn-chatbot-button {
  padding: 11px 20px;
  min-width: auto;
  height: auto;
  border-radius: 8px;
  background: #0a0a0a;
  border: 2px solid rgba(0, 255, 0, 0.9);
  color: #00ff00;
  font-size: 13px;
  font-weight: 700;
  font-family: 'Orbitron', 'Courier New', 'Share Tech Mono', monospace;
  letter-spacing: 1.5px;
  cursor: grab;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  overflow: visible;
  box-shadow: 
    0 0 8px rgba(0, 255, 0, 0.4),
    0 0 16px rgba(0, 255, 0, 0.2),
    inset 0 0 8px rgba(0, 255, 0, 0.05);
  transition: box-shadow 180ms ease, transform 120ms ease, border-color 180ms ease;
  text-shadow: 0 0 8px rgba(0, 255, 0, 0.7);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  will-change: box-shadow, transform;
}

@keyframes sn-terminal-glow {
  0%, 100% {
    box-shadow: 
      0 0 8px rgba(0, 255, 0, 0.4),
      0 0 16px rgba(0, 255, 0, 0.2),
      inset 0 0 8px rgba(0, 255, 0, 0.05);
    text-shadow: 0 0 8px rgba(0, 255, 0, 0.7);
  }
  50% {
    box-shadow: 
      0 0 12px rgba(0, 255, 0, 0.6),
      0 0 20px rgba(0, 255, 0, 0.3),
      inset 0 0 10px rgba(0, 255, 0, 0.08);
    text-shadow: 0 0 12px rgba(0, 255, 0, 0.9);
  }
}

@keyframes sn-terminal-pulse {
  0% {
    box-shadow: 
      0 0 8px rgba(0, 255, 0, 0.4),
      0 0 16px rgba(0, 255, 0, 0.2),
      inset 0 0 8px rgba(0, 255, 0, 0.05);
  }
  50% {
    box-shadow: 
      0 0 16px rgba(0, 255, 0, 0.7),
      0 0 28px rgba(0, 255, 0, 0.35),
      0 0 40px rgba(0, 255, 0, 0.15),
      inset 0 0 12px rgba(0, 255, 0, 0.12);
  }
  100% {
    box-shadow: 
      0 0 8px rgba(0, 255, 0, 0.4),
      0 0 16px rgba(0, 255, 0, 0.2),
      inset 0 0 8px rgba(0, 255, 0, 0.05);
  }
}

.sn-chatbot-button:hover {
  box-shadow: 
    0 0 14px rgba(0, 255, 0, 0.8),
    0 0 24px rgba(0, 255, 0, 0.4),
    0 0 36px rgba(0, 255, 0, 0.15),
    inset 0 0 10px rgba(0, 255, 0, 0.1);
  transform: translateY(-2px);
  color: #00ff00;
  border-color: rgba(0, 255, 0, 1);
  text-shadow: 0 0 14px rgba(0, 255, 0, 0.95);
}

.sn-chatbot-button:active {
  animation: sn-terminal-pulse 300ms ease-out 1;
  transform: translateY(0) scale(0.98);
}

.sn-chatbot-button.active {
  background: rgba(0, 255, 0, 0.02);
  color: #00ff00;
  border-color: rgba(0, 255, 0, 1);
  text-shadow: 0 0 14px rgba(0, 255, 0, 0.95);
}

@keyframes sn-flicker {
  0% { box-shadow: 0 0 30px rgba(0,255,0,0.6); transform: translateY(0); }
  30% { box-shadow: 0 0 6px rgba(0,255,0,0.25); transform: translateY(1px); }
  60% { box-shadow: 0 0 22px rgba(0,255,0,0.5); transform: translateY(0); }
  100% { box-shadow: 0 0 12px rgba(0,255,0,0.35); transform: translateY(0); }
}

.sn-chatbot-window {
  position: fixed;
  bottom: auto;
  right: auto;
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
  width: 640px;
  height: 500px;
  background: #000000;
  border: 2px solid #00ff00;
  border-radius: 4px;
  display: none;
  flex-direction: column;
  box-shadow: 0 0 30px rgba(0, 255, 0, 0.3), inset 0 0 20px rgba(0, 255, 0, 0.05), 0 0 60px rgba(0, 255, 0, 0.1);
  backdrop-filter: blur(2px);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

/* Mobile full-screen fixed layout with 100dvh support */
@supports (height: 100dvh) {
  .sn-chatbot-window.mobile {
    height: 100dvh;
    max-height: 100dvh;
  }
}

.sn-chatbot-window.open {
  display: flex;
  animation: slideUp 0.3s ease-out;
}

.sn-chatbot-window.mobile {
  inset: 0;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100dvh;
  border: none;
  border-radius: 0;
  box-shadow: none;
  transform: none !important;
  animation: none;
  display: flex;
  flex-direction: column;
  max-height: 100dvh;
  overflow: hidden;
}

.sn-chatbot-window.mobile.open {
  display: flex;
  animation: slideUp 0.3s ease-out;
}

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

.sn-chatbot-header {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(0, 255, 0, 0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #000000;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  font-family: 'Courier New', 'Share Tech Mono', monospace;
}

.sn-chatbot-window.mobile .sn-chatbot-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  cursor: default;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 12px max(12px, env(safe-area-inset-left));
  background: #000000;
  border-bottom: 1px solid rgba(0, 255, 0, 0.3);
  flex-shrink: 0;
  z-index: 1001;
}

.sn-chatbot-header h3 {
  margin: 0;
  color: #00ff00;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  text-shadow: 0 0 8px rgba(0, 255, 0, 0.6);
  font-family: 'Courier New', 'Share Tech Mono', monospace;
}

.sn-chatbot-close {
  background: none;
  border: none;
  color: #00ff00;
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.sn-chatbot-close:hover {
  color: #ff0000;
  text-shadow: 0 0 10px rgba(255, 0, 0, 0.6);
}

.sn-chatbot-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: #000000;
  -webkit-overflow-scrolling: touch;
  font-family: 'Courier New', 'Share Tech Mono', monospace;
  font-size: 13px;
}

.sn-chatbot-window.mobile .sn-chatbot-messages {
  flex: 1;
  margin-top: 0;
  margin-bottom: 0;
  padding: 16px;
  padding-top: 52px !important;
  padding-bottom: 100px;
  overflow-y: scroll;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  will-change: scroll-position;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.sn-chatbot-messages::-webkit-scrollbar {
  width: 6px;
}

.sn-chatbot-messages::-webkit-scrollbar-track {
  background: rgba(0, 255, 0, 0.1);
  border-radius: 2px;
}

.sn-chatbot-messages::-webkit-scrollbar-thumb {
  background: #00ff00;
  border-radius: 2px;
}

.sn-chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: #00dd00;
}

.sn-message {
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
  animation: fadeIn 0.3s ease-out;
  color: #00ff00;
  text-shadow: 0 0 4px rgba(0, 255, 0, 0.4);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.sn-message.user {
  align-items: flex-start;
}

.sn-message.bot {
  align-items: flex-start;
}

.sn-message-timestamp {
  font-size: 10px;
  color: rgba(0, 255, 0, 0.5);
  margin-top: 0;
  font-family: 'Courier New', 'Share Tech Mono', monospace;
  letter-spacing: 0;
  display: inline;
  margin-right: 8px;
}

.sn-message.user .sn-message-timestamp {
  margin-right: 8px;
  color: rgba(0, 255, 0, 0.5);
}

.sn-message-bubble {
  max-width: 100%;
  padding: 0;
  border-radius: 0;
  line-height: 1.5;
  word-wrap: break-word;
  font-size: 13px;
  word-break: break-word;
  background: none;
  border: none;
  color: #00ff00;
  text-shadow: 0 0 4px rgba(0, 255, 0, 0.4);
  font-family: 'Courier New', 'Share Tech Mono', monospace;
}

.sn-message.user .sn-message-bubble {
  background: none;
  color: #ff3b3b !important;
  text-shadow: 0 0 6px rgba(255, 59, 59, 0.55);
  font-weight: normal;
  border: none;
  margin-right: 0;
}

.sn-message.bot .sn-message-bubble {
  background: none;
  color: #00ff00 !important;
  text-shadow: 0 0 6px rgba(0, 255, 0, 0.45);
  border: none;
  margin-left: 0;
}

.sn-message.bot .sn-message-bubble code {
  background: rgba(0, 255, 0, 0.1);
  padding: 2px 4px;
  border-radius: 0;
  font-family: 'Courier New', 'Share Tech Mono', monospace;
  color: #ffff00;
}

.sn-chatbot-input-area {
  padding: 12px 16px;
  border-top: 1px solid rgba(0, 255, 0, 0.3);
  display: flex;
  gap: 8px;
  background: #000000;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.sn-chatbot-window.mobile .sn-chatbot-input-area {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  padding: 12px max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  border-radius: 0;
  margin: 0;
  border-top: 1px solid rgba(0, 255, 0, 0.3);
  flex-shrink: 0;
  z-index: 1001;
  background: #000000;
}

.sn-chatbot-input {
  flex: 1;
  background: #000000;
  border: 1px solid rgba(0, 255, 0, 0.4);
  color: #ff3b3b;
  caret-color: #ff3b3b;
  padding: 10px 12px;
  border-radius: 2px;
  font-family: 'Courier New', 'Share Tech Mono', monospace;
  font-size: 13px;
  transition: all 0.2s;
  outline: none;
  text-shadow: 0 0 4px rgba(255, 59, 59, 0.3);
}

.sn-chatbot-input::placeholder {
  color: rgba(255, 59, 59, 0.4);
}

.sn-chatbot-input:focus {
  border-color: #ff3b3b;
  background: #000000;
  box-shadow: 0 0 12px rgba(255, 59, 59, 0.4), inset 0 0 6px rgba(255, 59, 59, 0.05);
}

.sn-chatbot-send {
  background: #000000;
  border: 1px solid #00ff00;
  color: #00ff00;
  padding: 10px 14px;
  border-radius: 2px;
  cursor: pointer;
  font-weight: 700;
  font-size: 12px;
  transition: all 0.2s;
  font-family: 'Courier New', 'Share Tech Mono', monospace;
  min-width: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 0 6px rgba(0, 255, 0, 0.5);
  letter-spacing: 1px;
}

.sn-chatbot-send:hover {
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
  transform: scale(1.05);
}

.sn-chatbot-send:active {
  transform: scale(0.95);
}

.sn-chatbot-send:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.sn-typing-indicator {
  display: flex;
  gap: 2px;
  align-items: center;
}

.sn-typing-dot {
  width: 4px;
  height: 4px;
  border-radius: 0;
  background: #00ff00;
  animation: typing 1.4s infinite;
  text-shadow: 0 0 6px rgba(0, 255, 0, 0.5);
}

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

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

@keyframes typing {
  0%, 60%, 100% {
    opacity: 0.3;
  }
  30% {
    opacity: 1;
  }
}

/* Terminal cursor blink */
.sn-terminal-cursor {
  display: inline-block;
  width: 8px;
  height: 1em;
  background: #00ff00;
  margin-left: 2px;
  animation: sn-blink 0.8s infinite;
  text-shadow: 0 0 6px rgba(0, 255, 0, 0.6);
}

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

/* Mobile responsive */
@media (max-width: 480px) {
  html.sn-chatbot-active {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100dvh !important;
  }

  body.sn-chatbot-active {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100dvh !important;
  }

  .sn-chatbot-button {
    padding: 12px 24px !important;
    min-width: auto !important;
    height: auto !important;
    font-size: 13px !important;
    border-radius: 8px !important;
    letter-spacing: 1.5px !important;
    border: 2px solid rgba(0, 255, 0, 0.95) !important;
    cursor: grab !important;
    animation: none !important;
    position: fixed !important;
    bottom: max(20px, env(safe-area-inset-bottom)) !important;
    right: max(20px, env(safe-area-inset-right)) !important;
    z-index: 9998 !important;
  }

  .sn-chatbot-button:hover {
    animation: none !important;
  }

  .sn-chatbot-window.mobile {
    width: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
  }

  .sn-chatbot-messages {
    margin-top: 0 !important;
    margin-bottom: 80px !important;
    max-height: none !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
    will-change: auto;
  }

  .sn-message {
    max-width: 100%;
  }

  .sn-message-bubble {
    max-width: 100%;
    font-size: 12px;
  }

  .sn-message-timestamp {
    font-size: 9px;
    margin-top: 0;
  }

  .sn-chatbot-input {
    font-size: 16px !important;
  }

  .sn-chatbot-header h3 {
    font-size: 13px;
  }
}

/* Prevent scrolling on body when modal is open */
body.sn-chatbot-active {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}

html.sn-chatbot-active {
  overflow: hidden;
  height: 100%;
}

/* Prevent scrolling while keyboard or chat modal is active */
html.sn-keyboard-open,
body.sn-keyboard-open,
html.sn-chatbot-active,
body.sn-chatbot-active {
  overflow: hidden !important;
  position: fixed !important;
  width: 100% !important;
  height: 100dvh !important;
  top: 0 !important;
  left: 0 !important;
}

/* Prevent scrolling on body when dragging on mobile */
body.sn-dragging {
  overflow: hidden;
  touch-action: none;
}

/* ✅ User message red, bot message green */
.sn-message.user .sn-message-timestamp {
  color: rgba(255, 59, 59, 0.6) !important;
}

