/* Sync progress bars under the dashboard's two Sync buttons. 2026-10-09
   Green under "Sync with CRM", blue under "Email Sync Now". Driven by
   static/js/sync_bars.js (manual taps + the automatic syncs). The bar's space is
   always reserved, so nothing below it jumps when a sync starts. */

.ee-sync-slot {
  display: flex;
  flex-direction: column;
  min-width: 0;            /* let a long label wrap instead of widening the grid cell */
}
.ee-sync-slot > button {
  flex: 1 1 auto;          /* both buttons the same height, so both bars sit on one line */
}

.ee-sync-bar {
  --ee-sync-track: rgba(44,94,119, 0.14);
  --ee-sync-fill: linear-gradient(90deg, #1a4459, #4381a0 60%, #6cb7dc);
  position: relative;
  height: 4px;
  margin-top: 4px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--ee-sync-track);
  opacity: 0;              /* idle: invisible, space kept */
  transition: opacity 0.2s ease;
}
.ee-sync-bar--email {
  --ee-sync-track: rgba(21, 101, 192, 0.14);
  --ee-sync-fill: linear-gradient(90deg, #0D47A1, #1E88E5 60%, #64B5F6);
}
html[data-dark="1"] .ee-sync-bar {
  --ee-sync-track: rgba(108,183,220, 0.18);
  --ee-sync-fill: linear-gradient(90deg, #4381a0, #669fbb 60%, #95cbe6);
}
html[data-dark="1"] .ee-sync-bar--email {
  --ee-sync-track: rgba(100, 181, 246, 0.18);
  --ee-sync-fill: linear-gradient(90deg, #1E88E5, #42A5F5 60%, #90CAF9);
}

.ee-sync-bar__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: inherit;
  background: var(--ee-sync-fill);
  transition: none;        /* back to 0 instantly once the bar is hidden */
}

/* running: fast to ~40 %, then a long slow crawl that never quite reaches the end */
.ee-sync-bar.is-running,
.ee-sync-bar.is-done { opacity: 1; }
.ee-sync-bar.is-running .ee-sync-bar__fill {
  width: 92%;
  transition: width 40s cubic-bezier(0.05, 0.75, 0.2, 1);
}
.ee-sync-bar.is-running .ee-sync-bar__fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: translateX(-100%);
  animation: ee-sync-shimmer 1.3s linear infinite;
}
@keyframes ee-sync-shimmer {
  to { transform: translateX(100%); }
}

/* finished: fill the rest, hold, then fade (the JS adds is-fading) */
.ee-sync-bar.is-done .ee-sync-bar__fill {
  width: 100%;
  transition: width 0.35s ease-out;
}
.ee-sync-bar.is-error {
  --ee-sync-track: rgba(198, 40, 40, 0.16);
  --ee-sync-fill: linear-gradient(90deg, #B71C1C, #E53935);
}
html[data-dark="1"] .ee-sync-bar.is-error {
  --ee-sync-track: rgba(239, 83, 80, 0.2);
  --ee-sync-fill: linear-gradient(90deg, #E53935, #EF9A9A);
}
.ee-sync-bar.is-fading {
  opacity: 0;
  transition: opacity 0.45s ease;
}

/* reduced motion: no crawl, no shimmer -- a steady half-strength bar while running,
   full strength when done, then it simply goes away */
@media (prefers-reduced-motion: reduce) {
  .ee-sync-bar,
  .ee-sync-bar.is-fading,
  .ee-sync-bar__fill,
  .ee-sync-bar.is-running .ee-sync-bar__fill,
  .ee-sync-bar.is-done .ee-sync-bar__fill { transition: none; }
  .ee-sync-bar.is-running .ee-sync-bar__fill { width: 100%; opacity: 0.5; }
  .ee-sync-bar.is-running .ee-sync-bar__fill::after { animation: none; display: none; }
  .ee-sync-bar.is-done .ee-sync-bar__fill { opacity: 1; }
}

/* d1800 -- these bars moved to the bottom activity rail (static/js/themes.js, themes.css
   "ACTIVITY RAIL"). The elements stay so static/js/sync_bars.js keeps its state. */
.ee-sync-bar { display: none !important; }
