/**
 * WVTO Components CSS
 * 
 * Isolated component styles using design tokens.
 * All components are self-contained and independent of theme styles.
 * 
 * @package Woo_Virtual_Try_On
 * @since 2.0.0
 */

/* ==========================================================================
   Base Typography
   ========================================================================== */

[class*="wvto-"] {
    font-family: var(--wvto-font-family);
    font-size: var(--wvto-text-base);
    font-weight: var(--wvto-font-normal);
    line-height: var(--wvto-leading-normal);
    color: var(--wvto-text-primary);
}

/* ==========================================================================
   Button System - Premium Aesthetics
   ========================================================================== */

/**
 * Base button styles with hardcoded fallbacks
 */
.wvto-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;

    min-height: 48px !important;
    padding: 14px 28px !important;

    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    text-decoration: none !important;

    border: none !important;
    border-radius: 50px !important;

    cursor: pointer !important;
    user-select: none !important;

    /* Smooth transitions */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;

    /* Prevent theme overrides */
    box-sizing: border-box !important;
    outline: none !important;
}

.wvto-btn:hover {
    transform: translateY(-3px) scale(1.02) !important;
}

.wvto-btn:active {
    transform: translateY(-1px) scale(0.98) !important;
}

.wvto-btn:disabled,
.wvto-btn.wvto-btn--disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

/**
 * Primary Button - Beautiful Purple Gradient
 */
.wvto-btn--primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4),
        0 2px 6px rgba(0, 0, 0, 0.1) !important;
}

.wvto-btn--primary:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%) !important;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5),
        0 4px 10px rgba(0, 0, 0, 0.15) !important;
}

.wvto-btn--primary:active {
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4) !important;
}

/**
 * Secondary Button - Modern Gray
 */
.wvto-btn--secondary {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(45, 55, 72, 0.3),
        0 2px 6px rgba(0, 0, 0, 0.1) !important;
}

.wvto-btn--secondary:hover {
    background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%) !important;
    box-shadow: 0 8px 25px rgba(45, 55, 72, 0.4),
        0 4px 10px rgba(0, 0, 0, 0.15) !important;
}

/**
 * Success Button - Emerald Gradient
 */
.wvto-btn--success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4),
        0 2px 6px rgba(0, 0, 0, 0.1) !important;
}

.wvto-btn--success:hover {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%) !important;
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.5),
        0 4px 10px rgba(0, 0, 0, 0.15) !important;
}

/**
 * Danger Button - Vibrant Red (DESCARGAR)
 */
.wvto-btn--danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4),
        0 2px 6px rgba(0, 0, 0, 0.1) !important;
}

.wvto-btn--danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%) !important;
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.5),
        0 4px 10px rgba(0, 0, 0, 0.15) !important;
}

/**
 * WhatsApp Button - Official Green with Glow
 */
.wvto-btn--whatsapp {
    background: linear-gradient(135deg, #25d366 0%, #128c7e 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4),
        0 2px 6px rgba(0, 0, 0, 0.1) !important;
}

.wvto-btn--whatsapp:hover {
    background: linear-gradient(135deg, #128c7e 0%, #25d366 100%) !important;
    box-shadow: 0 8px 25px rgba(37, 211, 102, 0.5),
        0 4px 10px rgba(0, 0, 0, 0.15) !important;
}

/**
 * Outline variant
 */
.wvto-btn--outline {
    background: transparent !important;
    border: 2px solid #667eea !important;
    color: #667eea !important;
    box-shadow: none !important;
}

.wvto-btn--outline:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: #ffffff !important;
    border-color: transparent !important;
}

/**
 * Button Sizes
 */
.wvto-btn--sm {
    min-height: 36px !important;
    padding: 8px 16px !important;
    font-size: 12px !important;
}

.wvto-btn--lg {
    min-height: 56px !important;
    padding: 18px 36px !important;
    font-size: 16px !important;
}

/* ==========================================================================
   Modal
   ========================================================================== */

/**
 * Modal Overlay
 */
.wvto-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;

    display: flex;
    align-items: center;
    justify-content: center;

    background-color: var(--wvto-bg-overlay);
    z-index: var(--wvto-z-modal);

    opacity: 0;
    visibility: hidden;
    transition: opacity var(--wvto-duration-normal) var(--wvto-ease-out),
        visibility var(--wvto-duration-normal) var(--wvto-ease-out);
}

.wvto-modal.wvto-modal--active,
.wvto-modal[style*="display: block"],
.wvto-modal[style*="display:block"] {
    opacity: 1;
    visibility: visible;
}

/**
 * Modal Content
 */
.wvto-modal__content,
.wvto-modal-content {
    position: relative;
    width: var(--wvto-modal-width);
    max-width: var(--wvto-modal-max-width);
    max-height: var(--wvto-modal-max-height);

    padding: var(--wvto-modal-padding);

    background-color: var(--wvto-bg-modal);
    border-radius: var(--wvto-radius-xl);
    box-shadow: var(--wvto-shadow-2xl);

    overflow-y: auto;

    transform: scale(0.95);
    transition: transform var(--wvto-duration-normal) var(--wvto-ease-out);
}

.wvto-modal.wvto-modal--active .wvto-modal__content,
.wvto-modal.wvto-modal--active .wvto-modal-content,
.wvto-modal[style*="display: block"] .wvto-modal__content,
.wvto-modal[style*="display: block"] .wvto-modal-content,
.wvto-modal[style*="display:block"] .wvto-modal__content,
.wvto-modal[style*="display:block"] .wvto-modal-content {
    transform: scale(1);
}

/**
 * Modal Close Button
 */
.wvto-modal__close,
.wvto-close {
    position: absolute;
    top: var(--wvto-space-4);
    right: var(--wvto-space-4);

    display: flex;
    align-items: center;
    justify-content: center;

    width: 2rem;
    height: 2rem;

    font-size: var(--wvto-text-2xl);
    font-weight: var(--wvto-font-bold);
    line-height: 1;
    color: var(--wvto-text-muted);

    background-color: transparent;
    border-radius: var(--wvto-radius-full);

    cursor: pointer;
    transition: var(--wvto-transition-fast);
}

.wvto-modal__close:hover,
.wvto-close:hover {
    color: var(--wvto-text-primary);
    background-color: var(--wvto-gray-100);
}

/**
 * Modal Header
 */
.wvto-modal__content h2,
.wvto-modal-content h2 {
    margin-bottom: var(--wvto-space-4);
    padding-right: var(--wvto-space-8);

    font-size: var(--wvto-text-2xl);
    font-weight: var(--wvto-font-bold);
    color: var(--wvto-text-primary);
}

.wvto-modal__content h3,
.wvto-modal-content h3 {
    margin-bottom: var(--wvto-space-4);

    font-size: var(--wvto-text-xl);
    font-weight: var(--wvto-font-semibold);
    color: var(--wvto-text-primary);
}

.wvto-modal__content p,
.wvto-modal-content p {
    margin-bottom: var(--wvto-space-4);

    font-size: var(--wvto-text-base);
    color: var(--wvto-text-secondary);
    line-height: var(--wvto-leading-relaxed);
}

/* ==========================================================================
   Upload Area
   ========================================================================== */

.wvto-upload-area,
.wvto-upload {
    display: flex;
    flex-wrap: wrap;
    gap: var(--wvto-space-3);
    justify-content: center;

    margin-top: var(--wvto-space-6);
    padding: var(--wvto-space-6);

    background-color: var(--wvto-gray-50);
    border: 2px dashed var(--wvto-gray-300);
    border-radius: var(--wvto-radius-lg);

    transition: var(--wvto-transition-fast);
}

.wvto-upload-area:hover,
.wvto-upload:hover {
    border-color: var(--wvto-primary);
    background-color: var(--wvto-primary-light);
}

/* ==========================================================================
   Camera / Video
   ========================================================================== */

#wvto-video,
.wvto-video {
    width: 100%;
    max-width: var(--wvto-camera-max-width);
    margin: var(--wvto-space-4) auto;

    background-color: var(--wvto-bg-camera);
    border-radius: var(--wvto-radius-lg);
}

#wvto-canvas,
.wvto-canvas {
    display: none;
}

/* ==========================================================================
   Spinner / Loader
   ========================================================================== */

.wvto-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    padding: var(--wvto-space-8);
    text-align: center;
}

.wvto-loader {
    width: var(--wvto-spinner-size);
    height: var(--wvto-spinner-size);

    border: var(--wvto-spinner-border-width) solid var(--wvto-gray-200);
    border-top-color: var(--wvto-spinner-color);
    border-radius: var(--wvto-radius-full);

    animation: wvto-spin 1s linear infinite;
}

@keyframes wvto-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Safari support */
@-webkit-keyframes wvto-spin {
    from {
        -webkit-transform: rotate(0deg);
    }

    to {
        -webkit-transform: rotate(360deg);
    }
}

/* ==========================================================================
   Progress Bar
   ========================================================================== */

.wvto-progress-container,
.wvto-progress {
    width: 100%;
    max-width: 300px;
    height: var(--wvto-progress-height);
    margin: var(--wvto-space-4) auto;

    background-color: var(--wvto-progress-bg);
    border-radius: var(--wvto-radius-full);
    overflow: hidden;
}

#wvto-progress-bar,
.wvto-progress__bar {
    height: 100%;
    width: 0%;

    background: linear-gradient(90deg, var(--wvto-primary), var(--wvto-primary-hover));
    border-radius: var(--wvto-radius-full);

    transition: width var(--wvto-duration-normal) var(--wvto-ease-out);
}

#wvto-progress-text,
.wvto-progress__text {
    margin-top: var(--wvto-space-3);

    font-size: var(--wvto-text-sm);
    font-weight: var(--wvto-font-medium);
    color: var(--wvto-text-secondary);
}

/* ==========================================================================
   Result Container
   ========================================================================== */

#wvto-result-container,
.wvto-result {
    position: relative;
    display: flex;
    justify-content: center;

    margin-bottom: var(--wvto-space-6);
    overflow: hidden;
    border-radius: var(--wvto-radius-lg);
}

#wvto-result-image,
.wvto-result__image {
    max-width: 100%;
    height: auto;

    border-radius: var(--wvto-radius-lg);
    cursor: zoom-in;

    transform-origin: center center;
    transition: transform var(--wvto-duration-fast) var(--wvto-ease-out);
}

#wvto-result-image.zoomed,
.wvto-result__image.zoomed {
    transform: scale(2);
    cursor: zoom-out;
}

/* ==========================================================================
   Actions Container - Premium Buttons
   ========================================================================== */

.wvto-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 12px !important;
    justify-content: center !important;
    margin-top: 24px !important;
    padding: 0 !important;
}

/* All buttons in actions get premium styling */
.wvto-actions .wvto-btn,
.wvto-actions .button,
.wvto-actions button,
.wvto-actions a {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;

    min-height: 48px !important;
    padding: 14px 24px !important;

    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    text-decoration: none !important;

    border: none !important;
    border-radius: 50px !important;

    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.wvto-actions .wvto-btn:hover,
.wvto-actions .button:hover,
.wvto-actions button:hover,
.wvto-actions a:hover {
    transform: translateY(-3px) scale(1.02) !important;
}

/* DESCARGAR Button - Vibrant Red Gradient */
#wvto-download-btn {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4),
        0 2px 6px rgba(0, 0, 0, 0.1) !important;
}

#wvto-download-btn:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.5),
        0 4px 10px rgba(0, 0, 0, 0.15) !important;
}

/* WHATSAPP Button - Official Green with Glow */
#wvto-share-whatsapp {
    background: linear-gradient(135deg, #25d366 0%, #128c7e 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4),
        0 2px 6px rgba(0, 0, 0, 0.1) !important;
}

#wvto-share-whatsapp:hover {
    background: linear-gradient(135deg, #128c7e 0%, #075e54 100%) !important;
    box-shadow: 0 8px 25px rgba(37, 211, 102, 0.5),
        0 4px 10px rgba(0, 0, 0, 0.15) !important;
}

/* REINTENTAR & NUEVA FOTO Buttons - Modern Gray */
#wvto-retry-btn,
#wvto-regenerate-btn {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(45, 55, 72, 0.3),
        0 2px 6px rgba(0, 0, 0, 0.1) !important;
}

#wvto-retry-btn:hover,
#wvto-regenerate-btn:hover {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%) !important;
    box-shadow: 0 8px 25px rgba(45, 55, 72, 0.4),
        0 4px 10px rgba(0, 0, 0, 0.15) !important;
}

/* ==========================================================================
   Error Message
   ========================================================================== */

#wvto-error-message,
.wvto-error {
    padding: var(--wvto-space-4);
    margin: var(--wvto-space-4) 0;

    background-color: var(--wvto-danger-light);
    border: 1px solid var(--wvto-danger-border);
    border-radius: var(--wvto-radius-md);

    text-align: center;
}

#wvto-error-message strong,
.wvto-error__title {
    display: block;
    margin-bottom: var(--wvto-space-2);

    font-weight: var(--wvto-font-semibold);
    color: var(--wvto-danger);
}

#wvto-error-message p,
.wvto-error__message {
    margin: var(--wvto-space-2) 0;
    color: var(--wvto-text-secondary);
}

/* ==========================================================================
   Guest Limit Step
   ========================================================================== */

.wvto-step-limit {
    text-align: center;
    padding: var(--wvto-space-8) var(--wvto-space-4);
}

.wvto-step-limit h3 {
    font-size: var(--wvto-text-2xl);
    font-weight: var(--wvto-font-bold);
    color: var(--wvto-text-primary);
    margin-bottom: var(--wvto-space-4);
}

.wvto-step-limit p {
    font-size: var(--wvto-text-base);
    color: var(--wvto-text-secondary);
    margin-bottom: var(--wvto-space-3);
}

.wvto-step-limit strong {
    color: var(--wvto-text-primary);
}

/* ==========================================================================
   Trigger Button (Product Page) - Premium Animated
   ========================================================================== */

.wvto-button-wrapper {
    margin: 16px 0 !important;
    padding: 0 !important;
}

/* Position: Below the button (default - vertical stack) */
.wvto-button-wrapper.wvto-subtitle-below {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 6px !important;
}

/* Position: Beside the button (horizontal inline) */
.wvto-button-wrapper.wvto-subtitle-beside {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 12px !important;
}

.wvto-button-subtitle {
    margin: 0 !important;
    padding: 0 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-size: 12px !important;
    font-weight: 400 !important;
    color: #64748b !important;
    font-style: italic !important;
    line-height: 1.4 !important;
}

/* Beside position: limit width for better layout */
.wvto-subtitle-beside .wvto-button-subtitle {
    max-width: 200px !important;
}

#wvto-trigger-button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;

    min-height: 54px !important;
    padding: 16px 32px !important;

    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    text-decoration: none !important;

    /* Animated Gradient Background */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%) !important;
    background-size: 200% 200% !important;
    animation: wvto-gradient-shift 3s ease infinite !important;

    color: #ffffff !important;

    border: none !important;
    border-radius: 50px !important;

    /* Glow Effect */
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.5),
        0 2px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;

    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;

    /* Prevent theme overrides */
    box-sizing: border-box !important;
    outline: none !important;
}

/* Gradient Animation */
@keyframes wvto-gradient-shift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

#wvto-trigger-button:hover {
    transform: translateY(-4px) scale(1.03) !important;
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.6),
        0 4px 12px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
}

#wvto-trigger-button:active {
    transform: translateY(-2px) scale(1.01) !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4),
        0 2px 6px rgba(0, 0, 0, 0.15) !important;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 640px) {

    .wvto-modal__content,
    .wvto-modal-content {
        padding: var(--wvto-space-4);
        margin: var(--wvto-space-4);
        max-height: calc(100vh - 2rem);
    }

    .wvto-modal__content h2,
    .wvto-modal-content h2 {
        font-size: var(--wvto-text-xl);
    }

    .wvto-actions {
        flex-direction: column;
    }

    .wvto-actions .button,
    .wvto-actions button,
    .wvto-btn {
        width: 100%;
    }

    #wvto-trigger-button {
        width: 100%;
    }
}