/* ============================================
   360° VIEWER STYLES - MINIMAL
   ============================================ */

/* Viewer Container */
.viewer-container {
    position: fixed;
    inset: 0;
    z-index: var(--z-base);
    background: var(--color-bg-primary);
    overflow: hidden;
}

.viewer-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: grab;
}

.viewer-canvas:active {
    cursor: grabbing;
}

/* Loading State */
.viewer-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-primary);
    z-index: var(--z-modal);
}

.viewer-loading .spinner {
    width: 32px;
    height: 32px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.viewer-loading .loading-text {
    margin-top: var(--space-3);
    color: var(--color-text-muted);
    font-size: var(--text-xs);
}

.viewer-loading .loading-progress {
    width: 160px;
    height: 2px;
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-full);
    margin-top: var(--space-3);
    overflow: hidden;
}

.viewer-loading .loading-progress-bar {
    height: 100%;
    background: var(--color-accent-primary);
    border-radius: var(--radius-full);
    transition: width 0.1s linear;
}

/* Viewer UI Overlay */
.viewer-ui {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: var(--z-dropdown);
}

.viewer-ui>* {
    pointer-events: auto;
}

/* Header Bar */
.viewer-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3);
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent);
}

.viewer-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.viewer-title h2 {
    font-size: var(--text-base);
    font-weight: 500;
}

.viewer-title .subtitle {
    font-size: 10px;
    color: var(--color-accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.viewer-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* Back Button */
/* Back Button */
.btn-back {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 20px 0 14px;
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    color: white;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color var(--transition-fast), border-color var(--transition-fast);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.btn-back:hover {
    background-color: #2a2a2a;
    border-color: rgba(255, 255, 255, 0.35);
}

.btn-back svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Bottom Controls */
.viewer-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: var(--space-3);
    background: linear-gradient(to top, rgba(0, 0, 0, 0.5), transparent);
}

/* Panorama Navigation */
.panorama-nav {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.panorama-dots {
    display: flex;
    gap: var(--space-1);
}

.panorama-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.panorama-dot:hover {
    background: rgba(255, 255, 255, 0.5);
}

.panorama-dot.active {
    background: var(--color-accent-primary);
}

.panorama-label {
    font-size: 10px;
    color: var(--color-text-muted);
}

/* Control Buttons */
.control-buttons {
    display: flex;
    gap: var(--space-1);
}

/* Hotspot Markers */
.hotspot {
    position: absolute;
    width: 60px;
    height: 60px;
    transform: translate(-50%, -50%);
    cursor: pointer;
    z-index: var(--z-base);
}

.hotspot-marker {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-accent-primary);
    border-radius: 50%;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.hotspot-marker::before {
    display: none;
}

.hotspot-marker svg {
    width: 32px;
    height: 32px;
    fill: var(--color-accent-primary);
}

.hotspot:hover .hotspot-marker {
    background: var(--color-accent-primary);
}

.hotspot:hover .hotspot-marker svg {
    fill: var(--color-bg-primary);
}

/* Navigation Hotspot */
.hotspot-nav .hotspot-marker {
    border-color: var(--color-text-primary);
}

.hotspot-nav .hotspot-marker svg {
    fill: var(--color-text-primary);
}

.hotspot-nav:hover .hotspot-marker {
    background: var(--color-text-primary);
}

.hotspot-nav:hover .hotspot-marker svg {
    fill: var(--color-bg-primary);
}

/* Hotspot Label */
.hotspot-label {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: var(--space-1);
    padding: var(--space-1) var(--space-2);
    background: var(--color-bg-secondary);
    border-radius: var(--radius-sm);
    font-size: 10px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-fast);
}

.hotspot:hover .hotspot-label {
    opacity: 1;
    visibility: visible;
}

/* Compass - Hidden in Minimal */
.compass {
    display: none;
}

/* Zoom Controls */
.zoom-controls {
    position: absolute;
    right: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.zoom-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.zoom-btn:hover {
    border-color: var(--color-accent-primary);
}

.zoom-btn svg {
    width: 16px;
    height: 16px;
    fill: var(--color-text-primary);
}

/* Fullscreen Toggle */
.fullscreen-toggle {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
}

/* Gyroscope Toggle */
.gyro-toggle {
    position: absolute;
    top: 50%;
    right: var(--space-3);
    transform: translateY(calc(-50% + 48px));
}

/* Autorotate Control */
.autorotate-toggle {
    position: absolute;
    bottom: calc(var(--space-3) + 48px);
    left: 50%;
    transform: translateX(-50%);
}

/* Responsive */
@media (max-width: 768px) {
    .viewer-header {
        padding: var(--space-2);
    }

    .viewer-title h2 {
        font-size: var(--text-sm);
    }

    .viewer-controls {
        padding: var(--space-2);
        flex-direction: column;
        gap: var(--space-2);
    }

    .panorama-nav {
        order: 2;
    }

    .control-buttons {
        order: 1;
        width: 100%;
        justify-content: flex-end;
    }

    .hotspot {
        width: 36px;
        height: 36px;
    }

    .hotspot-marker svg {
        width: 16px;
        height: 16px;
    }

    .zoom-controls {
        display: none;
    }
}

/* Touch Devices - Force labels visible since there is no hover */
@media (hover: none) {
    .hotspot-label {
        opacity: 1 !important;
        visibility: visible !important;
        display: block !important;
    }
}

/* Landscape Mobile */
@media (max-width: 900px) and (orientation: landscape) {
    .viewer-header {
        padding: var(--space-2) var(--space-3);
    }

    .viewer-controls {
        padding: var(--space-2) var(--space-3);
    }

    .viewer-title h2 {
        font-size: var(--text-xs);
    }

    /* Modal styles are handled in the main mobile media query below */
}

/* ============================================
   HOTSPOT MODAL REDESIGN
   ============================================ */

.hotspot-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    backdrop-filter: blur(4px);
}

.hotspot-modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.hotspot-modal {
    position: relative;
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    background: var(--color-bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Desktop: Wider popup */
@media (min-width: 768px) {
    .hotspot-modal {
        width: 80vw !important;
        max-width: 900px !important;
        height: 80vh;
        max-height: none;
    }
}

/* Back button - Use higher specificity to override components.css */
.hotspot-modal .modal-close {
    position: absolute;
    top: var(--space-3);
    left: var(--space-3);
    right: auto !important;
    width: auto;
    height: 40px;
    padding: 0 20px 0 14px;
    background-color: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    color: white;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color var(--transition-fast), border-color var(--transition-fast);
    font-weight: 500;
    font-size: 0.95rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.hotspot-modal .modal-close:hover {
    background-color: #2a2a2a;
    border-color: rgba(255, 255, 255, 0.35);
}

.hotspot-modal .modal-close svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    flex-shrink: 0;
}

.hotspot-modal-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    color: var(--color-text-primary);
}

/* Visuals Section - Takes remaining space after header/footer */
.hotspot-visuals {
    flex: 1;
    min-height: 0;
    /* Allow shrinking in flex container */
    background: #000;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Carousel Styles */
.carousel {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.carousel-track {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.3s ease-in-out;
}

.carousel-slide {
    flex: 0 0 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.carousel-slide img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Carousel Navigation */
.carousel-nav {
    position: absolute;
    bottom: var(--space-3);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: var(--space-2);
    z-index: 2;
}

.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    padding: 0;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.carousel-dot.active {
    background: var(--color-accent-primary);
    transform: scale(1.2);
}

/* Carousel Arrows */
.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.3);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: background var(--transition-fast);
    z-index: 2;
}

.carousel-arrow:hover {
    background: rgba(0, 0, 0, 0.6);
}

.carousel-arrow svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.carousel-arrow.prev {
    left: var(--space-2);
}

.carousel-arrow.next {
    right: var(--space-2);
}

/* Info Header & Text Toggle */
.hotspot-info-header {
    padding: var(--space-3);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    position: relative;
    z-index: 20;
    /* Ensure header stays above text overlay */
}

.hotspot-title {
    margin: 0;
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--color-text-primary);
    flex: 1;
    padding-right: var(--space-2);
}

.btn-read-text {
    background: transparent;
    border: 1px solid var(--color-accent-primary);
    color: var(--color-accent-primary);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-read-text:hover {
    background: var(--color-accent-primary);
    color: white;
}

/* Collapsible Text Content */
.hotspot-text-content {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: var(--color-bg-primary);
    transition: all var(--transition-normal);
    max-height: 0;
    /* Hidden by default */
    opacity: 0;
}

.hotspot-text-content.open {
    max-height: 70vh;
    /* Allow expansion */
    opacity: 1;
    padding: var(--space-3);
}

.hotspot-text-scroll {
    height: 100%;
    overflow-y: auto;
    padding-right: var(--space-2);
}

.btn-close-text {
    display: none;
    /* Hidden by default on desktop */
    position: absolute;
    top: 0;
    right: 0;
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: var(--space-2);
    z-index: 5;
}

.btn-close-text svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.hotspot-description {
    font-size: var(--text-sm);
    line-height: 1.6;
    color: var(--color-text-secondary);
    margin: 0;
}

.hotspot-description::first-letter {
    float: none;
    font-size: inherit;
    font-weight: normal;
    color: inherit;
    line-height: inherit;
    margin: 0;
}

/* Audio Footer (Sticky) */
.hotspot-audio-footer {
    padding: var(--space-3);
    background: var(--color-bg-tertiary);
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
    margin-top: 32px;
}

/* Audio Player Styles Match Main App */
.audio-player {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
}

.audio-controls button {
    background: var(--color-accent-primary);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: filter var(--transition-fast);
}

.audio-controls button:hover {
    filter: brightness(1.1);
}

.audio-controls svg {
    fill: white;
    width: 20px;
    height: 20px;
}

.audio-info {
    flex: 1;
    min-width: 0;
}

.audio-title {
    font-size: var(--text-xs);
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.audio-progress {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    cursor: pointer;
}

.audio-progress-bar {
    height: 100%;
    background: var(--color-accent-primary);
    width: 0%;
    transition: width 0.1s linear;
}

/* Mobile Optimizations */
@media (max-width: 768px) {

    /* Larger hotspot markers on mobile for touch */
    .hotspot {
        width: 80px;
        height: 80px;
    }

    .hotspot-marker svg {
        width: 40px;
        height: 40px;
    }

    .hotspot-label {
        font-size: 12px;
        padding: var(--space-2) var(--space-3);
        opacity: 1 !important;
        visibility: visible !important;
        display: block !important;
    }

    .viewer-controls {
        justify-content: flex-start !important;
        flex-direction: row !important;
    }

    .panorama-nav {
        margin: 0 !important;
        order: -1;
    }

    .control-buttons {
        display: none !important;
    }

    .carousel-arrow {
        display: none !important;
        /* Hide arrows on touch, use swipe */
    }

    .hotspot-modal {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        max-width: none;
    }

    .hotspot-visuals {
        flex: 0 0 auto;
        max-height: 40vh;
    }

    .carousel-slide img {
        max-height: 40vh;
        width: 100%;
        height: 100%;
        object-fit: contain !important;
    }

    /* Larger button on mobile */
    .btn-read-text {
        padding: 10px 16px;
        font-size: var(--text-sm);
        min-height: 44px;
        /* Touch target size */
    }

    /* Text content overlay on mobile */
    .hotspot-text-content.open {
        position: absolute;
        bottom: 110px;
        left: 0;
        right: 0;
        background: rgba(10, 10, 15, 0.95);
        z-index: 5;
        max-height: 50vh;
        padding: var(--space-4);
        padding-top: 50px;
        /* Space for close button */
        border-top: 1px solid var(--color-border);
        overflow-y: auto;
    }

    /* Close text button (mobile only) */
    .btn-close-text {
        position: absolute;
        top: var(--space-2);
        right: var(--space-2);
        width: 36px;
        height: 36px;
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 50%;
        color: white;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 10;
    }

    .btn-close-text svg {
        width: 18px;
        height: 18px;
        fill: currentColor;
    }

    .btn-close-text:hover {
        background: rgba(255, 255, 255, 0.2);
    }

    .hotspot-text-scroll {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Larger back button on mobile */
    .hotspot-modal .modal-close {
        height: 44px;
        padding: 0 18px 0 14px;
        font-size: 1rem;
    }

    /* Audio footer fixed at bottom on mobile */
    .hotspot-audio-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 10;
        background: var(--color-bg-tertiary);
        border-top: 1px solid var(--color-border);
    }

    /* Larger audio controls */
    .audio-controls button {
        width: 48px;
        height: 48px;
    }

    /* Text Open Mode - Mobile Layout Shift */
    /* Instead of hiding visuals, we use flex to share space */
    .hotspot-modal-overlay.text-open .hotspot-modal-content {
        justify-content: flex-start;
    }

    .hotspot-modal-overlay.text-open .hotspot-visuals {
        flex: 0 1 30vh;
        /* Shrink to 30% height when text is open */
        min-height: 150px;
        transition: flex var(--transition-normal);
    }

    .hotspot-modal-overlay.text-open .hotspot-text-content.open {
        position: relative;
        bottom: auto;
        left: auto;
        right: auto;
        max-height: none;
        height: auto;
        flex: 1;
        /* Take remaining space */
        padding: var(--space-3);
        padding-bottom: 130px;
        /* Increased space for fixed audio footer */
        background: var(--color-bg-primary);
        z-index: auto;
        display: block;
        overflow-y: auto;
        border-top: 1px solid var(--color-border);
    }
}