/* ================= v2.7 Assistant redesign: Angel AI mascot, FAB, pending-action tray, thread sidebar ================= */
/* All colors reference the existing theme tokens defined in index.html's inline <style> — nothing here is hardcoded, so it recolors automatically across Light/Dark/Night/Gold/Slate. */

/* ---- Angel AI mascot (halo + wingtips + particles), reused at three sizes: FAB, message avatar, screen header ---- */
.angel-mascot { color: var(--blue); display: inline-block; overflow: visible; }
.angel-mascot .angel-halo { transform-origin: 50% 50%; animation: angelHaloSpin 10s linear infinite; }
.angel-mascot .angel-wing { fill: currentColor; opacity: 0.85; }
.angel-mascot .angel-particle { fill: currentColor; transform-origin: center; animation: angelTwinkle 2.6s ease-in-out infinite; }
.angel-mascot .angel-particle:nth-child(2) { animation-delay: 0.3s; }
.angel-mascot .angel-particle:nth-child(3) { animation-delay: 0.6s; }
.angel-mascot .angel-particle:nth-child(4) { animation-delay: 0.9s; }
.angel-mascot .angel-particle:nth-child(5) { animation-delay: 1.2s; }

/* "Thinking" state — toggled by JS while a reply is streaming/pending: halo spins faster, particles pulse brighter/faster. */
.angel-mascot.thinking .angel-halo { animation: angelHaloSpin 2.4s linear infinite; }
.angel-mascot.thinking .angel-particle { animation: angelTwinkleActive 0.9s ease-in-out infinite; }

@keyframes angelHaloSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes angelTwinkle { 0%, 100% { opacity: 0.35; transform: scale(0.85); } 50% { opacity: 0.95; transform: scale(1.15); } }
@keyframes angelTwinkleActive { 0%, 100% { opacity: 0.55; transform: scale(0.9); } 50% { opacity: 1; transform: scale(1.35); } }

@media (prefers-reduced-motion: reduce) {
  .angel-mascot .angel-halo, .angel-mascot .angel-particle { animation: none !important; }
}

/* ---- Floating action button — present on every screen ---- */
#assistant-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 900;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border-2); box-shadow: var(--shadow-lg);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: transform .15s ease;
}
#assistant-fab:hover { transform: scale(1.06); }
#assistant-fab.hidden { display: none; }

/* ---- FAB slide-over ---- */
#assistant-flyout {
  position: fixed; right: 16px; bottom: 90px; z-index: 901;
  width: min(400px, calc(100vw - 32px)); max-height: min(640px, calc(100vh - 130px));
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-lg);
  display: none; flex-direction: column; overflow: hidden;
}
#assistant-flyout.open { display: flex; }
.assistant-flyout-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.assistant-flyout-head .flyout-title { font-weight: 600; font-size: 14.5px; color: var(--text); flex: 1; }
.assistant-flyout-close { cursor: pointer; color: var(--text-3); font-size: 18px; background: none; border: none; padding: 4px; }

/* ---- Assistant full-page screen layout: sidebar + main pane ---- */
.assistant-shell { display: flex; gap: 16px; min-height: 560px; }
.assistant-sidebar {
  width: 220px; flex-shrink: 0; display: flex; flex-direction: column; gap: 8px;
  border-right: 1px solid var(--border); padding-right: 14px;
}
.assistant-thread-item {
  padding: 9px 10px; border-radius: 10px; font-size: 13px; color: var(--text-2); cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 1px solid transparent;
}
.assistant-thread-item:hover { background: var(--surface-2); }
.assistant-thread-item.active { background: var(--blue-soft); color: var(--text); border-color: var(--border-2); font-weight: 600; }
.assistant-main { flex: 1; display: flex; flex-direction: column; gap: 12px; min-width: 0; }

/* ---- Suggested-prompt chips (shown only when the active thread is empty) ---- */
.assistant-chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.assistant-chip {
  border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text-2);
  border-radius: 999px; padding: 8px 14px; font-size: 12.5px; cursor: pointer;
}
.assistant-chip:hover { background: var(--blue-soft); color: var(--text); }

/* ---- Pending-action tray — visually distinct from chat bubbles, on both the full screen and the flyout ---- */
.assistant-tray {
  border: 1px solid var(--border-2); background: var(--surface-2); border-radius: 16px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.assistant-tray-title { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
.assistant-tray-empty { font-size: 12.5px; color: var(--text-3); }
.assistant-tray-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px;
}
.assistant-tray-summary { font-size: 13px; color: var(--text); margin-bottom: 8px; }
.assistant-tray-actions { display: flex; gap: 8px; }
.assistant-tray-result { margin-top: 8px; font-size: 12.5px; color: var(--text-2); }

/* ---- Chat bubbles ---- */
.assistant-bubble-row { display: flex; gap: 10px; align-items: flex-start; }
.assistant-bubble-row.user { justify-content: flex-end; }
.assistant-bubble {
  max-width: 82%; padding: 10px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.45; white-space: pre-wrap;
}
.assistant-bubble-row.assistant .assistant-bubble { background: var(--surface-2); color: var(--text); }
.assistant-bubble-row.user .assistant-bubble { background: var(--blue); color: #fff; }

@media (max-width: 720px) {
  .assistant-shell { flex-direction: column; }
  .assistant-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); padding-right: 0; padding-bottom: 10px; flex-direction: row; overflow-x: auto; }
  .assistant-thread-item { white-space: nowrap; }
}

/* ---- Icon buttons on the in-progress chat input row (attach / mic) — theme-token surfaces, hover state only. ---- */
.assistant-icon-btn {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; transition: background .15s ease, color .15s ease;
}
.assistant-icon-btn:hover { background: var(--surface-2); color: var(--text); }
.assistant-icon-btn.listening { color: #fff; background: var(--red); border-color: transparent; animation: angelMicPulse 1.2s ease-in-out infinite; }
@keyframes angelMicPulse { 0%, 100% { opacity: 1; } 50% { opacity: .6; } }

/* ---- Attachment preview strip — shown above whichever input row has a pending attachment. ---- */
.assistant-attachment-preview { display: flex; align-items: center; gap: 8px; }
.assistant-attach-thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; border: 1px solid var(--border); }
.assistant-attach-file {
  font-size: 12.5px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.assistant-attach-remove {
  width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border-2); background: var(--surface);
  color: var(--text-2); cursor: pointer; font-size: 14px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.assistant-attach-remove:hover { background: var(--surface-2); color: var(--text); }
.assistant-bubble-thumb { display: block; margin-top: 8px; max-width: 220px; max-height: 220px; border-radius: 10px; }

/* =================================================================================================================
   v2.9.1 — Angel AI welcome screen (empty/new-conversation state), layered on top of .assistant-shell.
   DM's explicit call: this section's accent/glow is a FIXED violet — the one deliberate exception to this app's
   theme-token colors — while every surface/background/text color here still comes from the theme tokens above, so
   Light stays readable and Dark/Night/Gold/Slate all still look correct. Only --aai-accent/--aai-glow are fixed.
   ================================================================================================================= */
.assistant-welcome {
  --aai-accent: #8b5cf6;
  --aai-accent-2: #a855f7;
  --aai-glow: rgba(139, 92, 246, 0.35);
  --aai-glow-soft: rgba(139, 92, 246, 0.16);
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 6px; padding: 36px 16px 28px; flex: 1;
}
.assistant-welcome-mascot-frame {
  position: relative; width: 128px; height: 128px; display: flex; align-items: center; justify-content: center; margin-bottom: 6px;
}
/* Blurred radial glow behind the existing angel mascot — bigger + softer than the FAB/avatar usages, reads like the
   reference's glowing orb while the mascot itself (halo + wingtips + particles) is untouched. */
.assistant-welcome-mascot-frame::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle, var(--aai-glow) 0%, var(--aai-glow-soft) 45%, transparent 72%);
  filter: blur(6px); animation: angelWelcomeGlowPulse 4s ease-in-out infinite;
}
.assistant-welcome-mascot-frame::after {
  content: ""; position: absolute; inset: 14px; border-radius: 50%; border: 1px solid var(--aai-glow);
}
.assistant-welcome-mascot-frame .angel-mascot { position: relative; z-index: 1; color: var(--aai-accent); }
@keyframes angelWelcomeGlowPulse { 0%, 100% { opacity: .75; transform: scale(1); } 50% { opacity: 1; transform: scale(1.05); } }
@media (prefers-reduced-motion: reduce) { .assistant-welcome-mascot-frame::before { animation: none; } }

.assistant-welcome-eyebrow { font-size: 14px; font-weight: 600; color: var(--aai-accent); letter-spacing: .01em; }
.assistant-welcome-headline { font-size: 26px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; margin-bottom: 6px; }

.assistant-welcome-cards { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; max-width: 720px; margin: 8px 0 26px; }
.assistant-welcome-card {
  flex: 1 1 200px; max-width: 260px; text-align: left; padding: 14px 16px; border-radius: 16px; font-size: 13px; line-height: 1.4;
  color: var(--text-2); background: var(--surface); border: 1px solid var(--border); cursor: pointer; transition: border-color .15s ease, transform .15s ease;
}
.assistant-welcome-card:hover {
  border-color: var(--aai-accent); color: var(--text); transform: translateY(-1px);
  box-shadow: 0 0 0 1px var(--aai-glow-soft);
}

.assistant-welcome-inputbar {
  width: min(640px, 100%); display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 18px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--aai-glow);
  box-shadow: 0 0 0 1px var(--aai-glow-soft), 0 8px 28px var(--aai-glow-soft);
}
.assistant-welcome-inputbar:focus-within {
  border-color: var(--aai-accent); box-shadow: 0 0 0 2px var(--aai-glow-soft), 0 8px 28px var(--aai-glow);
}
.assistant-welcome-textarea {
  flex: 1; border: none; background: transparent; color: var(--text); font-size: 14.5px; font-family: inherit;
  resize: none; padding: 10px 4px; max-height: 120px; outline: none;
}
.assistant-pill-icon-btn, .assistant-pill-send-btn {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: background .15s ease, color .15s ease, opacity .15s ease;
}
.assistant-pill-icon-btn { background: transparent; color: var(--text-3); }
.assistant-pill-icon-btn:hover { background: var(--surface-2); color: var(--text-2); }
.assistant-pill-icon-btn.listening { color: #fff; background: var(--red); animation: angelMicPulse 1.2s ease-in-out infinite; }
.assistant-pill-send-btn { background: var(--aai-accent); color: #fff; }
.assistant-pill-send-btn:hover { background: var(--aai-accent-2); }

@media (max-width: 640px) {
  .assistant-welcome-headline { font-size: 21px; }
  .assistant-welcome-cards { flex-direction: column; align-items: stretch; }
  .assistant-welcome-card { max-width: none; }
}

/* v3 — Futuristic liquid-glass treatment for the full Angel AI page only. */
#screen-assistant {
  --aai-accent: #8a5cff;
  --aai-cyan: #55d7ff;
  --aai-pink: #d87bff;
  --aai-ink: #17131f;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(circle at 74% 16%, rgba(116, 196, 255, .17), transparent 29%),
    radial-gradient(circle at 38% 86%, rgba(181, 112, 255, .16), transparent 32%),
    linear-gradient(145deg, #f8f5fc 0%, #f1edf7 48%, #f8f7fb 100%);
}
#screen-assistant::before,
#screen-assistant::after {
  content: ""; position: fixed; z-index: -1; border-radius: 999px; pointer-events: none;
  filter: blur(14px); opacity: .72;
}
#screen-assistant::before { width: 420px; height: 420px; right: 6vw; top: 8vh; background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.9), rgba(89,203,255,.18) 42%, rgba(160,87,255,.12) 65%, transparent 72%); }
#screen-assistant::after { width: 520px; height: 300px; left: 22vw; bottom: -110px; background: radial-gradient(ellipse, rgba(177,112,255,.18), transparent 68%); }
#screen-assistant .app-layout { position: relative; z-index: 1; }
#screen-assistant .app-sidebar,
#screen-assistant #assistant-panel {
  background: rgba(255,255,255,.52) !important;
  border: 1px solid rgba(255,255,255,.8) !important;
  box-shadow: 0 24px 70px rgba(52,34,81,.10), inset 0 1px 0 rgba(255,255,255,.9) !important;
  backdrop-filter: blur(30px) saturate(145%);
  -webkit-backdrop-filter: blur(30px) saturate(145%);
}
#screen-assistant .app-sidebar { background: rgba(255,255,255,.42) !important; }
#screen-assistant .app-main { min-width: 0; }
.assistant-page-header { align-items: center; padding: 4px 2px 18px; }
.assistant-page-header .app-title { font-size: clamp(26px, 2.3vw, 36px); letter-spacing: -.045em; font-weight: 700; color: var(--aai-ink); }
.assistant-page-header .app-subtitle { margin-top: 5px; color: var(--text-2); }
.assistant-page-header #assistant-header-mascot { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 15px; background: rgba(255,255,255,.62); border: 1px solid rgba(255,255,255,.9); box-shadow: 0 10px 30px rgba(112,69,184,.15); }
.assistant-header-actions { display: flex; align-items: center; gap: 10px; }
.assistant-connection { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border: 1px solid rgba(255,255,255,.85); border-radius: 999px; background: rgba(255,255,255,.5); color: #6a577e; font-size: 12px; font-weight: 600; box-shadow: inset 0 1px 0 #fff; }
.assistant-connection i { width: 7px; height: 7px; border-radius: 50%; background: #8a5cff; box-shadow: 0 0 0 4px rgba(138,92,255,.12), 0 0 12px rgba(138,92,255,.65); }
.assistant-header-new { padding: 10px 15px !important; font-size: 13px !important; border-radius: 13px !important; background: rgba(255,255,255,.5) !important; }
#screen-assistant #assistant-panel { position: relative; overflow: hidden; min-height: calc(100vh - 150px); border-radius: 28px !important; padding: 0 !important; display: flex; flex-direction: column; gap: 0; }
#screen-assistant #assistant-panel::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(125deg, rgba(255,255,255,.46), transparent 28%, transparent 72%, rgba(255,255,255,.24)); }
.assistant-welcome { position: relative; z-index: 1; justify-content: center; min-height: calc(100vh - 180px); padding: 54px 28px 38px; }
.assistant-welcome-mascot-frame { width: 154px; height: 154px; margin-bottom: 14px; }
.assistant-welcome-mascot-frame::before { inset: -28px; filter: blur(18px); background: radial-gradient(circle, rgba(255,255,255,.98) 0 16%, rgba(85,215,255,.25) 31%, rgba(138,92,255,.33) 49%, rgba(216,123,255,.12) 62%, transparent 74%); }
.assistant-welcome-mascot-frame::after { inset: 20px; border: 1px solid rgba(255,255,255,.94); background: rgba(255,255,255,.3); box-shadow: inset 0 0 30px rgba(255,255,255,.85), 0 0 0 1px rgba(138,92,255,.18), 0 18px 44px rgba(94,48,143,.17); backdrop-filter: blur(10px); }
.assistant-welcome-mascot-frame .angel-mascot { filter: drop-shadow(0 6px 16px rgba(123,75,201,.35)); }
.assistant-welcome-eyebrow { margin-top: 4px; font-size: 11px; letter-spacing: .2em; font-weight: 700; background: linear-gradient(90deg, #6751e8, #b14fe2); -webkit-background-clip: text; background-clip: text; color: transparent; }
.assistant-welcome-headline { margin: 5px 0 0; font-size: clamp(30px, 3vw, 44px); line-height: 1.08; letter-spacing: -.045em; color: var(--aai-ink); }
.assistant-welcome-copy { max-width: 620px; margin: 8px 0 15px; color: var(--text-2); font-size: 14px; line-height: 1.55; }
.assistant-welcome-cards { width: min(760px, 100%); max-width: none; margin: 9px 0 26px; gap: 12px; }
.assistant-welcome-card { position: relative; min-height: 84px; padding: 17px 18px; border-radius: 20px; color: #575061; background: linear-gradient(145deg, rgba(255,255,255,.67), rgba(255,255,255,.34)); border: 1px solid rgba(255,255,255,.92); box-shadow: 0 14px 34px rgba(68,42,102,.08), inset 0 1px 0 #fff; backdrop-filter: blur(18px); }
.assistant-welcome-card::after { content: "↗"; position: absolute; right: 15px; bottom: 12px; color: #8a5cff; opacity: 0; transform: translate(-4px,4px); transition: .2s ease; }
.assistant-welcome-card:hover { border-color: rgba(138,92,255,.36); transform: translateY(-3px); box-shadow: 0 20px 42px rgba(92,52,139,.13), inset 0 1px 0 #fff; }
.assistant-welcome-card:hover::after { opacity: 1; transform: none; }
.assistant-welcome-inputbar { width: min(760px, 100%); min-height: 62px; padding: 7px 8px 7px 15px; border-radius: 21px; background: rgba(255,255,255,.65); border: 1px solid rgba(255,255,255,.95); box-shadow: 0 18px 50px rgba(68,38,105,.13), 0 0 0 1px rgba(138,92,255,.13), inset 0 1px 0 #fff; backdrop-filter: blur(22px); }
.assistant-welcome-inputbar:focus-within { border-color: rgba(138,92,255,.52); box-shadow: 0 20px 55px rgba(85,51,130,.17), 0 0 0 3px rgba(138,92,255,.10), inset 0 1px 0 #fff; }
.assistant-pill-send-btn { width: 45px; height: 45px; background: linear-gradient(145deg, #9b6cff, #7448ef); box-shadow: 0 8px 18px rgba(112,67,226,.34), inset 0 1px 0 rgba(255,255,255,.32); }
.assistant-pill-send-btn:hover { transform: scale(1.04); background: linear-gradient(145deg, #a879ff, #7b4df4); }
.assistant-pill-icon-btn { width: 40px; height: 40px; }
.assistant-shell { position: relative; z-index: 1; gap: 0; min-height: calc(100vh - 150px); }
.assistant-sidebar { width: 246px; padding: 20px 14px; gap: 10px; background: rgba(245,241,248,.42); border-right: 1px solid rgba(124,94,151,.10); }
.assistant-sidebar #assistant-new-thread-btn { border-radius: 14px !important; padding: 11px !important; background: linear-gradient(145deg, rgba(255,255,255,.82), rgba(255,255,255,.42)); border: 1px solid rgba(255,255,255,.9); box-shadow: 0 8px 22px rgba(66,40,90,.08); }
.assistant-thread-item { padding: 11px 12px; border-radius: 13px; }
.assistant-thread-item.active { background: rgba(255,255,255,.72); border-color: rgba(138,92,255,.18); box-shadow: 0 8px 24px rgba(71,42,100,.08); }
.assistant-main { padding: 22px; }
.assistant-tray { background: rgba(255,255,255,.48); border-color: rgba(255,255,255,.9); backdrop-filter: blur(18px); }
.assistant-bubble-row.assistant .assistant-bubble { background: rgba(255,255,255,.66); border: 1px solid rgba(255,255,255,.9); box-shadow: 0 8px 24px rgba(62,39,90,.06); }
.assistant-bubble-row.user .assistant-bubble { background: linear-gradient(145deg, #9567f5, #7448e8); box-shadow: 0 8px 24px rgba(113,70,218,.22); }

@media (prefers-color-scheme: dark) {
  #screen-assistant { --aai-ink: #f7f4ff; background: radial-gradient(circle at 75% 10%, rgba(63,88,146,.28), transparent 30%), radial-gradient(circle at 35% 85%, rgba(102,45,139,.23), transparent 34%), #111016; }
  #screen-assistant .app-sidebar, #screen-assistant #assistant-panel { background: rgba(27,25,34,.68) !important; border-color: rgba(255,255,255,.10) !important; }
  .assistant-welcome-card, .assistant-welcome-inputbar { background: rgba(37,34,45,.68); border-color: rgba(255,255,255,.11); }
}
@media (max-width: 760px) {
  .assistant-page-header { align-items: flex-start; }
  .assistant-connection { display: none; }
  .assistant-header-new { padding: 9px 11px !important; }
  #screen-assistant #assistant-panel, .assistant-welcome, .assistant-shell { min-height: 68vh; }
  .assistant-welcome { padding: 34px 16px 22px; }
  .assistant-welcome-mascot-frame { width: 120px; height: 120px; }
  .assistant-welcome-copy { font-size: 13px; }
  .assistant-welcome-cards { display: grid; grid-template-columns: 1fr; margin-bottom: 18px; }
  .assistant-welcome-card { min-height: 0; }
  .assistant-sidebar { width: 100%; padding: 12px; }
  .assistant-main { padding: 14px; }
}
