/* Swing Tracker interaction guard
   Gives immediate feedback for actions that may take time and prevents repeat taps. */

:root{
  --st-busy-backdrop:rgba(3,15,24,.42);
  --st-busy-surface:var(--surface,#0c2230);
  --st-busy-border:var(--border,#31536a);
  --st-busy-text:var(--text,#f5f8fa);
  --st-busy-muted:var(--muted,#aebdca);
  --st-busy-accent:var(--accent,#2f80ed);
}

html[data-theme="light"]{
  --st-busy-backdrop:rgba(12,28,40,.20);
}

#stProcessingOverlay{
  position:fixed;
  inset:0;
  z-index:2147483000;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
  background:var(--st-busy-backdrop);
  -webkit-backdrop-filter:blur(2px);
  backdrop-filter:blur(2px);
  opacity:0;
  visibility:hidden;
  pointer-events:none;
  transition:opacity .14s ease,visibility .14s ease;
}

#stProcessingOverlay.st-processing-visible{
  opacity:1;
  visibility:visible;
  /* Status only: do not trap scrolling or make the app feel frozen. */
  pointer-events:none;
}

#stProcessingOverlay .st-processing-card{
  width:min(92vw,360px);
  min-height:92px;
  display:flex;
  align-items:center;
  gap:15px;
  padding:18px 20px;
  border:1px solid var(--st-busy-border);
  border-radius:18px;
  background:var(--st-busy-surface);
  color:var(--st-busy-text);
  box-shadow:0 14px 38px rgba(0,0,0,.26);
}

#stProcessingOverlay .st-processing-spinner{
  width:34px;
  height:34px;
  flex:0 0 34px;
  border:4px solid color-mix(in srgb,var(--st-busy-accent) 24%,transparent);
  border-top-color:var(--st-busy-accent);
  border-radius:50%;
  animation:stBusySpin .75s linear infinite;
}

#stProcessingOverlay .st-processing-copy{
  min-width:0;
}

#stProcessingOverlay .st-processing-title{
  display:block;
  margin:0;
  font-size:1rem;
  font-weight:800;
  line-height:1.25;
  overflow-wrap:anywhere;
}

#stProcessingOverlay .st-processing-note{
  display:block;
  margin-top:4px;
  color:var(--st-busy-muted);
  font-size:.78rem;
  line-height:1.35;
}

/* Immediate per-control feedback appears before the full-screen overlay is needed. */
.st-action-pending{
  position:relative!important;
  cursor:progress!important;
  user-select:none!important;
  -webkit-user-select:none!important;
}

button.st-action-pending,
.btn.st-action-pending,
[role="button"].st-action-pending{
  padding-right:max(2.7rem,var(--st-action-original-right,2.7rem))!important;
}

button.st-action-pending::after,
.btn.st-action-pending::after,
[role="button"].st-action-pending::after{
  content:"";
  position:absolute;
  right:.85rem;
  top:50%;
  width:16px;
  height:16px;
  margin-top:-8px;
  box-sizing:border-box;
  border:2px solid currentColor;
  border-right-color:transparent;
  border-radius:50%;
  animation:stBusySpin .7s linear infinite;
  opacity:.9;
  pointer-events:none;
}

.st-action-locked{
  pointer-events:none!important;
}

body.st-processing-blocked{
  cursor:progress;
  /* Individual actions are locked by .st-action-locked; page scrolling stays available. */
}

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

@media(max-width:600px){
  #stProcessingOverlay{
    align-items:center;
    padding:16px 16px calc(16px + env(safe-area-inset-bottom,0px));
  }
  #stProcessingOverlay .st-processing-card{
    width:100%;
    min-height:84px;
    border-radius:16px;
    padding:16px 17px;
  }
}

@media(prefers-reduced-motion:reduce){
  #stProcessingOverlay,
  #stProcessingOverlay .st-processing-spinner,
  button.st-action-pending::after,
  .btn.st-action-pending::after,
  [role="button"].st-action-pending::after{
    transition:none!important;
    animation-duration:1.5s!important;
  }
}
