/* AR Peak orientation CSS - Premium Version */
#ar-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    overflow: hidden;
    background: #000;
    font-family: 'Inter', 'Noto Sans TC', sans-serif;
    z-index: 900;
    /* Stays beneath sticky navbar (1000) */
}

#ar-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

#ar-labels-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#ar-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

#ar-ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    pointer-events: none;
    color: white;
}

/* Peak Label Styles */
.peak-label {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    white-space: nowrap;
    transition: opacity 0.3s ease;
    pointer-events: auto;
    z-index: 25;
    /* Center bottom anchor */
    transform: translate(-50%, -100%);
    will-change: transform;
}

/* Entry Animation */
@keyframes peak-pop {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.peak-label.new {
    animation: peak-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.peak-label-line {
    width: 2px;
    height: 100px;
    background: linear-gradient(to bottom,
            rgba(255, 255, 255, 0.8) 0%,
            rgba(255, 255, 255, 0.3) 70%,
            transparent 100%);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.peak-label-dot {
    width: 10px;
    height: 10px;
    background: #ffd700;
    border-radius: 50%;
    margin-top: -5px;
    border: 2px solid #ffffff;
    box-shadow: 0 0 15px #ffd700, 0 0 5px #ffffff;
    animation: dot-pulse 2s infinite ease-in-out;
}

.peak-label-content {
    background: linear-gradient(135deg, rgba(15, 20, 30, 0.8), rgba(15, 20, 30, 0.4));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 6px 14px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.peak-label-content:active {
    transform: scale(0.95);
    background: rgba(46, 204, 113, 0.2);
}

.peak-name {
    display: block;
    font-weight: 800 !important;
    font-size: 1.0rem;
    color: #ffd700;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
    letter-spacing: 0.3px;
}

.peak-alt {
    display: block;
    font-size: 0.8rem;
    color: #ffffff;
    opacity: 0.9;
    margin-top: 1px;
}

@keyframes dot-pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 10px #ffd700;
    }

    50% {
        transform: scale(1.3);
        box-shadow: 0 0 20px #ffd700, 0 0 10px #ffffff;
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 10px #ffd700;
    }
}

/* Control Panel */
#ar-controls {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 450px;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 1001;
    /* Ensure ABOVE labels which can go up to 10000 but we'll cap those */
}

#ar-no-peaks-msg {
    position: absolute;
    top: -40px;
    /* Show above the controls instead of pushing them */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(231, 76, 60, 0.9);
    padding: 5px 15px;
    border-radius: 20px;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

.heading-slider-container {
    background: rgba(15, 20, 30, 0.85);
    /* Slightly darker for better contrast */
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 15px 25px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: transform 0.3s ease, background 0.3s ease;
}

/* Prevent background interaction during AR */
body:has(#ar-page.active) {
    overflow: hidden !important;
    height: 100dvh;
    position: fixed;
    width: 100%;
}

.heading-slider-container input[type="range"] {
    width: 100%;
    accent-color: #2ecc71;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    appearance: none;
    touch-action: none;
    /* Crucial for mobile sliders to not trigger scroll/jump */
}

.heading-slider-container input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.heading-slider-container input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: #2ecc71;
    border-radius: 50%;
    margin-top: -7px;
    box-shadow: 0 2px 10px rgba(46, 204, 113, 0.5);
    cursor: grab;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Ensure navigation is persistent and fully visible */
body:has(#ar-page.active) .navbar {
    opacity: 1 !important;
    filter: none !important;
    pointer-events: auto !important;
}

/* Hidden Utility */
.hidden {
    display: none !important;
}