/* 
 * Car 360 Viewer Styles
 * Styles for the 360-degree car viewer component
 */

/* Main container */
.car-360-viewer {
    position: relative;
    width: 100%;
    height: 600px;
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin: 30px 0;
}

/* Header */
.car-360-header {
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    z-index: 30;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.car-360-title {
    color: #000;
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
}

/* View selector */
.car-360-view-selector {
    display: flex;
    background-color: #f3f4f6;
    border-radius: 9999px;
    padding: 4px;
}

.car-360-view-button {
    padding: 8px 16px;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    background-color: #fff;
    color: #000;
    cursor: pointer;
    transition: all 0.5s ease-out;
}

.car-360-view-button:hover {
    background-color: #f9fafb;
    transform: scale(1.05);
}

.car-360-view-button.active {
    background-color: #000;
    color: #fff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: scale(1.05);
}

/* Content area */
.car-360-content {
    position: relative;
    width: 100%;
    height: 100%;
}

.car-360-exterior-view,
.car-360-interior-view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
}

.car-360-exterior-view.active,
.car-360-interior-view.active {
    display: block;
}

/* Image containers */
.car-360-image-container,
.car-360-interior-image-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
}

.car-360-image-container:active {
    cursor: grabbing;
}

.car-360-interior-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.3s;
}

.car-360-image {
    width: 120%;
    max-width: 120% !important;
    height: 120%;
    object-fit: contain;
    transition: opacity 0.3s;
}

@media (min-width: 768px) {
    .car-360-image,
    .car-360-interior-image {
        object-fit: cover;
    }
}

/* Rotation buttons */
.car-360-rotate-button {
    position: absolute;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.8);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.car-360-rotate-button:hover {
    background-color: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.car-360-rotate-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.car-360-rotate-left {
    left: 20px;
    bottom: 96px;
}

.car-360-rotate-right {
    right: 20px;
    bottom: 96px;
}

@media (min-width: 768px) {
    .car-360-rotate-button {
        width: 80px;
        height: 80px;
    }

    .car-360-rotate-left,
    .car-360-rotate-right {
        top: 50%;
        transform: translateY(-50%);
        bottom: auto;
    }

    .car-360-rotate-button:hover {
        transform: translateY(-50%) scale(1.1);
    }
}

.car-360-rotate-button span {
    font-size: 24px;
    line-height: 1;
}

/* Right arrow now uses its own SVG, no rotation needed */
.car-360-rotate-right span {
    /* No transform needed as we use a different SVG */
}

/* Color selector */
.car-360-color-selector {
    position: absolute;
    bottom: 16px;
    left: 16px;
    right: 16px;
    z-index: 30;
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.car-360-color-buttons {
    display: flex;
    gap: 12px;
}

.car-360-color-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #e5e7eb;
    padding: 0;
    cursor: pointer;
    transition: all 0.5s ease-out;
}

.car-360-color-button:hover {
    border-color: #9ca3af;
    transform: scale(1.05);
}

.car-360-color-button.active {
    border-color: #000;
    transform: scale(1.1);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.car-360-color-name {
    margin-left: 16px;
    font-size: 1.125rem;
    font-weight: 500;
    color: #4b5563;
    transition: all 0.3s ease-out;
}

/* Hotspots */
.car-360-hotspot {
    position: absolute;
    /*transform: translate(-50%, -50%);*/
    z-index: 10;
    cursor: pointer;
}

.car-360-hotspot-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #14b8a6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.3s;
    position: relative;
    z-index: 10;
    animation: pulse 2s infinite;
}

.car-360-hotspot-pulse {
    position: absolute;
    inset: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: rgba(20, 184, 166, 0.4);
    animation: ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.car-360-hotspot::after {
    content: '';
    position: absolute;
    top: -12px;
    left: -12px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(20, 184, 166, 0.15);
    animation: ping 2s cubic-bezier(0, 0, 0.2, 1) infinite;
    animation-delay: 0.5s;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes ping {
    75%, 100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* Modal */
.car-360-hotspot-modal {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.car-360-hotspot-modal-content {
    background-color: #fff;
    border-radius: 8px;
    padding: 24px;
    max-width: 500px;
    width: calc(100% - 32px);
    margin: 0 16px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.car-360-hotspot-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.car-360-hotspot-modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.car-360-hotspot-modal-close {
    font-size: 2rem;
    line-height: 1;
    color: #6b7280;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.car-360-hotspot-modal-close:hover {
    color: #1f2937;
}

.car-360-hotspot-modal-body p {
    margin-top: 0;
    line-height: 1.5;
}

/* Panorama viewer */
.car-360-panorama-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    background-color: #000;
    min-height: 400px; /* Ensure minimum height on all devices */
}

/* Loading indicator */
.car-360-loading-indicator {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    z-index: 40;
}

.car-360-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 3px solid white;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

/* Ensure Pannellum container takes full size */
.pnlm-container {
    width: 100% !important;
    height: 100% !important;
    background-color: #000;
}

/* Style Pannellum hotspots to match our design */
.pnlm-hotspot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #14b8a6;
    box-shadow: 0 0 10px rgba(20, 184, 166, 0.8);
    animation: pulse 2s infinite;
    cursor: pointer;
}

.pnlm-hotspot::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: rgba(20, 184, 166, 0.4);
    animation: ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
    z-index: -1;
}

.pnlm-hotspot::after {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(20, 184, 166, 0.15);
    animation: ping 2s cubic-bezier(0, 0, 0.2, 1) infinite;
    animation-delay: 0.5s;
    z-index: -2;
}

/* Hide default Pannellum hotspot text */
.pnlm-hotspot-text {
    display: none;
}

/* Pannellum controls */
.pnlm-controls-container {
    top: auto !important;
    bottom: 16px !important;
    right: auto !important;
    left: 16px !important;
}

/* Hide Pannellum attribution */
.pnlm-author-box {
    display: none !important;
}

/* Responsive styles for Pannellum */
@media (max-width: 768px) {
    /* Adjust container height for mobile */
    .car-360-viewer {
        height: 500px;
    }

    .car-360-panorama-container {
        min-height: 350px;
    }

    /* Make the animacion-360-container take up full width on mobile */
    .animacion-360-container .x-container {
        max-width: 100%;
        width: 100%;
        padding-left: 0;
        padding-right: 0;
    }

    /* Adjust Pannellum controls for mobile */
    .pnlm-controls-container {
        bottom: 8px !important;
    }

    .pnlm-zoom-controls {
        width: 26px !important;
        height: 52px !important;
    }

    .pnlm-zoom-in, .pnlm-zoom-out {
        width: 26px !important;
        height: 26px !important;
    }

    .pnlm-fullscreen-toggle-button {
        width: 26px !important;
        height: 26px !important;
    }

    /* Ensure touch events work properly */
    .pnlm-grab {
        cursor: grab !important;
    }

    .pnlm-grabbing {
        cursor: grabbing !important;
    }

    /* Improve hotspot visibility on mobile */
    .pnlm-hotspot {
        width: 24px !important;
        height: 24px !important;
    }
}

/* No images message */
.car-360-no-images {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6b7280;
    font-size: 1.125rem;
}


@media (max-width: 768px) {
    .car-360-content {
        display: flex;
        align-items: center;
    }
    .car-360-exterior-view {
        height: auto; /* Altura automática basada en el contenido */
        top: 50%; /* Centrar verticalmente */
        transform: translateY(-50%); /* Ajustar posición para centrado perfecto */
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .car-360-exterior-view.active {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .car-360-interior-view.active {
        display: block;
    }

}