/**
 * WooCommerce Virtual Try-On Styles
 * Matches the Vue app styling from vue-tryon
 */

/* Google Fonts - Spline Sans */
@import url('https://fonts.googleapis.com/css2?family=Spline+Sans:wght@300;400;500;600;700&display=swap');

/* CSS Variables */
:root {
    --wvt-primary: #683adf;
    --wvt-primary-hover: #5a32c4;
    --wvt-primary-light: rgba(104, 58, 223, 0.1);
    --wvt-background-light: #f6f6f8;
    --wvt-background-dark: #161220;
    --wvt-text-dark: #131217;
    --wvt-text-muted: #6e6586;
    --wvt-border-light: #dfdce5;
    --wvt-white: #ffffff;
    --wvt-font-family: 'Spline Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --wvt-radius-sm: 0.375rem;
    --wvt-radius-md: 0.5rem;
    --wvt-radius-lg: 0.75rem;
    --wvt-radius-xl: 1rem;
    --wvt-radius-full: 9999px;
    --wvt-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --wvt-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --wvt-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --wvt-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Try On Button */
.wvt-tryon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    margin-top: 0.75rem;
    background-color: var(--wvt-primary);
    color: var(--wvt-white);
    font-family: var(--wvt-font-family);
    font-size: 0.9375rem;
    font-weight: 500;
    border: none;
    border-radius: var(--wvt-radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    box-shadow: var(--wvt-shadow-md);
}

.wvt-tryon-button:hover {
    background-color: var(--wvt-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--wvt-shadow-lg);
}

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

/* Material Icon sizes */
.material-icons {
    font-family: 'Material Icons' !important;
    font-size: 24px;
    vertical-align: middle;
}

.wvt-tryon-button .material-icons {
    font-size: 24px;
}

.wvt-btn .material-icons {
    font-size: 24px;
    flex-shrink: 0;
}

.wvt-remove-photo .material-icons {
    font-size: 20px;
}

.wvt-camera-btn .material-icons {
    font-size: 36px;
}

/* Ensure white text on primary buttons */
.wvt-btn-primary,
.wvt-btn-process,
.wvt-tryon-button {
    color: #ffffff !important;
}

.wvt-btn-primary span,
.wvt-btn-process span,
.wvt-tryon-button span {
    color: #ffffff !important;
}

.wvt-btn-primary .material-icons,
.wvt-btn-process .material-icons,
.wvt-tryon-button .material-icons {
    color: #ffffff !important;
}

/* Popup Overlay */
.wvt-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.wvt-popup-overlay.wvt-active {
    display: flex;
    opacity: 1;
}

/* Popup Container */
.wvt-popup {
    background-color: var(--wvt-white);
    border-radius: var(--wvt-radius-xl);
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--wvt-shadow-xl);
    font-family: var(--wvt-font-family);
    animation: wvt-slide-up 0.3s ease;
}

@keyframes wvt-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Popup Header */
.wvt-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--wvt-border-light);
    background-color: var(--wvt-white);
    position: sticky;
    top: 0;
    z-index: 10;
}

.wvt-popup-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--wvt-text-dark);
    margin: 0;
}

.wvt-close-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background-color: var(--wvt-background-light);
    border: none;
    border-radius: var(--wvt-radius-full);
    cursor: pointer;
    color: var(--wvt-text-muted);
    transition: all 0.2s ease;
    font-size: 1.75rem;
    line-height: 1;
}

.wvt-close-button:hover {
    background-color: var(--wvt-border-light);
    color: var(--wvt-text-dark);
}

/* Views */
.wvt-view {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.wvt-view.wvt-view-active {
    display: flex;
}

/* Popup Content */
.wvt-popup-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
}

/* Sections */
.wvt-section {
    margin-bottom: 1.5rem;
}

.wvt-section:last-child {
    margin-bottom: 0;
}

.wvt-section-header {
    margin-bottom: 0.75rem;
}

.wvt-section-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--wvt-text-dark);
    margin: 0 0 0.25rem 0;
}

.wvt-section-desc {
    font-size: 0.8125rem;
    color: var(--wvt-text-muted);
    margin: 0;
}

/* Photo Area */
.wvt-photo-area {
    background-color: var(--wvt-background-light);
    border-radius: var(--wvt-radius-lg);
    padding: 1rem;
}

.wvt-photo-buttons {
    display: flex;
    gap: 0.75rem;
}

.wvt-photo-preview {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: var(--wvt-radius-md);
    overflow: hidden;
    background-color: var(--wvt-text-dark);
}

.wvt-photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wvt-remove-photo {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 1.75rem;
    height: 1.75rem;
    background-color: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: var(--wvt-radius-full);
    cursor: pointer;
    color: var(--wvt-white);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.wvt-remove-photo:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

/* Garment Preview */
.wvt-garment-preview {
    background-color: var(--wvt-background-light);
    border-radius: var(--wvt-radius-lg);
    padding: 0.75rem;
    aspect-ratio: 3 / 4;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wvt-garment-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--wvt-radius-md);
}

/* Buttons */
.wvt-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    font-family: var(--wvt-font-family);
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    border-radius: var(--wvt-radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

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

.wvt-btn-primary {
    background-color: var(--wvt-primary);
    color: var(--wvt-white);
    flex: 1;
}

.wvt-btn-primary:hover:not(:disabled) {
    background-color: var(--wvt-primary-hover);
}

.wvt-btn-secondary {
    background-color: var(--wvt-white);
    color: var(--wvt-text-dark);
    border: 1px solid var(--wvt-border-light);
    flex: 1;
}

.wvt-btn-secondary:hover:not(:disabled) {
    background-color: var(--wvt-background-light);
}

.wvt-btn-text {
    background: none;
    color: var(--wvt-text-muted);
    padding: 0.5rem;
}

.wvt-btn-text:hover {
    color: var(--wvt-primary);
}

.wvt-btn-full {
    width: 100%;
}

/* Process Button */
.wvt-btn-process {
    background-color: var(--wvt-primary);
    color: var(--wvt-white);
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
}

.wvt-btn-process:hover:not(:disabled) {
    background-color: var(--wvt-primary-hover);
}

.wvt-btn-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Spinner */
.wvt-spinner {
    animation: wvt-spin 1s linear infinite;
}

@keyframes wvt-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Footer */
.wvt-popup-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--wvt-border-light);
    background-color: var(--wvt-white);
}

/* Camera View */
.wvt-camera-container {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 500px;
    background-color: var(--wvt-background-dark);
    display: flex;
    align-items: center;
    justify-content: center;
}

#wvt-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

.wvt-camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wvt-camera-guide {
    width: 75%;
    aspect-ratio: 3 / 4;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--wvt-radius-lg);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.4);
}

.wvt-camera-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
}

.wvt-camera-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--wvt-white);
    transition: all 0.2s ease;
}

.wvt-camera-btn-close,
.wvt-camera-btn-switch {
    width: 4rem;
    height: 4rem;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: var(--wvt-radius-full);
}

.wvt-camera-btn-close .material-icons,
.wvt-camera-btn-switch .material-icons {
    font-size: 36px;
}

.wvt-camera-btn-close:hover,
.wvt-camera-btn-switch:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.wvt-camera-btn-capture {
    width: 4.5rem;
    height: 4.5rem;
    background-color: var(--wvt-white);
    border-radius: var(--wvt-radius-full);
    padding: 0.25rem;
}

.wvt-camera-btn-capture:hover {
    transform: scale(1.05);
}

.wvt-capture-ring {
    width: 100%;
    height: 100%;
    border: 3px solid var(--wvt-primary);
    border-radius: var(--wvt-radius-full);
}

/* Result View */
.wvt-result-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background-color: var(--wvt-background-light);
    overflow: hidden;
}

.wvt-result-image-wrapper {
    width: 100%;
    max-width: 320px;
    aspect-ratio: 3 / 4;
    border-radius: var(--wvt-radius-lg);
    overflow: hidden;
    box-shadow: var(--wvt-shadow-lg);
}

.wvt-result-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wvt-result-actions {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background-color: var(--wvt-white);
    border-top: 1px solid var(--wvt-border-light);
}

.wvt-result-actions .wvt-btn-full + .wvt-btn-full {
    margin-top: 0;
}

.wvt-result-actions .wvt-btn-text {
    text-align: center;
}

/* Mobile Adjustments */
@media (max-width: 480px) {
    .wvt-tryon-button {
        padding: 1rem 1.5rem !important;
        font-size: 1rem;
    }

    .wvt-popup {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .wvt-popup-overlay {
        padding: 0;
    }

    .wvt-photo-buttons {
        flex-direction: column;
    }

    .wvt-btn-primary,
    .wvt-btn-secondary {
        width: 100%;
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }

    .wvt-btn svg {
        width: 28px;
        height: 28px;
    }

    .wvt-btn-process {
        padding: 1.25rem;
        font-size: 1.125rem;
    }

    /* Larger camera controls on mobile */
    .wvt-camera-btn-close,
    .wvt-camera-btn-switch {
        width: 4.5rem;
        height: 4.5rem;
    }

    .wvt-camera-btn-close .material-icons,
    .wvt-camera-btn-switch .material-icons {
        font-size: 48px;
    }

    .wvt-camera-btn-capture {
        width: 5.5rem;
        height: 5.5rem;
    }

    .wvt-btn .material-icons {
        font-size: 28px;
    }

    .wvt-camera-controls {
        padding: 2rem 1.5rem;
    }
}

/* Safe Area Support for iOS */
@supports (padding: max(0px)) {
    .wvt-popup-footer,
    .wvt-result-actions {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }

    .wvt-camera-controls {
        padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
    }
}
