/**
 * Builder Loading Spinner - Unified Component Styles
 *
 * Design Reference: /test-results/image700.png
 * Used by: All Builder section pages (12+ pages)
 *
 * @package nonassa
 * @since 1.0.0
 * @see DESIGN_62_UNIFIED_BUILDER_LOADING_SPINNER_COMPONENT.md
 */

/* ========================================
 * Container - Inline Centering
 * ======================================== */

.builder-loading-spinner {
  display: none;  /* Hidden by default */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 0;
  min-height: 200px;
  text-align: center;
}

/* Inline positioning - default mode */
.builder-loading-spinner[data-position="inline"] {
  position: relative;
  width: 100%;
}

/* Absolute positioning - for overlay mode */
.builder-loading-spinner[data-position="absolute"] {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: auto;
  min-height: auto;
  padding: 0;
}

/* ========================================
 * Spinner Circle - ONLY this rotates
 * ======================================== */

.builder-loading-spinner__circle {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-top: 4px solid #2563eb;  /* Primary blue color */
  border-radius: 50%;
  animation: builder-spinner-rotate 1s linear infinite;
  margin-bottom: 1rem;
}

/* Animation definition - Single source of truth */
@keyframes builder-spinner-rotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ========================================
 * Text - Does NOT rotate
 * ======================================== */

.builder-loading-spinner__text {
  color: #6b7280;  /* Muted gray */
  font-size: 0.95rem;
  font-weight: 500;
  margin: 0;
  font-family: var(--font-system, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
}

/* Hide text by default (matches reference design) */
.builder-loading-spinner__text:empty {
  display: none;
}

/* ========================================
 * Size Variants (Optional)
 * ======================================== */

.builder-loading-spinner--small .builder-loading-spinner__circle {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

.builder-loading-spinner--large .builder-loading-spinner__circle {
  width: 64px;
  height: 64px;
  border-width: 5px;
}

/* ========================================
 * Theme Integration
 * ======================================== */

/* Respect CSS variables if defined */
.builder-loading-spinner__circle {
  border-top-color: var(--builder-primary-color, #2563eb);
  border-color: var(--builder-spinner-track, rgba(0, 0, 0, 0.1));
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .builder-loading-spinner__circle {
    border-color: rgba(255, 255, 255, 0.1);
    border-top-color: #3b82f6;
  }

  .builder-loading-spinner__text {
    color: #d1d5db;
  }
}

/* ========================================
 * Visibility States
 * ======================================== */

.builder-loading-spinner.is-visible {
  display: flex;
}

.builder-loading-spinner.is-hidden {
  display: none;
}

/* ========================================
 * Responsive Design
 * ======================================== */

@media (max-width: 768px) {
  .builder-loading-spinner {
    padding: 2rem 0;
    min-height: 150px;
  }

  .builder-loading-spinner__circle {
    width: 40px;
    height: 40px;
    border-width: 3px;
  }

  .builder-loading-spinner__text {
    font-size: 0.875rem;
  }
}

/* ========================================
 * Accessibility Improvements
 * ======================================== */

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  .builder-loading-spinner__circle {
    animation-duration: 2s;  /* Slower animation */
  }
}

/* Ensure focus visibility if needed */
.builder-loading-spinner:focus {
  outline: 2px solid #2563eb;
  outline-offset: 4px;
}
