/* Image & 3D Model Popup */
.image-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.9);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.image-popup-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.image-popup img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
}

.image-popup-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    color: white;
    border: none;
    font-size: 30px;
    cursor: pointer;
}

/* 3D Model Popup */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.8);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.popup-3d-container {
    position: relative;
    width: 90vw;
    height: 90vh;
    background: #f8f9fa;
    border-radius: 10px;
    overflow: hidden;
}

.popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    z-index: 100;
}

.popup-close:hover {
    background: rgba(0,0,0,0.9);
}

#popup-3d-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.popup-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    color: #333;
    z-index: 100;
}

.popup-controls {
    position: absolute;
    bottom: 20px;
    left: 20px;
    display: flex;
    gap: 15px;
    z-index: 100;
}

.popup-control-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
}

.popup-control-item i {
    color: #ff6b35;
}

.popup-zoom-controls {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 100;
}

.zoom-btn {
    width: 45px;
    height: 45px;
    background: rgba(44, 90, 160, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.zoom-btn:hover {
    background: rgba(44, 90, 160, 1);
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(44, 90, 160, 0.4);
}

.zoom-btn:active {
    transform: scale(0.95);
}

#autoRotateBtn.active {
    background: rgba(255, 107, 53, 0.9);
}

#autoRotateBtn.active:hover {
    background: rgba(255, 107, 53, 1);
}

@media (max-width: 768px) {
    .popup-3d-container {
        width: 95vw;
        height: 85vh;
        border-radius: 8px;
        margin: 2.5vh auto;
    }
    
    .popup-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 18px;
        background: rgba(0,0,0,0.8);
        backdrop-filter: blur(5px);
        -webkit-backdrop-filter: blur(5px);
    }
    
    .popup-controls {
        bottom: 15px;
        left: 15px;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        max-width: calc(100% - 30px);
    }
    
    .popup-control-item {
        font-size: 11px;
        padding: 6px 10px;
        white-space: nowrap;
    }
    
    .popup-loading {
        font-size: 16px;
    }
    
    /* Better touch interaction */
    #popup-3d-canvas {
        touch-action: pan-x pan-y;
    }
}

@media (max-width: 480px) {
    .popup-3d-container {
        width: 98vw;
        height: 80vh;
        margin: 1vh auto;
    }
    
    .popup-close {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .popup-controls {
        bottom: 8px;
        left: 8px;
        right: 8px;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .popup-control-item {
        font-size: 10px;
        padding: 4px 8px;
        margin-bottom: 2px;
    }
}