/**
 * Dresium Try-On — CSS result
 *
 * File estratto dal monolitico tryon.css nel M34 (2026-09-03).
 * Contiene solo le regole applicative del componente result.
 * Caricato dal blocks/tryon.liquid via stylesheet_tag.
 *
 * NON aggiungere qui regole di altre modali — se serve, crea un file dedicato.
 */

.dresium-result-modal {
  padding: 0;
  border: 0;
  background: transparent;
  max-width: 100vw;
  max-height: 100vh;
  overflow: visible;
  /* Reset per prevenire striscia nera visibile a lato del container
     (alcuni temi Shopify hanno margin/padding default sui <dialog>). */
  margin: auto;
  box-sizing: border-box;
}

.dresium-result-modal *, .dresium-result-modal *::before, .dresium-result-modal *::after {
  box-sizing: border-box;
}

.dresium-result-modal::backdrop {
  background: var(--dresium-tryon-backdrop, rgba(0, 0, 0, 0.6)); /* ext value */
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: dresium-result-fade-in 0.2s ease-out;
}

.dresium-result-modal[open] {
  animation: dresium-result-fade-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dresium-result-modal__container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch; /* logo sinistra invece di centrato */
  gap: 16px;
  padding: 25px; /* ext padding uniforme */
  background: var(--dresium-tryon-white, #ffffff);
  border-radius: 10px; /* ext modal-radius */
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); /* ext modal-shadow */
  max-width: 640px;
  /* M19: larghezza fissa 640px anche desktop — no wobble */
  width: min(640px, calc(100vw - 40px));
  max-height: 85vh; /* ext value */
  overflow-x: hidden;
  overflow-y: auto;
  /* M55E: font paragrafi merchant-driven (fallback Poppins pre-M55E). */
  font-family: var(--dresium-tryon-font-paragraphs, 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
  box-sizing: border-box;
}

.dresium-result-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: rgba(0, 0, 0, 0.04);
  color: #111;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.15s ease;
}

.dresium-result-modal__close:hover {
  background: rgba(0, 0, 0, 0.08);
  transform: scale(1.05);
}

.dresium-result-modal__title-logo {
  display: block;
  /* 2026-09-08 (user report): larghezza max 120px + margin-bottom 25px per
     tutti e 3 i logo modali (loading/result/setting), coerente con il
     brand. */
  margin: 0 0 25px;
  width: 120px;
  height: auto;
  max-width: 120px;
  background: transparent;
}

.dresium-result-modal__image-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.dresium-result-modal__image {
  max-width: 100%;
  max-height: min(60vh, 520px);
  width: auto;
  height: auto;
  display: block;
  border-radius: 16px; /* ext --radius-xl */
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15); /* ext value */
  opacity: 0;
  transform: scale(0.98);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.dresium-result-modal__image.is-loaded {
  opacity: 1;
  /* 2026-09-08 (user report): scale ridotta a 0.95 per compensare
     visivamente l'overlay full-width dei social share che appare al
     hover — l'immagine risulta meno "coperta". */
  transform: scale(0.95);
}

.dresium-result-modal__actions {
  display: flex;
  gap: 10px;
  width: 100%;
  flex-wrap: wrap;
}

.dresium-result-modal__btn {
  flex: 1 1 140px;
  min-width: 120px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: var(--dresium-tryon-radius, 12px);
  font-family: var(--dresium-tryon-font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease;
}

.dresium-result-modal__btn:active {
  transform: translateY(1px);
}

.dresium-result-modal__btn--secondary {
  background: var(--dresium-tryon-white, #ffffff);
  color: #111;
  border-color: rgba(0, 0, 0, 0.12);
}

.dresium-result-modal__btn--secondary:hover {
  background: #f7f8fa;
  border-color: rgba(0, 0, 0, 0.2);
}

.dresium-result-modal__btn--primary {
  background: var(--dresium-tryon-gradient, linear-gradient(90deg, rgb(76, 110, 245) 0%, rgb(155, 81, 224) 100%));
  color: var(--dresium-tryon-white, #ffffff);
  border-color: transparent;
  box-shadow: 0 4px 12px var(--dresium-tryon-primary-alpha-32, rgba(76, 110, 245, 0.32));
}

.dresium-result-modal__btn--primary:hover {
  background: var(--dresium-tryon-gradient-hover, linear-gradient(90deg, #4C6EF5 0%, #4C6EF5 100%));
  box-shadow: 0 6px 18px var(--dresium-tryon-primary-alpha-32, rgba(76, 110, 245, 0.42));
}

.dresium-result-modal__btn:disabled,
.dresium-result-modal__btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.dresium-result-modal__btn:disabled:hover,
.dresium-result-modal__btn[disabled]:hover {
  background: var(--dresium-tryon-white, #ffffff);
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: none;
}

.dresium-result-modal__btn--soft-disabled {
  opacity: 0.5;
  cursor: help;
}

.dresium-result-modal__btn--soft-disabled:hover {
  background: var(--dresium-tryon-white, #ffffff);
  border-color: rgba(0, 0, 0, 0.2);
  box-shadow: none;
}

.dresium-result-modal__share-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 16px; /* match --radius-xl dell'img */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 3;
}

.dresium-result-modal__image-wrapper:hover .dresium-result-modal__share-overlay,
.dresium-result-modal__image-wrapper:focus-within .dresium-result-modal__share-overlay {
  opacity: 1;
  visibility: visible;
}

.dresium-result-modal__share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: #333;
  cursor: pointer;
  transform: scale(0.8);
  transition: transform 0.2s ease, background 0.15s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.dresium-result-modal__image-wrapper:hover .dresium-result-modal__share-btn {
  transform: scale(1);
}

.dresium-result-modal__share-btn:hover {
  transform: scale(1.15) !important;
  background: var(--dresium-tryon-white, #ffffff);
}

.dresium-result-modal__share-btn:active {
  transform: scale(0.95) !important;
}

.dresium-result-modal__zoom-btn {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: rgba(0, 0, 0, 0.5);
  color: var(--dresium-tryon-white, #ffffff);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5; /* M15-fix-4b: sopra share-overlay (z:3) per restare cliccabile durante hover */
  transition: background 0.15s ease, transform 0.15s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.dresium-result-modal__zoom-btn:hover {
  background: rgba(0, 0, 0, 0.7);
  transform: scale(1.05);
}

.dresium-result-modal__video {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  bottom: 12px;
  width: calc(100% - 24px);
  height: calc(100% - 24px);
  object-fit: contain;
  border-radius: 12px;
  background: var(--dresium-tryon-black, #000000);
  z-index: 2;
}

/* 2026-09-08: badge scadenza video top-left. Mostrato solo quando il
   video generato e' visibile (JS toggle via [hidden]). Contenuto testuale
   popolato dinamicamente dal JS con i18n key 'videoExpiryBadge'. */
.dresium-result-modal__video-expiry {
  position: absolute;
  top: 20px;
  left: 20px;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.65);
  color: #ffffff;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  z-index: 5;
  pointer-events: none;
  max-width: 60%;
}

.dresium-result-modal__video-toggle {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: var(--dresium-tryon-gray-700, #374151);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  transition: transform 0.15s ease, background 0.15s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.dresium-result-modal__video-toggle:hover {
  background: var(--dresium-tryon-white, #ffffff);
  transform: scale(1.1);
}

.dresium-result-modal__video-toggle:active {
  transform: scale(0.95);
}

/* M47 (2026-09-04): fix decentraggio ottico icona play.
   Il triangolo SVG play ha bounding box centrato ma massa visiva a
   sinistra (punta a destra), quindi appare spostato a sinistra dentro
   il cerchio. Padding-left compensa otticamente. L'icona pause è
   simmetrica, non necessita compensazione. */
.dresium-result-modal__video-toggle-play,
.dresium-result-modal__video-toggle-stop {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.dresium-result-modal__video-toggle-play {
  padding-left: 2px;
}

@keyframes dresium-result-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}


@media (max-width: 968px) {
  .dresium-result-modal__container {
      width: 100vw;
      max-width: 100vw;
      height: 100vh;
      max-height: 100vh;
      border-radius: 0;
      padding: 56px 20px 24px;
      justify-content: center;
    }
  .dresium-result-modal__image-wrapper {
      flex: 1 1 auto;
      min-height: 0;
    }
  .dresium-result-modal__image {
      max-height: 55vh;
    }
  .dresium-result-modal__actions {
      flex-wrap: wrap;
    }
  .dresium-result-modal__btn {
      flex: 1 1 30%;
    }
  .dresium-result-modal__share-overlay {
      opacity: 1;
      transform: none;
      pointer-events: auto;
      top: 12px;
      right: 12px;
    }
  .dresium-result-modal__zoom-btn {
      bottom: 12px;
      right: 12px;
      width: 36px;
      height: 36px;
    }
}



/* ============================================================
   M46 (2026-09-04): spinner nel bottone Anima durante state 'busy'.
   Pattern port dal M43 crop save spinner (dresium-crop.css:270-299):
   empty span → cerchio 20x20 via ::before con border trasparente +
   border-top bianco animato con @keyframes dresium-spin (definito
   in tryon.css:381).
   ============================================================ */
.dresium-result-modal__btn-spinner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    position: relative;
    flex-shrink: 0;
    background: transparent;
    border: none;
    animation: none;
}

.dresium-result-modal__btn-spinner[hidden] {
    display: none !important;
}

.dresium-result-modal__btn-spinner::before {
    content: "";
    display: block;
    box-sizing: border-box;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-top-color: currentColor;
    border-radius: 50%;
    flex-shrink: 0;
    animation: dresium-spin 0.8s linear infinite;
}
