/**
 * TryMyLook Virtual Try-On Styles
 */

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

.trymylook-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    color: #ffffff !important;
}

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

/* Modal Overlay */
.trymylook-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

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

/* Modal Container */
.trymylook-modal {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Close Button */
.trymylook-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 32px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    z-index: 10;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.trymylook-modal-close:hover {
    background: #f5f5f5;
    color: #333;
}

/* Modal Content */
.trymylook-modal-content {
    padding: 40px;
}

.trymylook-modal-content h2 {
    margin: 0 0 30px 0;
    font-size: 28px;
    font-weight: 700;
    color: #333;
    text-align: center;
}

.trymylook-modal-content h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 600;
    color: #555;
}

/* Steps */
.trymylook-step {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid #e5e5e5;
}

.trymylook-step:last-of-type {
    border-bottom: none;
}

.trymylook-step.completed h3::before {
    content: "✓ ";
    color: #10b981;
}

/* Upload Area */
.trymylook-upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    transition: all 0.3s ease;
    background: #fafafa;
}

.trymylook-upload-area.dragging {
    border-color: #667eea;
    background: #f0f3ff;
}

.trymylook-upload-placeholder svg {
    color: #9ca3af;
    margin-bottom: 15px;
}

.trymylook-upload-placeholder p {
    color: #6b7280;
    margin: 0 0 15px 0;
    font-size: 14px;
}

.trymylook-browse-btn {
    display: inline-block;
    padding: 10px 20px;
    background: #667eea;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.trymylook-browse-btn:hover {
    background: #5568d3;
}

/* Image Preview */
.trymylook-image-preview {
    position: relative;
    display: inline-block;
}

.trymylook-image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.trymylook-remove-image {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 30px;
    height: 30px;
    background: #ef4444;
    color: #ffffff;
    border: 2px solid #ffffff;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
    transition: all 0.2s ease;
}

.trymylook-remove-image:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* Product Images Grid */
.trymylook-product-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
}

.trymylook-product-image {
    position: relative;
    border: 3px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    aspect-ratio: 1;
}

.trymylook-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.trymylook-product-image:hover {
    border-color: #d1d5db;
    transform: scale(1.05);
}

.trymylook-product-image.selected {
    border-color: #667eea;
    box-shadow: 0 0 0 2px #667eea33;
}

.trymylook-product-image.selected::after {
    content: "✓";
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background: #667eea;
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

/* Actions */
.trymylook-actions {
    text-align: center;
    margin-top: 30px;
}

.trymylook-generate-btn {
    padding: 14px 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border: none;
    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);
}

.trymylook-generate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.trymylook-generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Loading State */
.trymylook-loading {
    text-align: center;
    padding: 40px 20px;
}

.trymylook-spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    border: 4px solid #f3f4f6;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.trymylook-loading p {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0 0 10px 0;
}

.trymylook-loading small {
    color: #6b7280;
    font-size: 14px;
}

/* Result State */
.trymylook-result {
    text-align: center;
    padding: 20px 0;
}

.trymylook-result h3 {
    margin-bottom: 20px;
    text-align: center;
}

.trymylook-result-image {
    margin-bottom: 30px;
}

.trymylook-result-image img {
    max-width: 100%;
    max-height: 500px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.trymylook-result-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.trymylook-download-btn,
.trymylook-try-again-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.trymylook-download-btn {
    background: #10b981;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.trymylook-download-btn:hover {
    background: #059669;
    transform: translateY(-2px);
}

.trymylook-try-again-btn {
    background: #f3f4f6;
    color: #374151;
}

.trymylook-try-again-btn:hover {
    background: #e5e7eb;
}

/* Error State */
.trymylook-error {
    text-align: center;
    padding: 40px 20px;
}

.trymylook-error-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.trymylook-error-message {
    color: #ef4444;
    font-size: 16px;
    font-weight: 500;
    margin: 0 0 20px 0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .trymylook-modal {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .trymylook-modal-content {
        padding: 30px 20px;
    }

    .trymylook-modal-content h2 {
        font-size: 24px;
    }

    .trymylook-product-images {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
    }

    .trymylook-result-actions {
        flex-direction: column;
    }

    .trymylook-download-btn,
    .trymylook-try-again-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .trymylook-button {
        width: 100%;
        text-align: center;
    }

    .trymylook-modal-content h2 {
        font-size: 20px;
        margin-bottom: 20px;
    }

    .trymylook-modal-content h3 {
        font-size: 16px;
    }

    .trymylook-upload-area {
        padding: 30px 15px;
    }

    .trymylook-product-images {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Smooth scrollbar for modal */
.trymylook-modal::-webkit-scrollbar {
    width: 8px;
}

.trymylook-modal::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.trymylook-modal::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.trymylook-modal::-webkit-scrollbar-thumb:hover {
    background: #555;
}
