/* WC 360° Product Viewer - Frontend Styles */

.wc360-viewer-wrapper {
    position: relative;
    width: 100%;
    background: #f5f5f5;
    border-radius: 4px;
    overflow: hidden;
}

.wc360-canvas {
    display: block;
    width: 100%;
    height: auto;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    cursor: grab;
    position: relative;
    z-index: 1;
}

.wc360-canvas:active {
    cursor: grabbing;
}

/* Loading State */
.wc360-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    z-index: 10;
    transition: background 0.3s ease;
}

.wc360-loading.transparent {
    background: rgba(245, 245, 245, 0.8);
    backdrop-filter: blur(2px);
}

/* Loading Overlay - appears over first frame while rest load */
.wc360-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(1px);
    z-index: 10;
    transition: opacity 0.3s ease;
}

.wc360-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: wc360-spin 0.8s linear infinite;
}

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

.wc360-progress {
    margin-top: 15px;
    font-size: 14px;
    color: #fff;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.wc360-loading-overlay .wc360-spinner {
    border-color: rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
}

.wc360-loading-overlay .wc360-progress {
    color: #fff;
}

/* Controls */
.wc360-controls {
    position: absolute;
    bottom: 10px;
    left: 10px;
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
    z-index: 5;
}

.wc360-btn {
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    padding: 8px;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.wc360-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

.wc360-btn svg {
    width: 20px;
    height: 20px;
}

/* 360° Badge on Viewer */
.wc360-badge {
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    padding: 0;
    border-radius: 4px;
    letter-spacing: 0.5px;
    user-select: none;
    pointer-events: none;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* 360° Badge on Thumbnail */
.wc360-thumbnail {
    position: relative;
}

.wc360-thumb-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 3px;
    letter-spacing: 0.5px;
    pointer-events: none;
    z-index: 2;
}

/* Thumbnail hover effect */
.wc360-thumbnail:hover .wc360-thumb-badge {
    background: rgba(0, 0, 0, 0.9);
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .wc360-controls {
        bottom: 8px;
        left: 8px;
        gap: 6px;
    }
    
    .wc360-btn {
        width: 32px;
        height: 32px;
        padding: 6px;
    }
    
    .wc360-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .wc360-badge {
        font-size: 11px;
        width: 32px;
        height: 32px;
    }
    
    .wc360-thumb-badge {
        font-size: 10px;
        padding: 3px 6px;
    }
    
    .wc360-spinner {
        width: 40px;
        height: 40px;
        border-width: 3px;
    }
    
    .wc360-progress {
        font-size: 13px;
    }
}

/* Smooth transitions */
.wc360-viewer-wrapper * {
    -webkit-tap-highlight-color: transparent;
}

/* Prevent text selection during drag */
.wc360-canvas {
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
}

/* Loading fade animations */
.wc360-loading {
    transition: opacity 0.3s ease;
}

/* Theme compatibility */
.woocommerce-product-gallery .wc360-viewer-wrapper {
    margin: 0;
}

.woocommerce-product-gallery__image .wc360-viewer-wrapper {
    position: relative;
    display: block;
}

/* Ensure children fill the container */
.wc360-viewer-wrapper > .wc360-loading,
.wc360-viewer-wrapper > .wc360-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.wc360-viewer-wrapper > .wc360-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    width: auto;
    height: auto;
}

.wc360-canvas {
    position: absolute;
    pointer-events: auto;
}

/* Disable theme lightbox when 360 is active */
.woocommerce-product-gallery.wc360-active .woocommerce-product-gallery__trigger {
    display: none !important;
}
