/* ═══════════════════════════════════════════════════════════════
   AI COPILOT — Frosted Glass Launch Button + Fluid Bubble
   ═══════════════════════════════════════════════════════════════ */

/* ── Sidebar footer: row layout for logout + AI button ── */
.sidebar-footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
}

.logout-btn-compact {
  flex: 1;
  min-width: 0;
  /* Override the base rule that sets width:100% — flex:1 handles sizing here */
  width: auto !important;
  /* Truncate text gracefully on narrow sidebars */
  white-space: nowrap;
  overflow: hidden;
}

/* ── Logout Button — frosted glass pill matching AI button style ──
   High-specificity selectors override the grey overrides in
   glass.css / chrome-theme.css / liquid-glass.css. Keep grey-toned
   glass; hover mirrors the AI button's scale + glow animation.
   ── */
.logout-btn,
.sidebar .logout-btn,
body.theme-light .sidebar .logout-btn,
.sidebar-footer-actions .logout-btn {
  position: relative !important;
  overflow: hidden !important;
  border-radius: 999px !important;
  border: 1.5px solid rgba(255, 255, 255, 0.45) !important;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.22) 0%,
    rgba(255, 255, 255, 0.08) 100%
  ) !important;
  backdrop-filter: blur(12px) saturate(1.8) !important;
  -webkit-backdrop-filter: blur(12px) saturate(1.8) !important;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12),
    0 4px 16px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.30) !important;
  color: rgba(255, 255, 255, 0.92) !important;
  font-weight: 600 !important;
  letter-spacing: 0.25px !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55) !important;
  cursor: pointer !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  outline-offset: 2px !important;
}

/* Upper-hemisphere catch-light — same glass-sphere trick as the AI button */
.logout-btn::before,
.sidebar .logout-btn::before,
.sidebar-footer-actions .logout-btn::before {
  content: '' !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  height: 50% !important;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.26) 0%,
    rgba(255, 255, 255, 0.00) 100%
  ) !important;
  border-radius: 999px 999px 0 0 !important;
  pointer-events: none !important;
  z-index: 2 !important;
}

/* Push icon + text above the catch-light layer */
.logout-btn > *,
.sidebar .logout-btn > * {
  position: relative !important;
  z-index: 1 !important;
}

/* Hover — mirrors AI button: scale(1.09) + silver glow instead of red */
.logout-btn:hover,
.sidebar .logout-btn:hover,
body.theme-light .sidebar .logout-btn:hover,
.sidebar-footer-actions .logout-btn:hover {
  transform: scale(1.09) !important;
  border-color: rgba(255, 255, 255, 0.70) !important;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.30) 0%,
    rgba(220, 225, 235, 0.14) 100%
  ) !important;
  box-shadow:
    0 0 0 1.5px rgba(255, 255, 255, 0.55),
    0 6px 24px rgba(180, 190, 210, 0.30),
    0 0 18px rgba(220, 225, 240, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.40) !important;
  color: #ffffff !important;
  text-shadow:
    0 0 8px  rgba(255, 255, 255, 0.70),
    0 0 20px rgba(200, 215, 235, 0.55),
    0 1px 2px rgba(0, 0, 0, 0.55) !important;
}

.logout-btn:active,
.sidebar .logout-btn:active,
.sidebar-footer-actions .logout-btn:active {
  transform: scale(0.97) !important;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.18),
    0 2px 8px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.28) !important;
}

/* ── AI Copilot Launch Button — frosted glass circle ── */
.ai-copilot-launch-btn {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.22) 0%,
    rgba(255, 255, 255, 0.08) 100%
  );
  backdrop-filter: blur(12px) saturate(1.8);
  -webkit-backdrop-filter: blur(12px) saturate(1.8);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12),
    0 4px 16px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.30);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  outline-offset: 2px;
}

/* AI label — white at rest, red when active */
.ai-btn-label {
  position: relative;
  z-index: 1;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
  line-height: 1;
  user-select: none;
  font-family: inherit;
  transition: color 0.35s ease, text-shadow 0.35s ease;
}

/* Red glow when the bubble is running */
.ai-copilot-launch-btn.active .ai-btn-label {
  color: #ff1a1a;
  text-shadow:
    0 0 6px  rgba(255, 30, 30, 0.90),
    0 0 16px rgba(255, 60, 60, 0.65),
    0 1px 2px rgba(0, 0, 0, 0.55);
}

/* Upper-hemisphere catch-light typical of glass spheres */
.ai-copilot-launch-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.26) 0%,
    rgba(255, 255, 255, 0.00) 100%
  );
  border-radius: 50% 50% 0 0;
  pointer-events: none;
  z-index: 2;
}

.ai-copilot-launch-btn:hover {
  transform: scale(1.09);
  box-shadow:
    0 0 0 1.5px rgba(255, 60, 60, 0.55),
    0 6px 24px rgba(255, 40, 40, 0.30),
    inset 0 1px 0 rgba(255, 255, 255, 0.40);
  border-color: rgba(255, 120, 120, 0.70);
}

.ai-copilot-launch-btn:hover .ai-btn-label {
  text-shadow:
    0 0 8px  rgba(255, 30, 30, 1.00),
    0 0 20px rgba(255, 60, 60, 0.80),
    0 1px 2px rgba(0, 0, 0, 0.55);
}

/* Active / listening state — iridescent pulse */
.ai-copilot-launch-btn.active {
  border-color: rgba(130, 225, 255, 0.85);
  animation: ai-btn-pulse 2.4s ease-in-out infinite;
}

@keyframes ai-btn-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 2px  rgba(100, 200, 255, 0.40),
      0 0 16px   rgba(80,  180, 255, 0.45),
      0 6px 24px rgba(0,   120, 255, 0.38),
      inset 0 1px 0 rgba(255, 255, 255, 0.32);
  }
  50% {
    box-shadow:
      0 0 0 5px  rgba(100, 200, 255, 0.15),
      0 0 32px   rgba(80,  180, 255, 0.80),
      0 8px 32px rgba(0,   140, 255, 0.55),
      inset 0 1px 0 rgba(255, 255, 255, 0.32);
  }
}

/* ═══════════════════════════════════════════════════════════════
   AI COPILOT FLOATING FLUID BUBBLE
   ═══════════════════════════════════════════════════════════════ */

.ai-copilot-bubble {
  /* Fixed to viewport — JS drives left/top each frame for drift+drag */
  position: fixed;
  top: 0;
  left: 0;
  width: 148px;
  height: 148px;
  border-radius: 50%;
  z-index: 99999;

  /* Pointer events ON so the user can drag the bubble */
  pointer-events: auto;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;

  /* Subtle backdrop glass — frosted depth behind transparent canvas areas */
  backdrop-filter: blur(2px) brightness(1.06) saturate(1.30);
  -webkit-backdrop-filter: blur(2px) brightness(1.06) saturate(1.30);

  /* Delicate iridescent rim */
  border: 1.5px solid rgba(160, 220, 255, 0.38);

  /* Outer glow */
  box-shadow:
    0 0 40px rgba(60, 140, 255, 0.18),
    0 0 80px rgba(80, 180, 255, 0.10),
    inset 0 0 24px rgba(100, 200, 255, 0.06);

  overflow: hidden;
  clip-path: circle(50% at 50% 50%);
  -webkit-clip-path: circle(50% at 50% 50%);
  will-change: transform, opacity;
}

/* While dragging */
.ai-copilot-bubble.dragging {
  cursor: grabbing !important;
  transition: none !important;
  filter: drop-shadow(0 8px 28px rgba(60,140,255,0.55));
}

/* Pop-in entrance */
.ai-copilot-bubble.entering {
  animation: ai-bubble-appear 0.65s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Pop-out exit */
.ai-copilot-bubble.leaving {
  animation: ai-bubble-leave 0.38s cubic-bezier(0.4, 0, 0.6, 1) forwards;
}

@keyframes ai-bubble-appear {
  0%   { transform: scale(0.06) translateY(48px); opacity: 0; }
  55%  { opacity: 1; }
  100% { transform: scale(1) translateY(0);       opacity: 1; }
}

@keyframes ai-bubble-leave {
  0%   { transform: scale(1) translateY(0);       opacity: 1; }
  100% { transform: scale(0.06) translateY(48px); opacity: 0; }
}

/* ── Canvas fills the bubble completely ── */
#ai-copilot-canvas {
  position: absolute;
  inset: 0;
  width:  100% !important;
  height: 100% !important;
  border-radius: 50%;
  display: block;
}

/* ── Upper-left specular highlight — single bright caustic spot ── */
.ai-bubble-highlight {
  position: absolute;
  top:  9%;
  left: 11%;
  width:  44%;
  height: 36%;
  border-radius: 50%;
  background: radial-gradient(
    ellipse at 30% 30%,
    rgba(255, 255, 255, 0.52) 0%,
    rgba(255, 255, 255, 0.14) 48%,
    transparent 100%
  );
  transform: rotate(-32deg);
  pointer-events: none;
  mix-blend-mode: overlay;
  z-index: 10;
}

/* ── Lower secondary caustic shimmer ── */
.ai-bubble-caustic {
  position: absolute;
  bottom:  7%;
  right:  10%;
  width:  36%;
  height: 24%;
  border-radius: 50%;
  background: radial-gradient(
    ellipse,
    rgba(130, 220, 255, 0.22) 0%,
    transparent 70%
  );
  pointer-events: none;
  mix-blend-mode: screen;
  z-index: 10;
  animation: ai-caustic-drift 4.2s ease-in-out infinite alternate;
}

@keyframes ai-caustic-drift {
  0%   { transform: translate(0, 0) scale(1.00); opacity: 0.55; }
  100% { transform: translate(-8px, -10px) scale(1.18); opacity: 0.90; }
}

/* ── Rotating conic-gradient iridescent rim ring ── */
.ai-bubble-rim {
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: conic-gradient(
    rgba(80,  160, 255, 0.72)   0deg,
    rgba(150,  80, 255, 0.52)   72deg,
    rgba(255, 120,  60, 0.46)  144deg,
    rgba(60,  220, 180, 0.58)  216deg,
    rgba(255, 220,  80, 0.46)  288deg,
    rgba(80,  160, 255, 0.72)  360deg
  );
  /* Mask away the interior, leaving only a thin ring */
  mask: radial-gradient(
    farthest-side,
    transparent calc(100% - 3px),
    black       calc(100% - 3px)
  );
  -webkit-mask: radial-gradient(
    farthest-side,
    transparent calc(100% - 3px),
    black       calc(100% - 3px)
  );
  pointer-events: none;
  z-index: 11;
  animation: ai-rim-rotate 9s linear infinite;
  opacity: 0.80;
}

@keyframes ai-rim-rotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── AI Voice Subtitle ── */
#ai-subtitle {
  position          : fixed;
  transform         : translateX(-50%);
  max-width         : 280px;
  text-align        : center;
  pointer-events    : none;
  z-index           : 99998;
  opacity           : 0;
  transition        : opacity 0.6s ease;
  line-height       : 1.4;
  padding           : 0 4px;
}

#ai-subtitle.visible {
  opacity : 1;
}

#ai-subtitle .sub-user {
  display       : block;
  font-size     : 12px;
  color         : rgba(255, 255, 255, 0.72);
  text-shadow   : 0 1px 4px rgba(0, 0, 0, 0.85);
  font-style    : italic;
}

#ai-subtitle .sub-ai {
  display       : block;
  font-size     : 13px;
  font-weight   : 500;
  color         : #ffffff;
  text-shadow   : 0 1px 5px rgba(0, 0, 0, 0.90);
}

#ai-subtitle .sub-status {
  display       : block;
  font-size     : 11px;
  color         : rgba(180, 210, 255, 0.80);
  text-shadow   : 0 1px 3px rgba(0, 0, 0, 0.80);
  letter-spacing: 0.03em;
}

/* Typing cursor for keyboard input */
#ai-subtitle .type-cursor {
  display        : inline-block;
  width          : 2px;
  margin-left    : 1px;
  background     : rgba(255, 255, 255, 0.85);
  animation      : cion-blink 0.7s step-end infinite;
  vertical-align : text-bottom;
  font-style     : normal;
  color          : transparent;
}

@keyframes cion-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* Wider subtitle so typed sentences read comfortably */
#ai-subtitle {
  max-width : 420px;
}
