/**
 * ExploreXR Annotations - Advanced Features Styles
 * 
 * Styles for animated hotspots, dimension lines, and camera view hotspots
 * 
 * @package ExploreXR_Annotations
 * @since 1.0.0
 */

/* ===========================
   Animated Hotspots
   =========================== */

.explorexr-animated-hotspot {
    position: relative;
}

.explorexr-animated-label {
    background: #fff;
    border-radius: 4px;
    border: none;
    box-sizing: border-box;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
    color: rgba(0, 0, 0, 0.8);
    display: block;
    font-family: Futura, Helvetica Neue, sans-serif;
    font-size: 18px;
    font-weight: 700;
    max-width: 128px;
    padding: 0.5em 1em;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.explorexr-animated-label:hover {
    transform: translate(-50%, -100%) scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.lineContainer {
    pointer-events: none;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.line {
    stroke: #16a5e6;
    stroke-width: 2;
    stroke-dasharray: 2;
}

.explorexr-label-container {
    pointer-events: none;
}

.explorexr-label-container > * {
    pointer-events: auto;
}

/* ===========================
   Dimension Lines
   =========================== */

.dot {
    display: none; /* Hidden dots for dimension calculation */
}

.dim {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    border: none;
    box-sizing: border-box;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
    color: rgba(0, 0, 0, 0.8);
    display: block;
    font-family: Futura, Helvetica Neue, sans-serif;
    font-size: 1em;
    font-weight: 700;
    max-width: 128px;
    overflow-wrap: break-word;
    padding: 0.5em 1em;
    position: absolute;
    width: max-content;
    height: max-content;
    transform: translate3d(-50%, -50%, 0);
    pointer-events: none;
    --min-hotspot-opacity: 0;
}

@media only screen and (max-width: 800px) {
    .dim {
        font-size: 3vw;
    }
}

.dimensionLineContainer {
    pointer-events: none;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.dimensionLine {
    stroke: #16a5e6;
    stroke-width: 2;
    stroke-dasharray: 2;
}

.hide {
    display: none !important;
}

/* Dimension controls */
.glass {
    background: rgba(255, 255, 255, 0.37);
    backdrop-filter: blur(8px) contrast(0.89) saturate(1.27);
    -webkit-backdrop-filter: blur(8px) contrast(0.89) saturate(1.27);
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 0.5rem;
    border-radius: 0.5rem;
}

/* ===========================
   Camera View Hotspots
   =========================== */

.explorexr-camera-view-hotspot {
    background: #fff;
    border-radius: 4px;
    border: none;
    box-sizing: border-box;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
    color: rgba(0, 0, 0, 0.8);
    display: block;
    font-family: Futura, Helvetica Neue, sans-serif;
    font-size: 12px;
    font-weight: 700;
    max-width: 128px;
    overflow-wrap: break-word;
    padding: 0.5em 1em;
    position: absolute;
    width: max-content;
    height: max-content;
    transform: translate3d(-50%, -50%, 0);
    cursor: pointer;
    transition: all 0.3s ease;
}

.explorexr-camera-view-hotspot:hover {
    transform: translate3d(-50%, -50%, 0) scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.35);
    background: #f0f0f0;
}

.explorexr-camera-view-hotspot.active {
    background: #2AACE2;
    color: white;
    box-shadow: 0 4px 12px rgba(42, 172, 226, 0.5);
}

.explorexr-camera-view-hotspot.hover {
    border: 2px solid #2AACE2;
}

/* Camera reset button */
.explorexr-camera-reset {
    position: absolute;
    bottom: 70px;
    right: 16px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px 16px;
    cursor: pointer;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    z-index: 10;
}

.explorexr-camera-reset:hover {
    background: white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.explorexr-camera-reset .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Camera animation */
model-viewer.camera-animating {
    transition: camera-orbit 0.5s ease, camera-target 0.5s ease, field-of-view 0.5s ease;
}

/* ===========================
   Hotspot Visibility
   =========================== */

.explorexr-hotspot[data-visible="false"],
.explorexr-hotspot:not([data-visible]) {
    opacity: var(--min-hotspot-opacity, 0.3);
}

.explorexr-hotspot[data-visible="true"] {
    opacity: 1;
}

/* Visibility fade animation */
.explorexr-hotspot {
    transition: opacity 0.3s ease;
}

/* ===========================
   SVG Container Positioning
   =========================== */

model-viewer svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* ===========================
   AR Mode Adjustments
   =========================== */

model-viewer[ar-status="session-started"] .explorexr-camera-reset,
model-viewer[ar-status="session-started"] .dimensionLine,
model-viewer[ar-status="session-started"] .line {
    display: none;
}

/* ===========================
   Accessibility
   =========================== */

.explorexr-hotspot:focus,
.explorexr-camera-view-hotspot:focus,
.explorexr-animated-label:focus {
    outline: 2px solid #2AACE2;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .explorexr-hotspot,
    .explorexr-camera-view-hotspot,
    .dim {
        border: 2px solid currentColor;
    }
    
    .dimensionLine,
    .line {
        stroke-width: 3;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .explorexr-hotspot,
    .explorexr-camera-view-hotspot,
    .explorexr-animated-label,
    .explorexr-camera-reset,
    model-viewer.camera-animating {
        transition: none;
    }
}

/* ===========================
   Loading State
   =========================== */

model-viewer:not(:defined) > * {
    display: none;
}

/* ===========================
   Responsive Design
   =========================== */

@media only screen and (max-width: 768px) {
    .explorexr-camera-view-hotspot,
    .explorexr-animated-label {
        font-size: 3vw;
        padding: 0.4em 0.8em;
    }
    
    .explorexr-camera-reset {
        font-size: 12px;
        padding: 6px 12px;
        bottom: 60px;
    }
    
    .dimensionLine,
    .line {
        stroke-width: 1.5;
    }
}

@media only screen and (max-width: 480px) {
    .explorexr-camera-reset span {
        display: none;
    }
    
    .explorexr-camera-reset .dashicons {
        margin: 0;
    }
}
