/* ==========================================================================
   WHALE OS — Ask an AI Component (Design Spec: namethatui.com/3/Ask an AI.txt)
   Features: Animated Blob Mascot, Eyes Gaze Tracking, Multi-Provider Launchers,
   Glassmorphism Popover, 1-Click Clipboard Prompt Copying
   ========================================================================== */

/* --------------------------------
   Mascot Blob & Eyes Animations
--------------------------------- */
@keyframes ai-mascot-blob {
  0%, 100% { border-radius: 58% 42% 55% 45% / 52% 58% 42% 48%; }
  33% { border-radius: 45% 55% 48% 52% / 58% 44% 56% 42%; }
  66% { border-radius: 52% 48% 42% 58% / 45% 52% 48% 55%; }
}

@keyframes ai-mascot-blink {
  0%, 42%, 46%, 100% { transform: scaleY(1); }
  44% { transform: scaleY(.12); }
}

.ai-mascot {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #005dff, #00c6ff);
  color: #ffffff;
  animation: ai-mascot-blob 9s ease-in-out infinite;
  transition: transform 0.44s cubic-bezier(0.22, 1.5, 0.5, 1), box-shadow 0.3s ease;
  transform: rotate(-7deg);
  box-shadow: 0 4px 14px rgba(0, 93, 255, 0.35);
  user-select: none;
}

.ai-mascot[data-awake="true"] {
  transform: rotate(6deg) scale(1.08);
  box-shadow: 0 6px 20px rgba(0, 198, 255, 0.45);
}

.ai-mascot-eyes {
  display: flex;
  gap: 6px;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-mascot-eye {
  display: block;
  width: 3px;
  height: 8px;
  border-radius: 4px;
  background: #ffffff;
  animation: ai-mascot-blink 6.5s infinite;
  will-change: transform;
}

/* Eye Gaze Directions */
.ai-mascot[data-gaze="down"] .ai-mascot-eyes { transform: translate(1px, 3px); }
.ai-mascot[data-gaze="up"] .ai-mascot-eyes { transform: translate(1px, -3px); }
.ai-mascot[data-gaze="left"] .ai-mascot-eyes { transform: translate(-3px, 0px); }
.ai-mascot[data-gaze="right"] .ai-mascot-eyes { transform: translate(3px, 0px); }

/* --------------------------------
   Trigger Buttons
--------------------------------- */
.ask-ai-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 14px 0 6px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(0, 93, 255, 0.22);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--text-primary, #0f172a);
  font-family: 'Cairo', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 93, 255, 0.08);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  z-index: 100;
}

[data-theme="dark"] .ask-ai-trigger-btn {
  background: rgba(15, 23, 42, 0.8);
  border-color: rgba(255, 255, 255, 0.14);
  color: #f8fafc;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.ask-ai-trigger-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 93, 255, 0.2);
  border-color: rgba(0, 93, 255, 0.4);
}

.ask-ai-trigger-btn:active {
  transform: translateY(0) scale(0.98);
}

.ask-ai-trigger-btn .ask-ai-label {
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* Compact Variant */
.ask-ai-trigger-btn.compact {
  height: 32px;
  padding: 0 10px 0 4px;
  gap: 6px;
  font-size: 12px;
}
.ask-ai-trigger-btn.compact .ai-mascot {
  width: 24px;
  height: 24px;
}
.ask-ai-trigger-btn.compact .ai-mascot-eye {
  width: 2px;
  height: 5px;
}

/* Blob-Only Floating Variant */
.ask-ai-trigger-btn.blob-only {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  justify-content: center;
}

/* Floating AI Action Dock */
.ask-ai-floating-dock {
  position: fixed;
  bottom: 24px;
  left: 28px;
  z-index: 9980;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --------------------------------
   Glassmorphism Popover Modal
--------------------------------- */
.ask-ai-popover-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10050;
  background: rgba(10, 15, 30, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.ask-ai-popover-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.ask-ai-popover-card {
  width: 450px;
  max-width: calc(100vw - 32px);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 28px;
  padding: 24px;
  box-shadow: 0 24px 60px rgba(0, 30, 80, 0.22), 0 0 1px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  transform: scale(0.95) translateY(12px);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
  direction: rtl;
  color: var(--text-primary, #0f172a);
  font-family: 'Cairo', sans-serif;
}

[data-theme="dark"] .ask-ai-popover-card {
  background: rgba(15, 23, 42, 0.9);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  color: #f8fafc;
}

.ask-ai-popover-backdrop.open .ask-ai-popover-card {
  transform: scale(1) translateY(0);
}

.ask-ai-popover-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.ask-ai-popover-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ask-ai-popover-title {
  font-size: 16px;
  font-weight: 800;
  margin: 0;
  color: var(--text-primary, #0f172a);
}
[data-theme="dark"] .ask-ai-popover-title { color: #f8fafc; }

.ask-ai-close-btn {
  background: rgba(0, 0, 0, 0.05);
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
}
[data-theme="dark"] .ask-ai-close-btn { background: rgba(255, 255, 255, 0.08); color: #94a3b8; }
.ask-ai-close-btn:hover { background: rgba(0, 0, 0, 0.1); color: var(--text-primary, #0f172a); }

.ask-ai-popover-desc {
  font-size: 13px;
  color: var(--text-muted, #64748b);
  margin: 0 0 18px 0;
  line-height: 1.5;
}
[data-theme="dark"] .ask-ai-popover-desc { color: #94a3b8; }

/* --------------------------------
   Provider Grid (ChatGPT, Claude, Grok, Perplexity)
--------------------------------- */
.ask-ai-providers-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.ask-ai-provider-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 76px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.06);
  color: var(--text-muted, #64748b);
  text-decoration: none;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}
[data-theme="dark"] .ask-ai-provider-card {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
}

.ask-ai-provider-card:hover {
  transform: translateY(-3px);
  background: rgba(255, 255, 255, 0.95);
  color: var(--provider-brand, #005dff);
  border-color: var(--provider-brand, #005dff);
  box-shadow: 0 8px 20px rgba(0, 93, 255, 0.15);
}
[data-theme="dark"] .ask-ai-provider-card:hover {
  background: rgba(30, 41, 59, 0.95);
}

.ask-ai-provider-icon {
  width: 26px;
  height: 26px;
  transition: transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ask-ai-provider-card:hover .ask-ai-provider-icon {
  transform: translateY(-4px) scale(0.92);
}

.ask-ai-provider-name {
  position: absolute;
  bottom: 8px;
  font-size: 10px;
  font-weight: 700;
  opacity: 0;
  transform: translateY(4px);
  transition: all 0.2s ease;
}
.ask-ai-provider-card:hover .ask-ai-provider-name {
  opacity: 1;
  transform: translateY(0);
}

.ask-ai-provider-arrow {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 12px;
  height: 12px;
  opacity: 0;
  transition: opacity 0.2s;
  color: var(--provider-brand, #005dff);
}
.ask-ai-provider-card:hover .ask-ai-provider-arrow {
  opacity: 1;
}

/* --------------------------------
   1-Click Copy Prompt Bar
--------------------------------- */
.ask-ai-copy-btn {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 14px;
  border: 1px solid rgba(0, 93, 255, 0.18);
  background: rgba(0, 93, 255, 0.05);
  color: var(--text-primary, #0f172a);
  font-family: 'Cairo', sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}
[data-theme="dark"] .ask-ai-copy-btn {
  background: rgba(0, 93, 255, 0.12);
  border-color: rgba(0, 93, 255, 0.25);
  color: #f1f5f9;
}

.ask-ai-copy-btn:hover {
  background: rgba(0, 93, 255, 0.12);
  border-color: var(--blue-500, #005dff);
  color: var(--blue-500, #005dff);
}

.ask-ai-copy-btn.copied {
  background: rgba(16, 185, 129, 0.12);
  border-color: #10b981;
  color: #10b981;
}

.ask-ai-fallback-prompt {
  width: 100%;
  margin-top: 10px;
  border-radius: 12px;
  border: 1px solid var(--border-color, #cbd5e1);
  background: var(--bg-card, #ffffff);
  padding: 10px;
  font-size: 12px;
  color: var(--text-primary, #0f172a);
  outline: none;
  resize: none;
  box-sizing: border-box;
  direction: rtl;
}
