/* Product-page virtual try-on. Scoped so the storefront design is unchanged. */
#tryModal {
    position: fixed !important;
    inset: 0 !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 1300;
    padding: 20px;
    background: transparent;
}

#tryOverlay {
    z-index: 1290;
    background: rgba(20, 14, 16, .68);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

#tryModal [hidden] {
    display: none !important;
}

#tryModal .modal-card.modal-xl {
    position: relative;
    width: min(1180px, calc(100vw - 40px));
    height: min(680px, calc(100dvh - 64px));
    max-height: none;
    overflow: hidden;
    border: 1px solid rgba(72, 48, 55, .12);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 30px 90px rgba(18, 10, 13, .35);
}

#tryModal .modal-head {
    position: absolute !important;
    inset: 0 0 auto 0 !important;
    display: flex !important;
    visibility: visible !important;
    flex: 0 0 auto;
    min-height: 64px;
    padding: 12px 18px;
    border-bottom: 1px solid #eadfe1;
    z-index: 30;
}

#tryModal .modal-head h3 {
    margin: 0;
    color: #21191c;
    font: 600 clamp(16px, 1.5vw, 21px)/1.3 var(--font-heading, serif);
}

#tryModal .modal-close {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    place-items: center;
    padding: 0;
    border: 1px solid #d9cccf;
    border-radius: 50%;
    background: #fff;
    color: #21191c;
    font-size: 0;
    cursor: pointer;
}

#tryModal .modal-close::before {
    content: "\00d7";
    font: 400 24px/1 Arial, sans-serif;
}

#tryModal .modal-close:hover,
#tryModal .modal-close:focus-visible {
    border-color: #21191c;
    background: #21191c;
    color: #fff;
    outline: none;
}

#tryModal .modal-body.try-body {
    display: grid;
    flex: 1 1 auto;
    min-height: 0;
    grid-template-columns: minmax(0, .94fr) minmax(390px, 1.06fr);
    gap: 16px;
    align-items: stretch;
    overflow: hidden;
    margin-top: 64px;
    padding: 16px;
    background: #fbf9f7;
}

#tryModal .try-preview-col,
#tryModal .try-controls-col {
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #b7a9ad transparent;
}

#tryModal .try-preview-col {
    position: static;
    display: block;
    padding-right: 5px;
}

#tryModal .try-controls-col {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-right: 5px;
}

#tryModal .try-preview-card,
#tryModal .try-panel-box {
    border: 1px solid #e3d8d1;
    border-radius: 15px;
    background: #fffdfa;
    box-shadow: 0 8px 24px rgba(45, 28, 33, .055);
}

#tryModal .try-preview-card {
    gap: 16px;
    padding: 14px;
    overflow: visible;
}

#tryModal .try-result-view {
    width: 100%;
    max-width: none;
    height: auto;
    min-height: 0;
    max-height: 540px;
    aspect-ratio: 3 / 4;
    border: 1px solid #eee5df;
    border-radius: 11px;
    background: #f4eee8;
    box-shadow: 0 10px 25px rgba(38, 24, 29, .12);
}

#tryModal .try-result-view img,
#tryModal .try-result-view canvas {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: contain;
    background: #f4eee8;
}

#tryModal .try-result-badge {
    top: 12px;
    left: 12px;
    padding: 6px 11px;
    font-size: 11px;
    line-height: 1.2;
}

#tryModal .before-after-bar {
    gap: 8px;
    padding-top: 2px;
}

#tryModal .compare-btn {
    min-height: 36px;
    padding: 7px 13px;
    font-size: 12px;
}

#tryModal .try-panel-box {
    gap: 12px;
    padding: 16px;
}

#tryModal .try-product-mini {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    padding: 10px;
    border: 1px solid #eadfd9;
    border-radius: 11px;
    background: #fff;
    box-shadow: none;
}

#tryModal .try-product-mini > img {
    width: 72px;
    height: 90px;
    border-radius: 8px;
    object-fit: cover;
    background: #f1eae5;
}

#tryModal .try-product-mini-info strong {
    font-size: 14px;
    line-height: 1.4;
}

#tryModal .try-mini-description {
    display: -webkit-box;
    margin: 5px 0 7px;
    overflow: hidden;
    color: #76696d;
    font-size: 11px;
    line-height: 1.55;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

#tryModal .try-product-mini-info > span,
#tryModal .mini-tag,
#tryModal .try-step-title,
#tryModal .upload-zone span,
#tryModal .status-msg,
#tryModal .error-msg {
    font-size: 12px;
    line-height: 1.5;
}

#tryModal .upload-zone {
    min-height: 126px;
    padding: 14px;
    border: 1px dashed #d8c8bd;
    border-radius: 11px;
    background: #fff;
}

#tryModal .upload-done {
    grid-template-columns: 70px minmax(0, 1fr);
    gap: 13px;
}

#tryModal .upload-done > img {
    width: 70px;
    height: 82px;
    border-radius: 8px;
    object-fit: cover;
}

#tryModal .generation-status-card {
    padding: 14px;
    border-radius: 11px;
}

#tryModal .try-generate-panel .btn,
#tryModal .try-actions-row .btn {
    min-height: 46px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.3;
}

#tryModal .try-actions-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
}

@media (max-width: 900px) {
    #tryModal {
        padding: 12px;
    }

    #tryModal .modal-card.modal-xl {
        width: calc(100vw - 24px);
        height: calc(100dvh - 24px);
        border-radius: 15px;
    }

    #tryModal .modal-body.try-body {
        display: block;
        overflow-y: auto;
        padding: 14px;
    }

    #tryModal .try-preview-col,
    #tryModal .try-controls-col {
        overflow: visible;
        padding: 0;
    }

    #tryModal .try-controls-col {
        margin-top: 14px;
    }

    #tryModal .try-result-view {
        min-height: 0;
        aspect-ratio: 3 / 4;
    }
}

@media (max-width: 560px) {
    #tryModal {
        padding: 0;
    }

    #tryModal .modal-card.modal-xl {
        width: 100vw;
        height: 100dvh;
        border: 0;
        border-radius: 0;
    }

    #tryModal .modal-head {
        min-height: 60px;
        padding: 12px 14px;
    }

    #tryModal .modal-head h3 {
        max-width: calc(100vw - 80px);
        font-size: 16px;
    }

    #tryModal .modal-close {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
    }

    #tryModal .modal-body.try-body {
        margin-top: 60px;
        padding: 10px;
    }

    #tryModal .try-preview-card,
    #tryModal .try-panel-box {
        border-radius: 12px;
    }

    #tryModal .try-preview-card,
    #tryModal .try-panel-box {
        padding: 11px;
    }

    #tryModal .try-product-mini {
        grid-template-columns: 64px minmax(0, 1fr);
    }

    #tryModal .try-product-mini > img {
        width: 64px;
        height: 78px;
    }

    #tryModal .try-actions-row {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    #tryModal *,
    #tryModal *::before,
    #tryModal *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}
