/*
 * Pre-React initial loader styles
 * --------------------------------------------------------------------
 * Loaded as an external stylesheet from index.html so that the inline
 * `style="..."` attributes and `<style>` blocks can be removed from
 * index.html. This is what allows `script-src 'unsafe-inline'` to be
 * removed from the CSP — once the CSP audit lands the matching change
 * to `style-src` (blocked today by Radix UI + Tailwind JIT runtime
 * <style> injection), we can revisit removing this file too.
 *
 * Keep selectors scoped to `#initial-loader*` so this CSS cannot leak
 * into the React tree once it mounts and replaces #root.
 */

#initial-loader {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: hsl(40, 20%, 98%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: hsl(24, 10%, 10%);
  z-index: 9999;
}

#initial-loader .ccx-loader-card {
  text-align: center;
  padding: 1.5rem;
  max-width: 28rem;
}

#initial-loader-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid hsl(175, 84%, 32%, 0.2);
  border-top-color: hsl(175, 84%, 32%);
  border-radius: 50%;
  margin: 0 auto 1rem;
  animation: ccx-spin 0.8s linear infinite;
}

#initial-loader-text {
  margin: 0;
  font-size: 0.95rem;
  color: hsl(24, 10%, 40%);
}

/* Used after the watchdog fires to render the friendly error state. */
#initial-loader .ccx-error-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: hsl(0, 72%, 51%, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  font-size: 28px;
}

#initial-loader .ccx-error-title {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 600;
}

#initial-loader .ccx-error-body {
  margin: 0 0 1.25rem;
  font-size: 0.9rem;
  color: hsl(24, 10%, 40%);
  line-height: 1.5;
}

#initial-loader .ccx-refresh-btn {
  background: hsl(175, 84%, 32%);
  color: white;
  border: none;
  padding: 0.625rem 1.25rem;
  border-radius: 0.5rem;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
}

#initial-loader .ccx-refresh-btn--small {
  margin-top: 0.75rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* Hide GTM noscript iframe without inline style. */
.ccx-gtm-noscript-iframe {
  display: none;
  visibility: hidden;
}

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