/* GmActionGuard — full-page action overlay
 * Shown during form submits & fetch calls to prevent double actions.
 * z-index 10500: above page content, below Bootstrap modals (1055+).
 */

.gm-ag-overlay {
  position: fixed;
  inset: 0;
  z-index: 10500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.gm-ag-overlay--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* When a Bootstrap modal is open, step behind it */
body.modal-open .gm-ag-overlay {
  z-index: 1040;
}

.gm-ag-overlay__inner {
  text-align: center;
  padding: 2rem 2.5rem;
  background: rgba(255, 255, 255, 0.97);
  border-radius: 1rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  max-width: 320px;
  width: 90%;
}

.gm-ag-overlay__spinner {
  width: 44px;
  height: 44px;
  margin: 0 auto 1rem;
  border: 4px solid #e0e0e0;
  border-top-color: var(--gm-primary, #d32f2f);
  border-radius: 50%;
  animation: gm-ag-spin 0.8s linear infinite;
}

.gm-ag-overlay__text {
  font-family: "Inter", "Nunito", sans-serif;
  font-weight: 600;
  font-size: 1rem;
  color: #333;
  margin: 0;
  line-height: 1.4;
}

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

/* Responsive adjustments */
@media (max-width: 575px) {
  .gm-ag-overlay__inner {
    padding: 1.5rem 1.25rem;
    max-width: 280px;
  }
  .gm-ag-overlay__spinner {
    width: 36px;
    height: 36px;
  }
  .gm-ag-overlay__text {
    font-size: 0.9rem;
  }
}

/* High contrast / forced-colors support */
@media (forced-colors: active) {
  .gm-ag-overlay {
    background: Canvas;
    border: 2px solid CanvasText;
  }
  .gm-ag-overlay__spinner {
    border-color: CanvasText;
    border-top-color: Highlight;
  }
  .gm-ag-overlay__text {
    color: CanvasText;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .gm-ag-overlay__spinner {
    animation-duration: 1.6s;
  }
  .gm-ag-overlay {
    transition: none;
  }
}
