/* ============================================================
   AYE Tech Hub — AI Assistant Widget Styles  v1.0
   Fully isolated — all rules scoped to #aye-ai-widget.
   Inherits site CSS vars: --neon, --bg, --bg-card, --border,
   --text, --text-soft, --text-muted from index.html :root
   ============================================================ */

/* ---- Root container ---- */
#aye-ai-widget {
  position: fixed;
  bottom: 90px; /* above the #back-to-top arrow (46px tall at bottom:24px) */
  left: 24px;
  z-index: 997;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  /* Establish stacking context — prevents z-index bleed from site elements */
  isolation: isolate;
}

/* ============================================================
   FLOATING BUTTON
   ============================================================ */
#aye-ai-btn {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid rgba(0, 212, 255, 0.6);
  background: linear-gradient(135deg, #020f26, #0a1e40);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 0 20px rgba(0, 212, 255, 0.4),
    0 8px 32px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s;
  animation: ai-btn-float 3s ease-in-out infinite;
  z-index: 2;
  overflow: visible;
  will-change: transform, box-shadow;
}
#aye-ai-btn:hover {
  transform: scale(1.12) !important;
  box-shadow:
    0 0 35px rgba(0, 212, 255, 0.7),
    0 12px 40px rgba(0, 0, 0, 0.6);
  animation-play-state: paused;
}
#aye-ai-btn.panel-open {
  animation: none;
  border-color: rgba(0, 212, 255, 0.9);
  box-shadow:
    0 0 30px rgba(0, 212, 255, 0.6),
    0 8px 32px rgba(0, 0, 0, 0.5);
}
@keyframes ai-btn-float {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-7px); }
}

/* Pulse rings */
.ai-pulse-ring {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px solid rgba(0, 212, 255, 0.35);
  pointer-events: none;
  animation: ai-ring-pulse 2.5s ease-out infinite;
}
.ai-pulse-ring-2 {
  inset: -20px;
  border-color: rgba(0, 212, 255, 0.18);
  animation-delay: 0.7s;
}
@keyframes ai-ring-pulse {
  0%   { transform: scale(0.85); opacity: 1; }
  100% { transform: scale(1.5);  opacity: 0; }
}
#aye-ai-btn.panel-open .ai-pulse-ring,
#aye-ai-btn.panel-open .ai-pulse-ring-2 { display: none; }

/* Button icon */
.ai-btn-icon {
  width: 28px;
  height: 28px;
  color: #00d4ff;
  filter: drop-shadow(0 0 6px rgba(0, 212, 255, 0.8));
  transition: filter 0.3s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
#aye-ai-btn:hover .ai-btn-icon {
  filter: drop-shadow(0 0 14px rgba(0, 212, 255, 1));
}
.ai-btn-icon svg { width: 28px; height: 28px; }

/* Online status dot */
.ai-status-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #020817;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.8);
  animation: ai-dot-blink 2.5s ease-in-out infinite;
}
@keyframes ai-dot-blink {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

/* Tooltip */
.ai-btn-tooltip {
  position: absolute;
  left: 70px;
  top: 50%;
  transform: translateY(-50%) translateX(-6px);
  background: rgba(8, 18, 38, 0.96);
  border: 1px solid rgba(0, 212, 255, 0.3);
  color: #00d4ff;
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  white-space: nowrap;
  padding: 7px 13px;
  border-radius: 9px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
}
.ai-btn-tooltip::before {
  content: '';
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-right-color: rgba(0, 212, 255, 0.3);
}
#aye-ai-btn:hover .ai-btn-tooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* ============================================================
   CHAT PANEL
   ============================================================ */
#aye-ai-panel {
  position: absolute;
  bottom: 76px;
  left: 0;
  width: 380px;
  max-height: 570px;
  display: flex;
  flex-direction: column;

  background: rgba(8, 18, 38, 0.93);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(0, 212, 255, 0.22);
  border-radius: 20px;
  box-shadow:
    0 0 0 1px rgba(0, 212, 255, 0.05),
    0 30px 70px rgba(0, 0, 0, 0.65),
    0 0 50px rgba(0, 212, 255, 0.1);
  overflow: hidden;

  /* Closed state */
  opacity: 0;
  transform: translateY(18px) scale(0.95);
  pointer-events: none;
  transform-origin: bottom left;
  transition:
    opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: opacity, transform;
  contain: layout style;
}
#aye-ai-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Top neon accent line */
#aye-ai-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #00d4ff 30%, #3b82f6 70%, transparent);
  z-index: 2;
  pointer-events: none;
}

/* Ambient inner glow */
#aye-ai-panel::after {
  content: '';
  position: absolute;
  top: -100px; right: -100px;
  width: 240px; height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,212,255,0.05), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ---- Header ---- */
.ai-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 16px 14px;
  border-bottom: 1px solid rgba(0, 212, 255, 0.1);
  background: rgba(0, 212, 255, 0.025);
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}
.ai-header-left {
  display: flex;
  align-items: center;
  gap: 11px;
}
.ai-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(0,212,255,0.18), rgba(59,130,246,0.18));
  border: 1.5px solid rgba(0, 212, 255, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 14px rgba(0, 212, 255, 0.3);
  animation: ai-avatar-glow 3s ease-in-out infinite;
}
.ai-avatar svg { width: 18px; height: 18px; color: #00d4ff; }
@keyframes ai-avatar-glow {
  0%,100% { box-shadow: 0 0 12px rgba(0,212,255,0.28); }
  50%      { box-shadow: 0 0 24px rgba(0,212,255,0.6); }
}
.ai-header-name {
  font-size: 0.87rem;
  font-weight: 800;
  color: #e2e8f0;
  letter-spacing: 0.3px;
  line-height: 1.2;
}
.ai-header-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  color: #22c55e;
  font-weight: 600;
  letter-spacing: 0.4px;
  margin-top: 2px;
}
.ai-status-dot-sm {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.7);
  animation: ai-dot-blink 2.5s ease-in-out infinite;
}
.ai-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.ai-icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid rgba(0, 212, 255, 0.12);
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.ai-icon-btn svg { width: 14px; height: 14px; }
.ai-icon-btn:hover {
  background: rgba(0, 212, 255, 0.1);
  border-color: rgba(0, 212, 255, 0.3);
  color: #00d4ff;
}

/* ---- Messages list ---- */
.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 6px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  position: relative;
  z-index: 1;
  scroll-behavior: smooth;
  min-height: 0;
}
.ai-messages::-webkit-scrollbar { width: 4px; }
.ai-messages::-webkit-scrollbar-track { background: transparent; }
.ai-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 212, 255, 0.25);
  border-radius: 2px;
}

/* Message row */
.ai-message {
  display: flex;
  gap: 9px;
  animation: ai-msg-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.ai-message.user-msg { flex-direction: row-reverse; }
@keyframes ai-msg-in {
  from { opacity: 0; transform: translateY(14px) scale(0.94); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Mini avatar */
.ai-msg-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(0,212,255,0.12), rgba(59,130,246,0.12));
  border: 1px solid rgba(0, 212, 255, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 900;
  color: #00d4ff;
  flex-shrink: 0;
  margin-top: 2px;
}
.ai-message.user-msg .ai-msg-avatar {
  background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(59,130,246,0.15));
  border-color: rgba(99, 102, 241, 0.35);
  color: #818cf8;
}

/* Message body + bubble */
.ai-msg-body { max-width: calc(100% - 40px); }
.ai-msg-bubble {
  display: inline-block;
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 0.83rem;
  line-height: 1.62;
  color: #e2e8f0;
  max-width: 100%;
  word-break: break-word;
}
.ai-message:not(.user-msg) .ai-msg-bubble {
  background: rgba(0, 212, 255, 0.055);
  border: 1px solid rgba(0, 212, 255, 0.16);
  border-top-left-radius: 4px;
}
.ai-message.user-msg .ai-msg-bubble {
  background: linear-gradient(135deg, rgba(0,153,204,0.22), rgba(0,212,255,0.13));
  border: 1px solid rgba(0, 212, 255, 0.28);
  border-top-right-radius: 4px;
}
.ai-msg-time {
  font-size: 0.63rem;
  color: #334155;
  margin-top: 4px;
  padding: 0 2px;
}
.ai-message.user-msg .ai-msg-time { text-align: right; }

/* Welcome banner inside messages */
.ai-welcome-banner {
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(0,212,255,0.07), rgba(59,130,246,0.04));
  border: 1px solid rgba(0, 212, 255, 0.14);
  text-align: center;
  flex-shrink: 0;
}
.ai-welcome-banner .ai-welcome-emoji {
  font-size: 1.8rem;
  display: block;
  margin-bottom: 7px;
}
.ai-welcome-banner h4 {
  font-size: 0.84rem;
  font-weight: 800;
  color: #e2e8f0;
  margin-bottom: 5px;
  letter-spacing: 0.2px;
}
.ai-welcome-banner p {
  font-size: 0.74rem;
  color: #94a3b8;
  line-height: 1.5;
}

/* ---- Typing indicator ---- */
.ai-typing {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 14px 10px;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}
.ai-typing-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(0,212,255,0.12), rgba(59,130,246,0.12));
  border: 1px solid rgba(0, 212, 255, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 900;
  color: #00d4ff;
  flex-shrink: 0;
}
.ai-typing-bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 9px 14px;
  background: rgba(0, 212, 255, 0.055);
  border: 1px solid rgba(0, 212, 255, 0.16);
  border-radius: 16px;
  border-top-left-radius: 4px;
}
.ai-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #00d4ff;
  animation: ai-typing-bounce 1.4s ease-in-out infinite;
}
.ai-typing-dot:nth-child(2) { animation-delay: 0.22s; }
.ai-typing-dot:nth-child(3) { animation-delay: 0.44s; }
@keyframes ai-typing-bounce {
  0%,60%,100% { transform: translateY(0);   opacity: 0.35; }
  30%          { transform: translateY(-7px); opacity: 1; }
}

/* ---- Suggested prompts ---- */
.ai-suggestions {
  display: flex;
  gap: 6px;
  padding: 8px 14px 4px;
  overflow-x: auto;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  scrollbar-width: none;
}
.ai-suggestions::-webkit-scrollbar { display: none; }
.ai-suggestion-chip {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 0.71rem;
  font-weight: 600;
  color: #00d4ff;
  background: rgba(0, 212, 255, 0.07);
  border: 1px solid rgba(0, 212, 255, 0.22);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  font-family: inherit;
  letter-spacing: 0.2px;
}
.ai-suggestion-chip:hover {
  background: rgba(0, 212, 255, 0.15);
  border-color: rgba(0, 212, 255, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 212, 255, 0.18);
}

/* ---- Input row ---- */
.ai-input-row {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  padding: 10px 12px 13px;
  border-top: 1px solid rgba(0, 212, 255, 0.09);
  background: rgba(0, 0, 0, 0.18);
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}
.ai-input-wrap { flex: 1; }
.ai-input {
  width: 100%;
  padding: 9px 13px;
  border-radius: 12px;
  background: rgba(0, 212, 255, 0.05);
  border: 1px solid rgba(0, 212, 255, 0.18);
  color: #e2e8f0;
  font-family: inherit;
  font-size: 0.83rem;
  line-height: 1.5;
  outline: none;
  resize: none;
  max-height: 100px;
  min-height: 38px;
  overflow-y: auto;
  transition: border-color 0.2s, box-shadow 0.2s;
  scrollbar-width: none;
  display: block;
}
.ai-input::-webkit-scrollbar { display: none; }
.ai-input::placeholder { color: #334155; }
.ai-input:focus {
  border-color: rgba(0, 212, 255, 0.48);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.07);
}

.ai-voice-btn,
.ai-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
  border: none;
  font-family: inherit;
}
.ai-voice-btn svg, .ai-send-btn svg { width: 16px; height: 16px; }

.ai-voice-btn {
  background: rgba(0, 212, 255, 0.06);
  border: 1px solid rgba(0, 212, 255, 0.18);
  color: #475569;
}
.ai-voice-btn:hover {
  background: rgba(0, 212, 255, 0.14);
  border-color: rgba(0, 212, 255, 0.38);
  color: #00d4ff;
}
.ai-voice-btn.recording {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.45);
  color: #ef4444;
  animation: ai-recording-pulse 1.2s ease-in-out infinite;
}
@keyframes ai-recording-pulse {
  0%,100% { box-shadow: 0 0 0 0   rgba(239, 68, 68, 0.45); }
  50%      { box-shadow: 0 0 0 9px rgba(239, 68, 68, 0); }
}

.ai-send-btn {
  background: linear-gradient(135deg, #0099cc, #00d4ff);
  color: #020817;
}
.ai-send-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 5px 18px rgba(0, 212, 255, 0.45);
}
.ai-send-btn:active:not(:disabled) { transform: translateY(0); }
.ai-send-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ---- Footer ---- */
.ai-panel-footer {
  text-align: center;
  font-size: 0.62rem;
  color: #1e293b;
  padding: 5px 14px 9px;
  position: relative;
  z-index: 1;
  letter-spacing: 0.4px;
  flex-shrink: 0;
}
.ai-footer-brand { color: #00d4ff; font-weight: 700; }

/* ============================================================
   LIGHT THEME OVERRIDES
   ============================================================ */
[data-theme="light"] #aye-ai-btn {
  border-color: rgba(30, 58, 138, 0.55);
  background: linear-gradient(135deg, #eef2ff, #dbeafe);
  box-shadow: 0 0 18px rgba(30,58,138,0.22), 0 8px 30px rgba(0,0,0,0.12);
}
[data-theme="light"] .ai-btn-icon { color: #1e3a8a; filter: drop-shadow(0 0 4px rgba(30,58,138,0.5)); }
[data-theme="light"] .ai-btn-tooltip {
  background: rgba(255,255,255,0.97);
  border-color: rgba(30,58,138,0.3);
  color: #1e3a8a;
}
[data-theme="light"] .ai-btn-tooltip::before { border-right-color: rgba(30,58,138,0.3); }
[data-theme="light"] .ai-status-dot { border-color: #f0f4f8; }

[data-theme="light"] #aye-ai-panel {
  background: rgba(248, 250, 252, 0.96);
  border-color: rgba(30, 58, 138, 0.18);
  box-shadow: 0 0 0 1px rgba(30,58,138,0.05), 0 30px 70px rgba(0,0,0,0.12), 0 0 40px rgba(30,58,138,0.06);
}
[data-theme="light"] #aye-ai-panel::before {
  background: linear-gradient(90deg, transparent, #1e3a8a 30%, #3b82f6 70%, transparent);
}
[data-theme="light"] .ai-panel-header {
  border-bottom-color: rgba(30,58,138,0.1);
  background: rgba(30,58,138,0.03);
}
[data-theme="light"] .ai-avatar {
  background: linear-gradient(135deg, rgba(30,58,138,0.12), rgba(59,130,246,0.12));
  border-color: rgba(30,58,138,0.4);
  box-shadow: 0 0 12px rgba(30,58,138,0.2);
}
[data-theme="light"] .ai-avatar svg { color: #1e3a8a; }
[data-theme="light"] .ai-header-name { color: #1e293b; }
[data-theme="light"] .ai-status-dot-sm { background: #16a34a; box-shadow: 0 0 6px rgba(22,163,74,0.55); }
[data-theme="light"] .ai-header-status { color: #16a34a; }
[data-theme="light"] .ai-icon-btn { border-color: rgba(30,58,138,0.12); color: #64748b; }
[data-theme="light"] .ai-icon-btn:hover { background: rgba(30,58,138,0.08); border-color: rgba(30,58,138,0.3); color: #1e3a8a; }

[data-theme="light"] .ai-msg-bubble { color: #1e293b; }
[data-theme="light"] .ai-message:not(.user-msg) .ai-msg-bubble {
  background: rgba(30,58,138,0.05);
  border-color: rgba(30,58,138,0.14);
}
[data-theme="light"] .ai-message.user-msg .ai-msg-bubble {
  background: linear-gradient(135deg, rgba(30,58,138,0.12), rgba(59,130,246,0.08));
  border-color: rgba(30,58,138,0.22);
}
[data-theme="light"] .ai-msg-avatar { background: linear-gradient(135deg,rgba(30,58,138,0.1),rgba(59,130,246,0.1)); border-color: rgba(30,58,138,0.25); color: #1e3a8a; }
[data-theme="light"] .ai-message.user-msg .ai-msg-avatar { background: linear-gradient(135deg,rgba(99,102,241,0.12),rgba(59,130,246,0.12)); border-color: rgba(99,102,241,0.3); color: #4f46e5; }
[data-theme="light"] .ai-msg-time { color: #94a3b8; }

[data-theme="light"] .ai-welcome-banner { background: linear-gradient(135deg,rgba(30,58,138,0.06),rgba(59,130,246,0.03)); border-color: rgba(30,58,138,0.12); }
[data-theme="light"] .ai-welcome-banner h4 { color: #1e293b; }
[data-theme="light"] .ai-welcome-banner p { color: #64748b; }

[data-theme="light"] .ai-typing-avatar { background: linear-gradient(135deg,rgba(30,58,138,0.1),rgba(59,130,246,0.1)); border-color: rgba(30,58,138,0.25); color: #1e3a8a; }
[data-theme="light"] .ai-typing-bubble { background: rgba(30,58,138,0.05); border-color: rgba(30,58,138,0.14); }
[data-theme="light"] .ai-typing-dot { background: #1e3a8a; }

[data-theme="light"] .ai-suggestion-chip { color: #1e3a8a; background: rgba(30,58,138,0.06); border-color: rgba(30,58,138,0.2); }
[data-theme="light"] .ai-suggestion-chip:hover { background: rgba(30,58,138,0.13); border-color: rgba(30,58,138,0.4); box-shadow: 0 4px 12px rgba(30,58,138,0.14); }

[data-theme="light"] .ai-input-row { border-top-color: rgba(30,58,138,0.08); background: rgba(0,0,0,0.02); }
[data-theme="light"] .ai-input { background: rgba(30,58,138,0.04); border-color: rgba(30,58,138,0.16); color: #1e293b; }
[data-theme="light"] .ai-input::placeholder { color: #94a3b8; }
[data-theme="light"] .ai-input:focus { border-color: rgba(30,58,138,0.42); box-shadow: 0 0 0 3px rgba(30,58,138,0.07); }
[data-theme="light"] .ai-voice-btn { background: rgba(30,58,138,0.05); border-color: rgba(30,58,138,0.16); color: #64748b; }
[data-theme="light"] .ai-voice-btn:hover { background: rgba(30,58,138,0.12); border-color: rgba(30,58,138,0.35); color: #1e3a8a; }
[data-theme="light"] .ai-send-btn { background: linear-gradient(135deg, #1e3a8a, #3b82f6); color: #fff; }

[data-theme="light"] .ai-panel-footer { color: #94a3b8; }
[data-theme="light"] .ai-footer-brand { color: #1e3a8a; }

/* ============================================================
   VOICE BAR
   ============================================================ */
.ai-voice-bar {
  padding: 6px 12px 8px;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

.ai-voice-bar-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 12px;
  background: rgba(239, 68, 68, 0.07);
  border: 1px solid rgba(239, 68, 68, 0.22);
  transition: background 0.3s, border-color 0.3s;
}
.ai-voice-bar-inner[data-mode="speaking"] {
  background: rgba(0, 212, 255, 0.06);
  border-color: rgba(0, 212, 255, 0.22);
}

/* ---- Indicator dot + label ---- */
.ai-voice-indicator {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}
.ai-voice-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.7);
  animation: ai-vdot 1.1s ease-in-out infinite;
  flex-shrink: 0;
}
.ai-voice-bar-inner[data-mode="speaking"] .ai-voice-dot {
  background: #00d4ff;
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.7);
}
@keyframes ai-vdot {
  0%,100% { transform: scale(1);   opacity: 1; }
  50%      { transform: scale(1.4); opacity: 0.5; }
}
.ai-voice-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #ef4444;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color 0.3s;
}
.ai-voice-bar-inner[data-mode="speaking"] .ai-voice-label { color: #00d4ff; }

/* ---- Waveform canvas (listening mode) ---- */
.ai-waveform {
  flex: 1;
  height: 34px;
  min-width: 0;
  display: block;
  border-radius: 4px;
}
.ai-voice-bar-inner[data-mode="speaking"] .ai-waveform { display: none; }

/* ---- Equalizer bars (speaking mode) ---- */
.ai-voice-eq {
  flex: 1;
  display: none;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  height: 34px;
  padding: 4px 0;
}
.ai-voice-bar-inner[data-mode="speaking"] .ai-voice-eq { display: flex; }

.ai-voice-eq span {
  display: block;
  width: 3px;
  border-radius: 2px;
  background: linear-gradient(to top, #0099cc, #00d4ff);
  box-shadow: 0 0 5px rgba(0, 212, 255, 0.45);
  animation: ai-eq 1.3s ease-in-out infinite;
  transform-origin: bottom;
}
.ai-voice-eq span:nth-child(1) { height: 35%; animation-delay: 0.00s; }
.ai-voice-eq span:nth-child(2) { height: 65%; animation-delay: 0.18s; }
.ai-voice-eq span:nth-child(3) { height: 90%; animation-delay: 0.36s; }
.ai-voice-eq span:nth-child(4) { height: 100%; animation-delay: 0.54s; }
.ai-voice-eq span:nth-child(5) { height: 90%; animation-delay: 0.72s; }
.ai-voice-eq span:nth-child(6) { height: 65%; animation-delay: 0.90s; }
.ai-voice-eq span:nth-child(7) { height: 35%; animation-delay: 1.08s; }
@keyframes ai-eq {
  0%,100% { transform: scaleY(0.3); opacity: 0.45; }
  50%      { transform: scaleY(1);   opacity: 1; }
}

/* ---- Stop button ---- */
.ai-voice-stop-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
  font-family: inherit;
}
.ai-voice-stop-btn svg { width: 12px; height: 12px; }
.ai-voice-stop-btn:hover {
  background: rgba(239, 68, 68, 0.22);
  transform: scale(1.1);
}
.ai-voice-bar-inner[data-mode="speaking"] .ai-voice-stop-btn {
  background: rgba(0, 212, 255, 0.08);
  border-color: rgba(0, 212, 255, 0.28);
  color: #00d4ff;
}
.ai-voice-bar-inner[data-mode="speaking"] .ai-voice-stop-btn:hover {
  background: rgba(0, 212, 255, 0.18);
}

/* Light theme voice bar */
[data-theme="light"] .ai-voice-bar-inner {
  background: rgba(239, 68, 68, 0.05);
  border-color: rgba(239, 68, 68, 0.18);
}
[data-theme="light"] .ai-voice-bar-inner[data-mode="speaking"] {
  background: rgba(30, 58, 138, 0.05);
  border-color: rgba(30, 58, 138, 0.18);
}
[data-theme="light"] .ai-voice-label { color: #dc2626; }
[data-theme="light"] .ai-voice-bar-inner[data-mode="speaking"] .ai-voice-label { color: #1e3a8a; }
[data-theme="light"] .ai-voice-dot { box-shadow: 0 0 8px rgba(239,68,68,0.4); }
[data-theme="light"] .ai-voice-bar-inner[data-mode="speaking"] .ai-voice-dot { background: #1e3a8a; box-shadow: 0 0 8px rgba(30,58,138,0.4); }
[data-theme="light"] .ai-voice-eq span { background: linear-gradient(to top, #1e3a8a, #3b82f6); box-shadow: 0 0 5px rgba(30,58,138,0.3); }

/* ============================================================
   MUTE BUTTON
   ============================================================ */
/* Show speaker-on icon by default, hide speaker-off */
.ai-speaker-on  { display: block; }
.ai-speaker-off { display: none; }

/* When muted: swap icons, dim button */
#aye-ai-mute.muted .ai-speaker-on  { display: none; }
#aye-ai-mute.muted .ai-speaker-off { display: block; }
#aye-ai-mute.muted { color: #475569 !important; }
#aye-ai-mute.muted:hover { color: #00d4ff !important; }

/* ============================================================
   MOBILE — full-width bottom sheet
   ============================================================ */
@media (max-width: 640px) {
  #aye-ai-widget {
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 997;
  }
  #aye-ai-btn {
    position: fixed;
    bottom: calc(82px + env(safe-area-inset-bottom, 0px)); /* above back-to-top arrow */
    left: 18px;
    width: 54px;
    height: 54px;
  }
  #aye-ai-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 78dvh;
    max-height: 78vh; /* fallback for browsers without dvh */
    border-radius: 22px 22px 0 0;
    transform-origin: bottom center;
    transform: translateY(110%);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  #aye-ai-panel.open { transform: translateY(0); }

  /* Drag handle pill */
  .ai-panel-header::after {
    content: '';
    position: absolute;
    top: 9px;
    left: 50%;
    transform: translateX(-50%);
    width: 34px;
    height: 4px;
    border-radius: 2px;
    background: rgba(0, 212, 255, 0.22);
  }
  [data-theme="light"] .ai-panel-header::after {
    background: rgba(30, 58, 138, 0.18);
  }

  /* Slightly taller tooltip placement doesn't make sense on mobile */
  .ai-btn-tooltip { display: none; }
}

@media (max-width: 380px) {
  #aye-ai-panel {
    max-height: 86dvh;
    max-height: 86vh; /* fallback */
  }
}

/* ============================================================
   STREAMING CURSOR + ERROR STATES
   ============================================================ */

/* Blinking cursor shown while AI is streaming tokens */
.ai-cursor {
  display: inline-block;
  color: #00d4ff;
  animation: ai-cursor-blink 0.85s step-end infinite;
  font-weight: 300;
  margin-left: 1px;
  vertical-align: baseline;
}
[data-theme="light"] .ai-cursor { color: #1e3a8a; }

@keyframes ai-cursor-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* Error message bubble */
.ai-error-avatar {
  background: linear-gradient(135deg, rgba(239,68,68,0.15), rgba(220,38,38,0.1)) !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
  color: #ef4444 !important;
  font-size: 0.75rem !important;
  font-weight: 900 !important;
}

.ai-error-bubble {
  background: rgba(239, 68, 68, 0.07) !important;
  border-color: rgba(239, 68, 68, 0.22) !important;
  color: #fca5a5 !important;
  font-size: 0.8rem !important;
}
[data-theme="light"] .ai-error-bubble {
  background: rgba(239, 68, 68, 0.06) !important;
  border-color: rgba(239, 68, 68, 0.18) !important;
  color: #dc2626 !important;
}
