.vf-360-container {
    position: relative;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    background: transparent;
    overflow: hidden;
    touch-action: none;
    padding: 20px; /* Added padding to force car away from edges */
    box-sizing: border-box;
}

.vf-360-container:active {
    cursor: grabbing;
}

.vf-360-canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    object-fit: contain !important;
    transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
    opacity: 0;
    transform: scale(0.85) !important; /* Aggressive shrink to ensure it fits in the frame */
}

.vf-360-container.loaded .vf-360-canvas {
    opacity: 1;
}

/* Loading Overlay */
.vf-360-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    opacity: 0;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    z-index: 10;
    transition: opacity 0.5s ease;
}

.vf-loader-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(20, 100, 244, 0.1);
    border-top-color: #1464f4;
    border-radius: 50%;
    animation: vf-spin 1s linear infinite;
}

.vf-loader-text {
    padding: 10px 24px;
    background: rgba(15, 23, 42, 0.9);
    color: white;
    border-radius: 40px;
    font-weight: 700;
    font-size: 14px;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

/* Scroll/Drag Hint */
.vf-360-hint {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    padding: 14px 28px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    pointer-events: none;
    display: none;
    align-items: center;
    gap: 12px;
    z-index: 15;
    border: 1px solid rgba(255,255,255,0.5);
    backdrop-filter: blur(10px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.vf-360-hint.fade-out {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
}

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

/* Desktop styles - removing rigid min-height to ensure it fits the product stage */
@media (min-width: 1024px) {
    .vf-360-container {
        height: 100%;
    }
}

/* Mobile Portrait Fix - Optimized for 2026 devices */
@media (max-width: 768px) {
    .vf-360-container {
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
        margin: 0 auto !important; /* Auto margins center horizontally */
        padding: 0 !important; /* Loai bo padding de xe to bang anh dai dien */
        aspect-ratio: 16 / 9 !important; /* Dong bo ty le 16/9 voi Swiper */
        touch-action: none !important; /* Touch dragging works perfectly without vertical page jitter */
        overflow: hidden !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-sizing: border-box !important;
    }
    
    .vf-360-canvas {
        display: block !important;
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
        min-width: 0 !important;
        min-height: 0 !important;
        object-fit: contain !important;
        transform: scale(1) !important; /* Giữ tỷ lệ 100% (scale 1) để tránh bị cắt mất hai bên hình ảnh xe */
    }
    
    .vf-360-hint {
        top: 50% !important;
        bottom: auto !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        padding: 8px 16px !important;
        font-size: 11px !important;
        color: #0f172a !important;
        font-weight: 700 !important;
        background: rgba(255, 255, 255, 0.2) !important;
        backdrop-filter: blur(10px) !important;
        -webkit-backdrop-filter: blur(10px) !important;
        border: 1px solid rgba(255, 255, 255, 0.3) !important;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08) !important;
        gap: 6px !important;
    }
    
    .vf-360-hint svg {
        width: 14px !important;
        height: 14px !important;
    }
    
    .vf-360-hint.fade-out {
        transform: translate(-50%, -40%) !important;
        opacity: 0 !important;
    }
}


/* Tablet / Small Laptop */
@media (min-width: 769px) and (max-width: 1023px) {
    .vf-360-container {
        height: 450px !important;
        aspect-ratio: 16 / 9;
    }
}
