/* Updated: 2025-01-18 - Voice notes, gyroscope fixes */
/* PROTECTION: Disable selection and drag globally */
*:not(input):not(textarea) {
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

input,
textarea {
    user-select: text !important;
    -webkit-user-select: text !important;
    -webkit-touch-callout: default !important;
    pointer-events: auto !important;
    touch-action: auto !important;
}

img {
    -webkit-user-drag: none;
    user-drag: none;
    pointer-events: none;
}

/* Allow interaction with scene thumbs if needed, but usually we just click them, drag is for reorder? reorder needs drag. */
/* Editor needs drag for reordering scenes! */
/* So I must be careful. The user said "DESCARGAR EL SITIO WEB". Downloading images. */
/* drag-handle needs drag. */
.scene-item img {
    pointer-events: none;
}

.scene-item {
    -webkit-user-drag: element;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

body {
    font-family: system-ui, sans-serif;
    background: #0d1117;
    color: #e6edf3;
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    touch-action: manipulation;
}

.app {
    display: flex;
    height: 100vh;
    height: 100dvh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: #0d1117;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s ease;
    box-shadow: 5px 0 30px rgba(0, 0, 0, 0.3);
}

.sidebar-header {
    padding: 10px;
    background: linear-gradient(135deg, #238636, #1f6feb);
}

.sidebar-header .header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h1 {
    font-size: 1rem;
}

.sidebar-header small {
    opacity: 0.85;
    font-size: 0.65rem;
    display: block;
    margin-top: 2px;
}

.lang-select {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    color: white;
    font-size: 0.7rem;
    padding: 3px 6px;
    cursor: pointer;
}

.lang-select option {
    background: #21262d;
    color: white;
}

/* Mobile toggle */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 200;
    width: 44px;
    height: 44px;
    background: #238636;
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 1.4rem;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.upload-section {
    padding: 10px;
    border-bottom: 1px solid #30363d;
    transition: all 0.3s ease;
}

/*.sidebar.has-scenes .upload-section {
    display: none;
}*/

.btn-tour-rapido {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: linear-gradient(180deg, #2ea043, #238636);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 1px 0 rgba(27, 31, 36, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
    position: relative;
    overflow: hidden;
}

.btn-tour-rapido:hover {
    background: linear-gradient(180deg, #3fb950, #2ea043);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46, 160, 67, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-tour-rapido .tour-icon {
    font-size: 1.8rem;
}

.btn-tour-rapido .tour-text {
    display: flex;
    flex-direction: column;
}

.btn-tour-rapido .tour-text strong {
    font-size: 0.95rem;
}

.btn-tour-rapido .tour-text small {
    font-size: 0.7rem;
    opacity: 0.85;
}

.upload-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
    color: #6e7681;
    font-size: 0.7rem;
}

.upload-divider::before,
.upload-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #30363d;
}

.upload-area {
    border: 2px dashed #30363d;
    border-radius: 8px;
    padding: 14px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: #58a6ff;
    background: rgba(88, 166, 255, 0.1);
}

.upload-icon {
    font-size: 1.4rem;
}

.upload-text {
    font-size: 0.7rem;
    color: #8b949e;
    margin-top: 4px;
}

#fileInput {
    display: none;
}

.scenes-section {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    min-height: 0;
}

.section-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #8b949e;
    margin-bottom: 4px;
}

.drag-hint {
    font-size: 0.55rem;
    color: #58a6ff;
    font-weight: normal;
    text-transform: none;
    margin-left: 6px;
}

.scene-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* Increased sizes for better visibility */

/* Scene Items */
.scene-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    /* Increased padding */
    background: #21262d;
    border-radius: 6px;
    cursor: grab;
    border: 2px solid transparent;
    transition: all 0.15s;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
    min-height: 50px;
    /* Enforce height */
}

.scene-thumb {
    width: 60px;
    /* Significantly bigger */
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
    background: #30363d;
    pointer-events: none;
}

/* General Buttons */
.btn {
    width: 100%;
    padding: 10px 14px;
    /* Back to comfortable size */
    border-radius: 6px;
    border: none;
    font-size: 0.85rem;
    /* Larger font */
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 6px;
    height: 44px;
    /* Fixed larger height */
}

#desktopToolsBtn {
    height: 50px;
    font-size: 0.95rem;
}

#importBtn,
#exportJsonBtn {
    height: 60px;
    /* Matched size */
    font-size: 0.95rem;
    margin-bottom: 0;
    /* Margin handled by flex gap */
}

.scene-item:hover {
    background: #30363d;
}

.scene-item.active {
    border-color: #58a6ff;
    background: rgba(88, 166, 255, 0.15);
}

.scene-item.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.scene-item.drag-over-top {
    border-top: 2px solid #58a6ff;
}

.scene-item.drag-over-bottom {
    border-bottom: 2px solid #58a6ff;
}

.drag-handle {
    color: #8b949e;
    font-size: 10px;
    cursor: grab;
    padding: 0 2px;
    opacity: 0.5;
    transition: opacity 0.15s;
    letter-spacing: -2px;
}

.scene-item:hover .drag-handle {
    opacity: 1;
}

/* .scene-thumb moved up and consolidated */

.scene-info {
    flex: 1;
    min-width: 0;
    pointer-events: none;
}

.scene-name {
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scene-meta {
    font-size: 0.6rem;
    color: #8b949e;
}

.scene-delete {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #8b949e;
    cursor: pointer;
    border-radius: 4px;
    opacity: 0;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.scene-item:hover .scene-delete {
    opacity: 1;
}

.scene-delete:hover {
    background: #da3633;
    color: white;
}

.scene-edit-name {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #8b949e;
    cursor: pointer;
    border-radius: 4px;
    opacity: 0;
    flex-shrink: 0;
    font-size: 0.75rem;
}

.scene-item:hover .scene-edit-name {
    opacity: 1;
}

.scene-edit-name:hover {
    background: #58a6ff;
    color: white;
}

.scene-name {
    cursor: default;
}

.scene-name-input {
    background: #21262d;
    border: 1px solid #58a6ff;
    color: white;
    font-size: 0.8rem;
    padding: 2px 5px;
    border-radius: 4px;
    width: 100%;
    outline: none;
}

.hotspots-section {
    padding: 10px;
    border-top: 1px solid #30363d;
    max-height: 150px;
    overflow-y: auto;
}

.hotspots-section .section-label {
    display: flex;
    align-items: center;
    gap: 6px;
}

.hotspots-section .section-label small {
    font-size: 0.55rem;
    color: #58a6ff;
    font-weight: normal;
}

.hotspot-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hotspot-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 6px;
    background: #21262d;
    border-radius: 5px;
    font-size: 0.7rem;
}

.hotspot-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #3fb950;
    flex-shrink: 0;
}

.hotspot-item span {
    flex: 1;
    color: #8b949e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.hotspot-item button {
    background: none;
    border: none;
    color: #8b949e;
    cursor: pointer;
    padding: 2px 4px;
    font-size: 0.7rem;
    border-radius: 4px;
    flex-shrink: 0;
}

.hotspot-item button:hover {
    color: #fff;
}

.hotspot-item .hs-edit-btn {
    background: #21262d;
}

.hotspot-item .hs-edit-btn:hover {
    background: #58a6ff;
}

.hotspot-item .hs-del-btn:hover {
    background: #da3633;
}

.actions-section {
    padding: 10px;
    border-top: 1px solid #30363d;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.75rem;
}

.setting-row select {
    background: #21262d;
    border: 1px solid #30363d;
    border-radius: 4px;
    padding: 5px 8px;
    color: #e6edf3;
    font-size: 0.7rem;
    flex: 1;
    margin-left: 8px;
}

/* .btn definition moved up and consolidated */

.btn:last-child {
    margin-bottom: 0;
}

.btn-primary {
    background: #238636;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #2ea043;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary.active {
    background: #f0883e;
}

.btn-primary.active:hover {
    background: #d77a2e;
}

.btn-secondary {
    background: linear-gradient(180deg, #21262d, #161b22);
    color: #c9d1d9;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.03);
    transition: all 0.2s cubic-bezier(0.2, 0, 0.2, 1);
}

.btn-secondary:hover {
    background: linear-gradient(180deg, #30363d, #21262d);
    border-color: #8b949e;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.btn-secondary.active {
    background: linear-gradient(180deg, #238636, #1a7f37);
    border-color: rgba(255, 255, 255, 0.2);
    color: white;
    box-shadow: 0 0 15px rgba(35, 134, 54, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* ============ TOOLS GRID (2 Columns) ============ */
#desktopToolsBtn {
    display: none;
    /* Hidden by default (Mobile) */
    width: 100%;
    margin-bottom: 8px;
    justify-content: center;
    gap: 10px;
}

.tools-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin-bottom: 4px;
}

/* Desktop Only Logic */
@media (min-width: 769px) {
    #desktopToolsBtn {
        display: flex;
        /* Show on Desktop */
    }

    .tools-grid {
        display: none !important;
        /* Hide Grid on Desktop */
    }
}

.tools-grid .btn {
    padding: 2px 6px;
    /* Extreme compact padding */
    font-size: 0.65rem;
    margin-bottom: 0;
    display: flex;
    flex-direction: row;
    /* FORCE ROW */
    align-items: center;
    justify-content: flex-start;
    /* Align left */
    gap: 6px;
    border-radius: 4px;
    height: 28px;
    /* Fixed TINY height */
    white-space: nowrap;
    overflow: hidden;
}



.tools-grid .btn svg {
    display: block;
    flex-shrink: 0;
    width: 12px;
    height: 12px;
    min-width: 12px;
}

/* Icon specific colors */
#configBtn svg {
    color: #58a6ff;
}

#logoBtn svg {
    color: #f2cc60;
}

#nadirBtn svg {
    color: #f778ba;
}

/* Removed span 2 */
#autoRotateBtn svg {
    color: #a371f7;
}

#littlePlanetBtn svg {
    color: #3fb950;
}

#voiceNoteBtn svg {
    color: #f0883e;
}

#audioBgBtn svg {
    color: #2ea043;
}

/* Removed span 2 */
#addPinBtn svg {
    color: #ffffff;
}

#importBtn svg {
    color: #38d9a9;
}

#exportJsonBtn svg {
    color: #79c0ff;
}

#openProjectBtn svg {
    color: #8b949e;
}

#saveProjectBtn svg {
    color: #ff7b72;
}

#exportHtmlBtn svg {
    color: #fff;
}

.tools-grid .btn:hover svg,
.project-actions-grid .btn:hover svg {
    filter: drop-shadow(0 0 5px currentColor);
}

.project-actions-grid .btn {
    padding: 6px 4px;
    font-size: 0.65rem;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border-radius: 6px;
    height: 32px;
    /* Fixed smaller height */
}

/* ============ UNDO/REDO TOOLBAR ============ */
.undo-redo-toolbar {
    display: flex;
    gap: 6px;
    padding: 8px 0;
    border-bottom: 1px solid #30363d;
    margin-bottom: 8px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(48, 54, 61, 0.6);
    border: 1px solid #30363d;
    color: #8b949e;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
}

.btn-icon:hover:not(.disabled) {
    background: #30363d;
    color: #58a6ff;
    transform: translateY(-1px);
}

.btn-icon.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

/* ============ UNDO/REDO TOOLBAR ============ */
.undo-redo-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 10px 0;
    position: relative;
}

/* ============ HISTORY PANEL ============ */
.history-panel {
    display: none;
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    max-height: 250px;
    background: rgba(22, 27, 34, 0.98);
    backdrop-filter: blur(16px);
    border: 1px solid #30363d;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    z-index: 1000;
    overflow: hidden;
    animation: slideDown 0.2s ease;
}

.history-panel.show {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.history-header {
    padding: 10px 14px;
    background: rgba(88, 166, 255, 0.1);
    border-bottom: 1px solid #30363d;
    font-size: 12px;
    font-weight: 600;
    color: #58a6ff;
}

.history-list {
    max-height: 200px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-bottom: 1px solid rgba(48, 54, 61, 0.5);
    cursor: pointer;
    transition: background 0.15s ease;
    font-size: 12px;
}

.history-item:hover {
    background: rgba(48, 54, 61, 0.6);
}

.history-item.active {
    background: rgba(35, 134, 54, 0.2);
    border-left: 3px solid #238636;
}

.history-item.future {
    opacity: 0.5;
}

.history-icon {
    width: 16px;
    color: #8b949e;
    font-weight: bold;
}

.history-item.active .history-icon {
    color: #238636;
}

.history-desc {
    flex: 1;
    color: #e6edf3;
}

.history-time {
    font-size: 10px;
    color: #6e7681;
}

/* Copy button styling in radial menu */
.opt-copy {
    background: rgba(88, 166, 255, 0.2) !important;
    border-color: #58a6ff !important;
}

.opt-copy:hover {
    background: rgba(88, 166, 255, 0.4) !important;
}


/* Viewer */
#viewerArea {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#viewer {
    width: 100%;
    height: 100%;
    display: block;
    cursor: grab;
    position: relative;
    z-index: 0;
    /* Bajo para que css3dRendererContainer (z-index: 20) quede encima */
}

#viewer:active {
    cursor: grabbing;
}

/* CSS3D Container */
#css3dContainer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Let clicks pass through to WebGL by default */
    z-index: 1;
    /* Above WebGL canvas (z-index 0 implied) */
}

/* In Edit Mode, we might want to catch events on the container or manage z-indexes */
.edit-mode #css3dContainer {
    /* pointer-events can be managed per object */
}

.edit-mode #css3dContainer.editing-active {
    pointer-events: auto;
    /* If we need to click gizmos that might be in this layer */
}

/* Helper to block iframe interaction during edit mode */
.interaction-blocker {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    display: none;
    pointer-events: none;
}

.edit-mode .interaction-blocker {
    display: block;
    pointer-events: auto;
    background: rgba(88, 166, 255, 0.15);
    border: 2px dashed #58a6ff;
    cursor: move;
}

.web-pin-container {
    background: white;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

/* Pinned Media Toolbar (New) */
#pinned-toolbar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(22, 27, 34, 0.9);
    backdrop-filter: blur(10px);
    padding: 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: none;
    gap: 10px;
    z-index: 1000;
}

.edit-mode #pinned-toolbar {
    display: flex;
}

#pinned-toolbar button {
    background: #30363d;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

#pinned-toolbar button:hover {
    background: #58a6ff;
    border-color: #58a6ff;
}

#pinned-toolbar button.active {
    background: #238636;
    border-color: #2ea043;
}

/* Pinned Images Z-Index Override */
.css3d-container {
    z-index: 5 !important;
    pointer-events: none;
    /* Let clicks pass through empty areas */
}

.hotspot-pinned {
    pointer-events: auto !important;
    /* Re-enable clicks on hotspots */
}

.viewer-area {
    flex: 1;
    position: relative;
    background: #010409;
    min-width: 0;
    overflow: hidden;
}

#viewer {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
    position: relative;
    z-index: 0;
}

.empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #8b949e;
    padding: 20px;
}

.empty-state .icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.empty-state h2 {
    font-size: 1.1rem;
    color: #e6edf3;
    margin-bottom: 6px;
}

.empty-state p {
    font-size: 0.8rem;
}

/* Mode badges */
.mode-badge {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 16px;
    background: #8957e5;
    border-radius: 20px;
    font-size: 0.75rem;
    z-index: 50;
    display: none;
    white-space: nowrap;
    box-shadow: 0 2px 12px rgba(137, 87, 229, 0.4);
}

.mode-badge.show {
    display: block;
}

/* Drop zone indicator */
.drop-zone-active {
    position: absolute;
    inset: 0;
    background: rgba(88, 166, 255, 0.15);
    border: 3px dashed #58a6ff;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 40;
    pointer-events: none;
}

.drop-zone-active.show {
    display: flex;
}

.drop-zone-active span {
    background: #58a6ff;
    color: white;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Hotspot markers */
.hotspot-marker {
    position: absolute;
    transform: translate(-50%, -50%);
    cursor: pointer;
    pointer-events: auto;
    z-index: 30;
    transition: opacity 0.2s;
}

.hotspot-marker.editable {
    cursor: grab;
}

.hotspot-marker.editable:active {
    cursor: grabbing;
}

.hotspot-marker.dragging {
    cursor: grabbing !important;
    z-index: 1000 !important;
    opacity: 0.8;
}

.hotspot-marker.dragging .hs-tooltip {
    opacity: 0 !important;
}

.hotspot-marker.playing .inner {
    animation: audio-pulse 1.5s ease-in-out infinite !important;
}

@keyframes audio-pulse {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(88, 166, 255, 0.4);
    }

    50% {
        opacity: 0.8;
        box-shadow: 0 0 12px 4px rgba(88, 166, 255, 0.6);
    }
}

/* Hotspot tooltip */
.hs-tooltip {
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    font-size: 12px;
    white-space: nowrap;
    border-radius: 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    backdrop-filter: blur(4px);
    z-index: 100;
}

.hotspot-marker:hover .hs-tooltip {
    opacity: 1;
}

body.edit-mode .hotspot-marker {
    animation: edit-glow 2s ease-in-out infinite;
}

@keyframes edit-glow {

    0%,
    100% {
        filter: drop-shadow(0 0 4px #f0883e);
    }

    50% {
        filter: drop-shadow(0 0 10px #f0883e);
    }
}

@keyframes editing-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 4px rgba(240, 136, 62, 0.4);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(240, 136, 62, 0.6);
    }
}

@keyframes hs-float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

@keyframes hs-pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08);
    }
}

@keyframes hs-bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-8px);
    }

    60% {
        transform: translateY(-4px);
    }
}

@keyframes hs-rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Floor Arrow Hotspots - Street View Style */
.hotspot-floor {
    position: absolute;
    transform: translate(-50%, -50%);
    cursor: pointer;
    pointer-events: none;
    /* Parent doesn't receive events */
    z-index: 25;
    transition: transform 0.3s ease;
}

.hotspot-floor .floor-arrow {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Perspectiva 3D para que parezca en el piso */
    transform: perspective(200px) rotateX(55deg);
    transform-origin: center center;
    filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.6));
    transition: all 0.3s ease;
    pointer-events: auto;
    /* Arrow receives events */
    cursor: pointer;
    touch-action: none;
    /* Critical for smooth mobile drag */
}

.hotspot-floor .floor-arrow svg {
    transition: transform 0.3s ease, filter 0.3s ease;
    pointer-events: none;
    /* SVG doesn't capture, let parent arrow div handle */
}

.hotspot-floor:hover .floor-arrow {
    transform: perspective(200px) rotateX(50deg) scale(1.15);
    filter: drop-shadow(0 0 20px var(--glow-color, #58a6ff));
}

.hotspot-floor .floor-arrow .glow-effect {
    position: absolute;
    inset: -15px;
    background: radial-gradient(ellipse at center bottom, var(--glow-color, #58a6ff) 0%, transparent 70%);
    opacity: 0.4;
    pointer-events: none;
    z-index: -1;
    transform: scaleY(0.6);
}

.hotspot-floor:hover .glow-effect {
    opacity: var(--glow-intensity, 0.7);
}

.hotspot-floor .floor-tooltip {
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    font-size: 12px;
    white-space: nowrap;
    border-radius: 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    backdrop-filter: blur(4px);
}

.hotspot-floor:hover .floor-tooltip {
    opacity: 1;
}

/* Hide tooltip while dragging */
.hotspot-floor.dragging .floor-tooltip {
    opacity: 0 !important;
    visibility: hidden;
}

/* Floor arrow pulse animation */
@keyframes floor-pulse {

    0%,
    100% {
        transform: perspective(200px) rotateX(55deg) scale(1);
        filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.6));
    }

    50% {
        transform: perspective(200px) rotateX(55deg) scale(1.1);
        filter: drop-shadow(0 0 20px var(--glow-color, #58a6ff));
    }
}

@keyframes floor-float {

    0%,
    100% {
        transform: perspective(200px) rotateX(55deg) translateY(0);
    }

    50% {
        transform: perspective(200px) rotateX(55deg) translateY(-10px);
    }
}

@keyframes floor-bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: perspective(200px) rotateX(55deg) translateY(0);
    }

    40% {
        transform: perspective(200px) rotateX(55deg) translateY(-15px);
    }

    60% {
        transform: perspective(200px) rotateX(55deg) translateY(-7px);
    }
}

.hotspot-floor.pulse .floor-arrow {
    animation: floor-pulse 2s ease-in-out infinite;
}

.hotspot-floor.float .floor-arrow {
    animation: floor-float 2s ease-in-out infinite;
}

.hotspot-floor.bounce .floor-arrow {
    animation: floor-bounce 2s ease-in-out infinite;
}

/* Floor arrow in edit mode */
body.edit-mode .hotspot-floor {
    cursor: grab;
}

body.edit-mode .hotspot-floor:active {
    cursor: grabbing;
}

body.edit-mode .hotspot-floor .floor-arrow {
    animation: none;
    filter: drop-shadow(0 0 10px #f0883e);
}

/* Modals */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 300;
    padding: 20px;
}

.modal-backdrop.show {
    display: flex;
}

.modal {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 16px;
    width: 100%;
    max-width: 360px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal h3 {
    text-align: center;
    margin-bottom: 12px;
    font-size: 1rem;
}

.modal-scenes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.modal-scene {
    aspect-ratio: 16/10;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.15s;
    position: relative;
}

.modal-scene:hover {
    border-color: #58a6ff;
}

.modal-scene img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-scene .name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 4px 6px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    font-size: 0.65rem;
}

/* Config Modal */
.config-modal {
    max-width: 440px;
}

.config-type-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

@media (max-width: 600px) {
    .config-type-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 4px;
    }

    .config-tab {
        white-space: nowrap;
        flex-shrink: 0;
    }
}

.config-tab {
    padding: 6px 10px;
    border-radius: 8px;
    background: #21262d;
    border: 2px solid transparent;
    color: #8b949e;
    cursor: pointer;
    font-size: 0.7rem;
    transition: all 0.2s;
}

.config-tab:hover {
    background: #30363d;
    color: white;
}

.config-tab.active {
    background: #58a6ff;
    border-color: #58a6ff;
    color: white;
}

.config-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.config-section {
    background: #21262d;
    border-radius: 8px;
    padding: 10px;
}

.config-section .section-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: #58a6ff;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.config-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.config-row:last-child {
    margin-bottom: 0;
}

.config-row label {
    flex: 0 0 85px;
    font-size: 0.7rem;
    color: #8b949e;
}

.config-row input[type="range"] {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    background: #30363d;
    border-radius: 2px;
}

.config-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #58a6ff;
    border-radius: 50%;
    cursor: pointer;
}

.config-row input[type="color"] {
    width: 36px;
    height: 26px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: transparent;
}

.config-row input[type="text"] {
    flex: 1;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 4px;
    padding: 5px 8px;
    color: #e6edf3;
    font-size: 0.7rem;
}

.config-row select {
    flex: 1;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 4px;
    padding: 5px 8px;
    color: #e6edf3;
    font-size: 0.7rem;
}

.config-row span {
    width: 30px;
    font-size: 0.65rem;
    color: #8b949e;
    text-align: right;
}

.config-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #58a6ff;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #30363d;
    border-radius: 24px;
    transition: 0.3s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch input:checked+.toggle-slider {
    background: #58a6ff;
}

.toggle-switch input:checked+.toggle-slider:before {
    transform: translateX(20px);
}

.config-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.config-actions .btn {
    flex: 1;
}

/* Infospot Modal */
.infospot-modal {
    max-width: 400px;
}

.infospot-types {
    display: flex;
    gap: 6px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.infospot-type {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #21262d;
    border: 2px solid transparent;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 65px;
}

.infospot-type:hover {
    border-color: #30363d;
}

.infospot-type.active {
    border-color: #58a6ff;
    background: rgba(88, 166, 255, 0.15);
}

.infospot-type .type-icon {
    font-size: 1.3rem;
}

.infospot-type .type-label {
    font-size: 0.65rem;
    opacity: 0.8;
}

.infospot-content {
    margin-bottom: 15px;
}

.infospot-content label {
    display: block;
    font-size: 0.75rem;
    color: #8b949e;
    margin-bottom: 6px;
    margin-top: 10px;
}

.infospot-content label:first-child {
    margin-top: 0;
}

.infospot-content input,
.infospot-content textarea {
    width: 100%;
    padding: 10px;
    background: #21262d;
    border: 1px solid #30363d;
    border-radius: 8px;
    color: white;
    font-size: 0.85rem;
    resize: vertical;
}

.infospot-content input:focus,
.infospot-content textarea:focus {
    outline: none;
    border-color: #58a6ff;
}

.infospot-scenes {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    /* Prevent wrapping */
    overflow-x: auto;
    /* Enable horizontal scrolling */
    overflow-y: hidden;
    padding-bottom: 5px;
    /* Space for scrollbar */
    width: 100%;
    /* Smooth Scroll */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Custom Scrollbar for infospot scenes */
.infospot-scenes::-webkit-scrollbar {
    height: 6px;
}

.infospot-scenes::-webkit-scrollbar-track {
    background: #161b22;
    border-radius: 3px;
}

.infospot-scenes::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 3px;
}

.infospot-scene {
    min-width: 90px;
    /* Fixed width for items */
    width: 90px;
    flex-shrink: 0;
    /* Prevent shrinking */
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.infospot-scene:hover {
    border-color: #58a6ff;
}

.infospot-scene.selected {
    border-color: #58a6ff;
    box-shadow: 0 0 8px rgba(88, 166, 255, 0.5);
}

.infospot-scene img {
    width: 100%;
    height: 45px;
    object-fit: cover;
    display: block;
}

.infospot-scene .name {
    font-size: 0.6rem;
    padding: 3px;
    text-align: center;
    background: #21262d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Navigation Style Selector */
.nav-style-selector {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.nav-style-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    background: #21262d;
    border: 2px solid #30363d;
    border-radius: 10px;
    color: #8b949e;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-style-btn:hover {
    border-color: #58a6ff;
    color: #e6edf3;
}

.nav-style-btn.active {
    border-color: #58a6ff;
    background: rgba(88, 166, 255, 0.1);
    color: #58a6ff;
}

.nav-style-btn svg {
    width: 28px;
    height: 28px;
}

.nav-style-btn span {
    font-size: 0.75rem;
    font-weight: 500;
}

.infospot-upload-btn {
    padding: 12px;
    background: #21262d;
    border: 2px dashed #30363d;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    font-size: 0.85rem;
}

.infospot-upload-btn:hover {
    border-color: #58a6ff;
}

.infospot-image-preview {
    margin-top: 10px;
    text-align: center;
}

.infospot-image-preview img {
    max-width: 100%;
    max-height: 120px;
    border-radius: 8px;
}

/* Audio options inline in infospot modal */
.audio-options-inline {
    margin-top: 15px;
    padding: 12px;
    background: #21262d;
    border-radius: 8px;
}

.audio-option-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.audio-option-row:last-child {
    margin-bottom: 0;
}

.audio-option-row label {
    flex: 0 0 160px;
    font-size: 0.8rem;
    color: #8b949e;
}

.audio-option-row input[type="range"] {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    background: #30363d;
    border-radius: 2px;
}

.audio-option-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #58a6ff;
    border-radius: 50%;
    cursor: pointer;
}

.audio-option-row input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #58a6ff;
}

.audio-option-row span {
    font-size: 0.75rem;
    color: #58a6ff;
    min-width: 35px;
}

/* Rotation control for nav hotspots */
.rotation-control {
    margin-top: 15px;
    padding: 12px;
    background: #21262d;
    border-radius: 8px;
}

.rotation-control>label {
    display: block;
    font-size: 0.8rem;
    color: #8b949e;
    margin-bottom: 8px;
}

.rotation-slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.rotation-slider-row input[type="range"] {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    background: #30363d;
    border-radius: 2px;
}

.rotation-slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #58a6ff;
    border-radius: 50%;
    cursor: pointer;
}

.rotation-slider-row span {
    font-size: 0.8rem;
    color: #58a6ff;
    min-width: 35px;
    text-align: right;
}

.rotation-preview {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}

.rotation-preview-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #58a6ff, #8957e5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    transition: transform 0.2s;
    border: 3px solid white;
}

.rotation-presets {
    display: flex;
    gap: 4px;
    justify-content: center;
    flex-wrap: wrap;
}

.rotation-presets button {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: #30363d;
    border: 1px solid #30363d;
    color: white;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.rotation-presets button:hover {
    background: #58a6ff;
    border-color: #58a6ff;
}

/* Radial Edit Menu - Marzipano style */
.radial-menu {
    position: fixed;
    z-index: 3000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s;
}

.radial-menu.show {
    pointer-events: auto;
    opacity: 1;
}

.radial-center {
    position: absolute;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
    z-index: 2;
    border: 3px solid white;
}

.radial-center .radial-icon {
    display: inline-block;
    transition: transform 0.15s;
}

.radial-options {
    position: absolute;
    transform: translate(-50%, -50%);
}

.radial-option {
    position: absolute;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: white;
    cursor: pointer;
    transition: all 0.12s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.radial-option:hover {
    transform: scale(1.18);
    border-color: white;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.5);
}

.radial-option.opt-rotate {
    background: #6b7fd4;
}

.radial-option.opt-target {
    background: #808080;
}

.radial-option.opt-edit {
    background: #e08850;
}

.radial-option.opt-config {
    background: #238636;
}

.radial-option.opt-delete {
    background: #d64541;
}

.radial-option-label {
    position: absolute;
    white-space: nowrap;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 3px 7px;
    border-radius: 4px;
    font-size: 10px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s;
}

.radial-option:hover .radial-option-label {
    opacity: 1;
}

.radial-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2999;
}

.infospot-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* Custom icon upload */
.custom-icon-upload {
    display: flex;
    gap: 6px;
    flex: 1;
}

.custom-icon-upload input {
    flex: 1;
}

.upload-icon-btn {
    padding: 6px 12px;
    background: #30363d;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: white;
    cursor: pointer;
}

.upload-icon-btn:hover {
    background: #58a6ff;
}

/* Video preview */
.infospot-video-preview {
    margin-top: 10px;
    text-align: center;
}

/* Infospot Popup - Resizable */
.infospot-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 16px;
    padding: 20px;
    min-width: 280px;
    min-height: 150px;
    max-width: 90vw;
    max-height: 85vh;
    overflow: hidden;
    z-index: 500;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    resize: both;
}

.infospot-popup.show {
    display: flex;
    flex-direction: column;
}

.infospot-popup h4 {
    margin: 0 0 12px;
    font-size: 1rem;
    color: white;
    padding-right: 30px;
}

.infospot-popup .popup-body {
    flex: 1;
    overflow: auto;
}

.infospot-popup p {
    color: #c9d1d9;
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0;
    white-space: pre-wrap;
}

.infospot-popup img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
}

.infospot-popup video {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
}

.infospot-popup iframe {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: 8px;
    border: none;
}

.popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #30363d;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1rem;
    z-index: 10;
}

.popup-close:hover {
    background: #da3633;
}

.popup-link {
    display: inline-block;
    margin-top: 10px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #58a6ff, #8957e5);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}

.popup-link:hover {
    opacity: 0.9;
}

/* Resize handle indicator */
.infospot-popup::after {
    content: '';
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 12px;
    height: 12px;
    border-right: 2px solid #58a6ff;
    border-bottom: 2px solid #58a6ff;
    opacity: 0.5;
    pointer-events: none;
}

/* Popup backdrop */
/* Pinned Media Modal Styling */
#pinModal .modal {
    width: 400px;
    background: rgba(22, 27, 34, 0.95);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    border-radius: 16px;
    padding: 24px;
}

#pinModal h3 {
    text-align: center;
    margin-bottom: 24px;
    font-size: 1.2rem;
    background: linear-gradient(to right, #fff, #a5d6ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tools-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 10px;
}

.tools-grid .btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 90px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.tools-grid .btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: #58a6ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.tools-grid .btn svg {
    width: 28px;
    height: 28px;
    stroke-width: 1.5;
    color: #a5d6ff;
}

.tools-grid .btn span {
    font-size: 0.8rem;
    font-weight: 500;
    color: #e6edf3;
}

.tools-grid .btn:nth-child(3) {
    grid-column: span 2;
    flex-direction: row;
    height: 60px;
}

#webPinForm {
    /* Existing basic style overhaul */
    background: rgba(0, 0, 0, 0.2);
    padding: 16px !important;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
}

/* Pin Options Grid (Visible on Desktop) */
.pin-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.pin-options-grid .btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 90px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.pin-options-grid .btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: #58a6ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.pin-options-grid .btn svg {
    width: 28px;
    height: 28px;
    stroke-width: 1.5;
    color: #a5d6ff;
}

.pin-options-grid .btn span {
    font-size: 0.8rem;
    font-weight: 500;
    color: #e6edf3;
}

#webPinForm input {
    background: rgba(13, 17, 23, 0.8) !important;
    border: 1px solid rgba(48, 54, 61, 0.8) !important;
    padding: 12px !important;
    font-size: 0.9rem !important;
    border-radius: 8px !important;
    transition: border-color 0.2s;
}

#webPinForm input:focus {
    border-color: #58a6ff !important;
    outline: none;
}

#webPinForm .btn-primary {
    width: 100%;
    padding: 12px;
    font-weight: 600;
    margin-top: 12px !important;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal .btn-secondary-small {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #8b949e;
    margin-top: 16px !important;
}

.modal .btn-secondary-small:hover {
    border-color: #8b949e;
    color: white;
}

.popup-backdrop.show {
    display: block;
}

.hotspot-preview-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 70px;
    background: #0d1117;
    border-radius: 6px;
}

.hotspot-preview {
    position: relative;
}

.hotspot-preview .inner {
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hotspot-preview .tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 6px;
    white-space: nowrap;
    padding: 4px 10px;
}

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(60px);
    padding: 10px 20px;
    background: #21262d;
    border: 1px solid #30363d;
    border-radius: 8px;
    font-size: 0.8rem;
    z-index: 400;
    opacity: 0;
    transition: all 0.25s;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Logo overlay */
.logo-overlay {
    position: absolute;
    z-index: 60;
    pointer-events: none;
}

.logo-overlay img {
    display: block;
    pointer-events: none;
}

.logo-overlay .logo-delete-btn {
    display: none;
    position: absolute;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    background: #da3633;
    border: 2px solid white;
    border-radius: 50%;
    color: white;
    font-size: 12px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

body.edit-mode .logo-overlay {
    pointer-events: auto;
    cursor: move;
}

body.edit-mode .logo-overlay:hover {
    outline: 2px dashed #58a6ff;
    outline-offset: 4px;
}

body.edit-mode .logo-overlay.dragging {
    outline: 2px solid #58a6ff;
}

body.edit-mode .logo-overlay .logo-delete-btn {
    display: flex;
}

/* Logo clickeable cuando tiene URL configurada (fuera de edit-mode) */
.logo-overlay.has-url {
    pointer-events: auto;
    cursor: pointer;
}

.logo-overlay.has-url:hover {
    filter: brightness(1.1);
}

/* Indicador visual sutil de que es clickeable */
.logo-overlay.has-url::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 4px;
    transition: box-shadow 0.2s;
}

.logo-overlay.has-url:hover::after {
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.5);
}

/* Welcome Popup */
.welcome-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(145deg, #1a1f2e, #0d1117);
    border: 1px solid #30363d;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    z-index: 500;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 90%;
    width: 400px;
}

.welcome-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: #8b949e;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 5px;
    transition: all 0.2s;
}

.welcome-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.welcome-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.welcome-icon {
    font-size: 3.5rem;
    margin-bottom: 5px;
}

.welcome-popup h2 {
    color: #fff;
    font-size: 1.4rem;
    margin: 0;
}

.welcome-popup>.welcome-content>p {
    color: #8b949e;
    font-size: 0.9rem;
    margin: 0;
}

.btn-tour-rapido-big {
    display: flex;
    align-items: center;
    gap: 15px;
    background: linear-gradient(135deg, #238636, #2ea043);
    border: none;
    color: white;
    padding: 18px 30px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    margin-top: 10px;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(35, 134, 54, 0.4);
}

.btn-tour-rapido-big:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(35, 134, 54, 0.5);
}

.btn-tour-rapido-big .icon {
    font-size: 1.8rem;
}

.btn-tour-rapido-big .text {
    text-align: left;
}

.btn-tour-rapido-big .text strong {
    display: block;
    font-size: 1.1rem;
}

.btn-tour-rapido-big .text small {
    font-size: 0.75rem;
    opacity: 0.85;
}

.welcome-divider {
    color: #484f58;
    font-size: 0.75rem;
    position: relative;
    width: 100%;
    text-align: center;
    margin: 10px 0;
}

.welcome-divider::before,
.welcome-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 30%;
    height: 1px;
    background: #30363d;
}

.welcome-divider::before {
    left: 0;
}

.welcome-divider::after {
    right: 0;
}

.btn-secondary-small {
    background: transparent;
    border: 1px solid #30363d;
    color: #8b949e;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.btn-secondary-small:hover {
    border-color: #58a6ff;
    color: #58a6ff;
}

/* Tour Guide Modal */
.tour-guide-modal {
    max-width: 450px;
    text-align: left;
}

.tour-guide-modal h3 {
    text-align: center;
    margin-bottom: 20px;
}

.guide-section {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 12px;
}

.guide-title {
    font-weight: 600;
    color: #fff;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.guide-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.guide-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: #c9d1d9;
}

.guide-list .check {
    color: #3fb950;
    font-weight: bold;
}

.guide-list .magic {
    color: #f0883e;
}

.guide-instruction {
    font-size: 0.9rem;
    color: #c9d1d9;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.guide-instruction .folder-icon {
    font-size: 1.3rem;
}

.guide-instruction strong {
    color: #58a6ff;
}

.guide-how {
    background: rgba(88, 166, 255, 0.1);
    border: 1px solid rgba(88, 166, 255, 0.3);
}

.guide-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.guide-buttons .btn {
    flex: 1;
}

/* Desktop/Mobile visibility */
.mobile-only {
    display: none !important;
}

.desktop-only {
    display: flex !important;
}

/* Logo controls in viewer */
.logo-controls {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(22, 27, 34, 0.95);
    padding: 12px 20px;
    border-radius: 10px;
    border: 1px solid #30363d;
    z-index: 70;
    display: flex;
    gap: 20px;
    font-size: 0.75rem;
    color: #c9d1d9;
}

.logo-controls label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-controls input[type="range"] {
    width: 100px;
}

.logo-controls span {
    min-width: 35px;
}

/* Logo Modal */
.logo-modal {
    max-width: 400px;
}

.logo-upload-area {
    border: 2px dashed #30363d;
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    margin-bottom: 15px;
}

.logo-upload-area:active {
    border-color: #58a6ff;
    background: rgba(88, 166, 255, 0.1);
}

.logo-upload-area .upload-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.logo-upload-area .upload-text {
    font-size: 0.8rem;
    color: #8b949e;
}

.logo-preview-container {
    background: #21262d;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin-bottom: 15px;
}

.logo-preview-container img {
    max-width: 150px;
    max-height: 100px;
    object-fit: contain;
}

.logo-sliders {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.logo-sliders label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
}

.logo-sliders label span:first-child {
    min-width: 60px;
    color: #8b949e;
}

.logo-sliders input[type="range"] {
    flex: 1;
}

.logo-sliders label span:last-child {
    min-width: 35px;
    text-align: right;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.modal-buttons .btn {
    flex: 1;
    white-space: nowrap;
}

/* Checkbox styling */
.config-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Small button */
.btn-sm {
    padding: 4px 10px;
    font-size: 0.75rem;
}

/* Logo upload area - removed, using button only */

/* Target view modal */
.target-preview-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
}

.target-preview-container canvas {
    width: 100%;
    height: 100%;
    cursor: move;
    touch-action: none;
}

.target-crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: rgba(255, 255, 255, 0.8);
    pointer-events: none;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
}

.target-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.target-info {
    font-size: 0.75rem;
    color: #8b949e;
}

.target-actions {
    display: flex;
    gap: 8px;
}

.target-actions .btn {
    padding: 8px 16px;
}

::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 3px;
}

/* Hide mobile voice note FAB on desktop */
.mobile-voice-note-fab {
    display: none;
}

/* Hide hotspots when gyroscope is active */
body.gyro-active .hotspot-marker {
    display: none !important;
}

/* ===== MOBILE REDESIGN ===== */
@media (max-width: 768px) {

    /* Hide desktop sidebar */
    .sidebar {
        display: none !important;
    }

    .sidebar-toggle {
        display: none !important;
    }

    .viewer-area {
        width: 100%;
        height: 100%;
    }

    /* Welcome popup mobile */
    .welcome-popup {
        width: 90%;
        max-width: 350px;
        padding: 30px 25px;
    }

    .welcome-icon {
        font-size: 2.5rem;
    }

    .welcome-popup h2 {
        font-size: 1.2rem;
    }

    .btn-tour-rapido-big {
        padding: 15px 20px;
        width: 100%;
        justify-content: center;
    }

    .btn-tour-rapido-big .icon {
        font-size: 1.5rem;
    }

    /* Tour guide modal mobile */
    .tour-guide-modal {
        max-width: 90%;
        max-height: 85vh;
        overflow-y: auto;
    }

    .guide-section {
        padding: 12px;
    }

    .guide-list li {
        font-size: 0.8rem;
    }

    /* Show mobile instructions, hide desktop */
    .mobile-only {
        display: flex !important;
    }

    .desktop-only {
        display: none !important;
    }

    /* Logo responsive on mobile - positioned right, bigger */
    .logo-overlay {
        right: 12px;
        left: auto;
        top: 70px;
    }

    .logo-overlay img {
        max-width: 30vw;
        height: auto;
        max-height: 18vh;
    }

    /* Allow editing logo on mobile - remove fixed positioning */
    body.edit-mode .logo-overlay {
        pointer-events: auto !important;
        cursor: move !important;
        touch-action: none !important;
        right: auto !important;
        bottom: auto !important;
    }

    /* Logo clickeable en móvil - feedback táctil */
    .logo-overlay.has-url:active {
        transform: scale(0.97);
        transition: transform 0.1s;
    }

    .mobile-topbar {
        display: flex;
        position: fixed;
        top: 12px;
        left: 12px;
        right: 12px;
        z-index: 200;
        justify-content: flex-end;
        align-items: center;
        pointer-events: none;
        gap: 8px;
    }

    .mobile-topbar>* {
        pointer-events: auto;
    }

    .mobile-title {
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(10px);
        padding: 8px 14px;
        border-radius: 20px;
        font-size: 0.8rem;
        font-weight: 600;
        color: white;
    }

    .mobile-settings-btn {
        width: 44px;
        height: 44px;
        border-radius: 50%;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(10px);
        border: none;
        color: white;
        font-size: 1.3rem;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s;
    }

    .mobile-settings-btn:active {
        transform: scale(0.95);
        background: rgba(88, 166, 255, 0.4);
    }

    /* Voice note FAB on mobile - Modernized & Positioned higher */
    /* Container for Button + Label pairs */
    .mobile-fab-wrapper {
        display: flex;
        flex-direction: column;
        align-items: center;
        position: relative;
    }

    /* Voice note FAB on mobile - Modernized */
    .mobile-fab.voice-note {
        /* Inherits .mobile-fab base styles */
        background: linear-gradient(135deg, #4f46e5, #312e81);
        font-size: 1.6rem;
    }

    .mobile-fab.voice-note.active {
        background: linear-gradient(135deg, #ef4444, #991b1b);
        border-color: rgba(239, 68, 68, 0.5);
        animation: pulse-voice 1.5s ease-in-out infinite;
    }

    @keyframes pulse-voice {

        0%,
        100% {
            box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
        }

        70% {
            box-shadow: 0 0 0 15px rgba(239, 68, 68, 0);
        }
    }

    /* Floating buttons group - Right Aligned & Stacked */
    .mobile-fab-group {
        display: flex;
        flex-direction: column;
        align-items: center;
        position: fixed;
        right: 16px;
        bottom: 140px;
        /* Lowered significantly to be closer to thumb/bottom bar */
        gap: 10px;
        /* Reduced gap as requested ("mas cerca") */
        z-index: 200;
        pointer-events: none;
        /* Let clicks pass through container area */
    }

    .mobile-fab-group>* {
        pointer-events: auto;
        /* Re-enable clicks on children */
    }

    .mobile-fab {
        width: 56px;
        height: 56px;
        border-radius: 50%;
        border: 1px solid rgba(255, 255, 255, 0.2);
        color: white;
        font-size: 1.4rem;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
        backdrop-filter: blur(8px);
    }

    .mobile-fab:active {
        transform: scale(0.92);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    }

    .mobile-fab.tour-rapido {
        background: linear-gradient(135deg, #10b981, #047857);
        /* Premium Emerald */
        animation: pulse-glow 3s ease-in-out infinite;
    }

    /* Label hidden by default, shown on hover/active */
    .mobile-fab-label {
        background: rgba(13, 17, 23, 0.9);
        backdrop-filter: blur(8px);
        color: rgba(255, 255, 255, 0.95);
        font-size: 0.75rem;
        font-weight: 500;
        padding: 6px 12px;
        border-radius: 16px;
        white-space: nowrap;
        margin-top: 8px;
        border: 1px solid rgba(255, 255, 255, 0.15);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
        opacity: 0;
        transform: translateY(-5px);
        transition: all 0.2s ease;
        pointer-events: none;
    }

    /* Show label when wrapper is hovered OR local button is active/focused */
    .mobile-fab-wrapper:hover .mobile-fab-label,
    .mobile-fab:active+.mobile-fab-label,
    .mobile-fab:focus+.mobile-fab-label {
        opacity: 1;
        transform: translateY(0);
    }

    @keyframes pulse-glow {

        0%,
        100% {
            box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.3);
            border-color: rgba(255, 255, 255, 0.3);
        }

        50% {
            box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
            border-color: rgba(16, 185, 129, 0.6);
        }
    }


    .mobile-fab.secondary {
        background: rgba(48, 54, 61, 0.95);
        backdrop-filter: blur(10px);
    }

    /* Gyro Button - Styled like other FABs */
    .mobile-fab.gyro {
        background: #161b22;
        border: 1px solid rgba(255, 255, 255, 0.2);
        font-size: 1.5rem;
    }

    .mobile-fab.gyro.active {
        background: #238636;
        /* Green when active */
        border-color: #2ea043;
        box-shadow: 0 0 15px rgba(46, 160, 67, 0.4);
    }

    /* Bottom panel */
    .mobile-bottom {
        display: flex;
        flex-direction: column;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 200;
        padding: 10px;
        gap: 8px;
        background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
    }

    .mobile-scenes-row {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 12px 0 5px 0;
        /* More top padding for delete buttons */
        scroll-behavior: smooth;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
    }

    .mobile-scenes-row::-webkit-scrollbar {
        display: none;
    }

    .mobile-scene-thumb {
        width: 110px;
        height: 80px;
        border-radius: 8px;
        border: 2px solid rgba(255, 255, 255, 0.3);
        overflow: hidden;
        flex-shrink: 0;
        cursor: pointer;
        transition: all 0.2s;
        position: relative;
        background: #222;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
        scroll-snap-align: start;
    }

    .mobile-scene-thumb.active {
        border-color: #58a6ff;
        box-shadow: 0 0 10px rgba(88, 166, 255, 0.5);
    }

    .mobile-scene-thumb.dragging {
        opacity: 0.6;
        border-color: #f0883e;
        transform: scale(0.95);
    }

    .mobile-scene-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        pointer-events: none;
        -webkit-user-drag: none;
        /* user-drag is non-standard and often unsupported, removing or using webkit prefix only is safer */
        user-select: none;
    }

    /* Drag hint in edit mode */
    .mobile-drag-hint {
        display: none;
        position: fixed;
        bottom: 130px;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(240, 136, 62, 0.9);
        color: white;
        padding: 8px 16px;
        border-radius: 20px;
        font-size: 0.7rem;
        z-index: 201;
        pointer-events: none;
    }

    body.edit-mode .mobile-drag-hint {
        display: block;
    }

    .mobile-scene-thumb .name {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
        color: white;
        font-size: 11px;
        padding: 8px 3px 2px;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mobile-scene-thumb .edit-name-btn {
        position: absolute;
        top: 2px;
        right: 2px;
        width: 18px;
        height: 18px;
        border-radius: 50%;
        background: rgba(0, 0, 0, 0.7);
        border: none;
        color: white;
        font-size: 8px;
        cursor: pointer;
        opacity: 0;
        transition: opacity 0.2s;
    }

    .mobile-scene-thumb.active .edit-name-btn {
        opacity: 1;
    }

    .mobile-add-scene {
        width: 110px;
        height: 80px;
        border-radius: 8px;
        border: 2px dashed rgba(255, 255, 255, 0.4);
        background: rgba(255, 255, 255, 0.1);
        flex-shrink: 0;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.5rem;
        color: rgba(255, 255, 255, 0.6);
    }

    .mobile-add-scene:active {
        background: rgba(88, 166, 255, 0.3);
    }

    /* Mobile scene edit mode buttons */
    .mobile-scene-thumb.editable {
        border-color: #f0883e;
    }

    .mobile-scene-delete,
    .mobile-scene-edit {
        position: absolute;
        width: 22px;
        height: 22px;
        border-radius: 50%;
        border: none;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 5;
        opacity: 0;
        transition: opacity 0.2s;
    }

    .mobile-scene-thumb.editable .mobile-scene-delete,
    .mobile-scene-thumb.editable .mobile-scene-edit {
        opacity: 1;
    }

    .mobile-scene-delete {
        top: 2px;
        right: 2px;
        background: rgba(248, 81, 73, 0.9);
        color: white;
    }

    .mobile-scene-edit {
        top: 2px;
        left: 2px;
        background: rgba(88, 166, 255, 0.9);
        color: white;
    }

    .mobile-scene-delete:active,
    .mobile-scene-edit:active {
        transform: scale(0.9);
    }

    .mobile-scene-thumb.dragging {
        opacity: 0.5;
        border-color: #f0883e;
    }

    .mobile-scene-thumb.drag-over {
        border-color: #58a6ff;
        background: rgba(88, 166, 255, 0.2);
    }

    .mobile-actions-row {
        display: flex;
        justify-content: center;
        gap: 10px;
    }

    .mobile-action-btn {
        padding: 10px 20px;
        border-radius: 20px;
        border: none;
        font-size: 0.75rem;
        font-weight: 500;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .mobile-action-btn.edit {
        background: #f0883e;
        color: white;
    }

    .mobile-action-btn.edit.active {
        background: #58a6ff;
    }

    .mobile-action-btn.export {
        background: rgba(255, 255, 255, 0.15);
        color: white;
    }

    .mobile-action-btn:active {
        transform: scale(0.95);
    }

    /* Mobile menu modal */
    .mobile-menu-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.7);
        backdrop-filter: blur(5px);
        z-index: 300;
        align-items: flex-end;
    }

    .mobile-menu-backdrop.show {
        display: flex;
    }

    .mobile-menu {
        background: #161b22;
        border-radius: 20px 20px 0 0;
        width: 100%;
        max-height: 70vh;
        padding: 20px;
        animation: slideUp 0.3s ease;
        overflow-y: auto;
    }

    @keyframes slideUp {
        from {
            transform: translateY(100%);
        }

        to {
            transform: translateY(0);
        }
    }

    .mobile-menu-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 20px;
        padding-bottom: 15px;
        border-bottom: 1px solid #30363d;
    }

    .mobile-menu-header h3 {
        margin: 0;
        font-size: 1rem;
    }

    .mobile-lang-select {
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 6px;
        color: white;
        font-size: 1rem;
        padding: 4px 8px;
        cursor: pointer;
        margin-left: auto;
        margin-right: 10px;
    }

    .mobile-menu-close {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background: #30363d;
        border: none;
        color: white;
        font-size: 1.2rem;
        cursor: pointer;
    }

    .mobile-menu-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }

    /* Center buttons in Project section */
    .mobile-menu-section .mobile-menu-grid {
        display: flex;
        justify-content: center;
        gap: 15px;
    }

    .mobile-menu-section .mobile-menu-grid .mobile-menu-item {
        width: auto;
        min-width: 100px;
        flex: 0 0 auto;
    }

    .mobile-menu-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 6px;
        padding: 15px 10px;
        border-radius: 12px;
        background: #21262d;
        border: none;
        color: white;
        cursor: pointer;
    }

    .mobile-menu-item:active {
        background: #30363d;
    }

    .mobile-menu-item .icon {
        font-size: 1.5rem;
    }

    .mobile-menu-item .label {
        font-size: 0.65rem;
        opacity: 0.8;
    }

    .mobile-menu-section {
        margin-top: 15px;
        padding-top: 15px;
        border-top: 1px solid #30363d;
    }

    .mobile-menu-section-title {
        font-size: 0.7rem;
        color: #8b949e;
        margin-bottom: 10px;
        text-transform: uppercase;
    }

    .empty-state {
        padding: 20px;
    }

    .empty-state .icon {
        font-size: 3rem;
    }

    .empty-state h2 {
        font-size: 1.1rem;
    }

    .mode-badge {
        font-size: 0.7rem;
        padding: 8px 14px;
        top: 70px;
        border-radius: 15px;
    }

    .modal {
        max-width: 92%;
        padding: 15px;
        border-radius: 16px;
    }

    /* Config modal mobile - full width, no horizontal scroll */
    .config-modal {
        max-width: 95% !important;
        width: 95%;
        max-height: 85vh;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .config-modal .config-content {
        gap: 8px;
    }

    .config-modal .config-section {
        padding: 10px;
    }

    .config-modal .config-row {
        flex-wrap: wrap;
        gap: 6px;
    }

    .config-modal .config-row label {
        flex: 0 0 100%;
        margin-bottom: 2px;
    }

    /* Fix nadir scope row to show both options side by side */
    #nadirScopeRow {
        flex-wrap: nowrap !important;
    }

    #nadirScopeRow>label {
        flex: 0 0 auto !important;
        width: auto !important;
    }

    #nadirScopeRow>div {
        flex-wrap: nowrap !important;
    }

    #nadirScopeRow>div label {
        flex: 0 0 auto !important;
        font-size: 0.75rem;
    }

    .config-modal .config-row input[type="range"] {
        flex: 1;
        min-width: 0;
    }

    .config-modal .config-row input[type="color"] {
        width: 100%;
        height: 36px;
    }

    .config-modal .config-row select {
        width: 100%;
    }

    .config-modal .config-row span {
        flex: 0 0 35px;
    }

    .config-modal .hotspot-preview-container {
        margin-bottom: 5px;
    }

    /* Infospot modal mobile */
    .infospot-modal {
        max-width: 95% !important;
        width: 95%;
    }

    .infospot-types {
        gap: 4px;
    }

    .infospot-type {
        padding: 8px 8px;
        min-width: 55px;
    }

    .infospot-type .type-icon {
        font-size: 1.1rem;
    }

    .infospot-type .type-label {
        font-size: 0.55rem;
    }

    /* Hide undo/redo buttons on mobile */
    #mobileUndoBtn,
    #mobileRedoBtn,
    .history-toggle {
        display: none !important;
    }
}

/* Hide mobile on desktop */
@media (min-width: 769px) {

    .mobile-topbar,
    .mobile-fab-group,
    .mobile-bottom,
    .mobile-menu-backdrop {
        display: none !important;
    }
}

/* Voice Recording UI */
#recording-ui {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #dc143c;
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    display: none;
    align-items: center;
    gap: 10px;
    z-index: 6000;
    box-shadow: 0 0 15px #dc143c;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* ============================================
   SVG ICONS SYSTEM - Professional Styling
   Updated: 2025-01-19
   ============================================ */

/* Global SVG icon styles */
svg {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Icon wrapper for dynamic SVG */
.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

/* Button icons - ensure proper sizing and alignment */
button svg {
    pointer-events: none;
    flex-shrink: 0;
}

/* Sidebar button icons */
.btn svg {
    margin-right: 6px;
    vertical-align: -4px;
}

.btn-tour-rapido svg,
.btn-tour-rapido-big svg {
    width: 20px;
    height: 20px;
    margin-right: 10px;
}

/* Mobile FAB icons */
.mobile-fab svg {
    width: 24px;
    height: 24px;
}

/* SVG removed from mobile voice button - using emoji */

.mobile-settings-btn svg {
    width: 20px;
    height: 20px;
}

/* Mobile action buttons */
.mobile-action-btn svg {
    margin-right: 6px;
    vertical-align: -3px;
}

/* Mobile menu items */
.mobile-menu-item .icon svg {
    width: 24px;
    height: 24px;
}

/* Sidebar toggle */
.sidebar-toggle svg {
    width: 20px;
    height: 20px;
}

/* Upload area icons */
.upload-icon svg,
.logo-upload-area svg {
    width: 48px;
    height: 48px;
    opacity: 0.5;
}

/* Welcome/Empty state icons */
.welcome-icon svg,
.empty-state .icon svg {
    width: 64px;
    height: 64px;
}

/* Modal close buttons */
.welcome-close svg,
.mobile-menu-close svg {
    width: 20px;
    height: 20px;
}

/* Config tabs */
.config-tab svg {
    width: 16px;
    height: 16px;
    margin-right: 6px;
    vertical-align: -2px;
}

/* Infospot type buttons */
.infospot-type .type-icon svg {
    width: 24px;
    height: 24px;
}

/* Modal headers */
.modal h3 svg {
    vertical-align: -4px;
    margin-right: 8px;
}

/* Inline icons in text */
span svg {
    vertical-align: -3px;
}

/* Upload/action button inline icons */
.infospot-upload-btn svg,
.upload-icon-btn svg {
    width: 16px;
    height: 16px;
    margin-right: 6px;
    vertical-align: -2px;
}

/* Scene list icons */
.scene-item svg {
    width: 16px;
    height: 16px;
}

/* Hotspot list icons */
.hotspot-item svg {
    width: 16px;
    height: 16px;
    margin-right: 6px;
    vertical-align: -2px;
}

/* Target/Pin icons in lists */
.scene-pin svg,
.hotspot-target svg {
    width: 14px;
    height: 14px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.scene-pin:hover svg,
.hotspot-target:hover svg {
    opacity: 1;
}

/* Delete buttons */
.scene-delete svg,
.hotspot-delete svg,
.logo-delete-btn svg {
    width: 16px;
    height: 16px;
}

/* Guide section icons */
.guide-section svg {
    vertical-align: -3px;
    margin-right: 6px;
}

.check svg {
    width: 16px;
    height: 16px;
    color: #238636;
}

.magic svg {
    width: 16px;
    height: 16px;
    color: #f59e0b;
}

.folder-icon svg {
    width: 24px;
    height: 24px;
    margin-right: 10px;
}

/* Toast icons */
.toast svg {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    vertical-align: -3px;
}

/* Radial menu center icon */
.radial-center svg {
    width: 20px;
    height: 20px;
}

/* Hotspot preview in config */
.hotspot-preview .inner svg {
    width: 24px;
    height: 24px;
}

/* Recording UI icons */
#recording-ui svg {
    width: 16px;
    height: 16px;
    margin-right: 8px;
}

/* Ensure SVG inherits button colors */
button:hover svg {
    opacity: 0.9;
}

button:active svg {
    opacity: 0.8;
}

button:disabled svg {
    opacity: 0.4;
}

/* Primary button icons */
.btn-primary svg {
    color: currentColor;
}

/* Secondary button icons */
.btn-secondary svg {
    color: currentColor;
}

/* Icon-only buttons (no text) */
button:not(:has(span:not(.icon))):not(:has(div)) svg {
    margin: 0;
}

/* Smooth transitions for icon state changes */
svg {
    transition: opacity 0.2s, transform 0.2s;
}

/* Hover effects for interactive icons */
button:hover svg,
.interactive-icon:hover svg {
    transform: scale(1.05);
}

/* Active state for icons */
button:active svg {
    transform: scale(0.95);
}

/* Global Override Checkbox */
.global-override-check {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
    cursor: pointer;
    font-weight: normal;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 8px;
    border-radius: 4px;
    width: fit-content;
}

.global-override-check:hover {
    background: rgba(255, 255, 255, 0.1);
}

.global-override-check input {
    margin: 0;
    accent-color: var(--primary-color);
}

/* Iframe Modal - Resizable Window */
.iframe-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60vw;
    height: 70vh;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    z-index: 2000;
    display: none;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    resize: both;
    overflow: hidden;
    min-width: 320px;
    min-height: 240px;
    max-width: 95vw;
    max-height: 95vh;
}

.iframe-modal.show {
    display: flex;
}

.iframe-header {
    padding: 10px 20px;
    background: #161b22;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #30363d;
    flex-shrink: 0;
}

.iframe-header span {
    font-size: 0.8rem;
    color: #8b949e;
}

.iframe-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

.iframe-container {
    flex: 1;
    width: 100%;
    height: 100%;
    position: relative;
    background: white;
}

.iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Collapsible Hotspots Section */
.hotspots-section.collapsed #hotspotList {
    display: none;
}

.hotspots-section .section-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}

.hotspots-section .section-label:hover {
    color: white;
}


/* Resize Handle & Modal Overrides */
.resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 50%, rgba(255, 255, 255, 0.5) 50%);
    border-bottom-right-radius: 16px;
    z-index: 20;
}

.infospot-popup {
    width: 600px;
    max-width: 95vw;
    max-height: 90vh;
    overflow: hidden;
    resize: both;
    will-change: width, height;
}

.infospot-popup.resizing,
.iframe-modal.resizing {
    transition: none !important;
    pointer-events: auto;
}

.infospot-popup .popup-body {
    overflow: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-height: 0;
}

.infospot-popup img,
.infospot-popup video {
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
}

.infospot-popup iframe {
    width: 100%;
    height: 100%;
    min-height: 300px;
    flex: 1;
}



/* Iframe Modal Resizable Override */
.iframe-modal {
    width: 800px;
    max-width: 95vw;
    height: 70vh;
    max-height: 95vh;
    overflow: hidden;
    resize: both;
    display: none;
    flex-direction: column;
}

.iframe-modal.show {
    display: flex !important;
}

.iframe-container {
    position: relative;
    overflow: hidden;
    flex: 1;
    background: white;
}

/* Flyout Backdrop */
.flyout-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
    z-index: 999;
}

.flyout-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Ensure flown-out hotspot is above everything */
.hotspot-marker.flying {
    z-index: 1001 !important;
}

.hotspot-marker.flying .tooltip {
    opacity: 0 !important;
}

/* Integration with Flyout */
.infospot-popup {
    z-index: 2000 !important;
    /* Above flyout */
}

/* When flyout is active, we might want to hide the standard popup backdrop 
   or ensure it's above/below? 
   If we use flyout backdrop, we can hide this one or stack them.
   Let's ensure it's above flyout backdrop if shown.
*/
.popup-backdrop {
    z-index: 1900 !important;
}



/* ============ PINNED IMAGE CSS3D ============ */
#css3dWrapper {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 20;
}

#css3dScene {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    transform-style: preserve-3d;
}

#css3dCamera {
    position: absolute;
    transform-style: preserve-3d;
    width: 0;
    height: 0;
    will-change: transform;
}

.hotspot-pinned {
    position: absolute;
    left: 0;
    top: 0;
    margin-left: -50%;
    margin-top: -50%;
    transform-origin: center center;
    transform-style: preserve-3d;
    pointer-events: auto;
    cursor: pointer;
    backface-visibility: visible;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    transition: box-shadow 0.2s;
}

.hotspot-pinned:hover {
    box-shadow: 0 0 0 3px #58a6ff, 0 6px 30px rgba(0, 0, 0, 0.7);
}

.hotspot-pinned img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.hotspot-pinned .pinned-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 24px;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .hotspot-pinned {
        min-width: 80px;
        min-height: 60px;
    }
}


/* ============ RADIAL MENU ============ */
#radialMenu {
    position: fixed;
    width: 200px;
    height: 200px;
    margin-left: -100px;
    margin-top: -100px;
    z-index: 3000;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#radialMenu.show {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.radial-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

#radialOptions {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
}

.radial-option {
    position: absolute;
    margin-top: -18px;
    margin-left: -18px;
    /* Half of 36px */
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: white;
    z-index: 10;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

/* Large Radial Menu (Desktop Tools) */
.radial-menu.large .radial-option {
    margin-top: -25px;
    margin-left: -25px;
    width: 50px;
    height: 50px;
}

/* Specific Colors for Desktop Tools */
.radial-option.opt-config {
    background: #30363d;
    border-color: #8b949e;
}

.radial-option.opt-image {
    background: #0ea5e9;
    border-color: #7dd3fc;
}

/* Sky Blue */
.radial-option.opt-nadir {
    background: #8b5cf6;
    border-color: #c4b5fd;
}

/* Violet */
.radial-option.opt-rotate {
    background: #f59e0b;
    border-color: #fcd34d;
}

/* Amber */
.radial-option.opt-lp {
    background: #10b981;
    border-color: #6ee7b7;
}

/* Emerald */
.radial-option.opt-voice {
    background: #ec4899;
    border-color: #f9a8d4;
}

/* Pink */
.radial-option.opt-add {
    background: #238636;
    border-color: #4ac26b;
}

/* Green */
.radial-option.opt-audio {
    background: #6366f1;
    border-color: #a5b4fc;
}

/* Indigo */
.radial-option.opt-floorplan {
    background: #f59e0b;
    border-color: #fbbf24;
}

/* Amber */

.radial-option:hover {
    background: #58a6ff;
    border-color: #58a6ff;
    color: white;
    transform: scale(1.15);
    /* Removed !important for smoother transition */
    box-shadow: 0 6px 15px rgba(88, 166, 255, 0.4);
    z-index: 20;
}

/* Hotspot interaction */
.radial-option-icon svg {
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.radial-option-label {
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.radial-option:hover .radial-option-label {
    opacity: 1;
}

.radial-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2999;
    background: rgba(0, 0, 0, 0.2);
    display: none;
}

/* Fix Hotspot Inner Centering */
.hotspot-marker .inner {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hotspot Animations */
@keyframes hs-pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
    }

    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(255, 255, 255, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
}

@keyframes hs-float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes hs-bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-10px);
    }

    60% {
        transform: translateY(-5px);
    }
}

.hotspot-marker .inner.pulse,
.hotspot-floor.pulse {
    animation: hs-pulse 2s infinite;
}

.hotspot-marker .inner.float,
.hotspot-floor.float {
    animation: hs-float 2s ease-in-out infinite;
}

.hotspot-marker .inner.bounce,
.hotspot-floor.bounce {
    animation: hs-bounce 2s infinite;
}

/* Responsive Preview Containers */
.hotspot-preview-container {
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #161b22;
    border-radius: 8px;
    margin-bottom: 10px;
}

.floor-preview-container {
    height: 220px !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

@media (max-width: 600px) {

    .hotspot-preview-container,
    .floor-preview-container {
        height: 180px !important;
    }
}

/* Fix Floor Arrow Centering */
#floorArrowPreview>div {
    transform-origin: center center !important;
}

/* Fix Internal Icon Scaling */
.hotspot-marker .inner svg,
.hotspot-preview .inner svg {
    width: 60% !important;
    height: 60% !important;
    max-width: none;
    max-height: none;
}

.hotspot-preview .inner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* Fix Hotspot Centering */
.hotspot-marker .inner {
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hotspot-marker .hs-icon {
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hotspot-marker .hs-icon svg {
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50% !important;
    height: 50% !important;
}

/* Paste Cancel Pill - Modern Floating Button */
.paste-cancel-pill {
    position: fixed;
    bottom: 110px;
    /* Above bottom bar on mobile */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(22, 27, 34, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ef4444;
    /* Red text for cancel action */
    padding: 10px 24px;
    border-radius: 50px;
    display: none;
    /* Controlled by JS */
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.paste-cancel-pill.show {
    display: flex;
}

.paste-cancel-pill:hover {
    background: rgba(22, 27, 34, 0.95);
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    border-color: rgba(239, 68, 68, 0.5);
}

.paste-cancel-pill:active {
    transform: translateX(-50%) scale(0.95);
}

.paste-cancel-pill svg {
    width: 16px;
    height: 16px;
    stroke-width: 2.5;
}

@media (min-width: 769px) {
    .paste-cancel-pill {
        bottom: 30px;
        /* Lower on desktop */
    }
}

/* Modal Buttons Alignment */
.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    width: 100%;
}

.modal-buttons .btn {
    flex: 1;
    margin-bottom: 0;
    justify-content: center;
}

/* ====== MOBILE CAROUSEL TOGGLE ====== */
/* Button to hide/show carousel when working with bottom logos */
.mobile-carousel-toggle {
    display: none;
    position: fixed;
    bottom: 140px;
    right: 10px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(30, 30, 30, 0.95);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    z-index: 250;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.mobile-carousel-toggle:hover,
.mobile-carousel-toggle:active {
    background: rgba(50, 50, 50, 0.95);
    transform: scale(1.05);
}

.mobile-carousel-toggle.carousel-hidden {
    background: rgba(88, 166, 255, 0.9);
    border-color: #58a6ff;
}

.mobile-carousel-toggle svg {
    width: 20px;
    height: 20px;
}

/* Show toggle button only in edit mode on mobile */
@media (max-width: 768px) {
    body.edit-mode .mobile-carousel-toggle {
        display: flex;
    }

    /* When carousel is hidden */
    body.carousel-hidden .mobile-bottom {
        transform: translateY(100%);
        opacity: 0;
        pointer-events: none;
    }

    body.carousel-hidden .mobile-drag-hint {
        display: none !important;
    }

    /* Adjust toggle button position when carousel is hidden */
    body.carousel-hidden .mobile-carousel-toggle {
        bottom: 70px;
    }

    /* Transition for smooth hide/show */
    .mobile-bottom {
        transition: transform 0.3s ease, opacity 0.3s ease;
    }
}

/* ====== IMPROVED DRAG & DROP VISUAL FEEDBACK ====== */
/* Clear visual indicator for drag mode */
@media (max-width: 768px) {

    /* When dragging for reorder - orange highlight */
    .mobile-scene-thumb.dragging {
        opacity: 0.5;
        border-color: #f0883e !important;
        transform: scale(0.9);
    }

    /* Drop target for reorder */
    .mobile-scene-thumb.drag-over {
        border-color: #58a6ff !important;
        box-shadow: 0 0 15px rgba(88, 166, 255, 0.6);
        transform: scale(1.05);
    }

    /* Drag mode indicator badge */
    .drag-mode-indicator {
        display: none;
        position: fixed;
        top: 60px;
        left: 50%;
        transform: translateX(-50%);
        padding: 8px 16px;
        border-radius: 20px;
        font-size: 0.75rem;
        font-weight: 600;
        z-index: 10001;
        pointer-events: none;
        animation: pulse-indicator 1s ease infinite;
    }

    .drag-mode-indicator.reorder {
        display: block;
        background: rgba(240, 136, 62, 0.95);
        color: white;
    }

    .drag-mode-indicator.hotspot {
        display: block;
        background: rgba(88, 166, 255, 0.95);
        color: white;
    }

    @keyframes pulse-indicator {

        0%,
        100% {
            opacity: 1;
            transform: translateX(-50%) scale(1);
        }

        50% {
            opacity: 0.8;
            transform: translateX(-50%) scale(1.02);
        }
    }

    /* Hotspot drop zone enhancement */
    #dropZone.show {
        background: rgba(88, 166, 255, 0.3) !important;
        border: 3px dashed #58a6ff !important;
    }

    /* Moved styling to span to allow dynamic translation */
    #dropZone.show span {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: rgba(88, 166, 255, 0.9);
        color: white;
        padding: 12px 24px;
        border-radius: 25px;
        font-size: 0.85rem;
        font-weight: 600;
        white-space: nowrap;
    }

    #dropZone.show span::before {
        content: '📍 ';
        margin-right: 6px;
    }

    #dropZone.show::after {
        display: none;
    }
}

/* ====== DRAG ACTION BUTTONS (Alternative to gesture separation) ====== */
/* Show action buttons on long press instead of immediate drag */
.mobile-scene-actions-popup {
    display: none;
    position: fixed;
    background: rgba(22, 27, 34, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 8px;
    z-index: 10002;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    flex-direction: column;
    gap: 4px;
    min-width: 160px;
}

.mobile-scene-actions-popup.show {
    display: flex;
}

.mobile-scene-actions-popup button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: white;
    font-size: 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.mobile-scene-actions-popup button:hover,
.mobile-scene-actions-popup button:active {
    background: rgba(255, 255, 255, 0.1);
}

.mobile-scene-actions-popup button svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.mobile-scene-actions-popup button.reorder-btn {
    color: #f0883e;
}

.mobile-scene-actions-popup button.hotspot-btn {
    color: #2ea043;
}

.mobile-scene-actions-popup .popup-arrow {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid rgba(22, 27, 34, 0.98);
}

/* ====== UNIFIED FULLSCREEN BUTTON ====== */
/* Desktop Fullscreen Button - Fixed position top-right */
.desktop-fullscreen-btn {
    display: none;
    /* Hidden by default, shown only on desktop */
    position: fixed;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(22, 27, 34, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    z-index: 150;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.desktop-fullscreen-btn:hover {
    background: rgba(88, 166, 255, 0.3);
    border-color: #58a6ff;
    transform: scale(1.05);
}

.desktop-fullscreen-btn:active {
    transform: scale(0.95);
}

.desktop-fullscreen-btn svg {
    width: 22px;
    height: 22px;
}

/* Show desktop button only on larger screens */
@media (min-width: 769px) {
    .desktop-fullscreen-btn {
        display: flex;
    }
}

/* Fullscreen state - change icon */
:fullscreen .desktop-fullscreen-btn .icon-expand,
:-webkit-full-screen .desktop-fullscreen-btn .icon-expand {
    display: none;
}

:fullscreen .desktop-fullscreen-btn .icon-compress,
:-webkit-full-screen .desktop-fullscreen-btn .icon-compress {
    display: block;
}

/* When sidebar is collapsed, adjust position */
.sidebar.collapsed~.viewer-area .desktop-fullscreen-btn {
    right: 20px;
}

/* Mobile fullscreen adjustments */
@media (max-width: 768px) {

    /* Hide desktop button on mobile */
    .desktop-fullscreen-btn {
        display: none !important;
    }

    /* Improve mobile fullscreen button in topbar */
    #mobileFullscreenBtn {
        width: 44px;
        height: 44px;
    }
}

/* FIX: Overlay pointer-events */
/* css3dRendererContainer debe estar ENCIMA del canvas y pasar eventos */
#threeOverlayCanvas,
#css3dContainer {
    pointer-events: none !important;
}

/* css3dRendererContainer: pointer-events none para que eventos pasen a los hijos */
#css3dRendererContainer {
    pointer-events: none !important;
}

/* DIV intermedio creado por THREE.js también debe pasar eventos */
#css3dRendererContainer>div {
    pointer-events: none !important;
}

/* Edit mode: mismo comportamiento */
.edit-mode #threeOverlayCanvas,
.edit-mode #css3dRendererContainer,
.edit-mode #css3dContainer {
    pointer-events: none !important;
}

/* Radial Center - FIX CONSOLIDADO */
#radialCenter {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 50px !important;
    height: 50px !important;
    line-height: 1 !important;
    font-size: 0 !important;
    box-sizing: border-box !important;
    border-radius: 50%;
    /* Asegurar que el contenido esté centrado */
    text-align: center !important;
}

#radialCenter svg {
    display: block !important;
    margin: 0 auto !important;
    padding: 0 !important;
    /* transform removido para permitir ajuste visual */
    vertical-align: middle !important;
}

/* WEB PIN INTERACTION FIX */
/* El container SIEMPRE captura eventos */
/* El .interaction-blocker controla si van al iframe o se bloquean para edición */
.web-pin-container {
    pointer-events: auto !important;
}

/* ============================================
   FLOORPLAN MODULE STYLES
   ============================================ */

/* Utility classes (Tailwind-like for floorplan) */
.flex {
    display: flex !important;
}

.flex-col {
    flex-direction: column !important;
}

.items-center {
    align-items: center !important;
}

.justify-center {
    justify-content: center !important;
}

.justify-between {
    justify-content: space-between !important;
}

.gap-1 {
    gap: 0.25rem !important;
}

.gap-2 {
    gap: 0.5rem !important;
}

.gap-3 {
    gap: 0.75rem !important;
}

.p-1\.5 {
    padding: 0.375rem !important;
}

.p-2 {
    padding: 0.5rem !important;
}

.p-3 {
    padding: 0.75rem !important;
}

.p-6 {
    padding: 1.5rem !important;
}

.px-2 {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.px-3 {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.py-0\.5 {
    padding-top: 0.125rem;
    padding-bottom: 0.125rem;
}

.py-1\.5 {
    padding-top: 0.375rem;
    padding-bottom: 0.375rem;
}

.text-xs {
    font-size: 0.75rem !important;
}

.font-bold {
    font-weight: 700 !important;
}

.font-mono {
    font-family: monospace !important;
}

.uppercase {
    text-transform: uppercase !important;
}

.tracking-widest {
    letter-spacing: 0.1em !important;
}

.tracking-wider {
    letter-spacing: 0.05em !important;
}

.whitespace-nowrap {
    white-space: nowrap !important;
}

.text-blue-400 {
    color: #60a5fa !important;
}

.text-gray-300 {
    color: #d1d5db !important;
}

.text-gray-400 {
    color: #9ca3af !important;
}

.text-gray-700 {
    color: #374151 !important;
}

.text-red-400 {
    color: #f87171 !important;
}

.text-red-300 {
    color: #fca5a5 !important;
}

.text-slate-400 {
    color: #94a3b8 !important;
}

.text-slate-500 {
    color: #64748b !important;
}

.text-white {
    color: white !important;
}

.bg-black\/40 {
    background: rgba(0, 0, 0, 0.4) !important;
}

.bg-black\/20 {
    background: rgba(0, 0, 0, 0.2) !important;
}

.bg-black\/60 {
    background: rgba(0, 0, 0, 0.6) !important;
}

.bg-slate-900\/90 {
    background: rgba(15, 23, 42, 0.9) !important;
}

.bg-red-500\/80 {
    background: rgba(239, 68, 68, 0.8) !important;
}

.bg-blue-600 {
    background: #2563eb !important;
}

.hover\:bg-white\/10:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

.hover\:bg-red-500\/20:hover {
    background: rgba(239, 68, 68, 0.2) !important;
}

.hover\:bg-blue-500:hover {
    background: #3b82f6 !important;
}

.hover\:text-white:hover {
    color: white !important;
}

.hover\:text-blue-300:hover {
    color: #93c5fd !important;
}

.hover\:text-red-300:hover {
    color: #fca5a5 !important;
}

.border-b {
    border-bottom-width: 1px !important;
}

.border-t {
    border-top-width: 1px !important;
}

.border-white\/10 {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

.border-white\/5 {
    border-color: rgba(255, 255, 255, 0.05) !important;
}

.rounded {
    border-radius: 0.25rem !important;
}

.rounded-xl {
    border-radius: 0.75rem !important;
}

.rounded-full {
    border-radius: 9999px !important;
}

.cursor-move {
    cursor: move !important;
}

.cursor-nwse-resize {
    cursor: nwse-resize !important;
}

.select-none {
    user-select: none !important;
}

.overflow-hidden {
    overflow: hidden !important;
}

.overflow-x-auto {
    overflow-x: auto !important;
}

.pointer-events-none {
    pointer-events: none !important;
}

.pointer-events-auto {
    pointer-events: auto !important;
}

.absolute {
    position: absolute !important;
}

.relative {
    position: relative !important;
}

.fixed {
    position: fixed !important;
}

.inset-0 {
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
}

.top-2 {
    top: 0.5rem !important;
}

.right-2 {
    right: 0.5rem !important;
}

.bottom-0 {
    bottom: 0 !important;
}

.right-0 {
    right: 0 !important;
}

.bottom-8 {
    bottom: 2rem !important;
}

.right-8 {
    right: 2rem !important;
}

.w-full {
    width: 100% !important;
}

.h-full {
    height: 100% !important;
}

.w-px {
    width: 1px !important;
}

.h-3 {
    height: 0.75rem !important;
}

.w-10 {
    width: 2.5rem !important;
}

.h-10 {
    height: 2.5rem !important;
}

.w-4 {
    width: 1rem !important;
}

.h-4 {
    height: 1rem !important;
}

.mt-3 {
    margin-top: 0.75rem !important;
}

.mb-2 {
    margin-bottom: 0.5rem !important;
}

.z-30 {
    z-index: 30 !important;
}

.transition {
    transition: all 0.2s !important;
}

.transition-opacity {
    transition: opacity 0.2s !important;
}

.block {
    display: block !important;
}

/* Glass morphism effect */
.glass {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Floorplan Modal */
.floorplan-modal {
    z-index: 9000;
    display: flex;
    flex-direction: column;
    resize: both;
    min-width: 300px;
    min-height: 350px;
    max-width: 90vw;
    max-height: 90vh;
    position: fixed;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transition: width 0.3s, height 0.3s, border-radius 0.3s;
    overflow: hidden;
}

/* Minimized State */
.floorplan-modal.minimized {
    width: 56px !important;
    height: 56px !important;
    min-width: 56px;
    min-height: 56px;
    border-radius: 9999px !important;
    resize: none;
    padding: 0;
    overflow: hidden;
    cursor: pointer;
}

/* Viewport (Map Area) */
.floorplan-viewport {
    position: relative;
    flex-grow: 1;
    background-color: #1e293b;
    overflow: hidden;
    cursor: grab;
    user-select: none;
    background-image: radial-gradient(#334155 1px, transparent 1px);
    background-size: 20px 20px;
}

.floorplan-viewport:active {
    cursor: grabbing;
}

.floorplan-viewport.locked {
    cursor: default;
}

.floorplan-viewport.locked:active {
    cursor: default;
}

/* Canvas (Image + Points) */
#floorplan-canvas {
    position: absolute;
    transform-origin: 0 0;
    will-change: transform;
    pointer-events: none;
}

#floorplan-canvas>* {
    pointer-events: auto;
}

/* Floorplan Points (Hotspots) */
.floorplan-point {
    position: absolute;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 3px solid white;
    background-color: #3b82f6;
    z-index: 10;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.6);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: popIn 0.3s backwards;
}

.floorplan-point:hover {
    background-color: #60a5fa;
    transform: translate(-50%, -50%) scale(1.1);
}

.floorplan-point.active {
    background-color: #f59e0b !important;
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.4);
    z-index: 20;
    transform: translate(-50%, -50%) scale(1.15);
}

@keyframes popIn {
    from {
        transform: translate(-50%, -50%) scale(0);
    }
}

/* Tooltip on hover */
.floorplan-point:hover::after {
    content: attr(data-label);
    position: absolute;
    bottom: 34px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

/* Scrollbar hide */
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Utility classes for floorplan */
.hidden {
    display: none !important;
}

.opacity-0 {
    opacity: 0 !important;
}

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

/* ============================================
   FLOORPLAN MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .floorplan-modal {
        width: 90vw !important;
        height: 60vh !important;
        bottom: 10px;
        right: 10px;
        left: 10px;
        margin: 0 auto;
    }

    .floorplan-modal.minimized {
        width: 48px !important;
        height: 48px !important;
        min-width: 48px;
        min-height: 48px;
    }

    .floorplan-point {
        width: 36px;
        height: 36px;
    }

    .floorplan-point:hover::after {
        font-size: 10px;
        bottom: 40px;
    }
}

@media (max-width: 480px) {
    .floorplan-modal {
        width: 95vw !important;
        height: 50vh !important;
    }

    #floorplan-level-tabs button {
        font-size: 10px;
        padding: 6px 12px;
    }
}