/* ═══════════════════════════════════════════════════════════
   CHATBOT EDUCATIVO — Widget Styles
   Floating AI assistant for the physics simulator
   ═══════════════════════════════════════════════════════════ */

/* ── FAB (Floating Action Button — Pure Cognitive Liquid Orb) ── */
.chatbot-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 229, 255, 0.45);
  cursor: pointer;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 35% 30%, rgba(13, 17, 32, 0.85) 0%, rgba(5, 7, 15, 0.95) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.6),
    0 0 25px rgba(0, 229, 255, 0.35),
    inset 0 1px 2px rgba(255, 255, 255, 0.25);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.3s ease,
              border-color 0.3s ease,
              background 0.3s ease;
  animation: chatbot-fab-glow 4s ease-in-out infinite;
  padding: 0;
  overflow: visible;
  outline: none;
}

.chatbot-fab:hover {
  transform: scale(1.1) translateY(-3px);
  border-color: #00e5ff;
  box-shadow:
    0 14px 40px rgba(0, 0, 0, 0.65),
    0 0 35px rgba(0, 229, 255, 0.6),
    inset 0 1px 3px rgba(255, 255, 255, 0.45);
}

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

/* Open State: Elegant frosted glass close sphere */
.chatbot-fab.open {
  animation: none;
  transform: scale(1);
  background: radial-gradient(circle at 35% 30%, rgba(38, 12, 24, 0.92) 0%, rgba(18, 5, 12, 0.96) 100%);
  border-color: rgba(255, 60, 110, 0.7);
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.65),
    0 0 30px rgba(255, 60, 110, 0.45),
    inset 0 1px 2px rgba(255, 255, 255, 0.2);
}

.chatbot-fab.open:hover {
  border-color: #ff3c6e;
  box-shadow:
    0 14px 40px rgba(0, 0, 0, 0.7),
    0 0 40px rgba(255, 60, 110, 0.7);
  transform: scale(1.08);
}

/* Mini Liquid Orb inside FAB */
.chatbot-fab-orb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.3s ease, filter 0.3s ease, transform 0.3s ease;
}

.chatbot-fab-orb canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.chatbot-fab.open .chatbot-fab-orb {
  opacity: 0.18;
  filter: blur(2px);
  transform: scale(0.9);
}

/* Top-right AI status sparkle badge */
.chatbot-fab-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00e5ff 0%, #b57bee 100%);
  border: 2px solid #05070f;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  z-index: 3;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.7);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  animation: chatbot-badge-pulse 2.8s infinite ease-in-out;
}

.chatbot-fab.open .chatbot-fab-badge {
  opacity: 0;
  transform: scale(0.3);
}

/* Close Icon Overlay (SVG Vector) */
.chatbot-fab-close {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  color: #ff3c6e;
  opacity: 0;
  transform: scale(0.6) rotate(-90deg);
  transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  filter: drop-shadow(0 0 10px rgba(255, 60, 110, 0.8));
}

.chatbot-fab.open .chatbot-fab-close {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

@keyframes chatbot-fab-glow {
  0%, 100% {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 22px rgba(0, 229, 255, 0.3);
  }
  50% {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 35px rgba(181, 123, 238, 0.45);
  }
}

@keyframes chatbot-badge-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 10px rgba(0, 229, 255, 0.6); }
  50% { transform: scale(1.15); box-shadow: 0 0 16px rgba(0, 229, 255, 0.95); }
}

/* ── Panel Container ── */
.chatbot-panel {
  position: fixed;
  bottom: 100px;
  right: 28px;
  width: 390px;
  height: 540px;
  max-height: calc(100vh - 130px);
  z-index: 9999;
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;

  background: rgba(13, 17, 32, 0.92);
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  border: 1px solid rgba(0, 229, 255, 0.15);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.6),
    0 0 40px rgba(0, 229, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);

  /* Closed state */
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: opacity 0.3s ease,
              visibility 0.3s ease,
              transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chatbot-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  animation: chatbot-border-glow 6s infinite ease-in-out;
}

@keyframes chatbot-border-glow {
  0%, 100% {
    border-color: rgba(0, 229, 255, 0.15);
    box-shadow:
      0 20px 60px rgba(0, 0, 0, 0.6),
      0 0 40px rgba(0, 229, 255, 0.08),
      inset 0 1px 0 rgba(255, 255, 255, 0.05);
  }
  50% {
    border-color: rgba(181, 123, 238, 0.35);
    box-shadow:
      0 20px 60px rgba(0, 0, 0, 0.6),
      0 0 50px rgba(181, 123, 238, 0.16),
      inset 0 1px 0 rgba(255, 255, 255, 0.05);
  }
}

/* ── Header ── */
.chatbot-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(180deg, rgba(0, 229, 255, 0.06) 0%, transparent 100%);
  border-bottom: 1px solid rgba(0, 229, 255, 0.1);
  flex-shrink: 0;
}

.chatbot-header-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(0,229,255,0.15), rgba(181,123,238,0.15));
  border: 1px solid rgba(0, 229, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

/* ── Cognitive Header Orb ── */
.chatbot-header-orb {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  background: rgba(0, 0, 0, 0.35);
  border: 1.5px solid rgba(0, 229, 255, 0.35);
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.3);
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.chatbot-header-orb:hover {
  transform: scale(1.08);
  border-color: #00e5ff;
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.55);
}

.chatbot-header-orb canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.chatbot-header-orb.thinking {
  border-color: #ff3c6e;
  box-shadow: 0 0 20px rgba(255, 60, 110, 0.7);
  animation: orb-header-pulse 1s ease-in-out infinite alternate;
}

@keyframes orb-header-pulse {
  from { transform: scale(1); box-shadow: 0 0 12px rgba(255, 60, 110, 0.5); }
  to { transform: scale(1.08); box-shadow: 0 0 24px rgba(255, 60, 110, 0.9); }
}

.chatbot-header-status.thinking {
  background: #ff3c6e !important;
  box-shadow: 0 0 10px rgba(255, 60, 110, 0.8) !important;
  animation: status-dot-pulse 0.8s ease-in-out infinite alternate;
}

@keyframes status-dot-pulse {
  from { transform: scale(0.9); opacity: 0.8; }
  to { transform: scale(1.3); opacity: 1; }
}

.chatbot-fab.thinking {
  border-color: #ff3c6e;
  box-shadow: 0 0 32px rgba(255, 60, 110, 0.75), 0 10px 30px rgba(0, 0, 0, 0.6);
  animation: fab-thinking-pulse 1s ease-in-out infinite alternate;
}

@keyframes fab-thinking-pulse {
  from { box-shadow: 0 0 22px rgba(255, 60, 110, 0.55), 0 10px 30px rgba(0, 0, 0, 0.6); }
  to { box-shadow: 0 0 38px rgba(255, 60, 110, 0.95), 0 12px 35px rgba(0, 0, 0, 0.7); }
}

.chatbot-fab.open.thinking .chatbot-fab-orb {
  opacity: 0.45;
  filter: blur(1px);
}

.chatbot-header-style-tag {
  color: #00e5ff;
  font-weight: 700;
  cursor: pointer;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.2);
  transition: all 0.2s ease;
  user-select: none;
}

.chatbot-header-style-tag:hover {
  background: rgba(0, 229, 255, 0.2);
  border-color: rgba(0, 229, 255, 0.4);
}

/* ── Header Actions (Style, Theme, Close) ── */
.chatbot-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.chatbot-btn-action {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #7a85a0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  user-select: none;
}

.chatbot-btn-action:hover {
  background: rgba(0, 229, 255, 0.12);
  border-color: rgba(0, 229, 255, 0.35);
  color: #00e5ff;
  transform: translateY(-1px);
}

.chatbot-btn-action:active {
  transform: scale(0.92);
}

.chatbot-header-info {
  flex: 1;
}

.chatbot-header-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: #e8ecf8;
  letter-spacing: 0.01em;
}

.chatbot-header-subtitle {
  font-family: 'Space Mono', monospace;
  font-size: 0.62rem;
  color: #7a85a0;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.chatbot-header-status {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a3ff6b;
  box-shadow: 0 0 8px rgba(163, 255, 107, 0.5);
  margin-right: 5px;
  vertical-align: middle;
}

/* ── Provider Selector ── */
.chatbot-provider-selector {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 6px;
  padding: 4px;
  margin-top: 8px;
  width: 100%;
}

.chatbot-provider-tab {
  flex: 1;
  text-align: center;
  font-family: 'Space Mono', monospace;
  font-size: 0.58rem;
  padding: 4px 0;
  border-radius: 4px;
  cursor: pointer;
  color: #7a85a0;
  border: 1px solid transparent;
  transition: all 0.2s;
  user-select: none;
}

.chatbot-provider-tab:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #e8ecf8;
}

.chatbot-provider-tab.active {
  background: rgba(0, 229, 255, 0.1);
  color: #00e5ff;
  border-color: rgba(0, 229, 255, 0.2);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.1);
}

.chatbot-provider-tab.active[data-provider="groq"] {
  background: rgba(181, 123, 238, 0.1);
  color: #b57bee;
  border-color: rgba(181, 123, 238, 0.2);
  box-shadow: 0 0 10px rgba(181, 123, 238, 0.1);
}

.chatbot-provider-tab.active[data-provider="offline"] {
  background: rgba(255, 171, 0, 0.1);
  color: #ffab00;
  border-color: rgba(255, 171, 0, 0.2);
  box-shadow: 0 0 10px rgba(255, 171, 0, 0.1);
}


.chatbot-btn-close {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #7a85a0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.chatbot-btn-close:hover {
  background: rgba(255, 60, 110, 0.12);
  border-color: rgba(255, 60, 110, 0.3);
  color: #ff3c6e;
  transform: translateY(-1px);
}

.chatbot-btn-close:active {
  transform: scale(0.92);
}

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

/* Scrollbar */
.chatbot-messages::-webkit-scrollbar { width: 5px; }
.chatbot-messages::-webkit-scrollbar-track { background: transparent; }
.chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 229, 255, 0.15);
  border-radius: 10px;
}
.chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 229, 255, 0.3);
}

/* ── Message Bubbles ── */
.chatbot-msg {
  max-width: 88%;
  padding: 12px 16px;
  border-radius: 14px;
  font-family: 'Space Mono', monospace;
  font-size: 0.73rem;
  line-height: 1.75;
  color: #e8ecf8;
  animation: chatbot-msg-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

@keyframes chatbot-msg-in {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.chatbot-msg.bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom-left-radius: 4px;
}

.chatbot-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(0,229,255,0.12), rgba(0,229,255,0.06));
  border: 1px solid rgba(0, 229, 255, 0.18);
  border-bottom-right-radius: 4px;
}

/* Message content formatting */
.chatbot-msg p { margin: 0 0 8px 0; }
.chatbot-msg p:last-child { margin-bottom: 0; }

.chatbot-msg strong {
  color: #00e5ff;
  font-weight: 700;
}

.chatbot-msg em {
  color: #ffd166;
}

.chatbot-msg code {
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.12);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.7rem;
  color: #a3ff6b;
}

.chatbot-msg ul,
.chatbot-msg ol {
  padding-left: 18px;
  margin: 6px 0;
}

.chatbot-msg li {
  margin-bottom: 4px;
}

.chatbot-msg .msg-label {
  font-size: 0.58rem;
  color: #7a85a0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
  display: block;
}

/* ── Typing Indicator ── */
.chatbot-typing {
  display: none;
  align-self: flex-start;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  gap: 5px;
  align-items: center;
}

.chatbot-typing.active {
  display: flex;
}

.chatbot-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(0, 229, 255, 0.5);
  animation: chatbot-typing-bounce 1.4s ease-in-out infinite;
}

.chatbot-typing-dot:nth-child(2) { animation-delay: 0.16s; }
.chatbot-typing-dot:nth-child(3) { animation-delay: 0.32s; }

@keyframes chatbot-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-6px); opacity: 1; }
}

/* ── Suggestions ── */
.chatbot-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  flex-shrink: 0;
}

.chatbot-chip {
  background: rgba(0, 229, 255, 0.06);
  border: 1px solid rgba(0, 229, 255, 0.12);
  color: #00e5ff;
  font-family: 'Space Mono', monospace;
  font-size: 0.6rem;
  padding: 5px 11px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  animation: chatbot-chip-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

/* Staggered chip delays */
.chatbot-chip:nth-child(1) { animation-delay: 0.05s; }
.chatbot-chip:nth-child(2) { animation-delay: 0.1s; }
.chatbot-chip:nth-child(3) { animation-delay: 0.15s; }
.chatbot-chip:nth-child(4) { animation-delay: 0.2s; }

@keyframes chatbot-chip-in {
  from { opacity: 0; transform: translateY(12px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.chatbot-chip:hover {
  background: rgba(0, 229, 255, 0.14);
  border-color: rgba(0, 229, 255, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 229, 255, 0.25);
}

/* ── Input Area ── */
.chatbot-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 14px 16px;
  border-top: 1px solid rgba(0, 229, 255, 0.08);
  background: rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.chatbot-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 14px;
  color: #e8ecf8;
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  line-height: 1.5;
  resize: none;
  outline: none;
  min-height: 40px;
  max-height: 100px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.chatbot-input::placeholder {
  color: #4a5270;
}

.chatbot-input:focus {
  border-color: rgba(0, 229, 255, 0.25);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.06);
}

.chatbot-btn-send {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  background: linear-gradient(135deg, #00e5ff, #00b8d4);
  color: #05070f;
  box-shadow: 0 2px 12px rgba(0, 229, 255, 0.25);
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
  flex-shrink: 0;
}

.chatbot-btn-send:hover {
  transform: scale(1.06);
  box-shadow: 0 4px 18px rgba(0, 229, 255, 0.4);
}

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

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

/* ── Welcome message ── */
.chatbot-welcome {
  text-align: center;
  padding: 20px 10px;
}

.chatbot-welcome-emoji {
  font-size: 2.4rem;
  margin-bottom: 12px;
  display: inline-block;
  animation: chatbot-wave 2.2s infinite ease-in-out;
  transform-origin: 70% 70%;
}

@keyframes chatbot-wave {
  0%, 100% { transform: rotate(0deg); }
  12.5%    { transform: rotate(-12deg); }
  25%      { transform: rotate(14deg); }
  37.5%    { transform: rotate(-10deg); }
  50%      { transform: rotate(12deg); }
  62.5%    { transform: rotate(0deg); }
}

.chatbot-welcome-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: #e8ecf8;
  margin-bottom: 8px;
}

.chatbot-welcome-text {
  font-family: 'Space Mono', monospace;
  font-size: 0.68rem;
  color: #7a85a0;
  line-height: 1.7;
}

/* ── Error state ── */
.chatbot-msg.error {
  align-self: flex-start;
  background: rgba(255, 60, 110, 0.08);
  border: 1px solid rgba(255, 60, 110, 0.2);
  color: #ff6b8a;
  border-bottom-left-radius: 4px;
}

/* ── Context badge ── */
.chatbot-context-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(163, 255, 107, 0.06);
  border: 1px solid rgba(163, 255, 107, 0.15);
  border-radius: 8px;
  padding: 4px 10px;
  font-family: 'Space Mono', monospace;
  font-size: 0.58rem;
  color: #a3ff6b;
  margin-bottom: 8px;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .chatbot-panel {
    width: calc(100vw - 20px);
    right: 10px;
    bottom: 80px;
    height: calc(100vh - 110px);
    max-height: none;
    border-radius: 16px;
  }

  .chatbot-fab {
    bottom: 16px;
    right: 16px;
    width: 52px;
    height: 52px;
  }
}

@media (max-width: 360px) {
  .chatbot-chip {
    font-size: 0.55rem;
    padding: 4px 8px;
  }
}

/* ── Offline Mode Styles ── */
.chatbot-header-status.offline {
  background: #ffab00 !important;
  box-shadow: 0 0 8px rgba(255, 171, 0, 0.7) !important;
}

.chatbot-offline-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 171, 0, 0.08);
  border: 1px solid rgba(255, 171, 0, 0.25);
  border-radius: 8px;
  padding: 4px 10px;
  font-family: 'Space Mono', monospace;
  font-size: 0.6rem;
  color: #ffab00;
  margin-bottom: 8px;
  animation: pulse-offline-badge 2s infinite ease-in-out;
}

@keyframes pulse-offline-badge {
  0%, 100% { border-color: rgba(255, 171, 0, 0.25); }
  50% { border-color: rgba(255, 171, 0, 0.5); }
}

/* ── Premium Markdown Headers ── */
.chatbot-msg h1,
.chatbot-msg h2,
.chatbot-msg h3 {
  font-family: 'Syne', sans-serif;
  color: #00e5ff;
  margin-top: 14px;
  margin-bottom: 8px;
  font-weight: 700;
  line-height: 1.3;
}

.chatbot-msg h1 { font-size: 0.95rem; border-bottom: 1px solid rgba(0, 229, 255, 0.15); padding-bottom: 4px; }
.chatbot-msg h2 { font-size: 0.88rem; }
.chatbot-msg h3 { font-size: 0.8rem; }

/* ── Premium Tables with Glassmorphism and Neon accents ── */
.chatbot-table-container {
  width: 100%;
  overflow-x: auto;
  margin: 12px 0;
  border-radius: 12px;
  border: 1px solid rgba(0, 229, 255, 0.15);
  background: rgba(13, 17, 32, 0.6);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* Touch scroll momentum */
.chatbot-table-container::-webkit-scrollbar {
  height: 4px;
}
.chatbot-table-container::-webkit-scrollbar-thumb {
  background: rgba(0, 229, 255, 0.3);
  border-radius: 4px;
}

.chatbot-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Space Mono', monospace;
  font-size: 0.64rem;
  text-align: left;
  color: #e8ecf8;
}

.chatbot-table th {
  background: linear-gradient(180deg, rgba(0, 229, 255, 0.08) 0%, rgba(0, 229, 255, 0.03) 100%);
  color: #00e5ff;
  font-weight: 700;
  padding: 8px 12px;
  border-bottom: 1.5px solid rgba(0, 229, 255, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chatbot-table td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background-color 0.2s;
}

.chatbot-table tbody tr:last-child td {
  border-bottom: none;
}

.chatbot-table tbody tr:hover td {
  background: rgba(0, 229, 255, 0.03);
}

/* ── KaTeX Display Adjustments ── */
.katex-display {
  margin: 10px 0 !important;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 0;
}

.katex {
  font-size: 0.82rem !important;
  color: #e8ecf8;
}

.katex-display .katex {
  font-size: 0.9rem !important;
  color: #00e5ff;
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.15);
}

/* ── Responsive Mobile (Chatbot) ── */
@media (max-width: 640px) {
  .chatbot-fab {
    bottom: 16px;
    right: 16px;
    width: 50px;
    height: 50px;
    font-size: 1.35rem;
  }

  .chatbot-panel {
    bottom: 74px;
    right: 10px;
    left: 10px;
    width: auto;
    height: calc(100dvh - 90px);
    max-height: calc(100vh - 90px);
    border-radius: 16px;
  }

  .chatbot-header {
    padding: 12px 14px;
  }
  .chatbot-header-icon {
    width: 32px;
    height: 32px;
    font-size: 0.95rem;
  }
  .chatbot-header-title {
    font-size: 0.88rem;
  }
  .chatbot-provider-selector {
    margin-top: 6px;
    padding: 2px;
  }
  .chatbot-provider-tab {
    font-size: 0.58rem;
    padding: 4px 6px;
  }
  .chatbot-messages {
    padding: 12px 10px;
    gap: 10px;
  }
  .chatbot-msg {
    font-size: 0.82rem;
    padding: 10px 12px;
    max-width: 94%;
  }
  .chatbot-input-container {
    padding: 8px 10px 10px;
  }
  .chatbot-input {
    font-size: 0.85rem;
    padding: 9px 12px;
  }
  .chatbot-send-btn {
    width: 36px;
    height: 36px;
  }
}

/* ═══════════════════════════════════════════════════════════
   LIGHT THEME OVERRIDES FOR CHATBOT
   ═══════════════════════════════════════════════════════════ */
[data-theme="light"] .chatbot-panel {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(0, 131, 143, 0.22);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.16), 0 0 35px rgba(0, 131, 143, 0.08);
}

[data-theme="light"] .chatbot-header {
  background: linear-gradient(180deg, rgba(0, 131, 143, 0.08) 0%, transparent 100%);
  border-bottom: 1px solid rgba(0, 131, 143, 0.14);
}

[data-theme="light"] .chatbot-header-orb {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 131, 143, 0.35);
  box-shadow: 0 0 12px rgba(0, 131, 143, 0.2);
}

[data-theme="light"] .chatbot-header-style-tag {
  color: #00838f;
  background: rgba(0, 131, 143, 0.08);
  border-color: rgba(0, 131, 143, 0.25);
}

[data-theme="light"] .chatbot-header-style-tag:hover {
  background: rgba(0, 131, 143, 0.15);
  border-color: #00838f;
}

[data-theme="light"] .chatbot-header-title {
  color: #0f172a;
}

[data-theme="light"] .chatbot-header-subtitle {
  color: #475569;
}

[data-theme="light"] .chatbot-btn-action {
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.09);
  color: #475569;
}

[data-theme="light"] .chatbot-btn-action:hover {
  background: rgba(0, 131, 143, 0.1);
  border-color: rgba(0, 131, 143, 0.35);
  color: #00838f;
}

[data-theme="light"] .chatbot-btn-close {
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.09);
  color: #64748b;
}

[data-theme="light"] .chatbot-btn-close:hover {
  background: rgba(216, 27, 96, 0.1);
  border-color: rgba(216, 27, 96, 0.35);
  color: #d81b60;
}

[data-theme="light"] .chatbot-provider-selector {
  background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .chatbot-provider-tab {
  color: #64748b;
}

[data-theme="light"] .chatbot-provider-tab:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #0f172a;
}

[data-theme="light"] .chatbot-provider-tab.active {
  background: #ffffff;
  color: #00838f;
  border-color: rgba(0, 131, 143, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .chatbot-provider-tab.active[data-provider="groq"] {
  background: #ffffff;
  color: #6d28d9;
  border-color: rgba(109, 40, 217, 0.3);
  box-shadow: 0 2px 8px rgba(109, 40, 217, 0.12);
}

[data-theme="light"] .chatbot-provider-tab.active[data-provider="offline"] {
  background: #ffffff;
  color: #b45309;
  border-color: rgba(180, 83, 9, 0.3);
  box-shadow: 0 2px 8px rgba(180, 83, 9, 0.12);
}

[data-theme="light"] .chatbot-welcome-title {
  color: #0f172a;
}

[data-theme="light"] .chatbot-welcome-text {
  color: #475569;
}

[data-theme="light"] .chatbot-msg {
  color: #0f172a;
}

[data-theme="light"] .chatbot-msg.bot {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .chatbot-msg.user {
  background: linear-gradient(135deg, rgba(0, 131, 143, 0.14), rgba(0, 131, 143, 0.06));
  border: 1px solid rgba(0, 131, 143, 0.25);
  color: #0f172a;
}

[data-theme="light"] .chatbot-msg strong {
  color: #00838f;
}

[data-theme="light"] .chatbot-msg em {
  color: #b45309;
}

[data-theme="light"] .chatbot-msg code {
  background: rgba(0, 131, 143, 0.08);
  border: 1px solid rgba(0, 131, 143, 0.2);
  color: #00838f;
}

[data-theme="light"] .chatbot-msg h1,
[data-theme="light"] .chatbot-msg h2,
[data-theme="light"] .chatbot-msg h3 {
  color: #00838f;
}

[data-theme="light"] .chatbot-msg h1 {
  border-bottom-color: rgba(0, 131, 143, 0.2);
}

[data-theme="light"] .chatbot-table-container {
  background: #ffffff;
  border-color: rgba(0, 131, 143, 0.2);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .chatbot-table th {
  background: linear-gradient(180deg, rgba(0, 131, 143, 0.1) 0%, rgba(0, 131, 143, 0.03) 100%);
  color: #00838f;
  border-bottom: 1.5px solid rgba(0, 131, 143, 0.35);
}

[data-theme="light"] .chatbot-table td {
  color: #0f172a;
  border-bottom: 1px solid #e2e8f0;
}

[data-theme="light"] .chatbot-table tbody tr:hover td {
  background: rgba(0, 131, 143, 0.04);
}

[data-theme="light"] .chatbot-typing {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

[data-theme="light"] .chatbot-typing-dot {
  background: rgba(0, 131, 143, 0.6);
}

[data-theme="light"] .chatbot-chip {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
}

[data-theme="light"] .chatbot-chip:hover {
  background: rgba(0, 131, 143, 0.1);
  border-color: #00838f;
  color: #00838f;
}

[data-theme="light"] .chatbot-suggestions {
  border-top: 1px solid #e2e8f0;
}

[data-theme="light"] .chatbot-input-area {
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
}

[data-theme="light"] .chatbot-input {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #0f172a;
}

[data-theme="light"] .chatbot-input::placeholder {
  color: #94a3b8;
}

[data-theme="light"] .chatbot-input:focus {
  border-color: #00838f;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(0, 131, 143, 0.12);
}

[data-theme="light"] .chatbot-btn-send {
  background: linear-gradient(135deg, #00838f, #00acc1);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(0, 131, 143, 0.3);
}

[data-theme="light"] .katex {
  color: #0f172a !important;
}

[data-theme="light"] .katex-display .katex {
  color: #00838f !important;
  text-shadow: none;
}

/* ── Light Mode FAB ── */
[data-theme="light"] .chatbot-fab {
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.95) 0%, rgba(240, 246, 250, 0.98) 100%);
  border-color: rgba(0, 131, 143, 0.45);
  box-shadow:
    0 10px 30px rgba(15, 23, 42, 0.16),
    0 0 25px rgba(0, 131, 143, 0.25),
    inset 0 1px 2px rgba(255, 255, 255, 0.9);
}

[data-theme="light"] .chatbot-fab:hover {
  border-color: #00838f;
  box-shadow:
    0 14px 38px rgba(15, 23, 42, 0.22),
    0 0 32px rgba(0, 131, 143, 0.45);
}

[data-theme="light"] .chatbot-fab.open {
  background: radial-gradient(circle at 35% 30%, rgba(255, 245, 247, 0.95) 0%, rgba(255, 235, 240, 0.98) 100%);
  border-color: rgba(216, 27, 96, 0.6);
  box-shadow:
    0 10px 30px rgba(15, 23, 42, 0.18),
    0 0 25px rgba(216, 27, 96, 0.35);
}

[data-theme="light"] .chatbot-fab.open:hover {
  border-color: #d81b60;
  box-shadow:
    0 14px 38px rgba(15, 23, 42, 0.25),
    0 0 35px rgba(216, 27, 96, 0.5);
}

[data-theme="light"] .chatbot-fab-badge {
  border-color: #ffffff;
  background: linear-gradient(135deg, #00838f, #6d28d9);
  box-shadow: 0 0 10px rgba(0, 131, 143, 0.5);
}

[data-theme="light"] .chatbot-fab-close {
  color: #d81b60;
  filter: drop-shadow(0 0 8px rgba(216, 27, 96, 0.4));
}


