/* ZSH AI Assistant — Gold/Diamond exclusive */
.ai-fab {
  position: fixed; right: 16px; bottom: 16px; z-index: 10040;
  width: 56px; height: 56px; border: none; border-radius: 18px; cursor: pointer;
  background: linear-gradient(145deg, #fbbf24 0%, #f59e0b 35%, #b8f0ff 100%);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.25), 0 8px 28px rgba(245,158,11,0.45), 0 0 40px rgba(184,240,255,0.2);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  animation: aiFabPulse 3s ease-in-out infinite;
}
.ai-fab::before {
  content: ''; position: absolute; inset: -2px; border-radius: 20px; z-index: -1;
  background: linear-gradient(135deg, rgba(251,191,36,0.6), rgba(184,240,255,0.4));
  filter: blur(8px); opacity: 0.7;
}
.ai-fab:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 12px 36px rgba(245,158,11,0.5); }
.ai-fab.hub-pressed, .ai-fab:active { transform: translateY(2px) scale(0.96); }
.ai-fab-icon { font-size: 1.45rem; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.35)); }
.ai-fab-label {
  position: absolute; right: calc(100% + 10px); white-space: nowrap;
  font-size: 0.62rem; font-weight: 800; letter-spacing: 0.12em;
  padding: 0.35rem 0.65rem; border-radius: 999px;
  background: rgba(15,23,42,0.92); border: 1px solid rgba(251,191,36,0.45); color: #fde68a;
  opacity: 0; transform: translateX(8px); pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.ai-fab:hover .ai-fab-label { opacity: 1; transform: translateX(0); }
@keyframes aiFabPulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255,255,255,0.2), 0 8px 28px rgba(245,158,11,0.4); }
  50% { box-shadow: 0 0 0 1px rgba(184,240,255,0.35), 0 8px 32px rgba(184,240,255,0.35); }
}

.ai-overlay {
  position: fixed; inset: 0; z-index: 10060; display: none;
  align-items: flex-end; justify-content: flex-end; padding: 12px;
  background: rgba(4,8,18,0.55); backdrop-filter: blur(6px);
}
.ai-overlay.open { display: flex; animation: aiFadeIn 0.25s ease; }
@keyframes aiFadeIn { from { opacity: 0; } to { opacity: 1; } }

.ai-panel {
  width: min(100%, 400px); max-height: min(88dvh, 620px);
  display: flex; flex-direction: column; border-radius: 22px; overflow: hidden;
  border: 1px solid rgba(251,191,36,0.35);
  background: linear-gradient(165deg, rgba(20,16,8,0.98) 0%, rgba(15,23,42,0.98) 45%, rgba(30,20,50,0.98) 100%);
  box-shadow: 0 0 60px rgba(245,158,11,0.15), 0 24px 48px rgba(0,0,0,0.5);
  animation: aiSlideUp 0.32s cubic-bezier(0.34, 1.2, 0.64, 1);
}
@keyframes aiSlideUp { from { transform: translateY(24px) scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }

.ai-head {
  padding: 1rem 1.1rem 0.85rem; display: flex; align-items: flex-start; gap: 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(90deg, rgba(251,191,36,0.12), rgba(184,240,255,0.08));
}
.ai-avatar {
  width: 42px; height: 42px; border-radius: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 1.25rem;
  background: linear-gradient(135deg, #fbbf24, #a855f7);
  box-shadow: 0 0 16px rgba(168,85,247,0.35);
}
.ai-head-text { flex: 1; min-width: 0; }
.ai-head-text h2 { margin: 0; font-size: 0.95rem; letter-spacing: 0.06em; color: #fde68a; }
.ai-head-text p { margin: 0.2rem 0 0; font-size: 0.58rem; color: #94a3b8; line-height: 1.35; }
.ai-tier-badge {
  display: inline-flex; align-items: center; gap: 0.25rem; margin-top: 0.35rem;
  font-size: 0.55rem; font-weight: 800; letter-spacing: 0.08em;
  padding: 0.2rem 0.5rem; border-radius: 999px;
  border: 1px solid rgba(251,191,36,0.45); color: #fcd34d;
  background: rgba(251,191,36,0.1);
}
.ai-close {
  border: none; background: rgba(255,255,255,0.08); color: #94a3b8;
  width: 32px; height: 32px; border-radius: 10px; cursor: pointer; font-size: 1.1rem;
  transition: background 0.15s ease, color 0.15s ease;
}
.ai-close:hover { background: rgba(255,107,138,0.2); color: #fda4af; }

.ai-messages {
  flex: 1; overflow-y: auto; padding: 0.85rem 1rem; display: flex; flex-direction: column; gap: 0.75rem;
  min-height: 200px; max-height: min(52dvh, 380px);
}
.ai-messages::-webkit-scrollbar { width: 5px; }
.ai-messages::-webkit-scrollbar-thumb { background: rgba(251,191,36,0.3); border-radius: 99px; }

.ai-bubble {
  max-width: 92%; padding: 0.65rem 0.85rem; border-radius: 16px; font-size: 0.78rem; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word;
}
.ai-bubble.bot {
  align-self: flex-start; color: #e2e8f0;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(184,240,255,0.15);
  border-bottom-left-radius: 4px;
}
.ai-bubble.user {
  align-self: flex-end; color: #0f172a; font-weight: 600;
  background: linear-gradient(135deg, #fde68a, #fbbf24);
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(251,191,36,0.25);
}
.ai-typing {
  align-self: flex-start; display: flex; gap: 5px; padding: 0.65rem 0.85rem;
  background: rgba(255,255,255,0.05); border-radius: 16px; border: 1px solid rgba(255,255,255,0.08);
}
.ai-typing span {
  width: 7px; height: 7px; border-radius: 50%; background: #a855f7;
  animation: aiDot 1.2s ease-in-out infinite;
}
.ai-typing span:nth-child(2) { animation-delay: 0.15s; }
.ai-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes aiDot { 0%, 80%, 100% { opacity: 0.3; transform: scale(0.85); } 40% { opacity: 1; transform: scale(1); } }

.ai-prompts {
  display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0 1rem 0.65rem;
}
.ai-chip {
  font-size: 0.62rem; padding: 0.35rem 0.65rem; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(168,85,247,0.35); background: rgba(168,85,247,0.12); color: #e9d5ff;
  font-family: inherit; transition: transform 0.15s ease, background 0.15s ease;
}
.ai-chip:hover { background: rgba(168,85,247,0.22); transform: translateY(-1px); }

.ai-locked {
  padding: 1.25rem 1.1rem; text-align: center;
}
.ai-locked-icon { font-size: 2.2rem; margin-bottom: 0.5rem; }
.ai-locked h3 { margin: 0 0 0.5rem; font-size: 0.9rem; color: #fde68a; }
.ai-locked p { margin: 0 0 1rem; font-size: 0.72rem; color: #94a3b8; line-height: 1.5; }
.ai-upgrade-btn {
  width: 100%; padding: 0.75rem; border: none; border-radius: 14px; cursor: pointer;
  font-family: inherit; font-weight: 800; font-size: 0.78rem; letter-spacing: 0.04em;
  background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #1c1917;
  box-shadow: 0 4px 0 #b45309;
  transition: transform 0.15s ease;
}
.ai-upgrade-btn:hover { filter: brightness(1.05); transform: translateY(-2px); }
.ai-upgrade-btn:active { transform: translateY(2px); box-shadow: none; }

.ai-compose {
  padding: 0.75rem 1rem 1rem; border-top: 1px solid rgba(255,255,255,0.08);
  display: flex; gap: 0.5rem; align-items: flex-end;
  background: rgba(0,0,0,0.25);
}
.ai-input {
  flex: 1; min-height: 42px; max-height: 100px; resize: none;
  padding: 0.55rem 0.75rem; border-radius: 14px; font-size: 0.78rem; font-family: inherit;
  border: 1px solid rgba(184,240,255,0.25); background: rgba(0,0,0,0.35); color: #f1f5f9;
}
.ai-input:focus { outline: none; border-color: rgba(251,191,36,0.5); box-shadow: 0 0 12px rgba(251,191,36,0.15); }
.ai-send {
  position: relative;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  color: #fff;
  font-size: 1.1rem;
  background: transparent;
  isolation: isolate;
  transition: transform 0.22s cubic-bezier(0.34, 1.4, 0.64, 1), filter 0.22s ease;
}
.ai-send::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 17px;
  background: conic-gradient(
    from var(--ai-send-angle, 0deg),
    #22d3ee, #a855f7, #fbbf24, #f472b6, #22d3ee
  );
  opacity: 0.55;
  z-index: 0;
  animation: aiSendOrbit 2.8s linear infinite;
  transition: opacity 0.25s ease, inset 0.22s ease, filter 0.22s ease;
}
.ai-send::after {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 12px;
  z-index: 1;
  background: linear-gradient(145deg, #1e3a5f 0%, #312e81 45%, #4c1d95 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2);
  transition: background 0.22s ease, box-shadow 0.22s ease;
}
.ai-send-glyph {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  text-shadow: 0 0 12px rgba(34,211,238,0.9), 0 0 20px rgba(168,85,247,0.5);
  transition: transform 0.22s cubic-bezier(0.34, 1.4, 0.64, 1), text-shadow 0.22s ease;
}
@property --ai-send-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}
@keyframes aiSendOrbit {
  to { --ai-send-angle: 360deg; transform: rotate(360deg); }
}
.ai-send:hover {
  transform: translateY(-3px) scale(1.08);
  filter: brightness(1.12);
}
.ai-send:hover::before {
  opacity: 1;
  inset: -5px;
  filter: blur(0.5px) drop-shadow(0 0 14px rgba(168,85,247,0.75));
}
.ai-send:hover::after {
  background: linear-gradient(145deg, #0e7490 0%, #6d28d9 50%, #be185d 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), 0 0 20px rgba(34,211,238,0.35);
}
.ai-send:hover .ai-send-glyph {
  transform: translateX(2px) scale(1.1);
  text-shadow: 0 0 16px #fff, 0 0 28px rgba(251,191,36,0.8);
}
.ai-send:active:not(:disabled),
.ai-send.ai-send-pulse:not(:disabled) {
  transform: translateY(1px) scale(0.92);
  filter: brightness(1.25);
}
.ai-send:active:not(:disabled)::before,
.ai-send.ai-send-pulse:not(:disabled)::before {
  opacity: 1;
  animation-duration: 0.6s;
  filter: drop-shadow(0 0 22px rgba(251,191,36,0.9));
}
.ai-send:active:not(:disabled)::after,
.ai-send.ai-send-pulse:not(:disabled)::after {
  background: linear-gradient(145deg, #fde047, #a855f7, #22d3ee);
  box-shadow: 0 0 24px rgba(251,191,36,0.55);
}
.ai-send:active:not(:disabled) .ai-send-glyph,
.ai-send.ai-send-pulse:not(:disabled) .ai-send-glyph {
  transform: scale(0.95);
  color: #0f172a;
  text-shadow: none;
}
.ai-send:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
  filter: grayscale(0.5);
}
.ai-send:disabled::before { animation: none; opacity: 0.2; }

@media (max-width: 480px) {
  .ai-overlay { padding: 0; align-items: stretch; }
  .ai-panel { width: 100%; max-height: 100dvh; border-radius: 20px 20px 0 0; }
  .ai-fab { right: 12px; bottom: 12px; }
  .ai-fab-label { display: none; }
}
