/**
 * Virtual Try-On Styles
 */

/* Ensure proper touch behavior on mobile */
* {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    -webkit-touch-callout: none;
}

button, .button, input[type="file"] {
    touch-action: manipulation; /* Prevents double-tap zoom on buttons */
}

/* Try-On Button - Customizable via admin settings */
.virtual-try-on-container {
    margin: 15px 0;
}

.virtual-try-on-button {
    /* Colors will be applied via inline styles from admin settings */
    border: 1px solid;
    padding: 12px 30px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    border-radius: 0 !important; /* No rounded corners */
    cursor: pointer !important;
    transition: opacity 0.3s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    text-decoration: none !important;
    line-height: 20px !important;
    opacity: 1 !important;
}

.virtual-try-on-button .vto-button-icon {
    font-size: 1.2em;
    line-height: 1;
    display: inline-block;
    vertical-align: middle;
}

.virtual-try-on-button:hover {
    opacity: 0.85 !important;
}

/* Modal Styles */
.virtual-try-on-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden; /* Prevent scrolling in modal */
}

.virtual-try-on-modal-content {
    /* Background color will be applied via inline styles */
    border-radius: 0; /* No rounded corners */
    width: 500px;
    max-width: 90%;
    height: 95vh;
    max-height: 95vh;
    overflow: hidden; /* Prevent all scrolling */
    box-shadow: none;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: width 0.3s ease, height 0.3s ease, max-height 0.3s ease;
}

/* Expand modal when result is shown */
.virtual-try-on-modal-content.has-result {
    width: 900px;
    height: 95vh;
    max-width: 90%;
    max-height: 95vh;
    overflow: hidden; /* Prevent all scrolling when showing result */
}

/* Modal Header */
.virtual-try-on-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    padding: 20px;
    z-index: 100;
    background: transparent;
    border: none;
}

.virtual-try-on-header h3 {
    display: none;
}

.virtual-try-on-close {
    background: none;
    border: none;
    font-size: 32px;
    line-height: 1;
    font-weight: 300;
    /* Color will be applied via inline styles */
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
    opacity: 1;
    position: relative;
}

.virtual-try-on-close::before {
    content: 'X'; /* Clean X symbol */
    display: block;
}

.virtual-try-on-close:hover {
    opacity: 0.7;
}

/* Modal Body */
.virtual-try-on-body {
    flex: 1;
    padding: 0;
    margin: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    overflow: hidden; /* Prevent scrolling in body */
}

/* Consent Dialog */
.vto-consent-dialog {
    position: absolute;
    inset: 0;
    display: none;
    z-index: 20;
}

.vto-consent-dialog .vto-consent-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
}

.vto-consent-dialog .vto-consent-panel {
    position: relative;
    max-width: 560px;
    margin: 5vh auto;
    background: #333;
    border-radius: 0;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    max-height: 90vh;
    overflow-y: auto;
}

.vto-consent-panel h4 {
    margin: 0 0 15px 0;
    font-size: 20px;
    color: #fff;
    font-weight: 600;
}

.vto-consent-content p {
    margin: 12px 0;
    font-size: 14px;
    line-height: 1.6;
    color: #fff !important;
    background: #333 !important;
}

.vto-consent-content a {
    color: #fff;
    text-decoration: underline;
}

.vto-consent-panel {
    background: #333 !important
}

.vto-consent-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.vto-consent-actions .button {
    padding: 10px 24px !important;
    border-radius: 0 !important;
    font-size: 14px !important;
    cursor: pointer !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    font-weight: 600 !important;
    border: 1px solid #fff !important;
}

.vto-consent-actions .button-primary {
    background: #fff !important;
    color: #000 !important;
}

.vto-consent-actions .button:not(.button-primary) {
    background: transparent !important;
    color: #fff !important; /* Default white text */
}

/* Hide inline consent checkbox */
.upload-consent {
    display: none;
}

/* Upload Section */
.upload-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.upload-area {
    border: 2px solid;
    /* Border color will be applied via inline styles */
    border-radius: 0;
    padding: 50px 50px;
    cursor: pointer;
    transition: opacity 0.2s ease;
    /* Background will be slightly lighter, applied via inline styles */
    position: relative;
    overflow: hidden;
    max-width: 600px;
    width: 100%;
}

.upload-area.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.upload-area:hover:not(.disabled) {
    opacity: 0.85;
}

.upload-content {
    position: relative;
    z-index: 1;
    pointer-events: none;
}

.upload-icon {
    font-size: 60px;
    margin-bottom: 25px;
    display: block;
    opacity: 0.9;
}

.upload-area p {
    font-size: 18px;
    /* Color will be applied via inline styles */
    margin: 12px 0;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.upload-note {
    font-size: 14px !important;
    /* Color will be applied via inline styles */
    font-weight: normal !important;
    margin-top: 15px !important;
    opacity: 0.7;
}

/* Upload actions */
.upload-actions {
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Photo Instructions */
.vto-photo-instructions {
    padding: 20px;
    margin-bottom: 20px;
}

.vto-instructions-title {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 1px;
    margin: 0 0 20px 0;
    text-align: center;
}

.vto-instruction-step {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.vto-instruction-step:last-child {
    border-bottom: none;
}

.vto-step-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
}

.vto-step-icon svg {
    width: 100%;
    height: 100%;
}

.vto-step-text {
    font-size: 15px;
    line-height: 1.4;
    padding-top: 4px;
}

.upload-actions {
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.upload-actions .button {
    padding: 14px 40px !important;
    border-radius: 0 !important;
    font-size: 17px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    width: 100%;
    cursor: pointer;
}

.vto-upload-btn-primary {
    background-color: #000000 !important;
    color: #FFFFFF !important;
    border: 2px solid #FFFFFF !important;
}

.vto-upload-btn-primary:hover {
    background-color: #333333 !important;
    border-color: #FFFFFF !important;
}

.vto-selfie-btn-secondary {
    background-color: transparent !important;
    color: inherit !important;
    border: 2px solid currentColor !important;
}

.vto-selfie-btn-secondary:hover {
    opacity: 0.8;
}

/* Try-On Result Section - FULL SCREEN, NO SPACING */
.try-on-result {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    margin: 0 !important;
    background: #000;
    z-index: 999999;
    overflow: hidden !important; /* Prevent all scrolling */
}

/* Canvas fills entire screen, no spacing */
#try-on-canvas {
    display: block;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    object-fit: contain;
    margin: 0 !important;
    padding: 0 !important;
    background: #000;
    border: none !important;
    outline: none !important;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* Background will be modal background color with opacity */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top: 4px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-overlay p {
    font-size: 16px;
    /* Color via inline styles */
    margin: 0;
    font-weight: 500;
}

/* Selfie overlay */
.vto-selfie-overlay {
    position: absolute;
    inset: 0;
    display: none;
    z-index: 30;
    overflow-y: auto; /* Allow scrolling in the overlay */
}

.vto-selfie-backdrop {
    position: fixed; /* Fixed so it stays in place while scrolling */
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: -1; /* Behind the panel */
}

.vto-selfie-panel {
    position: relative;
    margin: 3vh auto;
    max-width: 720px;
    background: #000;
    border-radius: 0;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    max-height: none; /* Remove max-height to allow full content display */
}

.vto-selfie-panel h4 {
    margin: 0 0 15px;
    color: #000;
}

.vto-selfie-stage {
    position: relative;
    background: #000;
    border-radius: 0;
    overflow: hidden;
}

.vto-selfie-video,
.vto-selfie-canvas {
    width: 100%;
    height: auto;
    display: block;
}

.vto-countdown {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 80px;
    font-weight: 800;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.9);
}

.vto-selfie-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    padding: 15px 0 0;
}

.vto-selfie-actions .button {
    border-radius: 0 !important;
    padding: 10px 24px !important;
}

.vto-flex-spacer {
    flex: 1;
}

.vto-selfie-error {
    color: #d63638;
    margin-top: 10px;
    font-size: 14px;
}

/* Body class when modal is open */
body.virtual-try-on-modal-open {
    overflow: hidden;
}

/* Responsive Styles */
@media (max-width: 768px) {
    /* Upload Section */
    .upload-section {
        padding: 60px 20px 30px; /* Less top padding on tablet */
        min-height: 400px;
    }
    
    .upload-area {
        padding: 40px 30px;
        max-width: none;
    }
    
    .upload-area p {
        font-size: 15px;
    }
    
    .upload-icon {
        font-size: 48px; /* Slightly smaller on tablet */
    }
    
    .upload-section h3 {
        font-size: 18px;
    }
    
    /* Control Buttons */
    .try-on-controls {
        padding: 15px;
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .try-on-controls .button {
        flex: 1;
        min-width: 130px !important;
        padding: 12px 20px !important;
        font-size: 13px !important;
    }
    
    /* Privacy Dialog */
    .vto-consent-dialog {
        width: 90%;
        max-width: 500px;
        padding: 25px;
    }
    
    .vto-consent-dialog h3 {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    /* Modal Header - Larger close button for touch */
    .modal-header .close {
        font-size: 36px;
        padding: 12px;
        width: 48px;
        height: 48px;
    }
    
    /* Upload Section - Mobile optimized */
    .upload-section {
        padding: 50px 15px 20px; /* Minimal padding for small screens */
        min-height: 300px;
    }
    
    .upload-area {
        padding: 30px 20px;
        border-width: 2px;
    }
    
    .upload-icon {
        font-size: 40px;
    }
    
    .upload-section h3 {
        font-size: 16px;
        margin-bottom: 15px;
    }
    
    .upload-area p {
        font-size: 13px;
    }
    
    .format-text {
        font-size: 11px;
    }
    
    /* Selfie Button */
    #selfie-btn {
        padding: 12px 24px !important;
        font-size: 13px !important;
    }
    
    /* Control Buttons - Stacked on mobile */
    .try-on-controls {
        flex-direction: column;
        gap: 10px;
        padding: 12px;
    }
    
    .try-on-controls .button {
        width: 100% !important;
        min-width: auto !important;
        padding: 14px 20px !important;
        font-size: 14px !important;
    }
    
    /* Privacy Dialog - Full width on mobile */
    .vto-consent-dialog {
        width: 95%;
        max-width: none;
        padding: 20px;
        margin: 20px;
    }
    
    .vto-consent-dialog h3 {
        font-size: 18px;
        margin-bottom: 15px;
    }
    
    .vto-consent-content {
        font-size: 13px;
        max-height: 50vh;
    }
    
    .vto-consent-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .vto-consent-actions .button {
        width: 100%;
        padding: 12px 20px !important;
    }
}

/* Print Styles */
@media print {
    .virtual-try-on-modal,
    .virtual-try-on-button {
        display: none !important;
    }
}

/* Accessibility */
.virtual-try-on-button:focus,
.virtual-try-on-close:focus,
.try-on-controls .button:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Custom Scrollbar */
.virtual-try-on-modal-content::-webkit-scrollbar {
    width: 6px;
}

.virtual-try-on-modal-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.virtual-try-on-modal-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 0;
}

.virtual-try-on-modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}


/* Modal Styles */
.virtual-try-on-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.virtual-try-on-modal-content {
    background: white;
    border-radius: 12px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Modal Header */
.virtual-try-on-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

.virtual-try-on-header h3 {
    margin: 0;
    font-size: 24px;
    color: #333;
    font-weight: 600;
}

.virtual-try-on-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #666;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.virtual-try-on-close:hover {
    background: #e9ecef;
    color: #333;
}

/* Modal Body */
.virtual-try-on-body {
    padding: 30px;
    position: relative;
    min-height: 400px;
}

/* Nested Consent Dialog */
.vto-consent-dialog { /* container within modal */
    position: absolute;
    inset: 0;
    display: none; /* default hidden, JS will show */
    z-index: 20; /* above loading overlay */
}
.vto-consent-dialog .vto-consent-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
}
.vto-consent-dialog .vto-consent-panel {
    position: relative;
    max-width: 560px;
    margin: 10% auto;
    background: #fff;
    border-radius: 10px;
    padding: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.vto-consent-panel h4 {
    margin: 0 0 10px 0;
    font-size: 20px;
    color: #333;
}
.vto-consent-content p { margin: 8px 0; }
.vto-consent-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

/* Hide the inline checkbox row when using dialog; keep for progressive enhancement */
.upload-consent { display: none; }

/* Upload Section */
.upload-section {
    text-align: center;
}

.upload-consent {
    text-align: left;
    max-width: 720px;
    margin: 0 auto 12px auto;
    font-size: 14px;
    color: #fff !important;
    background: #333 !important;
    padding: 15px 20px;
    border-radius: 4px;
}

.upload-consent label {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.upload-consent input[type="checkbox"] {
    margin-top: 3px;
}

.upload-consent-hint {
    font-size: 12px;
    color: #ccc;
    margin-left: 26px;
}

.upload-consent-hint.highlight {
    color: #d63638; /* WP error red */
    font-weight: 600;
}

.upload-area {
    border: 3px dashed #007cba;
    border-radius: 12px;
    padding: 60px 40px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
    position: relative;
    overflow: hidden;
}

.upload-area.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(10%);
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: #005a87;
    background: #e3f2fd;
    transform: scale(1.02);
}

.upload-area:active {
    transform: scale(0.98);
    background: #bbdefb;
}

.upload-area:before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #007cba, #00a8e6);
    border-radius: 12px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.upload-area.drag-over:before {
    opacity: 0.1;
}

.upload-content {
    position: relative;
    z-index: 1;
    pointer-events: none; /* Let clicks pass through to parent */
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 20px;
    display: block;
}

.upload-area p {
    font-size: 18px;
    color: #333;
    margin: 10px 0;
    font-weight: 500;
}

.upload-note {
    font-size: 14px !important;
    color: #666 !important;
    font-weight: normal !important;
    margin-top: 15px !important;
}

/* Try-On Result Section */
.try-on-result {
    text-align: center;
    position: relative;
}

.ai-badge {
    display: inline-block;
    background: linear-gradient(45deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    animation: aiGlow 2s ease-in-out infinite alternate;
}

@keyframes aiGlow {
    from {
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    }
    to {
        box-shadow: 0 4px 25px rgba(102, 126, 234, 0.6);
    }
}

.canvas-container {
    margin-bottom: 25px;
    display: inline-block;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    background: #f8f9fa;
    padding: 10px;
}

#try-on-canvas {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.try-on-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.try-on-controls .button {
    padding: 12px 24px !important;
    font-size: 16px !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
    text-transform: none !important;
    min-width: 140px !important;
    transition: all 0.3s ease !important;
}

#reset-try-on {
    background: #6c757d !important;
    color: white !important;
    border: none !important;
}

#reset-try-on:hover {
    background: #545b62 !important;
    transform: translateY(-2px) !important;
}

#save-try-on {
    background: #28a745 !important;
    color: white !important;
    border: none !important;
}

#save-try-on:hover {
    background: #218838 !important;
    transform: translateY(-2px) !important;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-overlay p {
    font-size: 18px;
    color: #333;
    margin: 0;
    font-weight: 500;
}

/* Upload actions (Selfie button) */
.upload-actions {
    margin-top: 12px;
    text-align: center;
}

/* Selfie overlay */
.vto-selfie-overlay {
    position: absolute;
    inset: 0;
    display: none;
    z-index: 30;
    overflow-y: auto; /* Allow scrolling */
}
.vto-selfie-backdrop {
    position: fixed; /* Fixed so it stays in place */
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: -1; /* Behind the panel */
}
.vto-selfie-panel {
    position: relative;
    margin: 3% auto;
    max-width: 720px;
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-height: none; /* Remove max-height to allow full content display */
}
.vto-selfie-panel h4 {
    margin: 8px 8px 12px;
}
.vto-selfie-stage {
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}
.vto-selfie-video,
.vto-selfie-canvas {
    width: 100%;
    height: auto;
    display: block;
}
.vto-countdown {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 64px;
    font-weight: 800;
    text-shadow: 0 2px 10px rgba(0,0,0,0.8);
}
.vto-selfie-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    padding: 12px 8px 0;
}
.vto-flex-spacer { flex: 1; }
.vto-selfie-error { color: #d63638; margin-top: 8px; }

/* Body class when modal is open */
body.virtual-try-on-modal-open {
    overflow: hidden;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .virtual-try-on-modal {
        padding: 0;
        overflow: hidden; /* Prevent scrolling on mobile */
    }
    
    .virtual-try-on-modal-content {
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100vh !important;
        max-height: 100vh !important;
        border-radius: 0;
        overflow-y: auto !important; /* Allow scrolling for consent dialog */
    }
    
    .virtual-try-on-modal-content.has-result {
        width: 100vw !important;
        max-width: 100vw !important;
        overflow: hidden !important; /* No scrolling when showing generated image */
    }
    
    .virtual-try-on-header {
        padding: 15px 20px;
    }
    
    .virtual-try-on-header h3 {
        font-size: 20px;
    }
    
    .virtual-try-on-body {
        padding: 0; /* Remove all padding on mobile */
    }
    
    .upload-section {
        padding: 20px; /* Add padding only to upload section */
    }
    
    .upload-area {
        padding: 40px 20px;
    }
    
    .upload-area p {
        font-size: 16px;
    }
    
    .upload-icon {
        font-size: 36px;
    }
    
    .virtual-try-on-button {
        width: 100% !important;
        justify-content: center !important;
        padding: 15px 20px !important;
    }
    
    /* Consent dialog mobile fix */
    .vto-consent-dialog .vto-consent-panel {
        margin: 20px;
        max-width: calc(100vw - 40px);
        padding: 20px;
    }
    
    .vto-consent-panel h4 {
        font-size: 18px;
    }
    
    .vto-consent-content p {
        font-size: 13px;
    }
    
    .vto-consent-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .vto-consent-actions .button {
        width: 100%;
    }
    
    /* Selfie overlay mobile fix */
    .vto-selfie-panel {
        margin: 20px auto;
        max-width: calc(100vw - 40px);
        max-height: none; /* Let overlay handle scrolling */
        padding: 15px;
    }
    
    .vto-selfie-panel h4 {
        font-size: 18px;
    }
    
    .vto-selfie-actions {
        flex-wrap: wrap;
    }
    
    .vto-selfie-actions .button {
        flex: 1 1 auto;
        min-width: 100px;
    }
}

@media (max-width: 480px) {
    .virtual-try-on-header {
        padding: 12px 15px;
    }
    
    .virtual-try-on-body {
        padding: 0; /* Remove all padding */
        min-height: 300px;
    }
    
    .upload-section {
        padding: 15px; /* Add padding only to upload section */
    }
    
    .upload-area {
        padding: 30px 15px;
    }
    
    /* Even smaller screens - reduce consent dialog margins */
    .vto-consent-dialog .vto-consent-panel {
        margin: 10px;
        max-width: calc(100vw - 20px);
        padding: 15px;
    }
    
    .vto-consent-panel h4 {
        font-size: 16px;
        margin-bottom: 10px;
    }
    
    .vto-consent-content p {
        font-size: 12px;
        line-height: 1.5;
    }
    
    /* Selfie overlay for very small screens */
    .vto-selfie-panel {
        margin: 10px auto;
        max-width: calc(100vw - 20px);
        max-height: none; /* Let overlay handle scrolling */
        padding: 10px;
    }
    
    .vto-selfie-panel h4 {
        font-size: 16px;
    }
    
    .vto-selfie-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .vto-selfie-actions .button {
        width: 100%;
    }
}

/* Print Styles */
@media print {
    .virtual-try-on-modal,
    .virtual-try-on-button {
        display: none !important;
    }
}

/* High DPI / Retina Display Support */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    #try-on-canvas {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Accessibility Improvements */
.virtual-try-on-button:focus,
.virtual-try-on-close:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Custom Scrollbar for Modal */
.virtual-try-on-modal-content::-webkit-scrollbar {
    width: 8px;
}

.virtual-try-on-modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.virtual-try-on-modal-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.virtual-try-on-modal-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

