/* ai-glass.css — Ask AI panel uses the same Liquid Glass morph as the profile menu.
   The panel grows out of the Ask AI button; content fades in. Loaded last. */

html body .ai-panel {
  --ox: 50%; --oy: 0px;               /* grow-from point, set by js/ai-glass.js */
  --aig-r: 24px;
  --aig-ease: cubic-bezier(.22, 1, .36, 1);
  display: block;
  transform: none !important;         /* old translateX/translateY: replaced by individual props */
  translate: -50% 0;                  /* keeps the desktop panel centred */
  scale: .16 .13;
  transform-origin: var(--ox) var(--oy);
  border-radius: 999px !important;
  opacity: 0; visibility: hidden; pointer-events: none;
  background:
    radial-gradient(130% 80% at 0% 0%, rgba(255,255,255,.18), rgba(255,255,255,0) 55%),
    linear-gradient(160deg, rgba(255,255,255,.06), rgba(255,255,255,.01) 60%),
    rgba(12,10,20,.80) !important;   /* darker: the page behind isn't dimmed */
  -webkit-backdrop-filter: blur(32px) saturate(180%) brightness(.8) !important;
  backdrop-filter: blur(32px) saturate(180%) brightness(.8) !important;
  border: 1px solid rgba(255,255,255,.06) !important;
  box-shadow:
    inset 0 1px 1px rgba(255,255,255,.22),
    inset 0 -1px 1px rgba(255,255,255,.04),
    0 26px 64px rgba(0,0,0,.52), 0 3px 10px rgba(0,0,0,.30) !important;
  transition:
    scale .18s cubic-bezier(.4, 0, .9, .4),
    border-radius .18s ease-in,
    opacity .14s ease .04s,
    visibility 0s linear .18s !important;
}
html body .ai-panel.open {
  scale: 1;
  border-radius: var(--aig-r) !important;
  opacity: 1 !important; visibility: visible; pointer-events: auto !important;
  will-change: scale, opacity;
  transition:
    scale .36s var(--aig-ease),
    border-radius .3s var(--aig-ease),
    opacity .1s ease,
    visibility 0s !important;
}

/* light sweep + glass rim, same as the profile menu */
html body .ai-panel::before {
  content: ""; position: absolute; inset: 0; height: auto; border-radius: inherit; pointer-events: none; z-index: 0;
  background: linear-gradient(115deg, rgba(255,255,255,.20) 0%, rgba(255,255,255,0) 30%, rgba(255,255,255,0) 68%, rgba(255,255,255,.07) 100%);
  opacity: 0; transition: opacity .35s ease;
}
html body .ai-panel.open::before { opacity: 1; transition-delay: .06s; }
html body .ai-panel::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none; z-index: 2;
  background: linear-gradient(150deg, rgba(255,255,255,.34), rgba(255,255,255,.12) 18%, rgba(255,255,255,.03) 45%, rgba(255,255,255,.04) 70%, rgba(255,255,255,.16));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask-composite: exclude;
}

/* content fades in after the blob stretches */
.ai-input-row, .ai-body {
  position: relative; z-index: 1;
  opacity: 0; transform: translateY(-5px);
  transition: opacity .1s ease, transform .1s ease;
}
.ai-panel.open .ai-input-row, .ai-panel.open .ai-body {
  opacity: 1; transform: none;
  transition: opacity .26s ease, transform .32s var(--aig-ease, ease);
  transition-delay: .07s;
}
.ai-panel.open .ai-body { transition-delay: .12s; }

/* button reads as pressed glass while open */
.ai-btn { transition: transform .3s cubic-bezier(.2, 1.4, .3, 1), box-shadow .3s ease; }
.ai-btn.active { transform: scale(.94); box-shadow: 0 0 0 4px rgba(255,255,255,.10), 0 0 22px rgba(139,92,246,.45); }

/* phones: panel is pinned left/right, so no horizontal centring offset */
@media (max-width: 640px) {
  html body .ai-panel { translate: 0 0; --aig-r: 22px; }
  html body .ai-panel.open { transform: none !important; }
}

html.lite-mode .ai-panel, html.eco-mode .ai-panel {
  -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
  background: rgba(14,12,22,.97) !important;
}

@media (prefers-reduced-motion: reduce) {
  html body .ai-panel, html body .ai-panel.open { scale: 1; border-radius: var(--aig-r) !important; will-change: auto; }
  html body .ai-panel { transition: opacity .12s ease, visibility 0s linear .12s !important; }
  html body .ai-panel.open { transition: opacity .12s ease, visibility 0s !important; }
  .ai-input-row, .ai-body, .ai-panel.open .ai-input-row, .ai-panel.open .ai-body { transition: none; transform: none; }
}
