/* ======================================================================
   CYBERAI CHATBOT WIDGET - Glassmorphic Design with Animations
   ====================================================================== */

:root {
  --chatbot-width: 392px;
  --chatbot-height: min(580px, calc(100vh - 120px));
  --chatbot-layer-toggle: 2147483600;
  --chatbot-layer-window: 2147483590;
  --chatbot-layer-modal: 2147483640;
  --chatbot-layer-panel: 2147483630;
  --chatbot-radius: 20px;
  --chatbot-pad: 14px;
  --chatbot-gap: 10px;
  --chatbot-cyan: #37c0ff;
  --chatbot-orange: #ff8a00;
  --chatbot-purple: #a855f7;
  --chatbot-bg: #071525;
  --chatbot-bg-elevated: #0c2238;
  --chatbot-surface: rgba(12, 40, 64, 0.72);
  --chatbot-border: rgba(55, 192, 255, 0.16);
  --chatbot-text: rgba(234, 243, 249, 0.94);
  --chatbot-text-muted: rgba(166, 192, 211, 0.72);
  --chatbot-gradient-brand: linear-gradient(90deg, #37c0ff 0%, #ff8a00 38%, #a855f7 68%, #37c0ff 100%);
  --chatbot-gradient-brand-static: linear-gradient(90deg, #37c0ff 0%, #ff8a00 38%, #a855f7 68%);
}

/* ===== GLYPHS (compact neural orb + user monogram) ===== */
.chatbot-glyph {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
  isolation: isolate;
  contain: paint;
}

.chatbot-glyph--header {
  width: 40px;
  height: 40px;
  position: relative;
  overflow: visible;
  background: radial-gradient(circle at 38% 32%,
    rgba(55, 192, 255, 0.32) 0%,
    rgba(10, 38, 58, 0.80) 45%,
    rgba(2, 10, 20, 0.97) 100%);
  border: 1.5px solid transparent;
  background-clip: padding-box;
  box-shadow:
    0 0 0 1.5px rgba(55, 192, 255, 0.38),
    0 0 14px rgba(55, 192, 255, 0.28),
    0 0 22px rgba(255, 138, 0, 0.18);
  animation: chatbotToggleGlow 4s ease-in-out infinite;
}

.chatbot-glyph--header::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    rgba(55, 192, 255, 0.7),
    rgba(255, 138, 0, 0.55),
    rgba(168, 85, 247, 0.5),
    rgba(55, 192, 255, 0.7)
  );
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));
  animation: chatbotOrbRingSpin 6s linear infinite;
  pointer-events: none;
  z-index: -1;
}

.chatbot-glyph--bot {
  width: 28px;
  height: 28px;
  background: radial-gradient(circle at 35% 30%, rgba(55, 192, 255, 0.10) 0%, rgba(4, 18, 32, 0.88) 72%);
  border: 1px solid rgba(55, 192, 255, 0.15);
  box-shadow: none;
}

.chatbot-neural-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.chatbot-neural-svg--header {
  width: 34px;
  height: 34px;
}

.chatbot-neural-svg--message {
  width: 26px;
  height: 26px;
}

/* --- Neural atom header mark --- */
.chatbot-hex-svg {
  width: 32px;
  height: 32px;
  display: block;
  overflow: visible;
}

.cbh-node {
  animation: cbhNodePulse 2.6s ease-in-out infinite;
}

.cbh-node--o {
  animation-delay: 0.85s;
}

.cbh-core {
  animation: cbhCorePulse 3.0s ease-in-out infinite;
}

@keyframes cbhNodePulse {
  0%, 100% { opacity: 0.6; }
  50%      { opacity: 1;   }
}

@keyframes cbhCorePulse {
  0%, 100% { opacity: 0.75; }
  50%      { opacity: 1;    }
}

.chatbot-glyph--typing .chatbot-neural-node {
  animation: chatbotNodePulse 2.2s ease-in-out infinite;
}

.chatbot-glyph--typing .chatbot-neural-node--o {
  animation-delay: 0.4s;
}

@keyframes chatbotNodePulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

@keyframes chatbotOrbRingSpin {
  to { transform: rotate(360deg); }
}

.chatbot-glyph--user {
  width: 30px;
  height: 30px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--chatbot-text);
  background: linear-gradient(145deg, rgba(55, 192, 255, 0.28) 0%, rgba(37, 99, 235, 0.38) 100%);
  border: 1px solid rgba(55, 192, 255, 0.35);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

@media (prefers-reduced-motion: reduce) {
  .chatbot-glyph--typing .chatbot-neural-node,
  .cbh-node,
  .cbh-core,
  .chatbot-message.bot .chatbot-message-content::before {
    animation: none;
  }
}

/* ===== FLOATING TOGGLE BUTTON ===== */
#chatbot-toggle.chatbot-toggle,
.chatbot-toggle {
  position: fixed !important;
  bottom: 24px;
  right: 24px;
  left: auto !important;
  top: auto !important;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  overflow: visible; /* Allow ripples to propagate beyond button bounds */
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
  pointer-events: auto !important;
  cursor: pointer !important;
  -webkit-appearance: none;
  appearance: none;
  /* Transparent — brain canvas is the sole visual; no backdrop disc or ring frame.
     box-shadow is intentionally absent: any shadow on a border-radius:50% button
     produces a circular halo regardless of the brain's irregular shape. The canvas
     filter:drop-shadow (on .chatbot-brain-canvas) handles all external glow and
     correctly follows the brain pixel content, not the button boundary. */
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--chatbot-layer-toggle) !important;
  transition: transform 0.25s ease-out, background-position 0.25s ease-out;
  animation: chatbotFloat 6s ease-in-out infinite;
}

.chatbot-toggle:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: none;
}
.chatbot-toggle.pulse-boost{
  animation-duration:2.2s;
}
.chatbot-toggle.arrival-flight{
  animation: chatbotArrival 1.4s cubic-bezier(0.18,0.72,0.23,1) forwards;
}
.chatbot-toggle.glyph-pop{
  animation: glyphPop 0.9s ease-out forwards;
  box-shadow: none;
}
.chatbot-toggle.orbit-sweep{
  animation: orbitSweep 2.1s ease-in-out forwards;
}

.chatbot-toggle:active {
  transform: translateY(-2px) scale(0.98);
}

/* Live animated brain canvas (primary launcher visual) */
.chatbot-brain-canvas {
  width: 112px;
  height: 112px;
  display: block;
  pointer-events: none;
  /* No border-radius clip: aura + ring waves extend to the rim.
     drop-shadow follows brain pixel content, not the button circle — this is
     now the SOLE source of external ambient glow since the button box-shadow
     was removed to eliminate the circular ring artefact. */
  filter:
    drop-shadow(0 0 10px rgba(55,192,255,0.85))
    drop-shadow(0 0 26px rgba(55,192,255,0.48))
    drop-shadow(0 0 20px rgba(255,138,0,0.65))
    drop-shadow(0 0 44px rgba(255,138,0,0.34))
    drop-shadow(0 0 58px rgba(168,85,247,0.18));
  animation: chatbotLogoBreathe 3.8s ease-in-out infinite;
}
.chatbot-toggle:hover .chatbot-brain-canvas {
  animation-duration: 2.2s;
  filter:
    drop-shadow(0 0 14px rgba(55,192,255,0.95))
    drop-shadow(0 0 34px rgba(55,192,255,0.62))
    drop-shadow(0 0 26px rgba(255,138,0,0.80))
    drop-shadow(0 0 58px rgba(255,138,0,0.46))
    drop-shadow(0 0 72px rgba(168,85,247,0.28));
}

.chatbot-logo {
  width: 80px;
  height: 80px;
  border-radius: 50% !important;
  object-fit: cover;
  display: block;
  pointer-events: none;
  filter:
    drop-shadow(0 0 8px rgba(55,192,255,0.7))
    drop-shadow(0 0 16px rgba(55,192,255,0.5))
    drop-shadow(0 0 12px rgba(255,138,0,0.6))
    drop-shadow(0 0 24px rgba(255,138,0,0.4));
  /* Force non-rotating circular logo, even if older styles are cached */
  transform: none !important;
  animation: chatbotLogoBreathe 3.5s ease-in-out infinite !important;
}

/* PNG fallback: hidden unless the brain canvas can't render */
.chatbot-logo--fallback {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) !important;
}
.chatbot-logo--fallback.chatbot-logo--show {
  display: block;
}

.chatbot-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(239,68,68,0.5);
  animation: chatbotBadgePulse 2s ease-in-out infinite;
}

/* Pulse-ring divs are suppressed — the brain canvas provides its own internal
   emanation waves centred on the thalamic core; external CSS rings would add
   unwanted circular artefacts on top of the anatomy. */
.chatbot-pulse-ring,
.chatbot-pulse-ring-2,
.chatbot-pulse-ring-3 {
  display: none !important;
}
/* Pulse-ring overrides removed — rings are suppressed via display:none above. */

/* Amplified pulse effect on click */
.chatbot-toggle.click-amplify {
  transform: scale(1.1);
  transition: transform 0.2s ease-out;
}

/* click-amplify pulse-ring overrides removed — rings suppressed. */

/* Ripple effect rings for click — shaped as a horizontal organic blob to
   approximate the brain's lateral silhouette (wider than tall, ~4:3 ratio).
   Colors are preserved; the shape changes from a circle to an organic oval. */
.chatbot-ripple-ring {
  position: absolute;
  width: 112%;
  height: 88%;
  /* Organic blob border-radius mirrors the brain's wider-than-tall lateral aspect */
  border-radius: 58% 42% 52% 48% / 44% 56% 44% 56%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(
    ellipse 60% 50% at 50% 50%,
    rgba(255,138,0,0.85) 0%,
    rgba(255,138,0,0.6) 25%,
    rgba(55,192,255,0.5) 45%,
    rgba(168,85,247,0.3) 60%,
    transparent 75%
  );
  pointer-events: none;
  z-index: -4;
  animation: ripplePropagate 1s ease-out forwards;
  will-change: transform, opacity;
}

@keyframes ripplePropagate {
  0% {
    transform: translate(-50%, -50%) scale(0.65);
    opacity: 1;
  }
  30% {
    opacity: 0.9;
  }
  70% {
    opacity: 0.5;
  }
  100% {
    /* Non-uniform scale matches the brain's wider-than-tall shape */
    transform: translate(-50%, -50%) scaleX(3.2) scaleY(2.6);
    opacity: 0;
  }
}

/* Greeting bubble */
.chatbot-greet-bubble{
  position:fixed;
  z-index: var(--chatbot-layer-window);
  background:rgba(8,24,40,0.92);
  color:#eaf3f9;
  padding:.65rem .75rem;
  border-radius:12px;
  border:1px solid rgba(55,192,255,.25);
  box-shadow:0 12px 30px rgba(0,0,0,.4), 0 0 24px rgba(55,192,255,.2);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  max-width:240px;
  font-size:.92rem;
  animation: greetFloat .35s ease-out;
}
.chatbot-greet-text{ margin-right:1.5rem; display:block; }
.chatbot-greet-close{
  position:absolute;
  top:6px; right:8px;
  border:0; background:transparent; color:#eaf3f9;
  font-size:16px; cursor:pointer; line-height:1;
}
.chatbot-greet-close:hover{ color:#ffb45c; }
.chatbot-greet-arrow{
  position:absolute;
  bottom:-8px; left:16px;
  width:14px; height:14px;
  background:rgba(8,24,40,0.92);
  border-left:1px solid rgba(55,192,255,.25);
  border-bottom:1px solid rgba(55,192,255,.25);
  transform:rotate(45deg);
}
.chatbot-greet-bubble.hide{
  opacity:0; transform:translateY(-6px); transition:opacity .25s ease, transform .25s ease;
}
@keyframes greetFloat{
  from { opacity:0; transform:translateY(-6px); }
  to   { opacity:1; transform:translateY(0); }
}

@keyframes chatbotArrival{
  0%{ transform: translate(30px,-40px) scale(0.85); opacity:0; }
  40%{ transform: translate(-20px,20px) scale(1.05); opacity:1; }
  70%{ transform: translate(8px,-6px) scale(0.95); }
  100%{ transform: translate(0,0) scale(1); }
}
@keyframes glyphPop{
  0%{ transform: translateY(-6px) scale(0.9); }
  40%{ transform: translateY(-2px) scale(1.1); }
  100%{ transform: translateY(0) scale(1); }
}
@keyframes orbitSweep{
  0%   { transform: translate(-8vw, -12vh) scale(.85);   opacity:0; }
  18%  { transform: translate(-24vw, -20vh) scale(1.05); opacity:1; }
  40%  { transform: translate(-16vw,  14vh) scale(.95); }
  62%  { transform: translate(-30vw,  -6vh) scale(1.08); }
  82%  { transform: translate(-18vw, -24vh) scale(.96); }
  100% { transform: translate(0,0)     scale(1); }
}

@media (prefers-reduced-motion: reduce){
  .chatbot-greet-bubble, .chatbot-toggle,
  .chatbot-brain-canvas{
    animation:none !important;
    transition:none !important;
  }
}

/* ===== CHAT WINDOW ===== */
.chatbot-window {
  position: fixed !important;
  bottom: 96px;
  right: 24px;
  width: var(--chatbot-width);
  max-width: calc(100vw - 32px);
  height: var(--chatbot-height);
  max-height: calc(100vh - 120px);
  border-radius: var(--chatbot-radius);
  background:
    radial-gradient(ellipse 120% 80% at 100% 0%, rgba(55, 192, 255, 0.07) 0%, transparent 55%),
    radial-gradient(ellipse 90% 60% at 0% 100%, rgba(255, 138, 0, 0.05) 0%, transparent 50%),
    linear-gradient(168deg, #071525 0%, #0a1e32 52%, #061018 100%);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--chatbot-border);
  box-shadow:
    0 28px 72px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 138, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: var(--chatbot-layer-window) !important;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
  color: var(--chatbot-text);
  isolation: isolate;
}

.chatbot-window.open {
  opacity: 1 !important;
  transform: translateY(0) scale(1) !important;
  pointer-events: all !important;
  display: flex !important;
}

@media (prefers-color-scheme: dark) {
  .chatbot-window {
    border-color: var(--chatbot-border);
  }
}

/* Background mesh — static gradient only */
.chatbot-particles {
  display: none;
}

/* ===== HEADER ===== */
.chatbot-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px var(--chatbot-pad);
  min-height: 56px;
  background: rgba(6, 24, 40, 0.82);
  border-bottom: 1px solid var(--chatbot-border);
  backdrop-filter: blur(16px);
}

.chatbot-header::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--chatbot-gradient-brand-static);
  opacity: 0.55;
  pointer-events: none;
}

.chatbot-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.chatbot-header-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.chatbot-header-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.chatbot-header-text h3 {
  margin: 0;
  padding: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--chatbot-text);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.chatbot-title-accent {
  background: var(--chatbot-gradient-brand-static);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.chatbot-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  color: rgba(134, 239, 172, 1);
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.28);
  white-space: nowrap;
}

.chatbot-subtitle {
  margin: 0;
  padding: 0;
  font-size: 11px;
  color: var(--chatbot-text-muted);
  line-height: 1.35;
  font-weight: 500;
}

.chatbot-status-pill .status-dot {
  width: 6px;
  height: 6px;
  background: rgba(34, 197, 94, 1);
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
  animation: chatbotStatusPulse 2s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .chatbot-status-pill .status-dot {
    animation: none;
  }
}

.chatbot-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.chatbot-header-btn,
.chatbot-minimize.chatbot-header-btn {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid rgba(55, 192, 255, 0.18);
  background: rgba(12, 40, 64, 0.45);
  color: rgba(55, 192, 255, 0.85);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
  flex-shrink: 0;
  box-shadow: none;
  backdrop-filter: none;
  overflow: visible;
  will-change: auto;
}

.chatbot-header-btn::before,
.chatbot-minimize::before {
  display: none;
}

.chatbot-header-btn svg,
.chatbot-minimize svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  transition: transform 0.2s ease;
  position: static;
  z-index: auto;
}

.chatbot-header-btn:hover,
.chatbot-minimize:hover {
  background: rgba(55, 192, 255, 0.1);
  border-color: rgba(55, 192, 255, 0.38);
  color: rgba(55, 192, 255, 1);
  transform: translateY(-1px);
  box-shadow: none;
}

.chatbot-header-btn:hover svg,
.chatbot-minimize:hover svg {
  transform: none;
}

.chatbot-header-btn:active,
.chatbot-minimize:active {
  transform: translateY(0);
  box-shadow: none;
}

.chatbot-header-btn.active {
  background: rgba(55, 192, 255, 0.14);
  border-color: rgba(55, 192, 255, 0.45);
  color: #7dd3fc;
  box-shadow: none;
}

/* ===== MESSAGES ===== */
.chatbot-messages {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 140px;
  overflow-y: auto;
  padding: var(--chatbot-pad) 16px;
  display: flex;
  flex-direction: column;
  gap: var(--chatbot-gap);
  scrollbar-width: thin;
  scrollbar-color: rgba(55, 192, 255, 0.25) transparent;
}

.chatbot-welcome-static {
  opacity: 1 !important;
  visibility: visible !important;
}

.chatbot-welcome-static .chatbot-message-content {
  opacity: 1;
  visibility: visible;
  color: var(--chatbot-text);
}

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

.chatbot-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(55, 192, 255, 0.22);
  border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(55, 192, 255, 0.38);
}

.chatbot-message {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  animation: chatbotSlideIn 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.chatbot-message.user {
  flex-direction: row-reverse;
}

.chatbot-message-glyph {
  align-self: flex-end;
  margin-bottom: 2px;
}

/* Header orb is the identity mark — suppress repeated orbs on every message */
.chatbot-message.bot .chatbot-message-glyph {
  display: none;
}

/* Compensate: indent bot messages to align with the header text column */
.chatbot-message.bot {
  padding-left: 8px;
}

/* Typing indicator — dots alone are sufficient, drop the duplicate orb */
.chatbot-typing .chatbot-glyph--typing {
  display: none;
}

.chatbot-message-avatar {
  display: none;
}

.chatbot-message-content {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  position: relative;
}

.chatbot-message.bot .chatbot-message-content {
  background: var(--chatbot-surface);
  border: 1px solid var(--chatbot-border);
  color: var(--chatbot-text);
  border-bottom-left-radius: 4px;
  box-shadow: none;
  position: relative;
}

.chatbot-message.bot .chatbot-message-content::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 2px;
  border-radius: 1px;
  background: linear-gradient(
    180deg,
    rgba(55, 192, 255, 0.75) 0%,
    rgba(255, 138, 0, 0.55)  50%,
    rgba(55, 192, 255, 0.6)  100%
  );
  animation: chatbotBotAccentPulse 3.2s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes chatbotBotAccentPulse {
  0%, 100% { opacity: 0.45; }
  50%      { opacity: 0.9;  }
}

.chatbot-message.user .chatbot-message-content {
  background: rgba(37, 99, 235, 0.22);
  border: 1px solid rgba(55, 192, 255, 0.22);
  color: var(--chatbot-text);
  border-bottom-right-radius: 4px;
  box-shadow: none;
}

@media (prefers-color-scheme: light) {
  .chatbot-window {
    background:
      radial-gradient(ellipse 120% 80% at 100% 0%, rgba(55, 192, 255, 0.06) 0%, transparent 55%),
      linear-gradient(168deg, #f8fafc 0%, #eef4f8 52%, #e8f0f6 100%);
    color: rgba(15, 23, 42, 0.92);
  }

  .chatbot-message.bot .chatbot-message-content {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(55, 192, 255, 0.18);
    color: rgba(15, 23, 42, 0.92);
  }

  .chatbot-message.user .chatbot-message-content {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.2);
    color: rgba(15, 23, 42, 0.92);
  }
}

/* ===== TYPING INDICATOR ===== */
.chatbot-typing {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 0 16px 8px 24px;
  position: relative;
  z-index: 1;
}

.chatbot-typing-avatar {
  display: none;
}

.chatbot-typing-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  background: linear-gradient(135deg, rgba(12, 46, 68, 0.55) 0%, rgba(6, 34, 55, 0.5) 100%);
  border: 1px solid rgba(55, 192, 255, 0.2);
}

.chatbot-typing-dots {
  display: flex;
  gap: 4px;
}

.chatbot-typing-dots span {
  width: 7px;
  height: 7px;
  background: rgba(55, 192, 255, 0.85);
  border-radius: 50%;
  animation: chatbotTypingDot 1.4s ease-in-out infinite;
}

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

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

/* ===== SUGGESTIONS ===== */
.chatbot-suggestions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 var(--chatbot-pad) 8px;
}

.chatbot-suggestion {
  position: relative;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(12, 40, 64, 0.5);
  border: 1px solid rgba(55, 192, 255, 0.2);
  color: rgba(125, 211, 252, 0.95);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  animation: chatbotSlideIn 0.35s ease;
  box-shadow: none;
  backdrop-filter: none;
  will-change: auto;
}

.chatbot-suggestion::before {
  display: none;
}

.chatbot-suggestion:hover {
  background: rgba(55, 192, 255, 0.1);
  border-color: rgba(55, 192, 255, 0.38);
  color: #bae6fd;
  box-shadow: 0 0 0 1px rgba(255, 138, 0, 0.15);
  transform: none;
}

.chatbot-suggestion:active {
  transform: scale(0.98);
  box-shadow: none;
  border-color: rgba(55, 192, 255, 0.45);
}

.chatbot-suggestion svg {
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 5px;
  vertical-align: middle;
}

.chatbot-suggestion:hover svg {
  transform: none;
}

.chatbot-suggestion.pulse {
  animation: chatbotSlideIn 0.35s ease;
}

/* ===== COMPOSER ===== */
.chatbot-input-container {
  position: relative;
  z-index: 2;
  padding: 8px var(--chatbot-pad) 10px;
  background: rgba(4, 18, 32, 0.55);
  border-top: 1px solid var(--chatbot-border);
}

.chatbot-composer {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--chatbot-surface);
  border: 1px solid var(--chatbot-border);
  border-radius: 16px;
  overflow: hidden;
}

.chatbot-composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px 8px;
  border-top: 1px solid rgba(55, 192, 255, 0.1);
  background: rgba(6, 24, 40, 0.45);
}

.chatbot-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  position: relative;
}

.chatbot-input-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.chatbot-action-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--chatbot-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, background 0.2s ease;
  flex-shrink: 0;
}

.chatbot-action-btn:hover {
  background: rgba(55, 192, 255, 0.1);
  border-color: transparent;
  color: rgba(55, 192, 255, 1);
}

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

.chatbot-input-field-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
}

.chatbot-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 0;
  border: none;
  background: transparent;
  color: var(--chatbot-text);
  font-size: 13.5px;
  font-family: 'Open Sans', sans-serif;
  transition: none;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  line-height: 1.5;
  overflow-y: auto;
  box-sizing: border-box;
}

.chatbot-input:focus {
  outline: none;
  box-shadow: none;
}

.chatbot-input::placeholder {
  color: rgba(234, 243, 249, 0.45);
  font-weight: 400;
}

.chatbot-input::-webkit-scrollbar {
  width: 5px;
}

.chatbot-input::-webkit-scrollbar-track {
  background: transparent;
}

.chatbot-input::-webkit-scrollbar-thumb {
  background: rgba(55, 192, 255, 0.25);
  border-radius: 3px;
}

.chatbot-input-footer {
  display: none;
}

.chatbot-shortcut-hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 4px;
  font-size: 10px;
  line-height: 1;
  color: rgba(234, 243, 249, 0.45);
  cursor: pointer;
  transition: color 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chatbot-shortcut-hint:hover {
  color: rgba(55, 192, 255, 0.85);
}

.chatbot-shortcut-hint kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(55, 192, 255, 0.12);
  border: 1px solid rgba(55, 192, 255, 0.28);
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
  font-size: 9px;
  color: rgba(55, 192, 255, 0.9);
  font-weight: 600;
}

@media (prefers-color-scheme: light) {
  .chatbot-input-container {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.85) 0%, rgba(248, 250, 252, 0.9) 100%);
    border-top-color: rgba(255, 167, 38, 0.2);
  }

  .chatbot-input {
    background: rgba(255, 255, 255, 0.95);
    color: rgba(15, 23, 42, 0.92);
    border-color: rgba(255, 167, 38, 0.35);
  }

  .chatbot-input::placeholder {
    color: rgba(15, 23, 42, 0.45);
  }

  .chatbot-action-btn {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(255, 167, 38, 0.25);
    color: rgba(255, 138, 0, 0.9);
  }

  .chatbot-shortcut-hint {
    color: rgba(15, 23, 42, 0.45);
  }
}

.chatbot-send {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: none;
  background: var(--chatbot-gradient-brand-static);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 2px 8px rgba(255, 138, 0, 0.35);
  flex-shrink: 0;
}

.chatbot-send:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 138, 0, 0.45);
}

.chatbot-send:active {
  transform: translateY(0);
}

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

/* ===== FOOTER ===== */
.chatbot-footer {
  position: relative;
  z-index: 2;
  padding: 6px var(--chatbot-pad);
  text-align: center;
  font-size: 10px;
  color: rgba(234, 243, 249, 0.45);
  background: rgba(4, 18, 32, 0.5);
  border-top: 1px solid rgba(55, 192, 255, 0.08);
}

@media (prefers-color-scheme: dark) {
  .chatbot-footer {
    color: rgba(234, 243, 249, 0.45);
    background: rgba(4, 18, 32, 0.5);
  }
}

.chatbot-footer kbd {
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255,167,38,0.2);
  border: 1px solid rgba(255,167,38,0.3);
  font-family: monospace;
  font-size: 10px;
}

/* ===== ANIMATIONS ===== */
@keyframes chatbotFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes chatbotLogoBreathe {
  0%, 100% {
    transform: scale(1);
    filter:
      drop-shadow(0 0 8px  rgba(55,192,255,0.72))
      drop-shadow(0 0 20px rgba(55,192,255,0.40))
      drop-shadow(0 0 14px rgba(255,138,0,0.55))
      drop-shadow(0 0 36px rgba(255,138,0,0.28))
      drop-shadow(0 0 48px rgba(168,85,247,0.14));
  }
  50% {
    transform: scale(1.04);
    filter:
      drop-shadow(0 0 14px rgba(55,192,255,0.95))
      drop-shadow(0 0 30px rgba(55,192,255,0.60))
      drop-shadow(0 0 22px rgba(255,138,0,0.82))
      drop-shadow(0 0 52px rgba(255,138,0,0.46))
      drop-shadow(0 0 68px rgba(168,85,247,0.26));
  }
}

@keyframes chatbotPulse {
  0% {
    transform: translate(-50%, -50%) scale(0.7);
    opacity: 0;
  }
  20% {
    opacity: 0.9;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.4);
    opacity: 0;
  }
}

@keyframes chatbotToggleGlow {
  0%, 100% {
    box-shadow:
      0 0 0 1.5px rgba(55, 192, 255, 0.30),
      0 0 10px rgba(55, 192, 255, 0.20),
      0 0 18px rgba(255, 138, 0, 0.12);
  }
  50% {
    box-shadow:
      0 0 0 1.5px rgba(55, 192, 255, 0.60),
      0 0 16px rgba(55, 192, 255, 0.45),
      0 0 28px rgba(255, 138, 0, 0.28),
      0 0 38px rgba(168, 85, 247, 0.14);
  }
}


@keyframes chatbotBadgePulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

@keyframes chatbotAvatarGlow {
  0%, 100% {
    box-shadow: 
      0 4px 12px rgba(255,138,0,0.3),
      0 0 15px rgba(55,192,255,0.2);
    filter:
      drop-shadow(0 0 6px rgba(55,192,255,0.5))
      drop-shadow(0 0 10px rgba(255,138,0,0.4));
  }
  50% {
    box-shadow: 
      0 4px 20px rgba(255,138,0,0.5), 
      0 0 30px rgba(255,138,0,0.3),
      0 0 25px rgba(55,192,255,0.4);
    filter:
      drop-shadow(0 0 10px rgba(55,192,255,0.7))
      drop-shadow(0 0 15px rgba(255,138,0,0.6));
  }
}

@keyframes chatbotStatusPulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(0.9);
  }
}

@keyframes chatbotSlideIn {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes chatbotTypingDot {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-10px);
  }
}

@keyframes chatbotParticleFloat {
  0% {
    transform: translateY(100%) translateX(0) scale(0);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(-100%) translateX(50px) scale(1);
    opacity: 0;
  }
}

/* ===== MOBILE RESPONSIVENESS ===== */
@media (max-width: 480px) {
  .chatbot-shortcut-hint {
    display: none;
  }
}

@media (max-width: 768px) {
  .chatbot-window {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    border: none;
  }
  
  .chatbot-toggle {
    bottom: 16px;
    right: 16px;
    width: 80px;
    height: 80px;
  }
  
  .chatbot-logo {
    width: 68px;
    height: 68px;
    border-radius: 50% !important;
  }
  .chatbot-brain-canvas {
    width: 80px;
    height: 80px;
  }
}

/* ===== FILE PREVIEW ===== */
.file-preview {
  padding: 12px 16px;
  background: rgba(12, 46, 68, 0.6);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255,138,0,0.3);
  position: relative;
  z-index: 2;
}

.file-preview-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.file-preview-image {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(255,138,0,0.4);
}

.file-preview-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.file-preview-name {
  font-size: 14px;
  font-weight: 600;
  color: rgba(234,243,249,0.95);
}

.file-preview-size {
  font-size: 12px;
  color: rgba(166,192,211,0.8);
}

.file-preview-cancel {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: none;
  background: rgba(239,68,68,0.2);
  color: rgba(239,68,68,1);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
}

.file-preview-cancel:hover {
  background: rgba(239,68,68,0.3);
  transform: scale(1.1);
}

/* ===== EMOJI PICKER ===== */
.emoji-picker {
  position: fixed;
  width: 460px;
  max-height: 440px;
  background: rgba(9, 50, 75, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 2px solid rgba(255,138,0,0.4);
  border-radius: 16px;
  box-shadow:
    0 12px 40px rgba(0,0,0,0.6),
    0 0 40px rgba(255,138,0,0.2);
  z-index: var(--chatbot-layer-modal);
  opacity: 0;
  transform: translateY(10px) scale(0.95);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.emoji-picker.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.emoji-picker-header {
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 700;
  color: rgba(255,138,0,1);
  border-bottom: 1px solid rgba(255,138,0,0.3);
}

.emoji-picker-body {
  padding: 10px;
  max-height: 380px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,138,0,0.3) transparent;
}

.emoji-picker-body::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.emoji-picker-body::-webkit-scrollbar-thumb {
  background: rgba(255,138,0,0.3);
  border-radius: 3px;
}

.emoji-section {
  margin-bottom: 12px;
}

.emoji-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: rgba(166,192,211,0.9);
  margin: 0 2px 6px;
}

.emoji-strip {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 2px;
  scrollbar-width: thin;
}

.emoji-item {
  min-width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.emoji-item:hover {
  background: rgba(255,138,0,0.2);
  transform: scale(1.2);
}


/* Recording indicator */
.chatbot-action-btn.recording {
  background: rgba(239,68,68,0.25);
  color: rgba(239,68,68,1);
  animation: recordingPulse 1s ease-in-out infinite;
}

@keyframes recordingPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(239,68,68,0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(239,68,68,0);
  }
}

/* Message timestamps */
.chatbot-message-timestamp {
  font-size: 11px;
  color: rgba(166,192,211,0.6);
  margin-top: 6px;
  font-weight: 500;
}

/* Message actions - Enhanced icon buttons */
.chatbot-message-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  opacity: 0.55;
  transition: opacity 0.2s ease;
}

.chatbot-message:hover .chatbot-message-actions {
  opacity: 1;
}

.chatbot-message-action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 7px;
  background: rgba(55, 192, 255, 0.08);
  border: 1px solid rgba(55, 192, 255, 0.15);
  color: var(--chatbot-text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.chatbot-message-action::before {
  display: none;
}

.chatbot-message-action:hover {
  background: rgba(55, 192, 255, 0.14);
  border-color: rgba(55, 192, 255, 0.3);
  color: rgba(125, 211, 252, 1);
  transform: none;
  box-shadow: none;
}

/* Active state */
.chatbot-message-action:active {
  transform: scale(0.96);
  box-shadow: none;
}

.chatbot-message-action svg {
  width: 14px;
  height: 14px;
}

.chatbot-message-action:hover svg,
.chatbot-message-action[data-action="copy"]:hover svg,
.chatbot-message-action[data-action="regenerate"]:hover svg {
  transform: none;
}

/* Success state (when copy is clicked) */
.chatbot-message-action.success {
  background: 
    linear-gradient(135deg, rgba(12, 46, 68, 0.6) 0%, rgba(6, 34, 55, 0.5) 100%),
    linear-gradient(135deg, rgba(34, 197, 94, 0.25) 0%, rgba(22, 163, 74, 0.2) 100%);
  border-color: rgba(34, 197, 94, 0.5);
  color: rgba(74, 222, 128, 1);
  box-shadow: 
    0 4px 16px rgba(0,0,0,0.3),
    0 0 20px rgba(34, 197, 94, 0.4);
}

/* Markdown rendering styles */
.chatbot-message-content strong {
  font-weight: 700;
  color: rgba(255,167,38,1);
}

.chatbot-message-content em {
  font-style: italic;
  color: rgba(55,192,255,0.9);
}

.chatbot-message-content code {
  padding: 2px 6px;
  background: rgba(255,138,0,0.15);
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  color: rgba(255,167,38,1);
}

.chatbot-message-content ul {
  margin: 8px 0;
  padding-left: 20px;
}

.chatbot-message-content li {
  margin: 4px 0;
  line-height: 1.6;
}

.chatbot-message-content a {
  color: rgba(55,192,255,1);
  text-decoration: none;
  border-bottom: 1px solid rgba(55,192,255,0.3);
  transition: all 0.2s ease;
}

.chatbot-message-content a:hover {
  color: rgba(75,212,255,1);
  border-bottom-color: rgba(55,192,255,0.6);
}

/* ===== QUICK ACTIONS (NAV BUTTONS) ===== */
.chatbot-quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 6px var(--chatbot-pad) 8px;
  background: transparent;
  border-top: 1px solid rgba(55, 192, 255, 0.08);
}

.chatbot-quick-actions .quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 36px;
  padding: 6px 4px;
  border-radius: 10px;
  border: 1px solid rgba(55, 192, 255, 0.18);
  background: rgba(12, 46, 68, 0.35);
  color: rgba(234, 243, 249, 0.85);
  font-weight: 600;
  font-size: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chatbot-quick-actions .quick-action svg {
  color: rgba(55, 192, 255, 0.95);
  flex-shrink: 0;
}

.chatbot-quick-actions .quick-action span {
  line-height: 1.2;
  text-align: center;
}

.chatbot-quick-actions .quick-action:hover {
  background: rgba(55, 192, 255, 0.1);
  border-color: rgba(168, 85, 247, 0.35);
  box-shadow: 0 0 12px rgba(55, 192, 255, 0.12);
}

.chatbot-quick-actions .quick-action:active {
  transform: scale(0.98);
}

@media (max-width: 480px) {
  .chatbot-quick-actions .quick-action span {
    display: none;
  }

  .chatbot-quick-actions .quick-action {
    min-height: 34px;
    padding: 8px;
  }
}

/* ===== MODALS ===== */
#chatbot-modal-overlay {
  position: fixed !important;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: var(--chatbot-layer-modal) !important;
}

#chatbot-modal-overlay.chatbot-preview-overlay {
  align-items: center;
  justify-content: center;
  padding:
    max(12px, env(safe-area-inset-top, 0px))
    max(12px, env(safe-area-inset-right, 0px))
    max(12px, env(safe-area-inset-bottom, 0px))
    max(12px, env(safe-area-inset-left, 0px));
  overflow: hidden;
}

#chatbot-modal-overlay.chatbot-preview-overlay .chatbot-modal {
  width: min(920px, calc(100vw - 24px));
  height: min(760px, calc(100dvh - 24px));
  max-height: calc(100dvh - 24px);
  max-width: calc(100vw - 24px);
  margin: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

#chatbot-modal-overlay.chatbot-preview-overlay .chatbot-modal-header {
  position: relative;
  top: auto;
  z-index: 12;
  flex-shrink: 0;
}

#chatbot-modal-overlay.chatbot-preview-overlay .chatbot-modal-body {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 14px;
}

#chatbot-modal-overlay.chatbot-preview-overlay .chatbot-modal-embed {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  display: flex;
  flex-direction: column;
}

#chatbot-modal-overlay.chatbot-preview-overlay .chatbot-modal-embed iframe {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  width: 100%;
}

#chatbot-modal-overlay.chatbot-preview-overlay .chatbot-modal-highlights {
  flex-shrink: 0;
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  max-height: 44px;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

#chatbot-modal-overlay.chatbot-preview-overlay .chatbot-modal-footer {
  flex-shrink: 0;
  z-index: 12;
}

@media (max-width: 520px) {
  #chatbot-modal-overlay.chatbot-preview-overlay {
    padding:
      max(8px, env(safe-area-inset-top, 0px))
      max(8px, env(safe-area-inset-right, 0px))
      max(8px, env(safe-area-inset-bottom, 0px))
      max(8px, env(safe-area-inset-left, 0px));
  }

  #chatbot-modal-overlay.chatbot-preview-overlay .chatbot-modal {
    width: calc(100vw - 16px);
    height: min(680px, calc(100dvh - 16px));
    max-height: calc(100dvh - 16px);
  }
}

body.chatbot-preview-open {
  overflow: hidden;
}

#chatbot-modal-overlay.open {
  display: flex;
  pointer-events: all;
  opacity: 1;
}

.chatbot-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 12, 22, 0.72);
  backdrop-filter: blur(10px);
}

.chatbot-modal {
  position: relative;
  width: min(960px, calc(100vw - 40px));
  max-height: min(820px, calc(100vh - 128px));
  background: linear-gradient(168deg, #071525 0%, #0a1e32 52%, #061018 100%);
  border-radius: 18px;
  border: 1px solid rgba(55, 192, 255, 0.22);
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(168, 85, 247, 0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 1;
  outline: none;
  color: var(--chatbot-text);
}

.chatbot-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(6, 24, 40, 0.95);
  border-bottom: 1px solid var(--chatbot-border);
  flex-shrink: 0;
}

.chatbot-modal-titles {
  flex: 1;
  min-width: 0;
  padding-right: 8px;
}

.chatbot-modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--chatbot-text);
}

.chatbot-modal-title--gradient {
  background: var(--chatbot-gradient-brand-static);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.chatbot-modal-subtitle {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--chatbot-text-muted);
}

.chatbot-modal-close {
  flex-shrink: 0;
  position: relative;
  z-index: 20;
  border: 2px solid rgba(255, 156, 47, 0.75);
  background: rgba(8, 28, 48, 0.98);
  color: #ffb347;
  border-radius: 10px;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
}

.chatbot-modal-close:hover {
  background: rgba(255, 138, 0, 0.18);
  border-color: rgba(255, 180, 71, 0.95);
  color: #ffd08a;
  transform: scale(1.05);
}

.chatbot-modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 14px 14px;
  overflow: auto;
}

.chatbot-modal-embed {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(55, 192, 255, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  background: #061018;
  min-height: min(420px, 50vh);
}

.chatbot-modal-embed-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--chatbot-text-muted);
  background: rgba(6, 16, 28, 0.92);
  z-index: 2;
}

.chatbot-modal-embed.is-loaded .chatbot-modal-embed-loading {
  display: none;
}

.chatbot-modal-embed-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px;
  text-align: center;
  background: rgba(6, 16, 28, 0.95);
  z-index: 3;
}

.chatbot-modal-embed-error p {
  margin: 0;
  color: var(--chatbot-text-muted);
  font-size: 14px;
}

.chatbot-modal-embed-fallback {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid rgba(55, 192, 255, 0.35);
  background: rgba(55, 192, 255, 0.12);
  color: #bae6fd;
  font-weight: 600;
  cursor: pointer;
}

.chatbot-modal-embed.is-loaded .chatbot-modal-embed-loading,
.chatbot-modal-embed.is-loaded .chatbot-modal-embed-error {
  display: none !important;
}

.chatbot-modal-embed.is-error iframe {
  display: none !important;
}

.chatbot-modal-embed-error[hidden] {
  display: none !important;
}

.chatbot-modal-embed iframe {
  width: 100%;
  min-height: min(420px, 50vh);
  border: 0;
  background: #061018;
  display: block;
}

.chatbot-modal-embed-overlay {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 4;
  pointer-events: none;
  bottom: 10px;
  right: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(6, 18, 32, 0.82);
  color: rgba(234, 243, 249, 0.75);
  font-size: 10px;
  letter-spacing: 0.02em;
  pointer-events: none;
  z-index: 4;
  border: 1px solid rgba(55, 192, 255, 0.18);
}

.chatbot-modal-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chatbot-modal-highlight {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  color: rgba(186, 230, 253, 0.95);
  background: rgba(55, 192, 255, 0.08);
  border: 1px solid rgba(55, 192, 255, 0.2);
}

.chatbot-modal-footer {
  padding: 12px 16px 14px;
  border-top: 1px solid var(--chatbot-border);
  background: rgba(4, 18, 32, 0.95);
  flex-shrink: 0;
}

.chatbot-modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.chatbot-modal-cta,
.chatbot-modal-secondary {
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.chatbot-modal-cta {
  border: none;
  background: var(--chatbot-gradient-brand-static);
  color: #fff;
  box-shadow: 0 2px 10px rgba(255, 138, 0, 0.25);
}

.chatbot-modal-secondary {
  border: 1px solid rgba(55, 192, 255, 0.35);
  background: transparent;
  color: rgba(125, 211, 252, 0.95);
}

.chatbot-modal-cta:hover,
.chatbot-modal-secondary:hover {
  transform: translateY(-1px);
}

.chatbot-modal-cta:active,
.chatbot-modal-secondary:active {
  transform: translateY(0);
}

/* ===== RESOURCE CARDS ===== */
.chatbot-resource-cards {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.chatbot-resource-card {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(55, 192, 255, 0.22);
  background: rgba(8, 32, 52, 0.55);
  box-shadow: none;
}

.chatbot-resource-tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--chatbot-gradient-brand-static);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.chatbot-resource-title {
  margin: 8px 0 4px;
  font-weight: 700;
  color: var(--chatbot-text);
}

.chatbot-resource-desc {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--chatbot-text-muted);
}

.chatbot-resource-link {
  display: inline-block;
  font-weight: 700;
  color: rgba(55,192,255,1);
  text-decoration: none;
}

@media (prefers-color-scheme: dark) {
  .chatbot-resource-title { color: rgba(255,255,255,0.95); }
  .chatbot-resource-desc { color: rgba(255,255,255,0.75); }
}

/* ===== SIDE PANELS (HISTORY & SETTINGS) ===== */
.chatbot-side-panel {
  position: fixed !important;
  top: 0;
  right: 0;
  width: 380px;
  max-width: 90vw;
  height: 100vh;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-left: 2px solid rgba(255,167,38,0.3);
  box-shadow: -4px 0 40px rgba(0,0,0,0.3);
  z-index: var(--chatbot-layer-panel) !important;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.chatbot-side-panel.open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: all;
  visibility: visible;
}

.chatbot-side-panel-backdrop {
  position: fixed !important;
  inset: 0;
  z-index: calc(var(--chatbot-layer-panel) - 1) !important;
  background: rgba(2, 10, 20, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.chatbot-side-panel-backdrop.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

@media (prefers-color-scheme: dark) {
  .chatbot-side-panel {
    background: rgba(15,23,42,0.95);
  }
}

.chatbot-side-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 2px solid rgba(255,167,38,0.2);
  background: linear-gradient(135deg, rgba(255,167,38,0.15) 0%, rgba(255,138,0,0.15) 100%);
}

.chatbot-side-panel-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: rgba(255,167,38,1);
}

.chatbot-side-panel-close {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: rgba(255,167,38,0.2);
  color: rgba(255,167,38,1);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatbot-side-panel-close:hover {
  background: rgba(255,167,38,0.3);
  transform: scale(1.1);
}

.chatbot-side-panel-search {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,167,38,0.15);
}

.chatbot-side-panel-search input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 2px solid rgba(255,167,38,0.3);
  background: rgba(255,255,255,0.8);
  color: rgba(0,0,0,0.9);
  font-size: 14px;
  transition: all 0.2s ease;
}

.chatbot-side-panel-search input:focus {
  outline: none;
  border-color: rgba(255,167,38,0.6);
  box-shadow: 0 0 0 3px rgba(255,167,38,0.1);
}

@media (prefers-color-scheme: dark) {
  .chatbot-side-panel-search input {
    background: rgba(30,41,59,0.8);
    color: rgba(255,255,255,0.95);
  }
}

.chatbot-side-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,167,38,0.3) transparent;
}

.chatbot-side-panel-content::-webkit-scrollbar {
  width: 6px;
}

.chatbot-side-panel-content::-webkit-scrollbar-thumb {
  background: rgba(255,167,38,0.3);
  border-radius: 3px;
}

.chatbot-side-panel-footer {
  padding: 16px 20px;
  border-top: 2px solid rgba(255,167,38,0.2);
  display: flex;
  gap: 10px;
  background: rgba(255,255,255,0.3);
  flex-shrink: 0;
}

.chatbot-side-panel-footer .btn {
  flex: 1;
  justify-content: center;
}

#chatbot-settings-done {
  font-weight: 700;
}

#chatbot-history-done {
  font-weight: 700;
}

.chatbot-side-panel-footer--stacked {
  flex-direction: column;
  gap: 10px;
}

.chatbot-side-panel-footer-row {
  display: flex;
  gap: 10px;
  width: 100%;
}

.chatbot-side-panel-footer-row .btn {
  flex: 1;
  justify-content: center;
}

.chatbot-side-panel-footer-row--secondary .btn {
  font-size: 0.8125rem;
}

@media (prefers-color-scheme: dark) {
  .chatbot-side-panel-footer {
    background: rgba(15,23,42,0.3);
  }
}

.chatbot-history-item {
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,167,38,0.2);
  background: linear-gradient(135deg, rgba(255,167,38,0.1) 0%, rgba(55,192,255,0.08) 100%);
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chatbot-history-item:hover {
  border-color: rgba(255,167,38,0.4);
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(255,167,38,0.2);
}

.chatbot-history-item-title {
  font-weight: 700;
  font-size: 14px;
  color: rgba(255,167,38,1);
  margin-bottom: 6px;
}

.chatbot-history-item-meta {
  font-size: 12px;
  color: rgba(0,0,0,0.6);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

@media (prefers-color-scheme: dark) {
  .chatbot-history-item-meta {
    color: rgba(255,255,255,0.6);
  }
}

/* ===== SETTINGS PANEL ===== */
.chatbot-setting-group {
  margin-bottom: 20px;
}

.chatbot-setting-group label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: rgba(255,167,38,1);
  margin-bottom: 8px;
}

.chatbot-setting-group select,
.chatbot-setting-group input[type="range"] {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 2px solid rgba(255,167,38,0.3);
  background: rgba(255,255,255,0.8);
  color: rgba(0,0,0,0.9);
  font-size: 14px;
  transition: all 0.2s ease;
}

.chatbot-setting-group select:focus,
.chatbot-setting-group input[type="range"]:focus {
  outline: none;
  border-color: rgba(255,167,38,0.6);
  box-shadow: 0 0 0 3px rgba(255,167,38,0.1);
}

.chatbot-setting-group input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-right: 10px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: 2px solid rgba(100, 120, 140, 0.5);
  border-radius: 4px;
  background: rgba(30, 40, 55, 0.6);
  position: relative;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.chatbot-setting-group input[type="checkbox"]:hover {
  border-color: rgba(255, 167, 38, 0.5);
  background: rgba(30, 40, 55, 0.8);
}

.chatbot-setting-group input[type="checkbox"]:checked {
  background: linear-gradient(135deg, rgba(255, 167, 38, 1) 0%, rgba(255, 138, 0, 1) 100%);
  border-color: rgba(255, 167, 38, 1);
}

.chatbot-setting-group input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.chatbot-setting-group input[type="checkbox"]:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 167, 38, 0.15);
}

.chatbot-setting-group input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: rgba(255,167,38,0.2);
  border-radius: 3px;
  padding: 0;
}

.chatbot-setting-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: rgba(255,167,38,1);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(255,167,38,0.4);
}

.chatbot-setting-group input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: rgba(255,167,38,1);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(255,167,38,0.4);
}

#chatbot-voice-rate-value {
  display: inline-block;
  margin-left: 10px;
  font-weight: 600;
  color: rgba(255,167,38,0.9);
}

@media (prefers-color-scheme: dark) {
  .chatbot-setting-group select,
  .chatbot-setting-group input[type="range"] {
    background: rgba(30,41,59,0.8);
    color: rgba(255,255,255,0.95);
  }
}

/* ===== KEYBOARD SHORTCUTS MODAL ===== */
.chatbot-modal-overlay {
  position: fixed !important;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(6, 18, 32, 0.75);
  backdrop-filter: blur(8px);
  z-index: var(--chatbot-layer-modal) !important;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.chatbot-modal-overlay.show {
  display: flex;
  opacity: 1;
  pointer-events: all;
}

.chatbot-shortcuts-modal {
  width: min(500px, 90vw);
  max-height: 80vh;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-radius: 20px;
  border: 2px solid rgba(255,167,38,0.3);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.chatbot-modal-overlay.show .chatbot-shortcuts-modal {
  transform: scale(1);
}

@media (prefers-color-scheme: dark) {
  .chatbot-shortcuts-modal {
    background: rgba(15,23,42,0.95);
  }
}

.chatbot-shortcuts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 2px solid rgba(255,167,38,0.2);
  background: linear-gradient(135deg, rgba(255,167,38,0.15) 0%, rgba(255,138,0,0.15) 100%);
}

.chatbot-shortcuts-header h3 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  color: rgba(255,167,38,1);
}

.chatbot-shortcuts-close {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: rgba(255,167,38,0.2);
  color: rgba(255,167,38,1);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatbot-shortcuts-close:hover {
  background: rgba(255,167,38,0.3);
  transform: scale(1.1);
}

.chatbot-shortcuts-content {
  padding: 24px;
  max-height: calc(80vh - 100px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,167,38,0.3) transparent;
}

.chatbot-shortcuts-content::-webkit-scrollbar {
  width: 6px;
}

.chatbot-shortcuts-content::-webkit-scrollbar-thumb {
  background: rgba(255,167,38,0.3);
  border-radius: 3px;
}

.chatbot-shortcut-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  margin-bottom: 10px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255,167,38,0.1) 0%, rgba(55,192,255,0.08) 100%);
  border: 1px solid rgba(255,167,38,0.2);
  transition: all 0.2s ease;
}

.chatbot-shortcut-item:hover {
  border-color: rgba(255,167,38,0.4);
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(255,167,38,0.2);
}

.chatbot-shortcut-item kbd {
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(255,167,38,0.2);
  border: 1px solid rgba(255,167,38,0.3);
  font-family: monospace;
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,167,38,1);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chatbot-shortcut-item span {
  font-size: 14px;
  font-weight: 600;
  color: rgba(0,0,0,0.8);
}

@media (prefers-color-scheme: dark) {
  .chatbot-shortcut-item span {
    color: rgba(255,255,255,0.8);
  }
}

/* ===== BUTTON STYLES ===== */
.btn {
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-small {
  padding: 8px 14px;
  font-size: 13px;
}

.btn-outline {
  background: transparent;
  border: 2px solid rgba(255,167,38,0.3);
  color: rgba(255,167,38,1);
}

.btn-outline:hover {
  background: rgba(255,167,38,0.1);
  border-color: rgba(255,167,38,0.5);
  transform: translateY(-2px);
}

.btn:not(.btn-outline) {
  background: linear-gradient(135deg, rgba(255,167,38,1) 0%, rgba(255,138,0,1) 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(255,167,38,0.3);
}

.btn:not(.btn-outline):hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255,167,38,0.4);
}