/* ═══ Crown & Coach loading utilities ═══
 *
 * Shared spinner + progress-bar primitives used across the concierge
 * portal. Pages link this stylesheet (no module import) so the same
 * gold ring renders identically on every button regardless of which
 * page-level <style> block defines its other rules.
 *
 * Usage:
 *
 *   <button>
 *     <span class="cc-spinner"></span> Saving…
 *   </button>
 *
 *   <button class="loading">Saving…</button>   ← if you want the
 *                                                 spinner to appear
 *                                                 ::before via the
 *                                                 button class itself.
 *
 * The ring is intentionally small (12×12, 1.5px stroke) so it
 * cohabits with text in a button without ballooning button height.
 * Keep this in lock-step with the same utility in admin-portal's
 * styles/globals.css — if either gets fancier, port the change. */

.cc-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1.5px solid rgba(196, 163, 90, 0.25);
  border-top-color: #c4a35a;
  border-radius: 50%;
  animation: cc-spin 0.8s linear infinite;
  vertical-align: -2px;
  margin-right: 6px;
  /* Smooth fade-in so a spinner that appears mid-click doesn't jolt
     the layout. The button text it sits next to stays put because the
     spinner reserves its inline-block width whether or not it's spinning. */
  transition: opacity 0.15s ease;
}

.cc-spinner--lg {
  width: 22px;
  height: 22px;
  border-width: 2px;
  margin-right: 10px;
  vertical-align: -5px;
}

/* Variant: dark-on-gold spinner for buttons whose background IS gold
   (the Confirm / Reserve / primary-CTA family). Inverts the contrast
   so the ring stays readable. */
.cc-spinner--dark {
  border-color: rgba(12, 12, 12, 0.25);
  border-top-color: #0c0c0c;
}

/* Convenience: applying `.cc-loading` to a button auto-injects the
   spinner via ::before and dims the rest of the label. Lets you
   toggle loading without rewriting innerHTML. */
button.cc-loading::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1.5px solid rgba(196, 163, 90, 0.25);
  border-top-color: #c4a35a;
  border-radius: 50%;
  animation: cc-spin 0.8s linear infinite;
  vertical-align: -2px;
  margin-right: 6px;
}
button.cc-loading {
  cursor: wait;
  opacity: 0.85;
}

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

/* ── Top-of-page progress strip ─────────────────────────────────────
 * Optional 2px-tall shimmer at the very top of the viewport — handy
 * for navigation transitions or chained Cloud Function calls where a
 * single button-level spinner doesn't tell the whole story. Mount via
 * <div class="cc-progress" id="ccProgress" hidden></div> and toggle
 * `.cc-progress--active` to show. Use sparingly — splash screen
 * already covers initial load. */

.cc-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(196, 163, 90, 0.08);
  z-index: 11000;
  overflow: hidden;
  pointer-events: none;
}
.cc-progress::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    #c4a35a 50%,
    transparent 100%
  );
  transform: translateX(-100%);
  animation: cc-progress-slide 1.2s ease-in-out infinite;
}
.cc-progress[hidden] { display: none }

@keyframes cc-progress-slide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
