/* Floating bench loading pill — shared Admin + public contact form (20261005benchLoad1). */

.aa-bench-load {
  --aa-bench-copper: var(--copper, #c45c26);
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom, 0px) + var(--qw-dock-pad, 0px));
  z-index: 90; /* above Quotes workbench (80), below SMS chat bubble (12000) */
  width: min(420px, calc(100vw - 24px));
  pointer-events: none;
  font-family: var(--sans, "Plus Jakarta Sans", system-ui, sans-serif);
  color: var(--ink, #1c1917);
}

.aa-bench-load[hidden] {
  display: none !important;
}

.aa-bench-load-pill {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  margin: 0;
  padding: 10px 14px 12px;
  border: 1px solid rgb(28 25 23 / 0.12);
  border-radius: 16px 16px 12px 12px;
  background: rgb(255 252 248 / 0.96);
  box-shadow: 0 -8px 32px rgb(28 25 23 / 0.18), 0 4px 16px rgb(196 92 38 / 0.12);
  backdrop-filter: blur(12px);
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
}

.aa-bench-load-top {
  display: flex;
  align-items: baseline;
  gap: 8px 12px;
  flex-wrap: wrap;
}

.aa-bench-load-label {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.92rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aa-bench-load-count {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted, #78716c);
  white-space: nowrap;
}

.aa-bench-load-pct {
  font-size: 1.35rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--aa-bench-copper);
  letter-spacing: -0.02em;
  line-height: 1;
}

.aa-bench-load-track {
  position: relative;
  height: 9px;
  border-radius: 999px;
  overflow: hidden;
  background: rgb(196 92 38 / 0.16);
}

.aa-bench-load-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #a3471c, var(--aa-bench-copper) 45%, #e08a4f 78%, var(--aa-bench-copper));
  box-shadow: 0 0 10px rgb(196 92 38 / 0.45);
  transition: width 0.14s linear;
}

.aa-bench-load-hint {
  font-size: 0.78rem;
  font-weight: 700;
  color: #9a3412;
  min-height: 1.1em;
}

.aa-bench-load.is-stalled .aa-bench-load-track::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    rgb(255 255 255 / 0.0) 0 8px,
    rgb(255 255 255 / 0.35) 8px 16px
  );
  background-size: 22px 22px;
  animation: aa-bench-shimmer 0.9s linear infinite;
  pointer-events: none;
}

.aa-bench-load.is-stalled .aa-bench-load-fill {
  transition: none;
}

@keyframes aa-bench-shimmer {
  from { background-position: 0 0; }
  to { background-position: 22px 0; }
}

.aa-bench-load-panel {
  pointer-events: auto;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgb(28 25 23 / 0.1);
  background: rgb(255 252 248 / 0.98);
  box-shadow: 0 8px 24px rgb(28 25 23 / 0.14);
  max-height: 40vh;
  overflow: auto;
}

.aa-bench-load-panel[hidden] {
  display: none !important;
}

.aa-bench-load-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.aa-bench-load-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.82rem;
  font-weight: 700;
}

.aa-bench-load-elapsed {
  color: var(--muted, #78716c);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.aa-bench-load-empty {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted, #78716c);
}

/* Dark mode */
html[data-theme="dark"] .aa-bench-load-pill,
html[data-theme="dark"] .aa-bench-load-panel {
  background: rgb(28 25 23 / 0.94);
  border-color: rgb(255 255 255 / 0.1);
  color: #fafaf9;
  box-shadow: 0 -8px 32px rgb(0 0 0 / 0.45), 0 4px 16px rgb(196 92 38 / 0.2);
}

html[data-theme="dark"] .aa-bench-load-count,
html[data-theme="dark"] .aa-bench-load-elapsed,
html[data-theme="dark"] .aa-bench-load-empty {
  color: #a8a29e;
}

html[data-theme="dark"] .aa-bench-load-hint {
  color: #fdba74;
}

html[data-theme="dark"] .aa-bench-load-track {
  background: rgb(253 186 116 / 0.16);
}

/* Legacy thin top bar — hide if any leftover markup exists */
.aa-loadbar,
body.admin-page > .aa-loadbar {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .aa-bench-load-fill {
    transition: none;
  }
  .aa-bench-load.is-stalled .aa-bench-load-track::after {
    animation: none;
  }
}

@media (max-width: 480px) {
  .aa-bench-load {
    width: calc(100vw - 16px);
    bottom: calc(12px + env(safe-area-inset-bottom, 0px) + var(--qw-dock-pad, 0px));
  }
  .aa-bench-load-pct {
    font-size: 1.2rem;
  }
  .aa-bench-load-track {
    height: 8px;
  }
}
