/* =============================================================================
 * Annotation System — Styles
 * Inspired by the Pretzel extension, adapted for the Popsicle editor.
 * ============================================================================= */

/* ---------- Custom Properties ---------- */
:root {
  --ag-accent: #4080ff;
  --ag-accent-light: #4080ff;
  --ag-accent-soft: rgba(64, 128, 255, 0.12);
  --ag-accent-glow: rgba(64, 128, 255, 0.25);
  --ag-bg: rgba(10, 10, 10, 0.92);
  --ag-bg-solid: #0A0A0A;
  --ag-surface: rgba(255, 255, 255, 0.06);
  --ag-surface-hover: rgba(255, 255, 255, 0.10);
  --ag-border: rgba(255, 255, 255, 0.08);
  --ag-border-focus: rgba(64, 128, 255, 0.45);
  --ag-text: #EDEDED;
  --ag-text-dim: rgba(255, 255, 255, 0.5);
  --ag-text-muted: rgba(255, 255, 255, 0.65);
  --ag-text-dark: #0A0A0A;
  --ag-danger: #ff6b73;
  --ag-success: #2bf59e;
  --ag-radius: 10px;
  --ag-radius-sm: 6px;
  --ag-shadow: 0 8px 32px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.4);
  --ag-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --ag-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  --ag-z-base: 900;
}

/*
 * Stacking guarantee: the cluster exit-slides rightward into/behind the code/preview
 * pane.  #main-container has position:relative; z-index:1, which ensures it always
 * paints on top of .side-tabs (z-index:0) regardless of DOM order changes.
 */

/* ---------- 3-Button Annotation Cluster in Side Nav ---------- */
.annotate-cluster {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 2px;
  /* hidden/exit state — sits fully to the right, invisible */
  opacity: 0;
  transform: translateX(100%);
  pointer-events: none;
  /*
   * Exit animation: slide the full cluster width to the right first (into/behind
   * the code pane, which sits above it in z-order), then fade at the very end.
   * The delayed opacity means the buttons are already hidden by the pane before
   * they fade — no ghostly icons floating in the transition zone.
   */
  transition: transform 0.2s cubic-bezier(0.4, 0, 1, 1),
              opacity  0.05s linear 0.18s;
  will-change: transform, opacity;
}
.annotate-cluster.visible {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
  /* Entry: spring in from the right, quick fade-in */
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
              opacity  0.18s ease;
}

.annotate-cluster .side-tab {
  margin-top: 0;
  margin-bottom: 4px !important;
  border-radius: var(--r) 0 0 var(--r) !important;
  border: 1px solid #1A1A1A !important;
  border-right: 1px solid transparent !important;
  position: relative;
  background: var(--bg-pane) !important;
  color: var(--text-secondary) !important;
  /* Smooth background/color transition so mode-switch doesn't flash through the exit animation */
  transition: color 0.2s ease, background 0.3s ease !important;
}
body.preview-active .annotate-cluster .side-tab {
  background: var(--preview-bg, var(--bg-tertiary)) !important;
  color: var(--preview-fg, var(--text-secondary)) !important;
  border-color: #1A1A1A !important;
  border-right-color: transparent !important;
}
.annotate-cluster .side-tab:hover {
  color: #ff6090 !important;
}

/* Active annotation mode button glow */
.annotate-cluster #btn-annotate.annotate-active {
  color: #ff6090 !important;
}
body.preview-active .annotate-cluster #btn-annotate.annotate-active { color: #ff6090 !important; }

/* Inspirations active state (panel open) */
.annotate-cluster #btn-inspirations.inspirations-active {
  color: #ff6090 !important;
}
body.preview-active .annotate-cluster #btn-inspirations.inspirations-active {
  color: #ff6090 !important;
}

/* Active highlight for extra buttons */
.annotate-cluster .side-tab:active {
  color: #ff6090 !important;
}

/* Badge count on annotate button */
.annotate-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 14px;
  height: 14px;
  border-radius: 7px;
  background: var(--ag-accent);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
  animation: agBadgePop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 2;
}
.annotate-badge.visible {
  display: flex;
}

@keyframes agBadgePop {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

/* ---------- Annotation Toolbar (floating, bottom center in preview iframe area) ---------- */
.ag-toolbar {
  position: absolute;
  bottom: 24px;
  left: 50%;
  z-index: 999999;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  background: var(--ag-bg);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid var(--ag-border);
  border-radius: 999px;
  box-shadow: var(--ag-shadow);
  font-family: var(--ag-font);
  transform: translateX(-50%) translateY(52px);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 360ms cubic-bezier(0.22, 1, 0.36, 1),
              opacity 260ms ease,
              visibility 0s linear 360ms;
  will-change: transform, opacity;
}
.ag-toolbar.ag-toolbar-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  transition: transform 340ms cubic-bezier(0.16, 1, 0.3, 1),
              opacity 240ms ease,
              visibility 0s linear 0s;
}
.ag-toolbar.ag-toolbar-closing {
  pointer-events: none;
}

.ag-toolbar-btn {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #A0A0A0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
  font-size: 14px;
}
.ag-toolbar-btn:hover {
  background: transparent;
  color: #7EA8FF;
}
.ag-toolbar-btn.ag-active {
  background: transparent;
  color: #7EA8FF;
}
.ag-toolbar-btn i { font-size: 13px; }

.ag-toolbar-primary {
  background: #FFFFFF !important;
  color: #000000 !important;
}
.ag-toolbar-primary:hover {
  background: #E0E0E0 !important;
  transform: scale(1.05);
}

.ag-toolbar-divider {
  width: 1px;
  height: 22px;
  background: var(--ag-border);
  margin: 0 1px;
  flex-shrink: 0;
}

/* Toolbar tooltips */
.ag-toolbar-btn[data-tooltip] { position: relative; }
.ag-toolbar-btn[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 5px 10px;
  background: var(--ag-bg-solid);
  color: var(--ag-text);
  font-family: var(--ag-font);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  border-radius: 6px;
  border: 1px solid var(--ag-border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 10;
}
.ag-toolbar-btn[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.ag-toolbar-badge {
  position: absolute;
  top: 0px;
  right: 0px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  background: var(--ag-accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
  animation: agBadgePop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- Hover Overlay ---------- */
.ag-hover-overlay {
  position: absolute;
  pointer-events: none;
  z-index: var(--ag-z-base);
  border: 2px solid var(--ag-accent);
  border-radius: 0;
  background: var(--ag-accent-soft);
  transition: all 0.1s ease-out;
  opacity: 0;
}
.ag-hover-overlay.ag-visible { opacity: 1; }

/* ---------- Hover Label ---------- */
.ag-hover-label {
  position: absolute;
  pointer-events: none;
  z-index: calc(var(--ag-z-base) + 1);
  font-family: var(--ag-mono);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  padding: 4px 8px;
  background: var(--ag-accent);
  color: #fff;
  border-radius: 4px;
  white-space: nowrap;
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity 0.12s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.ag-hover-label.ag-visible { opacity: 1; }

/* ---------- Annotation Markers ---------- */
.ag-marker {
  position: absolute;
  z-index: calc(var(--ag-z-base) + 2);
  width: 26px;
  height: 26px;
  border-radius: 50px 50px 50px 6px;
  background: var(--ag-accent);
  color: #FFFFFF;
  font-family: var(--ag-font);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(64, 128, 255, 0.25), 0 0 0 2px rgba(64, 128, 255, 0.12);
  transform: scale(0);
  animation: agMarkerIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
}
.ag-marker:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 16px rgba(64, 128, 255, 0.5), 0 0 0 3px rgba(64, 128, 255, 0.2);
}
.ag-marker.ag-marker-exit {
  animation: agMarkerOut 0.25s ease-in forwards;
}

@keyframes agMarkerIn {
  0% { transform: scale(0) rotate(-90deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
@keyframes agMarkerOut {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0) rotate(90deg); opacity: 0; }
}

/* ---------- Resolve Button (on markers) ---------- */
.ag-resolve-btn {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: none;
  background: rgba(30, 30, 38, 1.0);
  color: var(--ag-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.7);
  transition: all 0.15s ease;
  pointer-events: auto;
  padding: 0;
  z-index: 2;
  font-size: 9px;
}
.ag-marker:hover .ag-resolve-btn {
  opacity: 1;
  transform: scale(1);
}
.ag-resolve-btn:hover {
  background: rgb(255, 32, 214);
  color: #ffffff;
}

/* ---------- Element Highlight (when hovering markers) ---------- */
.ag-element-highlight {
  position: absolute;
  pointer-events: none;
  z-index: var(--ag-z-base);
  border: 2px dashed var(--ag-accent);
  border-radius: 0;
  background: rgba(64, 128, 255, 0.06);
  transition: all 0.15s ease;
}

/* ---------- Annotation Popup ---------- */
.ag-popup {
  position: absolute;
  z-index: calc(var(--ag-z-base) + 10);
  width: 310px;
  background: var(--ag-bg);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid var(--ag-border);
  border-radius: var(--ag-radius);
  box-shadow: var(--ag-shadow);
  padding: 0;
  overflow: hidden;
  font-family: var(--ag-font);
  color: var(--ag-text);
  transform: scale(0.92) translateY(8px);
  opacity: 0;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.15s ease;
}
.ag-popup.ag-popup-visible {
  transform: scale(1) translateY(0);
  opacity: 1;
}
.ag-popup.ag-popup-exit {
  transform: scale(0.92) translateY(8px);
  opacity: 0;
  transition: transform 0.15s ease, opacity 0.12s ease;
}
.ag-popup.ag-popup-shake {
  animation: agShake 0.25s ease;
}

@keyframes agShake {
  0%, 100% { transform: scale(1) translateX(0); }
  20% { transform: scale(1) translateX(-6px); }
  40% { transform: scale(1) translateX(5px); }
  60% { transform: scale(1) translateX(-3px); }
  80% { transform: scale(1) translateX(2px); }
}

.ag-popup-header {
  padding: 10px 14px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ag-popup-element {
  font-size: 11px;
  font-weight: 600;
  color: var(--ag-text-muted);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--ag-mono);
}

.ag-popup-styles {
  padding: 0 14px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease, padding 0.25s ease;
}
.ag-popup-styles.ag-expanded {
  max-height: 200px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--ag-border);
}
.ag-popup-style-line {
  font-family: var(--ag-mono);
  font-size: 10px;
  line-height: 1.6;
  color: var(--ag-text-dim);
}
.ag-popup-style-prop { color: #c792ea; }
.ag-popup-style-val { color: #82aaff; }

.ag-popup-quote {
  padding: 8px 14px;
  font-size: 11px;
  color: var(--ag-text-dim);
  font-style: italic;
  border-bottom: 1px solid var(--ag-border);
  line-height: 1.4;
}

.ag-popup-body { padding: 0; }
.ag-popup-textarea {
  width: 100%;
  min-height: 56px;
  max-height: 140px;
  resize: vertical;
  background: var(--ag-surface);
  border: none;
  border-top: 1px solid var(--ag-border);
  border-bottom: 1px solid var(--ag-border);
  border-radius: 0;
  color: var(--ag-text);
  font-family: var(--ag-font);
  font-size: 12.5px;
  padding: 10px 14px;
  outline: none;
  line-height: 1.45;
}
.ag-popup-textarea::placeholder { color: var(--ag-text-dim); }
.ag-popup-textarea:focus {
  outline: none;
  border-color: var(--ag-border);
  box-shadow: none;
}

.ag-popup-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 14px 10px;
}
.ag-popup-btn {
  font-family: var(--ag-font);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--ag-radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.ag-popup-btn-cancel {
  background: transparent;
  color: var(--ag-text-dim);
  border: 1px solid transparent;
  border-radius: 3px;
  font-family: var(--ag-mono, var(--ag-font));
  font-size: 10.5px;
  font-weight: 500;
}
.ag-popup-btn-cancel:hover {
  color: var(--ag-text);
  background: var(--ag-surface);
  border: 1px solid var(--ag-surface);
  border-color: rgba(255, 255, 255, 0.14);
}
.ag-popup-btn-submit {
  background: var(--ag-accent);
  color: var(--ag-text-dark);
  border: 1px solid var(--ag-accent);
  font-family: var(--ag-mono, var(--ag-font));
  font-size: 10.5px;
  font-weight: 500;
  border-radius: 3px;
}
.ag-popup-btn-submit:hover {
  background: var(--ag-accent-light);
  border-color: var(--ag-accent-light);
  filter: brightness(1.1);
}
.ag-popup-btn-delete {
  background: transparent;
  color: var(--ag-danger);
  padding: 5px 7px;
  margin-right: auto;
}
.ag-popup-btn-delete:hover {
  background: rgba(255, 107, 115, 0.12);
}

/* ---------- Toast ---------- */
.ag-toast {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  z-index: calc(var(--ag-z-base) + 30);
  font-family: var(--ag-font);
  font-size: 12px;
  font-weight: 600;
  color: #111;
  background: var(--ag-success);
  padding: 4px 10px;
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(74, 222, 163, 0.3);
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}
.ag-toast.ag-toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Blocking Overlay (cursor crosshair over iframe) ---------- */
.ag-blocking-overlay {
  position: absolute;
  inset: 0;
  z-index: calc(var(--ag-z-base) - 2);
  cursor: crosshair;
  display: none;
}

/* ---------- "Annotations In Progress" Banner in Chat ---------- */
.annotation-banner {
  --banner-accent-rgb: 255, 96, 144;
  --banner-accent: #ff8eb3;
  --banner-text: #ffc0d4;
  --banner-strong: #ffdce8;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
  min-width: 0;
  box-sizing: border-box;
  background: rgba(var(--banner-accent-rgb), 0.08);
  border: 1px solid rgba(var(--banner-accent-rgb), 0.28);
  border-radius: var(--r);
  font-size: 12px;
  font-weight: 500;
  color: var(--banner-text);
  animation: bannerSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  margin: 4px 0;
  overflow: visible;
  align-self: stretch;
  flex-shrink: 0;
  min-height: 36px;
}

.annotation-banner.banner-theme-annotation {
  --banner-accent-rgb: 255, 96, 144;
  --banner-accent: #ff8eb3;
  --banner-text: #ffc0d4;
  --banner-strong: #ffdce8;
}

.annotation-banner.banner-theme-style-transfer {
  --banner-accent-rgb: 91, 156, 245;
  --banner-accent: #8ac0ff;
  --banner-text: #c0deff;
  --banner-strong: #e1efff;
}

.banner-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 6px;
  cursor: pointer;
  user-select: none;
  width: 100%;
  box-sizing: border-box;
  min-height: 34px;
  flex-shrink: 0;
}

.annotation-banner .banner-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(var(--banner-accent-rgb), 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--banner-accent);
  font-size: 11px;
}
.annotation-banner .banner-text {
  flex: 1;
  line-height: 1.4;
  min-width: 0;
}
.annotation-banner .banner-text strong {
  color: var(--banner-strong);
  font-weight: 600;
}
.annotation-banner .banner-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(var(--banner-accent-rgb), 0.2);
  border-top-color: var(--banner-accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
  margin-top: 4px;
}
.annotation-banner .banner-chevron {
  width: 20px;
  display: flex;
  justify-content: center;
  transition: transform 0.2s;
  color: var(--banner-accent);
  margin-top: 2px;
}
.annotation-banner.collapsed .banner-chevron {
  transform: rotate(-90deg);
}
.annotation-banner.collapsed .banner-body {
  display: none;
}
.banner-body {
  width: 100%;
  box-sizing: border-box;
  padding: 0 12px 12px;
  /* border-top: 1px solid rgba(88, 101, 242, 0.1); */
  margin-top: 2px;
}

/* ---------- Banner Icon Morph (from → to icon) ---------- */
.insp-icon-morph {
  position: relative;
}
.insp-icon-morph .insp-icon-from {
  transition: opacity 0.35s ease, transform 0.35s ease, filter 0.35s ease;
  opacity: 1;
  transform: scale(1) rotate(0deg);
  filter: blur(0px);
}
.insp-icon-morph .insp-icon-to {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.3) rotate(-90deg);
  opacity: 0;
  filter: blur(4px);
  transition: opacity 0.35s ease, transform 0.35s ease, filter 0.35s ease;
}
.insp-icon-morph.morphed .insp-icon-from {
  opacity: 0;
  transform: scale(0.3) rotate(90deg);
  filter: blur(4px);
}
.insp-icon-morph.morphed .insp-icon-to {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1) rotate(0deg);
  filter: blur(0px);
}
.banner-body ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.banner-body li {
  font-size: 11px;
  color: var(--banner-text);
}
.ann-comment {
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}
.ann-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  width: 100%;
}
.ann-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(var(--banner-accent-rgb), 0.14);
  border: 1px solid rgba(var(--banner-accent-rgb), 0.24);
  border-radius: 4px;
  padding: 3px 7px;
  font-family: var(--ag-mono);
  font-size: 9px;
  color: var(--banner-strong);
}

.ann-checkpoint-row {
  margin-top: 10px;
}

.ann-pill-checkpoint {
  background: rgba(var(--banner-accent-rgb), 0.22);
  border-color: rgba(var(--banner-accent-rgb), 0.42);
  color: var(--banner-strong);
  padding: 4px 9px;
  font-size: 9.5px;
}

.ann-pill-checkpoint i {
  font-size: 9px;
}

.annotation-banner.done {
  background: rgba(var(--banner-accent-rgb), 0.12);
  border-color: rgba(var(--banner-accent-rgb), 0.36);
  color: var(--banner-strong);
}
.annotation-banner.done .banner-icon {
  background: rgba(var(--banner-accent-rgb), 0.2);
  color: var(--banner-accent);
}
.annotation-banner.done .banner-text strong { color: var(--banner-strong); }
.annotation-banner.done .banner-spinner { display: none; }
.annotation-banner.done .banner-chevron { color: var(--banner-accent); }

@keyframes bannerSlideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Morphing Arrow / Spinner ---------- */
.ag-btn-icon-wrapper {
  position: relative;
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* margin-left: 4px; */
}
.ag-btn-icon-wrapper i {
  position: absolute;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ag-btn-icon-wrapper .fa-arrow-right {
  font-size: 10px;
  opacity: 1;
  transform: scale(1) rotate(0deg);
}
.ag-btn-icon-wrapper .fa-spinner {
  font-size: 12px;
  opacity: 0;
  transform: scale(0) rotate(-180deg);
}

.ag-toolbar-primary.loading .fa-arrow-right {
  opacity: 0;
  transform: scale(0) rotate(180deg);
}
.ag-toolbar-primary.loading .fa-spinner {
  opacity: 1;
  animation: agSpinnerRotate 1s linear infinite;
}
@keyframes agSpinnerRotate {
  0% { transform: scale(1) rotate(0deg); }
  100% { transform: scale(1) rotate(360deg); }
}

/* ---------- Detail level selector (slim) ---------- */
.ag-detail-select {
  font-family: var(--ag-font);
  font-size: 10px;
  font-weight: 500;
  color: var(--ag-text);
  background: var(--ag-surface);
  border: 1px solid var(--ag-border);
  border-radius: 999px;
  padding: 0 8px;
  cursor: pointer;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  height: 28px;
  line-height: 28px;
  text-align: center;
  transition: background 0.15s;
}
.ag-detail-select:hover { background: var(--ag-surface-hover); }
.ag-detail-select:focus { outline: none; border-color: var(--ag-border); box-shadow: none; }
.ag-detail-select option { background: var(--ag-bg-solid); color: var(--ag-text); }
