/*
 * HubPro loaders: grey placeholder cards for search results and a small brand spinner
 * inside buttons while a form submits. Pure CSS + inline SVG, no images or libraries.
 * Behaviour lives in loaders.js (window.HubProLoader). Reduced-motion users get the same
 * placeholders and spinner without the movement.
 */
:root {
  --hp-brand: #FF6A00;
  --hp-skel-base: rgba(148, 163, 184, 0.14);
  --hp-skel-shine: rgba(148, 163, 184, 0.30);
  --hp-skel-card: rgba(148, 163, 184, 0.06);
  --hp-skel-line: rgba(148, 163, 184, 0.18);
}

/* ── Placeholder cards ─────────────────────────────────────────────────── */
.hp-skel-list { display: grid; gap: 16px; grid-column: 1 / -1; width: 100%; }
.hp-skel-list.is-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.hp-skel-card {
  background: var(--hp-skel-card);
  border: 1px solid var(--hp-skel-line);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 92px;
}
.hp-skel-list.is-rows .hp-skel-card { flex-direction: row; align-items: center; gap: 16px; }
.hp-skel-list.is-rows .hp-skel-card .hp-skel-body { flex: 1; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.hp-skel-top { display: flex; align-items: center; gap: 12px; }
.hp-skel-top .hp-skel-body { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.hp-skel-row { display: flex; gap: 8px; flex-wrap: wrap; }
.hp-skel-bone {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: var(--hp-skel-base);
  background-image: linear-gradient(90deg, var(--hp-skel-base) 0%, var(--hp-skel-shine) 50%, var(--hp-skel-base) 100%);
  background-size: 200% 100%;
  animation: hp-skel-shimmer 1.4s ease-in-out infinite;
}
.hp-skel-bone.is-title { height: 16px; width: 62%; }
.hp-skel-bone.is-short { width: 38%; }
.hp-skel-bone.is-mid { width: 74%; }
.hp-skel-bone.is-full { width: 100%; }
.hp-skel-bone.is-pill { height: 22px; width: 88px; border-radius: 999px; }
.hp-skel-bone.is-avatar { width: 48px; height: 48px; border-radius: 12px; flex: none; }
.hp-skel-bone.is-btn { width: 96px; height: 34px; border-radius: 10px; flex: none; }
.hp-skel-table { width: 100%; border-collapse: collapse; }
.hp-skel-table td { padding: 14px 12px; border-bottom: 1px solid var(--hp-skel-line); }

@keyframes hp-skel-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* Real results fade in gently once they replace the placeholders. */
.hp-fill-in > * { animation: hp-fill-in 0.35s ease-out both; }
.hp-fill-in > *:nth-child(2) { animation-delay: 0.04s; }
.hp-fill-in > *:nth-child(3) { animation-delay: 0.08s; }
.hp-fill-in > *:nth-child(4) { animation-delay: 0.12s; }
.hp-fill-in > *:nth-child(n+5) { animation-delay: 0.16s; }
@keyframes hp-fill-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Screen-reader-only status text ("Loading results…"). */
.hp-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ── Button spinner ───────────────────────────────────────────────────── */
.hp-busy { cursor: progress !important; pointer-events: none; }
.hp-busy:disabled, .hp-busy[disabled] { opacity: 0.85; }
.hp-spin {
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-right: 0.45em;
  vertical-align: -0.14em;
  flex: none;
  color: var(--hp-spin-color, var(--hp-brand));
}
.hp-spin svg { display: block; width: 100%; height: 100%; animation: hp-spin 0.8s linear infinite; }
.hp-spin .hp-spin-track { stroke: currentColor; opacity: 0.22; }
.hp-spin .hp-spin-arc { stroke: currentColor; }
/* On orange (brand-coloured) buttons the spinner turns white so it stays visible. */
.hp-busy.hp-on-brand { --hp-spin-color: #fff; }
@keyframes hp-spin { to { transform: rotate(360deg); } }

/* Pop-up dialogs (SweetAlert) that show their own loader use the brand colour too. */
.swal2-loader { border-color: var(--hp-brand) transparent var(--hp-brand) transparent !important; }

/* ── Reduced motion: keep the placeholders and spinner, drop the movement ─ */
@media (prefers-reduced-motion: reduce) {
  .hp-skel-bone { animation: none; background-image: none; }
  .hp-fill-in > * { animation: none; }
  .hp-spin svg { animation: none; }
  .hp-spin .hp-spin-arc { stroke-dasharray: 14 100; }
  .swal2-loader { animation-duration: 3s !important; }
}
