/**
 * ExploreXR Annotations Add-On - Annotation Styles
 * 
 * Styles for annotation hotspots and popups.
 */

/* Container positioning context - ensures annotations are positioned correctly */
.ExploreXR-model-container,
.ExploreXR-model-viewer-container,
.explorexr-premium-model-viewer-wrapper {
    position: relative;
}

/* Hotspot Styles */
.explorexr-premium-hotspot {
    display: block;
    width: var(--hotspot-size, 20px);
    height: var(--hotspot-size, 20px);
    border-radius: 50%;
    border: none;
    background-color: #1e88e5;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
    padding: 0;
    position: relative;
    cursor: pointer;
    transform: translate(-50%, -50%);
    transition: transform 0.2s ease, opacity 0.3s ease;
    z-index: 10;
}

.explorexr-premium-hotspot:hover {
    transform: translate(-50%, -50%) scale(1.2);
}

.explorexr-premium-hotspot::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30%;
    height: 30%;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: transform 0.2s ease;
}

.explorexr-premium-hotspot:hover::before {
    transform: translate(-50%, -50%) scale(1.2);
}

.explorexr-premium-hotspot.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Annotation Content Styles */
.explorexr-premium-annotation-content {
    position: absolute;
    display: none;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: 4px;
    padding: 12px 15px;
    width: 280px;
    max-width: 90%;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    z-index: 100;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.explorexr-premium-annotation-content.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Arrow pointer - dynamically positioned via JavaScript */
.explorexr-premium-annotation-content::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    transition: top 0.3s ease, left 0.3s ease, border-color 0.3s ease;
}

/* Arrow pointing left (box is to the right of hotspot) */
.explorexr-premium-annotation-content.arrow-left::after {
    top: var(--arrow-top, 15px);
    left: -8px;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 8px solid rgba(0, 0, 0, 0.8);
}

/* Arrow pointing right (box is to the left of hotspot) */
.explorexr-premium-annotation-content.arrow-right::after {
    top: var(--arrow-top, 15px);
    right: -8px;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 8px solid rgba(0, 0, 0, 0.8);
}

/* Arrow pointing up (box is below hotspot) */
.explorexr-premium-annotation-content.arrow-top::after {
    top: -8px;
    left: var(--arrow-left, 50%);
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid rgba(0, 0, 0, 0.8);
}

/* Arrow pointing down (box is above hotspot) */
.explorexr-premium-annotation-content.arrow-bottom::after {
    bottom: -8px;
    left: var(--arrow-left, 50%);
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid rgba(0, 0, 0, 0.8);
}

.explorexr-premium-annotation-title {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: bold;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    padding-bottom: 0;
}

.explorexr-premium-annotation-text {
    font-size: 14px;
    line-height: 1.4;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.explorexr-premium-annotation-text p {
    margin: 0 0 8px 0;
}

.explorexr-premium-annotation-text p:last-child {
    margin-bottom: 0;
}

.explorexr-premium-annotation-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 18px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.explorexr-premium-annotation-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Animated Hotspot Styles */
.explorexr-premium-animated-hotspot {
    position: relative;
    overflow: visible;
}

.explorexr-premium-hotspot-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: inherit;
    opacity: 0.5;
    transform: translate(-50%, -50%) scale(1);
    animation: explorexr-premium-pulse 2s ease-out infinite;
    pointer-events: none;
}

@keyframes explorexr-premium-pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.7;
    }
    100% {
        transform: translate(-50%, -50%) scale(2.5);
        opacity: 0;
    }
}

/* Dimension Annotations Styles */
.explorexr-premium-dimension-hotspot {
    width: var(--hotspot-size, 12px);
    height: var(--hotspot-size, 12px);
    opacity: 0.8;
}

.explorexr-premium-dimension-label {
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    pointer-events: auto;
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
    transform: translate(-50%, -50%);
}

.explorexr-premium-dimension-content {
    max-width: 250px;
}

/* Hidden class for hotspots - REMOVED, hotspots should always be visible */
/* The .hidden class was causing all hotspots to be invisible on frontend */

.explorexr-premium-dimension-lines-container {
    pointer-events: none;
    z-index: 10;
}

/* Enhanced Dimension Annotations Styles */
.explorexr-premium-dimension-hotspot.dot {
    width: var(--hotspot-size, 8px);
    height: var(--hotspot-size, 8px);
    opacity: 0.9;
    border: none !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.explorexr-premium-dimension-label.dim {
    background-color: rgba(0, 0, 0, 0.8) !important;
    color: white !important;
    padding: 4px 8px !important;
    border-radius: 12px !important;
    font-size: 12px !important;
    font-weight: bold !important;
    border: none !important;
    pointer-events: auto !important;
    cursor: pointer !important;
    text-align: center !important;
    white-space: nowrap !important;
    transform: translate(-50%, -50%) !important;
    min-width: max-content !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.explorexr-premium-dimension-label.dim:hover {
    background-color: rgba(0, 0, 0, 0.9) !important;
    transform: translate(-50%, -50%) scale(1.05) !important;
}

/* Dimension line container */
.explorexr-premium-dimension-lines-container {
    pointer-events: none !important;
    z-index: 10 !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    overflow: visible !important;
}

.explorexr-premium-dimension-lines {
    pointer-events: none;
}

.dimensionLine {
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.explorexr-premium-dimension-lines.hide,
.dimensionLine.hide {
    opacity: 0 !important;
    visibility: hidden;
}

/* Camera View Annotations Styles */
.explorexr-premium-camera-view-hotspot {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(55, 125, 255, 0.85) !important;
}

.explorexr-premium-camera-view-icon {
    width: 70%;
    height: 70%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.explorexr-premium-camera-view-icon svg {
    width: 100%;
    height: 100%;
    fill: white;
}

.explorexr-premium-camera-view-button {
    display: block;
    margin: 10px auto 0;
    padding: 5px 15px;
    background-color: #1e88e5;
    color: white;
    border: none;
    border-radius: 3px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.explorexr-premium-camera-view-button:hover {
    background-color: #1565c0;
}

/* Mobile Styles */
@media (max-width: 767px) {
    .explorexr-premium-annotation-content {
        width: 240px;
        padding: 10px;
    }
    
    .explorexr-premium-annotation-title {
        font-size: 14px;
        margin-bottom: 6px;
        padding-right: 20px;
    }
    
    .explorexr-premium-annotation-text {
        font-size: 13px;
    }
    
    .explorexr-premium-annotation-close {
        top: 6px;
        right: 6px;
        font-size: 16px;
    }
}

/* Always display mode adjustments */
model-viewer[data-annotations-display-mode="always"] .explorexr-premium-annotation-content {
    position: relative;
    display: block;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    margin-top: 10px;
    width: 100%;
}

model-viewer[data-annotations-display-mode="always"] .explorexr-premium-annotation-content::after {
    display: none;
}
