/* Stork Virtual Try-On - Simplified CSS */

/* VTO Button */
.stork-vto-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    margin: 10px 0;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    display: inline-block;
    text-decoration: none;
}

.stork-vto-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.stork-vto-button:active {
    transform: translateY(0);
}

/* Modal */
#stork-vto-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.stork-vto-content {
    position: relative;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    margin: 2% auto;
    padding: 0;
    border-radius: 15px;
    width: 90%;
    max-width: 800px;
    height: 90vh;
    max-height: 600px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Close Button */
.stork-vto-close-button {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.stork-vto-close-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Simple Glasses Display */
#stork-simple-glasses {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#stork-simple-glasses img {
    max-width: 300px;
    max-height: 200px;
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

#stork-simple-glasses img:hover {
    transform: scale(1.05);
}

#stork-simple-glasses p {
    color: white;
    margin-top: 15px;
    font-size: 14px;
    font-weight: 500;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Loading States */
.stork-vto-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 18px;
    text-align: center;
}

.stork-vto-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-left: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .stork-vto-content {
        width: 95%;
        height: 95vh;
        margin: 2.5% auto;
    }
    
    #stork-simple-glasses {
        padding: 15px;
    }
    
    #stork-simple-glasses img {
        max-width: 250px;
        max-height: 150px;
    }
    
    .stork-vto-button {
        padding: 10px 20px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .stork-vto-content {
        width: 98%;
        height: 98vh;
        margin: 1% auto;
        border-radius: 10px;
    }
    
    #stork-simple-glasses img {
        max-width: 200px;
        max-height: 120px;
    }
    
    #stork-simple-glasses p {
        font-size: 12px;
    }
}

/* Video and Canvas Elements */
#stork-vto-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: 100vw;
    max-height: 100vh;
    box-sizing: border-box;
    object-fit: cover;
    z-index: 1;
    transform: scaleX(-1); /* Mirror the video */
    visibility: hidden; /* Hide video element since it's drawn on canvas */
    opacity: 0;
}

#stork-vto-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: 100vw;
    max-height: 100vh;
    box-sizing: border-box;
    z-index: 3; /* أعلى من الفيديو */
    pointer-events: none; /* لا تمنع التفاعل مع الفيديو */
    background: transparent; /* شفاف تماماً */
    /* تحسينات الجودة */
    image-rendering: auto;
    image-rendering: smooth;
    image-rendering: high-quality;
    /* تحسينات إضافية */
    transform: translateZ(0) scaleX(-1); /* Mirror the glasses to match the video */
    backface-visibility: hidden;
    perspective: 1000px;
    /* إصلاح مشكلة الرؤية */
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Color Variations Selector */
#stork-vto-color-selector {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
    display: none;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

#stork-vto-color-variations {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border: 1px solid #666;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    min-width: 150px;
    backdrop-filter: blur(5px);
}

/* Animation for modal appearance */
#stork-vto-modal.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.stork-vto-content.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { 
        transform: translateY(-50px);
        opacity: 0;
    }
    to { 
        transform: translateY(0);
        opacity: 1;
    }
}
