/* Tsumu global loading feedback */

#tsumu-global-loading {
  position: fixed;
  inset: 0;
  z-index: 2147483646;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(7, 12, 24, .56);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 140ms ease, visibility 140ms ease;
}

#tsumu-global-loading.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.tsumu-global-loading-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(420px, calc(100vw - 48px));
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 18px;
  background: rgba(15, 23, 42, .96);
  color: #f8fafc;
  box-shadow: 0 22px 70px rgba(0, 0, 0, .42);
}

.tsumu-global-loading-spinner {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 3px solid rgba(255, 255, 255, .18);
  border-top-color: var(--tsumu-brand-gold, #f4b83f);
  border-radius: 999px;
  animation: tsumu-global-loading-spin .75s linear infinite;
}

.tsumu-global-loading-copy {
  min-width: 0;
}

.tsumu-global-loading-message,
.tsumu-global-loading-hint {
  margin: 0;
}

.tsumu-global-loading-message {
  color: inherit;
  font-family: "Nunito", sans-serif;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
}

.tsumu-global-loading-hint {
  display: none;
  margin-top: 3px;
  color: rgba(226, 232, 240, .72);
  font-family: "Nunito", sans-serif;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

#tsumu-global-loading.is-taking-longer .tsumu-global-loading-hint {
  display: block;
}

html.tsumu-is-loading,
html.tsumu-is-loading body {
  cursor: progress;
}

.tsumu-loading-trigger {
  pointer-events: none !important;
}

/* Compact status cards normally reserve the first grid column for an icon.
   Some global notices intentionally render without one; let their copy use
   the full text column instead of being squeezed into the 42px icon slot. */
.tsumu-product-body .tsumu-product-state-card.is-compact:not(:has(> .tsumu-product-state-icon)) {
  grid-template-columns: minmax(0, 1fr) auto;
}

.tsumu-product-body .tsumu-product-state-card.is-compact:not(:has(> .tsumu-product-state-icon)) > .tsumu-product-state-copy {
  min-width: 0;
}

@keyframes tsumu-global-loading-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 640px) {
  #tsumu-global-loading {
    padding: 18px;
  }

  .tsumu-global-loading-card {
    width: min(360px, calc(100vw - 36px));
    padding: 14px 16px;
    border-radius: 16px;
  }

  .tsumu-product-body .tsumu-product-state-card.is-compact:not(:has(> .tsumu-product-state-icon)) {
    grid-template-columns: minmax(0, 1fr);
  }

  .tsumu-product-body .tsumu-product-state-card.is-compact:not(:has(> .tsumu-product-state-icon)) > .tsumu-product-button {
    grid-column: 1;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  #tsumu-global-loading {
    transition: none;
  }

  .tsumu-global-loading-spinner {
    animation: none;
    border-top-color: var(--tsumu-brand-gold, #f4b83f);
    border-right-color: var(--tsumu-brand-gold, #f4b83f);
  }
}
