/**
 * Defox Simple 360° Viewer - Modern Minimalist Design
 * 
 * Clean, modern styles for the 360° product viewer
 * 
 * @since 1.0.0
 */

/* ==========================================================================
   Modern 360° Viewer Container
   ========================================================================== */

.defox-simple-360-viewer {
    position: relative;
    width: 100%;
    max-width: 50%;
    margin: 0;
    background: transparent;
    border-radius: 0;
    overflow: visible;
    box-shadow: none;
}

.defox-360-main-container {
    position: relative;
    width: 100%;
    min-height: 400px;
    background: #fafafa;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.defox-360-main-container:hover {
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.defox-360-image {
    width: 100%;
    height: auto;
    min-height: 400px;
    object-fit: cover;
    cursor: zoom-in;
    user-select: none;
    transition: none;
    border-radius: 16px;
}

.defox-360-image:active {
    cursor: grabbing;
}

/* ==========================================================================
   Minimal Overlay Elements
   ========================================================================== */

.defox-360-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 2;
}

.defox-360-icon {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 6px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    backdrop-filter: blur(8px);
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.defox-360-drag-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 12px 20px;
    border-radius: 16px;
    backdrop-filter: blur(12px);
    transition: opacity 0.5s ease;
    pointer-events: none;
    max-width: 200px;
}

.defox-360-drag-text {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
    line-height: 1.3;
}

.defox-360-drag-arrows {
    display: block;
    font-size: 18px;
    opacity: 0.7;
}

/* ==========================================================================
   Modern Controls Panel
   ========================================================================== */

.defox-360-controls {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 16px;
    border-radius: 32px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    z-index: 10;
    transition: all 0.3s ease;
}

.defox-360-controls:hover {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.15);
}

.defox-360-btn {
    background: transparent;
    border: none;
    color: #333;
    font-size: 16px;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    position: relative;
}

.defox-360-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    transform: scale(1.05);
}

.defox-360-btn:active {
    transform: scale(0.95);
}

.defox-360-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 120, 255, 0.3);
}

/* Progress Container */
.defox-360-progress-container {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
}

.defox-360-progress-track {
    position: relative;
    height: 4px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
    cursor: pointer;
    overflow: hidden;
    flex: 1;
    min-width: 80px;
}

.defox-360-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #007aff, #0056cc);
    border-radius: 2px;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
}

.defox-360-progress-handle {
    position: absolute;
    top: -3px;
    width: 10px;
    height: 10px;
    background: #007aff;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(-50%);
    left: 0%;
}

.defox-360-progress-text {
    display: flex;
    align-items: center;
    gap: 2px;
    color: #666;
    font-size: 11px;
    font-weight: 600;
    min-width: 32px;
    text-align: center;
    justify-content: center;
}

/* ==========================================================================
   Minimal Preload Indicator
   ========================================================================== */

.defox-360-preload-indicator {
    position: absolute;
    top: 16px;
    left: 16px;
    background: rgba(255, 255, 255, 0.95);
    padding: 6px 12px;
    border-radius: 12px;
    backdrop-filter: blur(12px);
    transition: opacity 0.5s ease;
    z-index: 8;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.defox-360-preload-bar {
    height: 2px;
    background: linear-gradient(90deg, #34c759, #30d158);
    border-radius: 1px;
    transition: width 0.3s ease;
    width: 0%;
    margin-bottom: 4px;
}

.defox-360-preload-text {
    color: #666;
    font-size: 10px;
    font-weight: 500;
    text-align: center;
    line-height: 1;
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.defox-360-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    background: #fafafa;
    color: #666;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.defox-360-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top: 3px solid #007aff;
    border-radius: 50%;
    animation: defox-spin 1s linear infinite;
    margin-bottom: 12px;
}

@keyframes defox-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.defox-360-loading p {
    margin: 0;
    font-size: 13px;
    font-weight: 500;
    color: #999;
}

/* ==========================================================================
   Error States
   ========================================================================== */

.defox-360-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    background: #fafafa;
    color: #666;
    text-align: center;
    padding: 20px;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.defox-360-error p {
    margin: 0 0 12px 0;
    font-size: 13px;
    font-weight: 500;
}

.defox-360-retry {
    background: #007aff;
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.defox-360-retry:hover {
    background: #0056cc;
    transform: translateY(-1px);
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .defox-360-main-container {
        border-radius: 12px;
        min-height: 300px;
    }
    
    .defox-360-image {
        border-radius: 12px;
        min-height: 300px;
    }
    
    .defox-360-loading,
    .defox-360-error {
        min-height: 300px;
    }
    
    .defox-360-controls {
        bottom: 12px;
        padding: 6px 12px;
        gap: 8px;
    }
    
    .defox-360-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .defox-360-progress-container {
        min-width: 100px;
    }
    
    .defox-360-progress-track {
        min-width: 60px;
    }
    
    .defox-360-progress-text {
        font-size: 10px;
        min-width: 28px;
    }
    
    .defox-360-icon {
        top: 12px;
        right: 12px;
        padding: 4px 8px;
        font-size: 10px;
    }
    
    .defox-360-preload-indicator {
        top: 12px;
        left: 12px;
        padding: 4px 8px;
    }
    
    .defox-360-preload-text {
        font-size: 9px;
    }
}

@media (max-width: 480px) {
    .defox-360-main-container {
        min-height: 250px;
    }
    
    .defox-360-image {
        min-height: 250px;
    }
    
    .defox-360-loading,
    .defox-360-error {
        min-height: 250px;
    }
    .defox-360-controls {
        bottom: 8px;
        padding: 4px 8px;
        gap: 6px;
        flex-wrap: wrap;
        max-width: calc(100% - 16px);
    }
    
    .defox-360-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .defox-360-progress-container {
        order: 3;
        flex-basis: 100%;
        margin-top: 4px;
        min-width: auto;
    }
    
    .defox-360-drag-hint {
        padding: 8px 16px;
        max-width: 160px;
    }
    
    .defox-360-drag-text {
        font-size: 12px;
    }
    
    .defox-360-drag-arrows {
        font-size: 16px;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.defox-360-btn:focus-visible {
    outline: 2px solid #007aff;
    outline-offset: 2px;
}

/* Usuń focus outline z głównego kontenera */
.defox-simple-360-viewer:focus-within .defox-360-main-container {
    outline: none;
}

/* Screen reader text */
.defox-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   Performance Optimizations
   ========================================================================== */

.defox-360-image {
    will-change: transform;
    backface-visibility: hidden;
    transform: translateZ(0);
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .defox-360-spinner {
        animation: none;
    }
    
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .defox-360-main-container {
        background: #1a1a1a;
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .defox-360-main-container:hover {
        border-color: rgba(255, 255, 255, 0.2);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }
    
    .defox-360-loading,
    .defox-360-error {
        background: #1a1a1a;
        border-color: rgba(255, 255, 255, 0.1);
        color: #ccc;
    }
    
    .defox-360-spinner {
        border-color: rgba(255, 255, 255, 0.2);
        border-top-color: #0a84ff;
    }
    
    .defox-360-controls {
        background: rgba(28, 28, 30, 0.95);
        border-color: rgba(255, 255, 255, 0.1);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    }
    
    .defox-360-controls:hover {
        background: rgba(28, 28, 30, 0.98);
    }
    
    .defox-360-btn {
        color: #fff;
    }
    
    .defox-360-btn:hover {
        background: rgba(255, 255, 255, 0.1);
    }
    
    .defox-360-progress-track {
        background: rgba(255, 255, 255, 0.2);
    }
    
    .defox-360-progress-bar {
        background: linear-gradient(90deg, #0a84ff, #007aff);
    }
    
    .defox-360-progress-handle {
        background: #0a84ff;
    }
    
    .defox-360-progress-text {
        color: #ccc;
    }
    
    .defox-360-preload-indicator {
        background: rgba(28, 28, 30, 0.95);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .defox-360-preload-text {
        color: #ccc;
    }
    
    .defox-360-icon {
        background: rgba(0, 0, 0, 0.8);
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .defox-simple-360-viewer {
        break-inside: avoid;
    }
    
    .defox-360-controls,
    .defox-360-overlay,
    .defox-360-preload-indicator {
        display: none;
    }
    
    .defox-360-main-container {
        border-radius: 0;
        border: 1px solid #ccc;
    }
}

/* ==========================================================================
   Elementor Integration
   ========================================================================== */

.elementor-widget-defox-product-360 .defox-simple-360-viewer {
    margin: 0;
}

.elementor-widget-defox-product-360 .defox-360-main-container {
    border-radius: inherit;
}

/* ==========================================================================
   Touch Gestures Enhancement
   ========================================================================== */

@media (hover: none) and (pointer: coarse) {
    .defox-360-image {
        cursor: default;
    }
    
    .defox-360-image:active {
        cursor: default;
    }
    
    .defox-360-btn:hover {
        transform: none;
        background: transparent;
    }
    
    .defox-360-btn:active {
        transform: scale(0.95);
        background: rgba(0, 0, 0, 0.1);
    }
    
    .defox-360-main-container:hover {
        border-color: rgba(0, 0, 0, 0.06);
        box-shadow: none;
    }
    
    .defox-360-controls:hover {
        background: rgba(255, 255, 255, 0.95);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    }
}

/* ==========================================================================
   Fullscreen Lightbox
   ========================================================================== */

.defox-360-fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(8px);
}

.defox-360-fullscreen-overlay.defox-360-fullscreen-visible {
    opacity: 1;
}

.defox-360-fullscreen-content {
    position: relative;
    width: 90vw;
    height: 90vh;
    max-width: 1200px;
    max-height: 800px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.defox-360-fullscreen-viewer {
    width: 100%;
    height: 100%;
}

.defox-360-fullscreen-viewer .defox-simple-360-viewer {
    width: 100%;
    height: 100%;
    max-width: none;
}

.defox-360-fullscreen-viewer .defox-360-main-container {
    height: 100%;
    min-height: 100%;
    border-radius: 12px;
}

.defox-360-fullscreen-viewer .defox-360-image {
    height: 100%;
    min-height: 100%;
    cursor: grab;
}

.defox-360-fullscreen-viewer .defox-360-image:active {
    cursor: grabbing;
}

.defox-360-fullscreen-close {
    position: absolute;
    top: -50px;
    right: -10px;
    background: transparent !important;
    border: none;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: white !important;
    z-index: 1000000;
    font-weight: 300;
    line-height: 1;
    opacity: 1;
}

/* Zablokuj wszystkie możliwe hover effects */
.defox-360-fullscreen-close:hover {
    background: transparent !important;
    color: white !important;
    transform: none !important;
    opacity: 1 !important;
    box-shadow: none !important;
    border: none !important;
}

.defox-360-fullscreen-close:active {
    background: transparent !important;
    color: white !important;
    transform: none !important;
    opacity: 1 !important;
    box-shadow: none !important;
    border: none !important;
}

.defox-360-fullscreen-close:focus {
    background: transparent !important;
    color: white !important;
    transform: none !important;
    opacity: 1 !important;
    box-shadow: none !important;
    border: none !important;
    outline: none !important;
}

/* Blokada selection pseudo-elementu */
.defox-360-fullscreen-close::selection {
    background: transparent !important;
    color: white !important;
}

.defox-360-fullscreen-close::-moz-selection {
    background: transparent !important;
    color: white !important;
}

.defox-360-fullscreen-close span {
    line-height: 1;
    margin: 0;
    font-family: Arial, sans-serif;
}

/* Dark mode for fullscreen */
@media (prefers-color-scheme: dark) {
    .defox-360-fullscreen-overlay {
        background: rgba(0, 0, 0, 0.98);
    }
    
    .defox-360-fullscreen-close {
        color: #fff;
    }
}

/* Responsive fullscreen */
@media (max-width: 768px) {
    .defox-360-fullscreen-content {
        width: 95vw;
        height: 95vh;
    }
    
    .defox-360-fullscreen-close {
        top: -40px;
        right: 0;
        width: 44px;
        height: 44px;
        font-size: 28px;
    }
}
