/* modules/mascotWizardModule.css */
/* Mascot Avatar Generation Wizard (Phase 1: portrait candidates + picker),
   launched from the Edit Companion modal (see .ape-* in styles.css). A
   standalone, self-contained modal -- not built on wizardModule.css's shared
   chrome since this flow is a single small step, not a multi-step wizard.
   Colors mirror .ape-modal's theme tokens so it reads as part of the same
   Companion Console surface. */

.mwm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10002;
  padding: 24px;
}

.mwm-modal {
  width: min(560px, 96vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-3);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.45);
  color: var(--text-primary);
  overflow: hidden;
}

.mwm-header {
  padding: 16px 20px;
  border-bottom: 1px solid #1f2a3d;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mwm-title {
  font-size: 16px;
  font-weight: 600;
}

.mwm-close {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.mwm-close:hover {
  color: var(--text-primary);
}

.mwm-body {
  padding: 20px;
  overflow-y: auto;
}

.mwm-copy {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 16px;
}

.mwm-copy.mwm-loading {
  color: var(--text-primary);
}

.mwm-copy.mwm-error {
  color: #f87171;
}

.mwm-btn {
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.mwm-btn {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.mwm-btn-primary {
  background: #4f46e5;
  color: #fff;
  border-color: #4f46e5;
}

.mwm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.mwm-note {
  margin: 12px 0 0;
  font-size: 12px;
}

.mwm-btn-primary:hover {
  background: #4338ca;
}

.mwm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.mwm-candidate {
  border: 2px solid var(--border-color);
  border-radius: 10px;
  padding: 0;
  overflow: hidden;
  background: transparent;
  cursor: pointer;
  aspect-ratio: 1 / 1;
}

.mwm-candidate:hover {
  border-color: #4f46e5;
}

.mwm-candidate img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mwm-final-preview {
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  display: block;
  margin-bottom: 16px;
}

/* ---- waiting states: spinner, progress bar, elapsed + ETA ---- */

.mwm-wait {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.mwm-spinner {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(129, 140, 248, 0.2);
  border-top-color: #818cf8;
  animation: mwm-spin 0.9s linear infinite;
}

.mwm-wait-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.mwm-wait-note {
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-secondary);
}

.mwm-bar {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.mwm-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: #4f46e5;
  transition: width 0.6s ease;
}

.mwm-bar-indeterminate .mwm-bar-fill {
  width: 38%;
  animation: mwm-slide 1.5s ease-in-out infinite;
}

.mwm-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 16px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

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

@keyframes mwm-slide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(290%); }
}

@media (prefers-reduced-motion: reduce) {
  .mwm-spinner { animation-duration: 3s; }
  .mwm-bar-indeterminate .mwm-bar-fill { animation: none; width: 100%; opacity: 0.45; }
  .mwm-bar-fill { transition: none; }
}
