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

dialog puri).

   Rollback: rimuovere questo blocco fino a EOF.
   ================================================================ */

#dresium-tryon-crop-modal {
    /* M32-fix2 (2026-09-03): !important su tutte le proprietà dialog
       perché il tema Shopify del merchant inietta regole dopo il nostro
       CSS (padding 16px, background gray, box-shadow none, border-radius
       0). Senza !important vince il tema. Fallback esplicito 25px al
       posto di var(--dresium-modal-radius) perché il dialog HTML5 aperto
       via showModal() finisce nel top-layer del browser che potrebbe
       non ereditare le CSS custom properties definite su .dresium-tryon-block.
       25px = 1.5625rem del WP --dresium-modal-radius. */
    padding: 0 !important;
    border: none !important;
    border-radius: 25px !important;
    background: var(--dresium-tryon-white, #ffffff) !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
    max-width: 800px !important;
    width: 95% !important;
    height: 100% !important;
    max-height: calc(100vh - 32px) !important;
    /* Fallback */
    max-height: calc(100dvh - 32px) !important;
    /* Dynamic viewport for mobile */
    overflow: hidden !important;
    /* Hidden by default - only show when [open] */
    display: none !important
    }

#dresium-tryon-crop-modal[open] {
    display: flex !important;
    flex-direction: column !important
    }

#dresium-tryon-crop-modal::backdrop {
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px)
    }

#dresium-tryon-crop-modal .dresium-tryon-crop-modal__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 25px;
    border-bottom: none;
    background: var(--dresium-tryon-white, #ffffff);
    flex-shrink: 0;
    position: relative
    }

#dresium-tryon-crop-modal .dresium-tryon-crop-modal__header-content {
    flex: 1
    }

#dresium-tryon-crop-modal .dresium-tryon-crop-modal__title {
    font-size: 28px;
    font-weight: 700;
    color: #212529;
    margin: 0;
    letter-spacing: -0.5px;
    border-bottom: 1px solid var(--dresium-tryon-canvas, #F4F5F9);
    padding-bottom: 6px;
    margin-bottom: 6px
    }

#dresium-tryon-crop-modal .dresium-tryon-crop-modal__subtitle {
    font-size: 15px;
    color: #7A7A7A;
    margin: 6px 0 0 0;
    padding-top: 6px;
    line-height: 1.6
    }

#dresium-tryon-crop-modal .dresium-tryon-crop-warning {
    margin-top: 12px;
    padding: 12px 16px;
    background: #fdf33c;
    border-radius: 4px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--dresium-tryon-black, #000000);
    width: 100%;
    box-sizing: border-box
    }

#dresium-tryon-crop-modal .dresium-tryon-crop-warning svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--dresium-tryon-black, #000000)
    }

#dresium-tryon-crop-modal .dresium-tryon-crop-warning strong {
    color: var(--dresium-tryon-black, #000000)
    }

#dresium-tryon-crop-modal .dresium-tryon-crop-modal__close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 20px;
    right: 20px
    }

#dresium-tryon-crop-modal .dresium-tryon-crop-modal__body {
    flex: 1;
    padding: 0 25px 25px 25px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 0
    }

#dresium-tryon-crop-modal .dresium-tryon-crop-modal__footer {
    display: flex;
    padding: 16px 25px;
    background-color: var(--dresium-tryon-white, #ffffff);
    border-top: 1px solid var(--dresium-tryon-canvas, #F4F5F9);
    gap: 12px;
    flex-shrink: 0
    }

/* M43-fix2 (2026-09-04): il rule generico `.dresium-btn` era per port
   letterale WP dove i bottoni footer hanno anche la classe .dresium-btn.
   Nella MSS Shopify i bottoni hanno solo __cancel-btn / __save-btn.
   Aggiungo selettori espliciti ai due bottoni MSS. */
#dresium-tryon-crop-modal .dresium-tryon-crop-modal__footer .dresium-btn,
#dresium-tryon-crop-modal .dresium-tryon-crop-modal__footer .dresium-tryon-crop-modal__cancel-btn,
#dresium-tryon-crop-modal .dresium-tryon-crop-modal__footer .dresium-tryon-crop-modal__save-btn {
    flex: 1;
    width: 50%;
    touch-action: none;
    -webkit-tap-highlight-color: transparent
    }

#dresium-tryon-crop-modal .dresium-tryon-crop-modal__footer .dresium-tryon-crop-modal__cancel-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: var(--dresium-tryon-canvas, #F4F5F9) !important;
    color: var(--dresium-tryon-black, #000000) !important;
    font-weight: 500 !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 16px !important;
    font-size: 14px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important
    }

#dresium-tryon-crop-modal .dresium-tryon-crop-modal__footer .dresium-tryon-crop-modal__cancel-btn:hover {
    background: #e8e9ed !important
    }

.dresium-tryon-crop-container {
    width: 100%;
    flex: 1;
    min-height: 200px;
    background: #f5f5f5;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Touch-friendly on mobile */
    touch-action: none;
    user-select: none;
    -webkit-user-select: none
    }

.dresium-tryon-crop-container img {
    max-width: 100%;
    max-height: 100%;
    /* Fill container height */
    display: block
    }

.dresium-tryon-crop-controls {
    display: flex !important;
    flex-direction: row !important;
    /* RG-WEBDEV 2025-01-18: Ensure horizontal layout */
    align-items: center !important;
    gap: 0.5rem !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
    padding: 0.5rem 0 !important;
    width: 100%;
    /* RG-WEBDEV 2026-02-26: Ensure controls are above cropper canvas */
    position: relative;
    z-index: 100
    }


@media (min-width: 768px) {
  .dresium-tryon-crop-controls {
        gap: 0.75rem
        }
}


.dresium-tryon-crop-control {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    background: var(--dresium-tryon-white, #ffffff);
    border: 1px solid var(--dresium-tryon-gray-200, #e5e7eb);
    border-radius: 8px;
    color: var(--dresium-tryon-gray-700, #374151);
    cursor: pointer;
    transition: all 0.15s ease;
    /* RG-WEBDEV 2026-02-26: iOS Safari mobile fix
    	   touch-action: none tells browser not to handle touch gestures,
    	   which allows click events to fire reliably */
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    position: relative;
    z-index: 101
    }

.dresium-tryon-crop-control:hover {
    background: var(--dresium-tryon-primary, #4362db);
    border-color: var(--dresium-tryon-primary, #4362db);
    color: var(--dresium-tryon-white, #ffffff)
    }

.dresium-tryon-crop-control svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0
    }


@media (min-width: 768px) {
  .dresium-tryon-crop-control {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px
        }
  .dresium-tryon-crop-control svg {
        width: 22px;
        height: 22px
        }
}


.dresium-tryon-crop-control:active {
    transform: scale(0.95)
    }

/* M43-fix3+fix4 (2026-09-04): vero spinner circolare MSW-parity.
   Prima: il markup ha `<span class="__save-btn-spinner">...</span>` con
   3 punti letterali come placeholder + animazione rotate applicata al
   testo → l'utente vedeva "..." ruotare, non uno spinner.
   Fix4: rimossi i '...' dal liquid (empty span MSW-parity). Fix3: cerchio
   con border trasparente + border-top bianco via ::before, animato con
   @keyframes dresium-spin (definito in tryon.css:381).
   Port da dresium-crop.css:270-299 del WP. */
/* M43-fix5 (2026-09-04): 2 bug residui
   Bug A: lo spinner si vedeva subito all'apertura del modal (anziché
     apparire solo durante save). Root cause: il rule `.spinner {
     display: inline-flex }` vinceva su `[hidden] { display: none }`
     nativo del browser (specificità classe > UA rule).
     Fix: rule esplicita `.spinner[hidden] { display: none !important }`.
   Bug B: lo spinner appariva ovale, non circolare. Root cause: il
     border 2px senza box-sizing: border-box amplia la size effettiva
     oltre 20x20 dentro un parent flex compact → shrink asimmetrico.
     Fix: box-sizing: border-box + flex-shrink: 0 sul ::before. */
.dresium-tryon-crop-modal__save-btn-spinner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    position: relative;
    background: transparent;
    border: none;
    animation: none;
    flex-shrink: 0;
    }

.dresium-tryon-crop-modal__save-btn-spinner[hidden] {
    display: none !important;
    }

.dresium-tryon-crop-modal__save-btn-spinner::before {
    content: "";
    display: block;
    box-sizing: border-box;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    flex-shrink: 0;
    /* keyframes dresium-spin definito in tryon.css:381 (base) */
    animation: dresium-spin 0.8s linear infinite;
    }

.cropper-point {
    width: 12px;
    height: 12px
    }


@media (max-width: 767px) {
  .cropper-point {
        width: 20px;
        height: 20px
        }
}


.cropper-crop-box {
    touch-action: none
    }


@media (max-width: 767px) {
  .cropper-line {
        background-color: rgba(255, 255, 255, 0.4)
        }
  .cropper-view-box {
        outline: 2px solid rgba(255, 255, 255, 0.8)
        }
}



@media (max-width: 767px) {
  #dresium-tryon-crop-modal {
        position: fixed !important;
        inset: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        margin: 0 !important;
        border-radius: 0 !important;
        transform: none !important
        }
  #dresium-tryon-crop-modal[open] {
        display: flex !important;
        flex-direction: column !important
        }
  #dresium-tryon-crop-modal .dresium-tryon-crop-modal__header {
        padding: 12px 16px !important
        }
  #dresium-tryon-crop-modal .dresium-tryon-crop-modal__title {
        font-size: 18px !important;
        margin-bottom: 2px !important;
        padding-bottom: 2px !important
        }
  #dresium-tryon-crop-modal .dresium-tryon-crop-modal__subtitle {
        font-size: 12px !important;
        margin-top: 2px !important
        }
  #dresium-tryon-crop-modal .dresium-tryon-crop-modal__body {
        padding: 0 16px 12px 16px !important;
        gap: 8px !important;
        flex: 1 !important;
        min-height: 0 !important;
        overflow: hidden !important
        }
  #dresium-tryon-crop-modal .dresium-tryon-crop-container {
        flex: 1 !important;
        min-height: 100px !important;
        max-height: none !important
        }
  #dresium-tryon-crop-modal .dresium-tryon-crop-modal__footer {
        flex-direction: column-reverse !important;
        padding: 12px 16px !important;
        gap: 8px !important
        }
  #dresium-tryon-crop-modal .dresium-tryon-crop-modal__footer .dresium-btn,
  #dresium-tryon-crop-modal .dresium-tryon-crop-modal__footer .dresium-tryon-crop-modal__cancel-btn,
  #dresium-tryon-crop-modal .dresium-tryon-crop-modal__footer .dresium-tryon-crop-modal__save-btn {
        width: 100% !important
        }
  .dresium-tryon-crop-container {
        flex: 1;
        min-height: 150px;
        max-height: none
        }
  .dresium-tryon-crop-controls {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 6px !important;
        padding: 8px 0 !important;
        justify-items: center !important
        }
  .dresium-tryon-crop-control {
        display: inline-flex !important;
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        min-height: 36px !important
        }
  .dresium-tryon-crop-control svg {
        width: 16px !important;
        height: 16px !important
        }
  .dresium-tryon-crop-modal__body {
        max-height: calc(100vh - 140px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch
        }
  .dresium-tryon-crop-modal__footer {
        position: sticky;
        bottom: 0;
        background: white;
        border-top: 1px solid #e5e5e5
        }
}


.dresium-tryon-crop-control:focus {
    outline: 2px solid var(--dresium-tryon-primary, #4C6EF5);
    outline-offset: 2px
    }


@media (prefers-contrast: high) {
  .cropper-view-box {
        outline: 3px solid currentColor
        }
  .cropper-line {
        background-color: currentColor
        }
}



@media (prefers-reduced-motion: reduce) {
  .dresium-tryon-crop-modal__save-btn-spinner {
        animation: none
        }
  .dresium-tryon-crop-control:active {
        transform: none
        }
}


#dresium-tryon-crop-modal .dresium-tryon-crop-modal__save-btn {
    /* M43 (2026-09-04): allineato a MSW (dresium-crop.css) per parity.
       Prima: padding 10px 22px, font-size 14px, border-radius 8px → il
       bottone appariva sottodimensionato rispetto al cancel (che ha
       padding 16px). Ora dimensioni identiche al cancel button. */
    padding: 16px !important;
    border: 0 !important;
    border-radius: 12px !important;
    background: var(--dresium-tryon-gradient-diag, linear-gradient(135deg, #4362db 0%, #7C3AED 100%)) !important;
    color: var(--dresium-tryon-white, #ffffff) !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 4px 12px var(--dresium-tryon-primary-alpha-20, rgba(67, 98, 219, 0.2)) !important;
    /* M55E: font pulsanti merchant-driven (fallback Poppins pre-M55E). */
    font-family: var(--dresium-tryon-font-buttons, 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif) !important;
}

#dresium-tryon-crop-modal .dresium-tryon-crop-modal__save-btn:hover:not(:disabled) {
    background: var(--dresium-tryon-gradient-diag-hover, linear-gradient(135deg, #3451c9 0%, #6b2adc 100%)) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 6px 18px var(--dresium-tryon-primary-alpha-30, rgba(67, 98, 219, 0.3)) !important;
}

#dresium-tryon-crop-modal .dresium-tryon-crop-modal__save-btn:disabled {
    opacity: 0.55 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

#dresium-tryon-crop-modal .dresium-tryon-crop-modal__title {
    /* M55E: font heading merchant-driven (fallback Poppins pre-M55E). */
    font-family: var(--dresium-tryon-font-headings, 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif) !important;
}

/* M43-fix5 (2026-09-04): duplicato max-width/width qui in fondo al file
   perché il rule iniziale riga 30-31 non stava vincendo su desktop
   (utente vedeva la modale fullwidth invece di 800px). Ipotesi: qualche
   regola del tema merchant o pseudo default del <dialog> in top-layer
   estende la width oltre 800px quando il rule iniziale non è l'ultimo
   nel source order. Ora questo è l'ultimo rule sul selettore, vince. */
#dresium-tryon-crop-modal {
    padding: 0 !important;
    border: none !important;
    border-radius: 25px !important;
    background: var(--dresium-tryon-white, #ffffff) !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
    max-width: 800px !important;
    width: 95% !important;
    height: 100% !important;
    max-height: calc(100vh - 32px) !important;
    max-height: calc(100dvh - 32px) !important;
    margin: auto !important;
}

/* Override desktop-specifico: garantisce che il rule sopra vinca su
   qualunque altra regola desktop. Su mobile (max-width:767px) il rule
   fullscreen a riga 359-370 con !important vincerà comunque per source
   order (viene dopo nel file). */
@media (min-width: 768px) {
  #dresium-tryon-crop-modal {
    max-width: 800px !important;
    width: 95% !important;
  }
}

