/* =========================================================================
   Moments — montage magique
   Baguette dans la visionneuse, boîte de confirmation, panneau de résultat.
   Volontairement autonome : Favoris et « À cette date » ne chargent pas
   styles-upload.css, donc aucun bouton n'est emprunté à cette feuille.
   ========================================================================= */

/* ---- Baguette dans la visionneuse -------------------------------------------- */

.magic-icon {
  position: absolute;
  right: 20px;
  bottom: 134px;                 /* 3e emplacement, sous le cœur */
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  user-select: none;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.magic-icon:hover {
  background: rgba(255, 255, 255, 0.92);
  color: var(--brand);
  transform: scale(1.06);
}
.magic-icon[hidden] { display: none; }

/* ---- Confirmation ------------------------------------------------------------ */

/* Réutilise .confirm-overlay / .confirm-dialog (styles-moments.css), en
   remplaçant le rouge de suppression par la couleur de marque. */
.magic-overlay .magic-confirm-icon {
  background: var(--brand-soft);
  color: var(--brand);
}
.magic-overlay .magic-confirm-text {
  margin-bottom: 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}
.magic-overlay .magic-notice {
  margin: 0 0 20px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--muted);
}

.magic-primary {
  flex: 1;
  padding: 12px 18px;
  border: none;
  border-radius: 12px;
  background: var(--brand-grad);
  color: #fff;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 18px -8px rgba(49, 135, 195, 0.9);
  transition: filter 0.18s ease, transform 0.18s ease;
}
.magic-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.magic-primary:active { transform: none; }

.magic-secondary {
  flex: 1;
  padding: 12px 18px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.magic-secondary:hover { background: var(--bg); border-color: #c9d6e4; }

/* ---- Panneau de résultat ------------------------------------------------------ */

.magic-result-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100001;               /* au-dessus de la visionneuse et de la confirmation */
  justify-content: center;
  align-items: center;
  padding: 16px;
  background: rgba(8, 16, 26, 0.72);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.magic-result-overlay.active { display: flex; }

.magic-result-panel {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 26px 24px 22px;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: magicIn 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}
@keyframes magicIn {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}

.magic-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}
.magic-close:hover { background: var(--bg); color: var(--ink); }

/* Attente */
.magic-spinner {
  width: 62px;
  height: 62px;
  margin: 8px auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 26px;
  animation: magic-pulse 1.5s ease-in-out infinite;
}
@keyframes magic-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.1); opacity: 0.68; }
}
.magic-loading-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}
.magic-loading-note {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--muted);
}

/* Résultat */
.magic-result-image {
  display: block;
  width: 100%;
  max-height: 62vh;
  margin: 0 auto;
  object-fit: contain;
  border-radius: 16px;
  background: var(--bg);
}
.magic-hint {
  margin: 12px 0 16px;
  font-size: 12.5px;
  color: var(--muted);
}
.magic-actions {
  display: flex;
  gap: 10px;
}

/* Erreur */
.magic-error-icon {
  width: 56px;
  height: 56px;
  margin: 8px auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: rgba(214, 69, 69, 0.10);
  color: var(--danger);
  font-size: 24px;
}
.magic-error-text {
  margin: 0 0 20px;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink-soft);
}

/* ---- Mobile ------------------------------------------------------------------- */

@media (max-width: 600px) {
  .magic-icon { right: 14px; bottom: 118px; width: 42px; height: 42px; font-size: 16px; }
  .magic-result-panel { padding: 22px 16px 18px; border-radius: 18px; }
  .magic-result-image { max-height: 52vh; border-radius: 14px; }
  .magic-actions { flex-direction: column; }
  .magic-primary, .magic-secondary { width: 100%; }
}
