/**
 * PK Sapad Connect — shared loading UI (web dashboard + auth).
 * Brand green aligned with apps: #198754 / #14532D family.
 */
:root {
  --pk-load-green: #198754;
  --pk-load-green-dark: #14532d;
  --pk-load-mint: #f0fdf4;
  --pk-load-border: #bbf7d0;
  --pk-load-muted: #64748b;
}

@keyframes pk-spin {
  to { transform: rotate(360deg); }
}

@keyframes pk-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.pk-spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid rgba(25, 135, 84, 0.22);
  border-top-color: var(--pk-load-green);
  border-radius: 50%;
  animation: pk-spin 0.7s linear infinite;
  vertical-align: -0.15em;
  flex-shrink: 0;
}

.pk-spinner.is-light {
  border-color: rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
}

.pk-spinner.is-lg {
  width: 2rem;
  height: 2rem;
  border-width: 3px;
}

/* Button busy state — works on <button> and styled <a> */
.pk-is-busy,
button.pk-is-busy,
a.pk-is-busy {
  position: relative;
  pointer-events: none;
  cursor: wait !important;
  opacity: 0.92;
}

.pk-is-busy .pk-busy-label,
button.pk-is-busy .pk-busy-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

/* Full-page / section overlay — only when explicitly requested */
.pk-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(245, 250, 247, 0.72);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.pk-loading-overlay[hidden] {
  display: none !important;
}

.pk-loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  min-width: 12rem;
  max-width: min(90vw, 22rem);
  padding: 1.25rem 1.5rem;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--pk-load-border);
  box-shadow: 0 18px 40px rgba(20, 83, 45, 0.12);
  color: var(--pk-load-green-dark);
  text-align: center;
}

.pk-loading-card p {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--pk-load-green-dark);
}

.pk-loading-card .pk-loading-hint {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--pk-load-muted);
}

/* Skeleton placeholders for tables / cards */
.pk-skeleton {
  display: block;
  border-radius: 8px;
  background: linear-gradient(
    90deg,
    #e8f5ee 0%,
    #f5faf7 45%,
    #e8f5ee 90%
  );
  background-size: 200% 100%;
  animation: pk-shimmer 1.2s ease-in-out infinite;
}

.pk-skeleton-row {
  height: 2.4rem;
  margin: 0.45rem 0;
}

.pk-skeleton-card {
  height: 5.5rem;
  margin-bottom: 0.75rem;
}

.pk-skeleton-block {
  padding: 0.75rem 0;
}

body.pk-loading-lock {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .pk-spinner,
  .pk-skeleton {
    animation: none;
  }
  .pk-spinner {
    border-top-color: var(--pk-load-green);
    opacity: 0.85;
  }
}
