/**
 * Marketplace Product 360 Degree View Module
 * Frontend CSS
 *
 * @author    Developer
 * @copyright 2024
 * @license   Commercial
 */

/* 360 View Section */
.kb-360view-section {
    margin: 20px 0;
}

.kb-360view-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.kb-360view-wrapper {
    display: flex;
    justify-content: center;
}

/* 360 Viewer */
.kb-360view-viewer {
    position: relative;
    background-color: #000;
    border-radius: 8px;
    overflow: hidden;
    user-select: none;
}

.kb-360view-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.kb-360view-image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kb-360view-image {
    position: absolute;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.1s ease;
}

.kb-360view-image.active {
    opacity: 1;
    z-index: 1;
}

/* Controls */
.kb-360view-controls {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.kb-360view-btn {
    background-color: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    pointer-events: auto;
    color: #333;
}

.kb-360view-btn:hover {
    background-color: #fff;
    transform: scale(1.1);
}

.kb-360view-fullscreen-btn {
    position: absolute;
    top: 15px;
    right: 15px;
}

.kb-360view-bottom-controls {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 8px 15px;
    border-radius: 30px;
}

.kb-360view-bottom-controls .kb-360view-btn {
    width: 36px;
    height: 36px;
}

.kb-360view-counter {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    pointer-events: none;
}

/* Loading */
.kb-360view-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    display: none;
}

.kb-360view-viewer.loading .kb-360view-loading {
    display: block;
}

.kb-360view-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: kb360spin 1s linear infinite;
}

@keyframes kb360spin {
    to {
        transform: rotate(360deg);
    }
}

/* Drag Hint */
.kb-360view-drag-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.kb-360view-viewer:hover .kb-360view-drag-hint {
    opacity: 1;
}

.kb-360view-viewer.playing .kb-360view-drag-hint,
.kb-360view-viewer.dragging .kb-360view-drag-hint {
    opacity: 0;
}

/* Playing state */
.kb-360view-viewer.playing .kb-360view-play-icon {
    display: none;
}

.kb-360view-viewer.playing .kb-360view-pause-icon {
    display: block !important;
}

/* Fullscreen Modal */
.kb-360view-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
}

.kb-360view-modal.active {
    display: flex;
}

.kb-360view-modal-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
}

.kb-360view-modal-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 10px;
    transition: transform 0.2s ease;
}

.kb-360view-modal-close:hover {
    transform: scale(1.2);
}

.kb-360view-modal-viewer {
    width: 100%;
    height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.kb-360view-modal-viewer .kb-360view-image-wrapper {
    width: 100%;
    height: 100%;
}

.kb-360view-modal-controls {
    position: absolute;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
}

.kb-360view-modal-controls .kb-360view-btn {
    width: 50px;
    height: 50px;
}

.kb-360view-modal-counter {
    position: absolute;
    bottom: -55px;
    right: 0;
    color: #fff;
    font-size: 14px;
}

/* Thumbnail trigger */
.kb-360view-thumbnail-trigger {
    position: relative;
    display: inline-block;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 4px;
    transition: border-color 0.2s ease;
}

.kb-360view-thumbnail-trigger:hover {
    border-color: #25b9d7;
}

.kb-360view-thumbnail-icon {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.kb-360view-badge {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 11px;
    text-align: center;
    padding: 2px;
    border-radius: 0 0 2px 2px;
}

/* Footer section specific */
.kb-360view-footer-section {
    padding: 20px;
    background-color: #f8f8f8;
    border-radius: 8px;
}

/* Tab section specific */
.kb-360view-tab-section {
    padding: 15px 0;
}

/* Responsive */
@media (max-width: 768px) {
    .kb-360view-viewer {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 1;
    }

    .kb-360view-btn {
        width: 36px;
        height: 36px;
    }

    .kb-360view-bottom-controls .kb-360view-btn {
        width: 32px;
        height: 32px;
    }

    .kb-360view-counter {
        font-size: 11px;
        padding: 6px 10px;
    }

    .kb-360view-modal-viewer {
        height: 50vh;
    }

    .kb-360view-modal-controls .kb-360view-btn {
        width: 40px;
        height: 40px;
    }
}

/* Touch device optimizations */
@media (hover: none) {
    .kb-360view-drag-hint {
        opacity: 1;
    }

    .kb-360view-viewer:active .kb-360view-drag-hint {
        opacity: 0;
    }
}
