
/* ==========================================
   WOOCOMMERCE VIRTUAL TRY-ON BY ML
   ========================================== */



/* ==========================================
   TRY-ON BUTTON
   ========================================== */

body.single-product form.cart button#try-on-btn {
    display: block !important;
    width: 100% !important;

    margin-top: 18px !important;
    margin-bottom: 12px !important;

    position: relative !important;
    top: 6px !important;

    padding: 13px 18px !important;

    background: #000 !important;
    color: #fff !important;

    border: 1px solid #000 !important;
    border-radius: 4px !important;

    font-size: 15px !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;

    text-align: center !important;
    cursor: pointer !important;

    transition: background 0.2s ease, color 0.2s ease !important;
}

body.single-product form.cart button#try-on-btn:hover,
body.single-product form.cart button#try-on-btn:focus {
    background: #222 !important;
    color: #fff !important;
}



/* ==========================================
   PAGE SCROLL LOCK
   ========================================== */

html.tryon-page-lock {
    overflow: hidden !important;
    overscroll-behavior: none !important;
}


/* ==========================================
   MODAL BACKGROUND
   ========================================== */

.tryon-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;

    display: none;
    align-items: center;
    justify-content: center;

    width: 100%;
    height: 100%;
    height: 100dvh;

    padding: 15px;
    box-sizing: border-box;

    background: rgba(0, 0, 0, 0.82);

    overflow-y: auto;
    overscroll-behavior: contain;
}

.tryon-modal.is-open {
    display: flex;
}


/* ==========================================
   MAIN CONTENT
   ========================================== */

#tryon-content {
    position: relative;

    display: flex;
    flex-direction: column;
    align-items: center;

    width: 100%;
    max-width: 500px;

    max-height: 95vh;
    max-height: 95dvh;

    padding: 12px;
    box-sizing: border-box;

    background: #fff;
    border-radius: 12px;

    overflow: hidden;

    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.25);
}


/* ==========================================
   CANVAS
   ========================================== */

.tryon-canvas-wrap {
    position: relative;

    width: 100%;
    max-height: 68vh;
    max-height: 68dvh;

    aspect-ratio: 400 / 520;

    overflow: hidden;
    border-radius: 6px;

    background: #f4f4f4;
}

#tryon-canvas {
    display: block;

    width: 100%;
    height: 100%;

    opacity: 0;
    pointer-events: none;

    object-fit: contain;

    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;

    transition: opacity 0.4s ease;
}

.tryon-modal.is-ready #tryon-canvas {
    opacity: 1;
    pointer-events: auto;
}


/* ==========================================
   CAMERA / UPLOAD STATUS
   ========================================== */

.tryon-status {
    position: absolute;
    z-index: 5;

    left: 50%;
    bottom: 18px;

    width: calc(100% - 30px);
    max-width: 360px;

    padding: 10px 14px;
    box-sizing: border-box;

    transform: translateX(-50%);

    background: rgba(0, 0, 0, 0.78);
    color: #fff;

    border-radius: 6px;

    font-size: 13px;
    line-height: 1.5;
    text-align: center;

    opacity: 0;
    visibility: hidden;

    transition: opacity 0.2s ease;
}

.tryon-status.visible {
    opacity: 1;
    visibility: visible;
}


/* ==========================================
   CONTROL BARS
   ========================================== */

.tryon-controls {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    gap: 12px;

    opacity: 0;
    pointer-events: none;

    transition: opacity 0.4s ease;
}

.tryon-modal.is-ready .tryon-controls {
    opacity: 1;
    pointer-events: auto;
}

.tryon-controls.top {
    padding-top: 13px;
}

.tryon-controls.bottom {
    padding-top: 10px;
    padding-bottom: 2px;
}


/* ==========================================
   CONTROL BUTTONS
   ========================================== */

.tryon-control {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 44px;
    height: 44px;
    min-width: 44px;

    padding: 10px;

    background: #fff;
    color: #111;

    border: 1px solid #dedede;
    border-radius: 50%;

    cursor: pointer;

    touch-action: none;
    user-select: none;
    -webkit-user-select: none;

    transition:
        background 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease,
        transform 0.15s ease;
}

.tryon-control svg {
    display: block;

    width: 21px;
    height: 21px;

    pointer-events: none;
}

.tryon-control:hover,
.tryon-control:active {
    background: #111;
    color: #fff;
    border-color: #111;
}

.tryon-control:active {
    transform: scale(0.94);
}

.tryon-control.close-control {
    background: #111;
    color: #fff;
    border-color: #111;
}

.tryon-control.close-control:hover {
    background: #333;
}


/* ==========================================
   INTRO SCREEN
   ========================================== */

.tryon-intro {
    position: absolute;
    z-index: 10;
    inset: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px;
    box-sizing: border-box;

    background: #fff;

    opacity: 1;
    visibility: visible;

    animation: introEntrance 0.65s ease both;
}

.intro-box {
    width: 100%;
    max-width: 350px;

    text-align: center;
}

.intro-logo {
    margin-bottom: 22px;

    color: #111;

    font-size: 12px;
    font-weight: 800;
    letter-spacing: 3px;
}

.intro-box h2 {
    margin: 0 0 10px;

    color: #111;

    font-size: 25px;
    font-weight: 700;
    line-height: 1.25;
}

.intro-description {
    margin: 0 auto 26px;

    max-width: 300px;

    color: #777;

    font-size: 13px;
    line-height: 1.6;
}

.intro-instructions {
    display: flex;
    flex-direction: column;
    gap: 15px;

    width: 100%;
    margin: 0 auto;
    text-align: left;
}

.intro-instruction {
    display: flex;
    align-items: center;
    gap: 14px;

    color: #333;

    font-size: 13px;
    line-height: 1.45;
}

.intro-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    width: 39px;
    height: 39px;

    background: #f3f3f3;
    color: #111;

    border-radius: 50%;
}

.intro-icon svg {
    width: 19px;
    height: 19px;
}

.intro-footer {
    margin-top: 27px;

    color: #999;

    font-size: 11px;
    letter-spacing: 0.2px;
}


/* ==========================================
   INTRO ANIMATIONS
   ========================================== */

@keyframes introEntrance {
    from {
        opacity: 0;
        transform: scale(0.97);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.tryon-intro.leaving {
    animation: introExit 0.45s ease forwards;
    pointer-events: none;
}

@keyframes introExit {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(1.025);
    }
}


/* ==========================================
   MOBILE RESPONSIVENESS
   ========================================== */

@media (max-width: 480px) {

    .tryon-modal {
        padding: 8px;
    }

    #tryon-content {
        max-width: 100%;
        padding: 9px;
        border-radius: 9px;
    }

    .tryon-canvas-wrap {
        max-height: 65vh;
        max-height: 65dvh;
    }

    .tryon-controls {
        gap: 9px;
    }

    .tryon-control {
        width: 41px;
        height: 41px;
        min-width: 41px;
        padding: 9px;
    }

    .tryon-control svg {
        width: 20px;
        height: 20px;
    }

    .intro-box h2 {
        font-size: 22px;
    }

    .intro-description {
        margin-bottom: 20px;
    }

    .intro-instructions {
        gap: 12px;
    }

    .intro-instruction {
        font-size: 12px;
    }

    .intro-icon {
        width: 36px;
        height: 36px;
    }
}

@media (max-height: 650px) {

    #tryon-content {
        max-height: 98vh;
        max-height: 98dvh;
    }

    .tryon-canvas-wrap {
        max-height: 58vh;
        max-height: 58dvh;
    }

    .intro-logo {
        margin-bottom: 12px;
    }

    .intro-box h2 {
        font-size: 21px;
    }

    .intro-description {
        margin-bottom: 14px;
    }

    .intro-instructions {
        gap: 9px;
    }

    .intro-footer {
        margin-top: 15px;
    }
}
