/* Virtual Try-On Frontend Styles */

/* Drag and drop states */
.vto-file-input.vto-drag-over {
    border-color: #007cba;
    background: #f0f8ff;
    transform: scale(1.02);
}

.vto-file-input.vto-focus {
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

/* Loading animation for preview images */
.vto-preview-image img {
    transition: opacity 0.3s ease;
}

.vto-preview-image img[src=""] {
    opacity: 0;
}

/* Responsive design */
@media (max-width: 768px) {
    .vto-tryon-container {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .vto-submit-btn {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
    
    .vto-preview-image {
        max-width: 90%;
    }
}

@media (max-width: 480px) {
    .vto-tryon-container {
        margin: 0.5rem;
        padding: 1rem;
    }
    
    .vto-file-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .vto-remove-file {
        align-self: flex-start;
    }
}

/* Accessibility improvements */
.vto-file-input:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.vto-submit-btn:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .vto-tryon-container {
        border: 2px solid #000;
    }
    
    .vto-file-input {
        border: 2px solid #000;
    }
    
    .vto-submit-btn {
        border: 2px solid #fff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .vto-tryon-container,
    .vto-file-input,
    .vto-submit-btn,
    .vto-preview-image img {
        transition: none;
    }
    
    .vto-spinner {
        animation: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .vto-tryon-container {
        background: transparent !important;
        color: #e2e8f0;
    }
    
    .vto-label {
        color: #e2e8f0;
    }
    
    .vto-file-input {
        background: #4a5568;
        border-color: #718096;
        color: #e2e8f0;
    }
    
    .vto-file-input:hover {
        background: #2d3748;
        border-color: #007cba;
    }
    
    .vto-file-name {
        color: #a0aec0;
    }
    
    .vto-error-message {
        background: #742a2a;
        color: #fed7d7;
        border-color: #c53030;
    }
}

/* Print styles */
@media print {
    .vto-tryon-container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .vto-submit-btn,
    .vto-remove-file,
    .vto-reset-btn {
        display: none;
    }
    
    .vto-preview-container {
        display: block !important;
    }
}

/* Custom scrollbar for webkit browsers */
.vto-tryon-container::-webkit-scrollbar {
    width: 8px;
}

.vto-tryon-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.vto-tryon-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.vto-tryon-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Animation for file upload progress */
@keyframes upload-progress {
    0% { width: 0%; }
    100% { width: 100%; }
}

.vto-upload-progress {
    position: relative;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.vto-upload-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #007cba, #005a87);
    border-radius: 2px;
    animation: upload-progress 2s ease-in-out;
}

/* Success animation */
@keyframes success-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.vto-success-animation {
    animation: success-pulse 0.6s ease-in-out;
}

/* Error shake animation */
@keyframes error-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.vto-error-animation {
    animation: error-shake 0.5s ease-in-out;
} 

/* Make Virtual Try-On button match Add to Cart button */
.vto-tryon-btn-wrap .vto-submit-btn {
    width: 100%;
    background: #e5007d; /* Replace with your theme's Add to Cart color if different */
    color: #fff;
    border: none;
    border-radius: 0;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 1rem 0;
    margin: 0;
    transition: background 0.2s;
    box-shadow: none;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
}
.vto-tryon-btn-wrap .vto-submit-btn:hover {
    background: #c4006a; /* Slightly darker for hover */
}

/* Style the Try It On button with custom class for independent styling */
.vto-custom-button,
.vto-tryon-btn-wrap .vto-custom-button,
button.vto-custom-button,
.vto-button-container .vto-custom-button {
    width: 100% !important;
    background: transparent !important;
    color: #e5007d !important;
    border: 2px solid #e5007d !important;
    border-radius: 0 !important;
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    padding: 1rem 0 !important;
    margin: 0 !important;
    transition: all 0.2s !important;
    box-shadow: none !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    display: block !important;
    cursor: pointer;
}

/* Mobile responsive styles for optimized modal */
@media (max-width: 768px) {
    .vto-modal {
        padding: 10px 0;
    }
    
    .vto-modal-content {
        width: 95%;
        max-width: none;
        padding: 15px;
        margin: 10px auto;
    }
}

@media (max-width: 480px) {
    .vto-modal {
        padding: 5px 0;
    }
    
    .vto-modal-content {
        width: 98%;
        padding: 10px;
        border-radius: 5px;
        margin: 5px auto;
    }
}

/* Remove excessive scrolling and optimize content sections */
.vto-modal-body {
    padding-top: 10px;
}

/* Image preview container - more compact */
#vto-photo-preview {
    max-height: 250px;
    overflow: hidden;
    text-align: center;
    margin: 10px 0;
}

#vto-photo-preview img {
    max-width: 100%;
    height: auto;
    max-height: 250px;
    border-radius: 5px;
}

/* User image preview container */
.vto-user-image-preview {
    margin-top: 1rem;
    text-align: center;
}

.vto-user-image-preview > div {
    position: relative;
    margin-top: 1rem;
    display: inline-block;
    max-width: 100%;
}

.vto-user-image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    display: block;
    margin: 0 auto;
}

/* Clear image button (X button) - Chrome compatible */
.vto-clear-image {
    position: absolute !important;
    top: 8px !important;
    right: 8px !important;
    background: rgba(0, 0, 0, 0.7) !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    width: 32px !important;
    height: 32px !important;
    font-size: 20px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    z-index: 10 !important;
    line-height: 1 !important;
    padding: 0 !important;
    margin: 0 !important;
    visibility: visible !important;
    opacity: 1 !important;
    box-sizing: border-box !important;
}

.vto-clear-image:hover {
    background: rgba(0, 0, 0, 0.9) !important;
    transform: scale(1.1) !important;
}

.vto-clear-image:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.vto-processing-image-wrapper {
    position: relative !important;
    display: inline-block !important;
    margin: 0 auto 1.5rem auto !important;
    text-align: center;
    width: auto;
    height: auto;
    vertical-align: middle;
    line-height: 0;
    overflow: visible;
}

.vto-processing-image {
    max-width: 250px;
    max-height: 250px;
    border-radius: 12px;
    opacity: 0.8;
    display: block !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    margin: 0 !important;
    padding: 0 !important;
    width: auto;
    height: auto;
}

.vto-processing-spinner {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 4px solid rgba(0, 0, 0, 0.1) !important;
    width: 60px !important;
    height: 60px !important;
    margin-top: -30px !important;
    margin-left: -30px !important;
    border-radius: 50% !important;
    border-top: 4px solid #E5077E !important;
    z-index: 11 !important;
    transform-origin: center center;
    animation: vto-spin 1s linear infinite;
    box-sizing: border-box !important;
    pointer-events: none;
}

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

.vto-processing-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.vto-processing-subtext {
    font-size: 0.875rem;
    color: #666;
}

/* Modal header component */
.vto-modal-header-component {
    text-align: center;
    margin-bottom: 1.5rem;
}

.vto-modal-header-component .vto-modal-icon {
    margin: 0 0 1rem 0;
}

.vto-modal-header-component .vto-hashtag-title {
    margin: 0.5rem 0;
}

.vto-modal-header-component .vto-tagline {
    font-size: 1.125rem;
    color: #1a1a1a;
    margin: 0.75rem 0;
    font-weight: 500;
}

/* Modal footer component */
.vto-modal-footer {
    border-top: 1px solid #E0E0E0;
    padding: 1.5rem 0 0 0;
    margin-top: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    width: 100%;
}

.vto-footer-hashtag {
    font-size: 0.875rem;
    font-weight: 600;
    color: #E5077E;
}

.vto-footer-cta {
    font-size: 0.875rem;
    font-weight: 500;
    color: #666;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Result container - remove scrolling */
#vto-result-container {
    margin: 10px 0;
}

/* Product grid - more compact */
.vto-product-grid {
    max-height: 300px;
    overflow-y: auto;
    margin: 10px 0;
}

/* Close button positioning - simplified */
.vto-close {
    position: absolute !important;
    top: 10px !important;
    right: 15px !important;
    z-index: 1001 !important;
    background: none !important;
    border-radius: 0 !important;
    width: auto !important;
    height: auto !important;
    text-align: center !important;
    line-height: normal !important;
    font-size: 28px !important;
    color: #aaa !important;
    cursor: pointer !important;
}

.vto-custom-button:hover,
.vto-tryon-btn-wrap .vto-custom-button:hover,
button.vto-custom-button:hover,
.vto-button-container .vto-custom-button:hover {
    background: transparent !important;
    color: #e5007d !important;
    border: 2px solid #e5007d !important;
}

/* Ensure button appears below Add to Cart on all screens */
.vto-tryon-btn-wrap {
    margin-top: 16px !important;
    width: 100% !important;
    display: block !important;
}

/* Make the try-on form align with Add to Cart */
.vto-tryon-btn-wrap .vto-tryon-form {
    width: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

/* Ensure modal displays properly - optimized for better UX */
.vto-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow-y: auto;
    padding: 20px 0;
    box-sizing: border-box;
}

.vto-modal-content {
    background-color: #fefefe;
    margin: 20px auto;
    padding: 20px;
    border: 1px solid #888;
    width: 90%;
    max-width: 600px;
    border-radius: 10px;
    position: relative;
    min-height: auto;
    box-sizing: border-box;
} 

/* Virtual Try-On Result Styles */
.vto-result-container {
    text-align: center;
    padding: 2rem;
}

.vto-result-container h3 {
    margin-bottom: 1.5rem;
    color: #333;
    font-size: 1.5rem;
    font-weight: 600;
}

.vto-result-image {
    margin-bottom: 2rem;
}

.vto-result-image img {
    max-width: 100%;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    transition: transform 0.3s ease;
}

.vto-result-image img:hover {
    transform: scale(1.02);
}

.vto-result-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.vto-save-btn,
.vto-try-again-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.vto-save-btn {
    background: #007cba;
    color: white;
}

.vto-save-btn:hover {
    background: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,124,186,0.3);
}

.vto-try-again-btn {
    background: #f8f9fa;
    color: #333;
    border: 1px solid #dee2e6;
}

.vto-try-again-btn:hover {
    background: #e9ecef;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Loading state for submit button */
.vto-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Responsive result display */
@media (max-width: 768px) {
    .vto-result-container {
        padding: 1rem;
    }
    
    .vto-result-container h3 {
        font-size: 1.25rem;
    }
    
    .vto-result-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .vto-save-btn,
    .vto-try-again-btn {
        width: 100%;
        max-width: 200px;
        justify-content: center;
    }
}

/* Dark mode support for results */
@media (prefers-color-scheme: dark) {
    .vto-result-container h3 {
        color: #e2e8f0;
    }
    
    .vto-try-again-btn {
        background: #4a5568;
        color: #e2e8f0;
        border-color: #718096;
    }
    
    .vto-try-again-btn:hover {
        background: #2d3748;
    }
}

/* Virtual Try-On Error Styles */
.vto-error-container {
    text-align: center;
    padding: 2rem;
}

.vto-error-container h3 {
    margin-bottom: 1.5rem;
    color: #dc3545;
    font-size: 1.5rem;
    font-weight: 600;
}

.vto-error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.vto-error-message {
    margin-bottom: 2rem;
    padding: 1rem;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    color: #721c24;
}

.vto-error-message p {
    margin: 0;
    font-size: 1rem;
    line-height: 1.5;
}

.vto-error-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.vto-close-modal-btn {
    padding: 0.75rem 1.5rem;
    border: 1px solid #6c757d;
    border-radius: 8px;
    background: #6c757d;
    color: white;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.vto-close-modal-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108,117,125,0.3);
}

/* Responsive error display */
@media (max-width: 768px) {
    .vto-error-container {
        padding: 1rem;
    }
    
    .vto-error-container h3 {
        font-size: 1.25rem;
    }
    
    .vto-error-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .vto-try-again-btn,
    .vto-close-modal-btn {
        width: 100%;
        max-width: 200px;
        justify-content: center;
    }
}

/* Dark mode support for errors */
@media (prefers-color-scheme: dark) {
    .vto-error-container h3 {
        color: #ea868f;
    }
    
    .vto-error-message {
        background: #4a1e1e;
        border-color: #6b2b2b;
        color: #f5b5b5;
    }
    
    .vto-close-modal-btn {
        background: #6c757d;
        border-color: #6c757d;
    }
    
    .vto-close-modal-btn:hover {
        background: #5a6268;
    }
} 