/* ==========================================================================
   GHOST CREATIVE SYSTEM — MASTER DESIGN SYSTEM v2.0
   Premium UI foundation inspired by Adobe CC, Figma, Raycast, and Arc.
   ========================================================================== */

/* No remote @import: CEP panels can run without internet access.
   Type falls back to the host UI stack (Adobe ships a Segoe/SF-class face). */


/* ==========================================================================
   1. DESIGN TOKENS
   ========================================================================== */
:root {
  /* ── Color Palette ─────────────────────────────────────────────────────── */
  --ghost-bg:             var(--bg, #1B1B1D);
  --ghost-bg-elevated:    #202023;
  --ghost-sidebar:        var(--panel, #18181A);
  --ghost-card:           var(--panel-2, #232326);
  --ghost-card-hover:     var(--panel-3, #2A2A2E);
  --ghost-surface:        #1E1E21;
  --ghost-border:         var(--border, rgba(255, 255, 255, 0.06));
  --ghost-border-strong:  rgba(255, 255, 255, 0.10);
  --ghost-border-focus:   rgba(59, 130, 246, 0.5);

  /* ── Accent & Semantic ─────────────────────────────────────────────────── */
  --ghost-accent:         var(--accent, #3B82F6);
  --ghost-accent-hover:   var(--accent-hover, #2563EB);
  --ghost-accent-subtle:  rgba(59, 130, 246, 0.10);
  --ghost-accent-glow:    rgba(59, 130, 246, 0.20);
  --ghost-success:        #22C55E;
  --ghost-success-subtle: rgba(34, 197, 94, 0.12);
  --ghost-danger:         #EF4444;
  --ghost-danger-subtle:  rgba(239, 68, 68, 0.10);
  --ghost-warning:        #F59E0B;
  --ghost-warning-subtle: rgba(245, 158, 11, 0.10);

  /* ── Text ──────────────────────────────────────────────────────────────── */
  --ghost-text-primary:   var(--text, #EDEDEF);
  --ghost-text-secondary: var(--text-muted, #9D9DA5);
  --ghost-text-muted:     var(--text-faint, #64646C);
  --ghost-text-inverse:   #09090B;

  /* ── Typography ────────────────────────────────────────────────────────── */
  --ghost-font:      'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --ghost-font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, Monaco, monospace;

  /* ── 8px Spacing Grid ──────────────────────────────────────────────────── */
  --ghost-space-2xs: 2px;
  --ghost-space-xs:  4px;
  --ghost-space-sm:  8px;
  --ghost-space-md:  12px;
  --ghost-space-lg:  16px;
  --ghost-space-xl:  24px;
  --ghost-space-2xl: 32px;
  --ghost-space-3xl: 48px;

  /* ── Border Radius ─────────────────────────────────────────────────────── */
  --ghost-radius-xs:   4px;
  --ghost-radius-sm:   6px;
  --ghost-radius-md:   8px;
  --ghost-radius-lg:   12px;
  --ghost-radius-xl:   16px;
  --ghost-radius-full: 9999px;

  /* ── Elevation / Shadows ───────────────────────────────────────────────── */
  --ghost-shadow-xs:   0 1px 2px rgba(0, 0, 0, 0.20);
  --ghost-shadow-sm:   0 2px 4px -1px rgba(0, 0, 0, 0.25);
  --ghost-shadow-md:   0 4px 12px -2px rgba(0, 0, 0, 0.35);
  --ghost-shadow-lg:   0 12px 32px -4px rgba(0, 0, 0, 0.50);
  --ghost-shadow-xl:   0 24px 48px -8px rgba(0, 0, 0, 0.60);
  --ghost-shadow-glow: 0 0 20px var(--ghost-accent-glow);

  /* ── Motion / Easing ───────────────────────────────────────────────────── */
  --ghost-ease:             cubic-bezier(0.16, 1, 0.3, 1);
  --ghost-ease-spring:      cubic-bezier(0.34, 1.56, 0.64, 1);
  --ghost-transition-fast:  100ms var(--ghost-ease);
  --ghost-transition-normal:150ms var(--ghost-ease);
  --ghost-transition-slow:  250ms var(--ghost-ease);
  --ghost-transition-expand:300ms var(--ghost-ease);

  /* ── Layout Constants ──────────────────────────────────────────────────── */
  --ghost-target-min:     32px;
  --ghost-sidebar-width:  220px;
  --ghost-toolbar-height: 40px;
}

/* ── Theme Overrides ─────────────────────────────────────────────────────── */
[data-theme="grey"] {
  --ghost-bg: #000000;
  --ghost-bg-elevated: #323236;
  --ghost-sidebar: #1F1F22;
  --ghost-card: #37373F;
  --ghost-card-hover: #45454F;
  --ghost-surface: #2E2E33;
  --ghost-border: rgba(255, 255, 255, 0.08);
  --ghost-border-strong: rgba(255, 255, 255, 0.14);
  --ghost-text-primary: #FAFAFA;
  --ghost-text-secondary: #D4D4D8;
  --ghost-text-muted: #A1A1AA;
  --ghost-accent: #E4E4E7;
  --ghost-accent-hover: #FFFFFF;
}

[data-theme="macos"] {
  --ghost-bg: #F5F5F7;
  --ghost-bg-elevated: #FFFFFF;
  --ghost-sidebar: #EAEAEF;
  --ghost-card: #FFFFFF;
  --ghost-card-hover: #F2F2F7;
  --ghost-surface: #EAEAEF;
  --ghost-border: rgba(0, 0, 0, 0.08);
  --ghost-border-strong: rgba(0, 0, 0, 0.15);
  --ghost-text-primary: #1D1D1F;
  --ghost-text-secondary: #515154;
  --ghost-text-muted: #86868B;
  --ghost-accent: #0071E3;
  --ghost-accent-hover: #0077ED;
  --ghost-accent-subtle: rgba(0, 113, 227, 0.1);
}

[data-theme="eyecare"] {
  --ghost-bg: #1E201E;
  --ghost-bg-elevated: #2C302E;
  --ghost-sidebar: #151715;
  --ghost-card: #2C302E;
  --ghost-card-hover: #3A403C;
  --ghost-surface: #222523;
  --ghost-border: rgba(255, 255, 255, 0.05);
  --ghost-border-strong: rgba(255, 255, 255, 0.10);
  --ghost-text-primary: #EAECE9;
  --ghost-text-secondary: #A3B899;
  --ghost-text-muted: #6B7B66;
  --ghost-accent: #8EAC50;
  --ghost-accent-hover: #A0C45C;
  --ghost-accent-subtle: rgba(142, 172, 80, 0.12);
}


/* ==========================================================================
   2. BASE RESET & TYPOGRAPHY
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body {
  background-color: var(--ghost-bg);
  color: var(--ghost-text-primary);
  font-family: var(--ghost-font);
  font-size: 13px;
  line-height: 1.5;
  user-select: none;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

input, button, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  outline: none;
  border: none;
  background: transparent;
}

a { color: var(--ghost-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg { display: block; max-width: 100%; }

::selection {
  background: var(--ghost-accent-subtle);
  color: var(--ghost-text-primary);
}


/* ==========================================================================
   3. CUSTOM SCROLLBARS
   ========================================================================== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--ghost-radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.14);
}
::-webkit-scrollbar-corner {
  background: transparent;
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}


/* ==========================================================================
   4. BUTTON SYSTEM
   ========================================================================== */
.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--ghost-target-min);
  padding: 0 var(--ghost-space-md);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.01em;
  border-radius: var(--ghost-radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--ghost-transition-fast);
  position: relative;
  overflow: hidden;
}

.ghost-btn:active:not(:disabled) {
  transform: scale(0.97);
  transition-duration: 50ms;
}

.ghost-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.ghost-btn:focus-visible {
  outline: 2px solid var(--ghost-accent);
  outline-offset: 1px;
}

/* Primary — Solid Accent */
.ghost-btn-primary {
  background: var(--ghost-accent);
  color: #FFFFFF;
  font-weight: 600;
}
.ghost-btn-primary:hover:not(:disabled) {
  background: var(--ghost-accent-hover);
  box-shadow: var(--ghost-shadow-glow);
}

/* Secondary — Subtle Dark */
.ghost-btn-secondary {
  background: var(--ghost-card);
  color: var(--ghost-text-primary);
  border-color: var(--ghost-border);
}
.ghost-btn-secondary:hover:not(:disabled) {
  background: var(--ghost-card-hover);
  border-color: var(--ghost-border-strong);
}

/* Danger — Red */
.ghost-btn-danger {
  background: transparent;
  color: var(--ghost-danger);
  border-color: rgba(239, 68, 68, 0.25);
}
.ghost-btn-danger:hover:not(:disabled) {
  background: var(--ghost-danger-subtle);
  border-color: var(--ghost-danger);
}

/* Ghost — Transparent */
.ghost-btn-ghost {
  background: transparent;
  color: var(--ghost-text-secondary);
}
.ghost-btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.05);
  color: var(--ghost-text-primary);
}

/* Icon Only — Square */
.ghost-btn-icon {
  width: var(--ghost-target-min);
  height: var(--ghost-target-min);
  padding: 0;
  background: transparent;
  color: var(--ghost-text-secondary);
  border-radius: var(--ghost-radius-sm);
  flex-shrink: 0;
}
.ghost-btn-icon:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ghost-text-primary);
}


/* ==========================================================================
   5. INPUT SYSTEM
   ========================================================================== */
.ghost-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.ghost-input-icon {
  position: absolute;
  left: 10px;
  width: 14px;
  height: 14px;
  color: var(--ghost-text-muted);
  pointer-events: none;
  opacity: 0.7;
}

.ghost-input {
  width: 100%;
  height: var(--ghost-target-min);
  padding: 0 var(--ghost-space-md) 0 32px;
  background: var(--ghost-card);
  color: var(--ghost-text-primary);
  border: 1px solid var(--ghost-border);
  border-radius: var(--ghost-radius-md);
  font-size: 12px;
  transition: border-color var(--ghost-transition-fast),
              background var(--ghost-transition-fast),
              box-shadow var(--ghost-transition-fast);
}

.ghost-input::placeholder {
  color: var(--ghost-text-muted);
}

.ghost-input:focus {
  border-color: var(--ghost-accent);
  background: var(--ghost-bg-elevated);
  box-shadow: 0 0 0 3px var(--ghost-accent-subtle);
}

.ghost-textarea {
  width: 100%;
  min-height: 80px;
  padding: var(--ghost-space-sm) var(--ghost-space-md);
  background: var(--ghost-card);
  color: var(--ghost-text-primary);
  border: 1px solid var(--ghost-border);
  border-radius: var(--ghost-radius-md);
  font-size: 12px;
  line-height: 1.6;
  resize: vertical;
  transition: border-color var(--ghost-transition-fast),
              box-shadow var(--ghost-transition-fast);
}

.ghost-textarea:focus {
  border-color: var(--ghost-accent);
  box-shadow: 0 0 0 3px var(--ghost-accent-subtle);
}


/* ==========================================================================
   6. BADGE SYSTEM
   ========================================================================== */
.ghost-badge-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  border-radius: var(--ghost-radius-full);
  background: rgba(255, 255, 255, 0.08);
  color: var(--ghost-text-secondary);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.ghost-badge-md {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--ghost-radius-full);
  background: var(--ghost-accent-subtle);
  color: var(--ghost-accent);
  font-size: 10px;
  font-weight: 700;
}


/* ==========================================================================
   7. SIDEBAR NAVIGATION COMPONENTS (Spec Only — Actual Sidebar in style.css)
   ========================================================================== */
.ghost-sidebar-shell {
  width: var(--ghost-sidebar-width);
  background: var(--ghost-sidebar);
  border-right: 1px solid var(--ghost-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100%;
  overflow: hidden;
}

.ghost-sidebar-group {
  padding: var(--ghost-space-xs) 0;
}

.ghost-sidebar-header {
  padding: var(--ghost-space-sm) var(--ghost-space-md);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ghost-text-muted);
  user-select: none;
}

.ghost-sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--ghost-space-sm);
  height: 34px;
  padding: 0 var(--ghost-space-sm) 0 var(--ghost-space-md);
  margin: 1px var(--ghost-space-sm);
  border-radius: var(--ghost-radius-sm);
  color: var(--ghost-text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--ghost-transition-fast);
}

.ghost-sidebar-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--ghost-text-primary);
}

.ghost-sidebar-item.active {
  background: var(--ghost-accent-subtle);
  color: var(--ghost-accent);
  font-weight: 600;
  border-color: rgba(59, 130, 246, 0.15);
}

.ghost-sidebar-item-icon {
  width: 16px;
  height: 16px;
  opacity: 0.65;
  flex-shrink: 0;
}
.ghost-sidebar-item:hover .ghost-sidebar-item-icon,
.ghost-sidebar-item.active .ghost-sidebar-item-icon {
  opacity: 1;
}

.ghost-sidebar-item-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ghost-sidebar-item-badge {
  margin-left: auto;
  flex-shrink: 0;
}


/* ==========================================================================
   8. CARD SYSTEM
   ========================================================================== */
.ghost-card {
  position: relative;
  background: var(--ghost-card, #222225);
  border: 1px solid var(--ghost-border);
  border-radius: var(--ghost-radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: transform var(--ghost-transition-normal),
              border-color var(--ghost-transition-normal),
              box-shadow var(--ghost-transition-normal),
              background var(--ghost-transition-normal);
}

.ghost-card:hover {
  transform: translateY(-2px) scale(1.01);
  border-color: var(--ghost-border-strong);
  box-shadow: var(--ghost-shadow-md);
  background: var(--ghost-card-hover);
}

.ghost-card.selected {
  border-color: var(--ghost-accent);
  box-shadow: 0 0 0 1px var(--ghost-accent),
              var(--ghost-shadow-glow);
}

.ghost-card-preview {
  position: relative;
  aspect-ratio: 4 / 3;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.ghost-card-preview img,
.ghost-card-preview video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--ghost-transition-slow);
}

.ghost-card:hover .ghost-card-preview img,
.ghost-card:hover .ghost-card-preview video {
  transform: scale(1.04);
}

.ghost-card-meta {
  padding: var(--ghost-space-xs) var(--ghost-space-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ghost-space-xs);
}

.ghost-card-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--ghost-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.ghost-card-badge {
  display: none !important;
}


/* ==========================================================================
   9. NAVIGATION TABS (Adobe CC Panel Style)
   ========================================================================== */
.ghost-nav-tabs {
  display: flex;
  align-items: center;
  gap: var(--ghost-space-2xs);
  background: transparent;
  border-bottom: 1px solid var(--ghost-border);
  padding: 0 var(--ghost-space-md);
  height: var(--ghost-toolbar-height);
  flex-shrink: 0;
}

.ghost-tab-item {
  display: flex;
  align-items: center;
  gap: 6px;
  height: var(--ghost-toolbar-height);
  padding: 0 var(--ghost-space-md);
  font-size: 12px;
  font-weight: 500;
  color: var(--ghost-text-secondary);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color var(--ghost-transition-fast),
              border-color var(--ghost-transition-fast);
  white-space: nowrap;
}

.ghost-tab-item:hover {
  color: var(--ghost-text-primary);
}

.ghost-tab-item.active {
  color: var(--ghost-text-primary);
  font-weight: 600;
  border-bottom-color: var(--ghost-accent);
}

.ghost-tab-icon, .ghost-icon {
  width: 15px;
  height: 15px;
  stroke-width: 1.75;
  stroke: currentColor;
  fill: none;
  opacity: 0.8;
}


/* ==========================================================================
   10. FILTER CHIP PILLS
   ========================================================================== */
.ghost-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--ghost-radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--ghost-text-secondary);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--ghost-transition-fast);
}

.ghost-chip:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--ghost-text-primary);
}

.ghost-chip.active {
  background: var(--ghost-accent);
  color: #FFFFFF;
  font-weight: 600;
  border-color: var(--ghost-accent);
  box-shadow: 0 2px 8px -2px rgba(59, 130, 246, 0.3);
}


/* ==========================================================================
   11. STATUS / CONNECTION DOT
   ========================================================================== */
.ghost-status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--ghost-text-secondary);
}

.ghost-status-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ghost-text-muted);
  transition: background var(--ghost-transition-normal),
              box-shadow var(--ghost-transition-normal);
}

.ghost-status-dot.connected::before {
  background: var(--ghost-success);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.45);
}

.ghost-status-dot.disconnected::before {
  background: var(--ghost-danger);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.35);
}


/* ==========================================================================
   12. MODAL / DIALOG SYSTEM
   ========================================================================== */
.ghost-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.60);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: ghost-fade-in 150ms ease-out;
}

.ghost-modal-window {
  width: 680px;
  max-height: 85vh;
  background: var(--ghost-bg-elevated);
  border: 1px solid var(--ghost-border-strong);
  border-radius: var(--ghost-radius-lg);
  box-shadow: var(--ghost-shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: ghost-slide-up 200ms var(--ghost-ease);
}

.ghost-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--ghost-space-lg) var(--ghost-space-xl);
  border-bottom: 1px solid var(--ghost-border);
}

.ghost-modal-header h2 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.ghost-modal-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.ghost-modal-sidebar {
  width: 180px;
  background: rgba(0, 0, 0, 0.12);
  border-right: 1px solid var(--ghost-border);
  padding: var(--ghost-space-md);
  flex-shrink: 0;
}

.ghost-modal-content {
  flex: 1;
  padding: var(--ghost-space-xl);
  overflow-y: auto;
}

.ghost-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--ghost-space-sm);
  padding: var(--ghost-space-md) var(--ghost-space-xl);
  border-top: 1px solid var(--ghost-border);
  background: var(--ghost-bg-elevated);
}


/* ==========================================================================
   13. TOGGLE SWITCH
   ========================================================================== */
.ghost-switch {
  position: relative;
  display: inline-flex;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.ghost-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.ghost-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--ghost-card-hover);
  border-radius: var(--ghost-radius-full);
  border: 1px solid var(--ghost-border);
  transition: background var(--ghost-transition-normal),
              border-color var(--ghost-transition-normal);
}

.ghost-slider::before {
  content: "";
  position: absolute;
  height: 14px;
  width: 14px;
  left: 2px;
  bottom: 2px;
  background: #FFFFFF;
  border-radius: 50%;
  transition: transform var(--ghost-transition-normal);
  box-shadow: var(--ghost-shadow-xs);
}

input:checked + .ghost-slider {
  background: var(--ghost-accent);
  border-color: var(--ghost-accent);
}

input:checked + .ghost-slider::before {
  transform: translateX(16px);
}

input:focus-visible + .ghost-slider {
  box-shadow: 0 0 0 3px var(--ghost-accent-subtle);
}


/* ==========================================================================
   14. CHAT UI
   ========================================================================== */
.ghost-chat-stream {
  display: flex;
  flex-direction: column;
  gap: var(--ghost-space-lg);
  padding: var(--ghost-space-lg);
  overflow-y: auto;
  flex: 1;
}

.ghost-msg-row {
  display: flex;
  gap: var(--ghost-space-md);
  max-width: 88%;
  animation: ghost-slide-up 200ms var(--ghost-ease);
}

.ghost-msg-row.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.ghost-msg-row.assistant {
  align-self: flex-start;
}

.ghost-msg-bubble {
  padding: var(--ghost-space-md) var(--ghost-space-lg);
  border-radius: var(--ghost-radius-lg);
  font-size: 13px;
  line-height: 1.55;
}

.ghost-msg-row.user .ghost-msg-bubble {
  background: var(--ghost-accent);
  color: #FFFFFF;
  border-bottom-right-radius: var(--ghost-radius-xs);
}

.ghost-msg-row.assistant .ghost-msg-bubble {
  background: var(--ghost-card);
  color: var(--ghost-text-primary);
  border: 1px solid var(--ghost-border);
  border-bottom-left-radius: var(--ghost-radius-xs);
}

.ghost-code-block {
  background: #121214;
  border: 1px solid var(--ghost-border);
  border-radius: var(--ghost-radius-sm);
  padding: var(--ghost-space-md);
  font-family: var(--ghost-font-mono);
  font-size: 12px;
  line-height: 1.5;
  margin-top: var(--ghost-space-sm);
  overflow-x: auto;
  -webkit-font-smoothing: auto;
}

.ghost-chat-dock {
  position: sticky;
  bottom: 0;
  background: var(--ghost-bg);
  padding: var(--ghost-space-md) var(--ghost-space-lg);
  border-top: 1px solid var(--ghost-border);
}

.ghost-chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: var(--ghost-space-sm);
  background: var(--ghost-card);
  border: 1px solid var(--ghost-border);
  border-radius: var(--ghost-radius-lg);
  padding: var(--ghost-space-sm) var(--ghost-space-md);
  transition: border-color var(--ghost-transition-fast);
}

.ghost-chat-input-bar:focus-within {
  border-color: var(--ghost-accent);
  box-shadow: 0 0 0 3px var(--ghost-accent-subtle);
}

.ghost-chat-textarea {
  flex: 1;
  background: transparent;
  border: none;
  resize: none;
  max-height: 120px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ghost-text-primary);
}


/* ==========================================================================
   15. POPOVER / TOOLTIP (Glassmorphism)
   ========================================================================== */
.ghost-popover {
  position: absolute;
  background: rgba(30, 30, 34, 0.92);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--ghost-radius-lg);
  box-shadow: var(--ghost-shadow-lg);
  padding: var(--ghost-space-sm);
  z-index: 1000;
  animation: ghost-fade-in 120ms ease-out;
}


/* ==========================================================================
   16. ANIMATIONS
   ========================================================================== */
@keyframes ghost-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes ghost-slide-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes ghost-slide-down {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes ghost-scale-in {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes ghost-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes ghost-glow-pulse {
  0%, 100% { box-shadow: 0 0 8px var(--ghost-accent-glow); }
  50%      { box-shadow: 0 0 16px var(--ghost-accent-glow); }
}


/* ==========================================================================
   17. UTILITY CLASSES
   ========================================================================== */
.ghost-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ghost-flex {
  display: flex;
}

.ghost-flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.ghost-flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ghost-gap-xs  { gap: var(--ghost-space-xs); }
.ghost-gap-sm  { gap: var(--ghost-space-sm); }
.ghost-gap-md  { gap: var(--ghost-space-md); }
.ghost-gap-lg  { gap: var(--ghost-space-lg); }

.ghost-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Fade transition helper */
.ghost-fade-enter {
  opacity: 0;
  transform: translateY(4px);
}
.ghost-fade-active {
  transition: opacity var(--ghost-transition-normal),
              transform var(--ghost-transition-normal);
  opacity: 1;
  transform: none;
}

/* Icons8 Image Styling */
.icons8-img {
  width: 14px;
  height: 14px;
  object-fit: contain;
  display: inline-block;
  vertical-align: middle;
  transition: opacity var(--ghost-transition-fast), transform var(--ghost-transition-fast);
}

.icons8-img.fav-img {
  width: 12px;
  height: 12px;
}

button:hover .icons8-img {
  opacity: 1;
  transform: scale(1.05);
}

button:active .icons8-img {
  transform: scale(0.95);
}
