/* ═══════════════════════════════════════════
   ARCHSEC LABS — AI Chatbot Styles
   ═══════════════════════════════════════════ */

/* ── Floating Trigger Button ── */
#archbot-trigger {
  position: fixed;
  left: 24px;
  bottom: 32px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0066cc, #6366f1);
  border: 1px solid #6366f166;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9997;
  box-shadow: 0 0 0 0 #6366f180, 0 8px 32px #0066cc80;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
  backdrop-filter: blur(10px);
}

#archbot-trigger:hover {
  transform: scale(1.12);
  box-shadow: 0 0 0 0 #6366f180, 0 0 40px #6366f199, 0 8px 32px #0066cc99;
}

#archbot-trigger svg {
  transition: transform 0.4s ease, opacity 0.3s ease;
}

#archbot-trigger.open svg.icon-bot {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
  position: absolute;
}

#archbot-trigger.open svg.icon-close {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

#archbot-trigger svg.icon-close {
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
  position: absolute;
  transition: transform 0.4s ease, opacity 0.3s ease;
}

/* Pulse rings */
.archbot-pulse {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid #6366f199;
  animation: arcPulse 2.2s ease-out infinite;
  pointer-events: none;
}

.archbot-pulse:nth-child(2) {
  animation-delay: 0.7s;
  inset: -12px;
  border-color: #0066cc4d;
}

@keyframes arcPulse {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }

  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

#archbot-trigger.open .archbot-pulse {
  animation: none;
  opacity: 0;
}

/* Tooltip */
.archbot-tooltip {
  position: absolute;
  left: 74px;
  background: #0f0f14eb;
  backdrop-filter: blur(12px);
  border: 1px solid #6366f14d;
  color: #e2e8f0;
  font-size: 0.75rem;
  font-family: 'DM Sans', system-ui, sans-serif;
  padding: 6px 12px;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.2s, transform 0.2s;
  letter-spacing: 0.3px;
}

#archbot-trigger:hover .archbot-tooltip {
  opacity: 1;
  transform: translateX(0);
}

/* Notification dot */
.archbot-notif {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #4ade80;
  border: 2px solid #0a0a0f;
  animation: notifBlink 2s ease-in-out infinite;
}

@keyframes notifBlink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

/* ── Overlay Scrim ── */
#archbot-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#archbot-overlay.open {
  display: block;
  opacity: 1;
}

/* ── Chat Panel ── */
#archbot-panel {
  position: fixed;
  left: 100px;
  bottom: 32px;
  width: 420px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  z-index: 9999;
  border-radius: 20px;
  overflow: hidden;

  /* Glassmorphism */
  background: #0c0c12e0;
  backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid #6366f140;
  box-shadow:
    0 0 0 1px #ffffff0a,
    0 32px 80px #000000b3,
    0 0 60px #6366f11f,
    inset 0 1px 0 #ffffff0f;

  /* Hidden by default */
  transform: scale(0.88) translateY(20px) translateX(-10px);
  opacity: 0;
  pointer-events: none;
  transform-origin: bottom left;
  transition: transform 0.35s cubic-bezier(0.34, 1.36, 0.64, 1), opacity 0.3s ease;
}

#archbot-panel.open {
  transform: scale(1) translateY(0) translateX(0);
  opacity: 1;
  pointer-events: all;
}

/* Animated border glow */
#archbot-panel::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 20px;
  background: linear-gradient(135deg, #6366f166, #0066cc33, #6366f166);
  background-size: 200% 200%;
  animation: borderGlow 4s linear infinite;
  z-index: -1;
  pointer-events: none;
}

@keyframes borderGlow {

  0%,
  100% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }
}

/* ── Header ── */
.archbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(135deg, #f00 0%, #8b00ff 100%);
  border-bottom: 1px solid #ffffff14;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

/* Scan line effect on header */
.archbot-header::after {
  content: '';
  position: absolute;
  top: -100%;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #ffffff00, transparent);
  animation: scanLine 3s linear infinite;
}

@keyframes scanLine {
  0% {
    top: -2px;
  }

  100% {
    top: 100%;
  }
}

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

.archbot-orb {
  width: 50px;
  height: 50px;
  border-radius: 100%;
  background: #ffffff1f;
  border: 1px solid #ffffff00;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}

/* Orb inner glow animation */
.archbot-orb::before {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff4d 0%, transparent 70%);
  animation: orbPulse 2s ease-in-out infinite alternate;
}

@keyframes orbPulse {
  from {
    opacity: 0.4;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1.1);
  }
}

.archbot-title {
  font-family: 'Orbitron', monospace;
  font-size: 0.88rem;
  font-weight: 700;
  color: #00ffff;
  letter-spacing: 1px;
}

.archbot-status {
  font-size: 0.7rem;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.archbot-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  display: inline-block;
  animation: notifBlink 1.8s ease-in-out infinite;
}

.archbot-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.archbot-hdr-btn {
  background: #ffffff1f;
  border: 1px solid #ffffff26;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  font-size: 0.7rem;
  font-family: 'DM Sans', sans-serif;
}

.archbot-hdr-btn:hover {
  background: #ffffff40;
  transform: scale(1.08);
}

.archbot-hdr-btn[title="Clear chat"] {
  font-size: 0.8rem;
  letter-spacing: 0.3px;
  width: auto;
  padding: 0 10px;
  border-radius: 10px;
  color: #ffffff;
}

/* ── Messages Container ── */
.archbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: #00ffff transparent;
}

.archbot-messages::-webkit-scrollbar {
  width: 4px;
}

.archbot-messages::-webkit-scrollbar-thumb {
  background: #6366f159;
  border-radius: 4px;
}

/* ── Message Bubbles ── */
.ab-msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: msgAppear 0.35s cubic-bezier(0.34, 1.3, 0.64, 1) both;
}

@keyframes msgAppear {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.ab-msg--bot {
  align-items: flex-start;
}

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

.ab-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

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

.ab-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0066cc, #6366f1);
  border: 1px solid #6366f166;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.7rem;
}

.ab-bubble {
  max-width: 85%;
  padding: 10px 18px;
  border-radius: 16px;
  font-size: 1rem;
  line-height: 1.65;
  font-family: 'DM Sans', system-ui, sans-serif;
  word-break: break-word;
}

.ab-msg--bot .ab-bubble {
  background: #1e1e2dd9;
  color: #ffffff;
  border: 1px solid #6366f126;
  border-bottom-left-radius: 4px;
}

.ab-msg--bot .ab-bubble p,
.ab-msg--bot .ab-bubble ul,
.ab-msg--bot .ab-bubble ol,
.ab-msg--bot .ab-bubble li,
.ab-msg--bot .ab-bubble h1,
.ab-msg--bot .ab-bubble h2,
.ab-msg--bot .ab-bubble h3,
.ab-msg--bot .ab-bubble h4,
.ab-msg--bot .ab-bubble h5,
.ab-msg--bot .ab-bubble h6 {
  color: #ffffff !important;
  margin-bottom: 10px;
}

.ab-msg--bot .ab-bubble li::marker {
  color: #00ffff !important;
  font-weight: bold;
}

.ab-msg--bot .ab-bubble strong,
.ab-msg--bot .ab-bubble b {
  color: #c2ccff !important;
  font-weight: 700;
}

.ab-msg--bot .ab-bubble p:last-child {
  margin-bottom: 0;
}

.ab-msg--user .ab-bubble {
  background: linear-gradient(135deg, #0066cc, #6366f1);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 16px #6366f14d;
}

/* Markdown-style inside bot bubbles */
.ab-bubble strong {
  color: #c2ccff;
}

.ab-bubble a {
  color: #60a5fa;
  text-decoration: underline;
}

.ab-bubble code {
  font-family: 'Courier New', monospace;
  background: #6366f133;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.8rem;
  color: #a5b4fc;
}

.ab-bubble ul {
  padding-left: 18px;
  margin: 6px 0;
}

.ab-bubble li {
  margin: 3px 0;
}

.ab-time {
  font-size: 0.66rem;
  color: #94a3b8;
  padding: 0 4px;
}

/* ── Typing Indicator ── */
.ab-typing .ab-bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 18px;
  min-width: 60px;
}

.ab-typing .ab-bubble span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6366f1b3;
  animation: typeDot 1.2s ease-in-out infinite;
}

.ab-typing .ab-bubble span:nth-child(2) {
  animation-delay: 0.2s;
}

.ab-typing .ab-bubble span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typeDot {

  0%,
  80%,
  100% {
    transform: scale(0.9);
    opacity: 0.4;
  }

  40% {
    transform: scale(1.3);
    opacity: 1;
    background: #6366f1;
  }
}

/* AI thinking label */
.ab-thinking {
  font-size: 0.6rem;
  color: #ffffff;
  font-family: 'Orbitron', monospace;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 36px;
}

.ab-thinking::before {
  content: '';
  width: 14px;
  height: 1px;
  background: #00000000;
  display: inline-block;
}

/* ── Suggestion Chips ── */
.archbot-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 6px;
  margin-left: 36px;
}

.archbot-sugg {
  background: transparent;
  border: 1px solid #6366f159;
  color: #a5b4fc;
  border-radius: 20px;
  padding: 5px 13px;
  font-size: 0.74rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  font-family: 'DM Sans', system-ui, sans-serif;
}

.archbot-sugg:hover {
  background: #6366f12e;
  border-color: #6366f1;
  transform: translateY(-1px);
}

/* ── Input Footer ── */
.archbot-footer {
  padding: 10px 15px 15px;
  border-top: 1px solid #ffffff0f;
  flex-shrink: 0;
  background: #00000080;
}

.archbot-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: #191928cc;
  border: 1px solid #6366f133;
  border-radius: 14px;
  padding: 8px 10px;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.archbot-input-wrap:focus-within {
  border-color: #6366f199;
  box-shadow: 0 0 0 3px #6366f11a, 0 0 20px #6366f114;
}

#archbot-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #ffffff;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.875rem;
  resize: none;
  max-height: 100px;
  line-height: 2;
}

#archbot-input::placeholder {
  color: #94a3b880;
}

#archbot-send {
  background: linear-gradient(135deg, #0066cc, #6366f1);
  border: none;
  color: #ffffff;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 2px 10px #6366f14d;
}

#archbot-send:hover:not(:disabled) {
  opacity: 0.9;
  transform: scale(1.08);
  box-shadow: 0 4px 16px #6366f180;
}

#archbot-send:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

.archbot-footer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.archbot-powered {
  font-size: 0.66rem;
  color: #ffffff;
  font-family: 'DM Sans', system-ui, sans-serif;
}

.archbot-powered span {
  color: #00ffff;
}

.archbot-hint {
  font-size: 0.64rem;
  color: #add8e6;
  font-family: 'DM Sans', system-ui, sans-serif;
}

/* ── Particles Container ── */
#archbot-particles {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 200px;
  height: 200px;
  pointer-events: none;
  z-index: 9996;
  overflow: visible;
}

.arc-particle {
  position: absolute;
  border-radius: 50%;
  background: #6366f199;
  pointer-events: none;
  animation: floatParticle linear infinite;
}

@keyframes floatParticle {
  0% {
    transform: translateY(0) scale(1);
    opacity: 0.8;
  }

  100% {
    transform: translateY(-160px) scale(0);
    opacity: 0;
  }
}

/* ── Error bubble ── */
.ab-error .ab-bubble {
  border-color: #ef44444d;
  background: #270a0acc;
  color: #fca5a5;
}

/* ── Attachment Previews ── */
.archbot-attachment-preview {
  display: flex;
  gap: 8px;
  padding: 0 4px;
  margin-bottom: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.archbot-attachment-preview:empty {
  display: none;
}

.ab-preview-item {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 8px;
  background: #1e1e2d;
  border: 1px solid #6366f140;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.ab-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ab-preview-item .ab-file-icon {
  font-size: 20px;
  color: #a5b4fc;
}

.ab-preview-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.8;
}

.ab-preview-remove:hover {
  opacity: 1;
}

/* ── Attach Button ── */
#archbot-attach {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, transform 0.15s;
}

#archbot-attach:hover {
  color: #6366f1;
  transform: scale(1.1);
}

/* ── Message Actions ── */
.ab-actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  margin-left: 36px;
}

.ab-action-btn {
  background: transparent;
  border: none;
  color: #94a3b880;
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.ab-action-btn:hover {
  color: #a5b4fc;
}

.ab-time {
  margin-left: 0 !important;
  /* Override inline style */
}

/* ── Tables (Inside bot bubbles) ── */
.ab-bubble table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.85rem;
  display: block;
  overflow-x: auto; /* Enable horizontal scroll for wide tables */
  white-space: nowrap;
  scrollbar-width: thin;
}
.ab-bubble th, .ab-bubble td {
  border: 1px solid #6366f140;
  padding: 8px 12px;
  text-align: left;
  color: #ffffff !important;
}
.ab-bubble th {
  background: #6366f133;
  color: #00ffff !important;
  font-family: 'Orbitron', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}
.ab-bubble tr:nth-child(even) {
  background: #ffffff05;
}

/* ── Code Blocks (Prism) ── */
.ab-bubble pre {
  margin: 8px 0;
  border-radius: 8px;
  background: #0f0f14 !important;
  border: 1px solid #6366f126;
  padding: 12px;
  overflow-x: auto;
  font-size: 0.85rem;
}

.ab-bubble pre code {
  background: transparent !important;
  padding: 0;
  color: inherit;
}

/* ── Mobile ── */
@media (max-width: 600px) {
  #archbot-panel {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    height: 78vh;
    max-height: 78vh;
    transform-origin: bottom center;
  }

  #archbot-trigger {
    left: 16px;
    bottom: 20px;
  }

  #archbot-particles {
    display: none;
  }
}