/* Extensiones de estilos para la nueva funcionalidad con API */

/* Visor 3D sin iframe */
#viewer-container {
    width: 100%;
    height: 100%;
    display: none; /* Oculto hasta que se cargue un modelo */
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: #000;
}

#viewer-container.loaded {
    display: block;
}

#model-viewer {
    width: 100%;
    height: 100%;
    display: block;
}

.desktop-pointerlock-hint {
    position: absolute;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    z-index: 70;
    pointer-events: none;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
}

.desktop-pointerlock-hint.is-active {
    background: rgba(46, 204, 113, 0.45);
}

/* Mensaje cuando no hay modelo cargado */
.no-model-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
    font-size: 1.2rem;
    text-align: center;
    padding: 2rem;
}

.no-model-message svg {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.delete-button {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
    padding: 4px;
    border-radius: 4px;
    border: none;
    background: none;
    cursor: pointer;
    color: currentColor;
    width: 24px;
    height: 24px;
    transition: all 0.2s ease;
}

.edit-button {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
    padding: 4px;
    border-radius: 4px;
    border: none;
    background: none;
    cursor: pointer;
    color: currentColor;
    width: 24px;
    height: 24px;
    transition: all 0.2s ease;
}

.delete-button:hover {
    opacity: 1;
    background: #dc3545;
    color: white;
}

.edit-button:hover {
    opacity: 1;
    background: #2c3e50;
    color: white;
}

.delete-button svg {
    stroke-width: 2;
}

.example-link.active .delete-button {
    color: white;
}

.upload-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.upload-button:disabled:hover {
    background: var(--primary-color);
    box-shadow: 0 2px 4px rgba(139, 0, 0, 0.2);
}

.empty-message {
    padding: 40px 20px;
    text-align: center;
    color: #666;
}

.empty-message p:first-child {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #2c3e50;
}

.empty-message p:last-child {
    font-size: 14px;
    line-height: 1.5;
}

/* Animación de carga en el botón de upload */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.upload-button:disabled svg {
    animation: spin 1s linear infinite;
}

/* Mejorar feedback visual al eliminar */
.example-link.deleting {
    opacity: 0.5;
    pointer-events: none;
}

/* Toast notifications (opcional para futuro) */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #2c3e50;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    animation: slideIn 0.3s ease;
}

.toast.success {
    background: #28a745;
}

.toast.error {
    background: #dc3545;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .empty-message {
        padding: 30px 15px;
    }
    
    .empty-message p:first-child {
        font-size: 14px;
    }
    
    .empty-message p:last-child {
        font-size: 13px;
    }
}

.logo-full {
    width: 243px;
    height: auto;
    object-fit: contain;
    margin-bottom: 8px;
}

.model-name-text {
    flex: 1;
    cursor: default;
    user-select: none;
    margin-right: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rename-input {
    width: 100%;
    padding: 2px 4px;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    font-size: inherit;
    font-family: inherit;
    background: white;
    color: #333;
    outline: none;
}

.example-link.active .rename-input {
    background: rgba(255, 255, 255, 0.9);
}

/* Vanguard Loading Overlay */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    pointer-events: none;
}

.loading-overlay.active {
    display: flex;
}

.scan-circle {
    width: 120px;
    height: 120px;
    border: 2px solid rgba(139, 0, 0, 0.2);
    border-radius: 50%;
    position: relative;
    margin-bottom: 30px;
}

.scan-circle::after {
    content: '';
    position: absolute;
    inset: -10px;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    border-top-color: transparent;
    border-bottom-color: transparent;
    animation: rotate 2s linear infinite;
}

.scan-circle::before {
    content: '';
    position: absolute;
    inset: 20%;
    background: var(--primary-color);
    border-radius: 50%;
    opacity: 0.1;
    animation: pulse 1.5s ease-in-out infinite;
}

.loading-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: #2c3e50;
    font-family: 'Courier New', Courier, monospace;
    width: 250px;
}

.loading-text {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
    animation: flicker 2s infinite;
}

.progress-wrap {
    width: 100%;
    height: 2px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-color);
    transition: width 0.3s ease;
}

.progress-percentage {
    font-size: 14px;
    font-weight: 700;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { transform: scale(0.8); opacity: 0.1; }
    50% { transform: scale(1.1); opacity: 0.3; }
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

#edit-model-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 0;
    border: none;
    border-radius: 12px;
    background: white;
    margin: 0;
    width: min(720px, 92vw);
    max-height: 90vh;
}

#edit-model-modal::backdrop {
    background: rgba(0, 0, 0, 0.55);
}

.edit-modal-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px 24px 24px;
}

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

.edit-modal-header h3 {
    font-size: 18px;
    color: #2c3e50;
}

.edit-modal-close {
    border: none;
    background: transparent;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    color: #666;
}

.edit-section h4 {
    margin-bottom: 12px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #8B0000;
}

.edit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.edit-grid label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: #2c3e50;
}

.edit-grid input[type="text"] {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
}

.edit-grid input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.edit-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.edit-modal-actions .primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.edit-modal-actions .secondary {
    background: #f2f2f2;
    color: #333;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    cursor: pointer;
}

/* Params panel overlay (editor, on top of canvas) */
.params-panel-toggle {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 60;
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
}

.params-panel-toggle:hover {
    background: rgba(0, 0, 0, 0.6);
}

.params-panel-toggle[aria-hidden="false"] {
    display: flex;
}

.params-panel-toggle[aria-hidden="true"] {
    display: none;
}

html[data-mode="view"] .params-panel-toggle {
    display: none !important;
}

/* Panel starts below the toggle button so it doesn't overlap it */
.params-panel {
    position: absolute;
    top: 56px;
    right: 12px;
    z-index: 61;
    width: 340px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    color: #fff;
    display: none;
    flex-direction: column;
    gap: 8px;
}

.params-panel[aria-hidden="false"] {
    display: flex;
}

.params-panel[aria-hidden="true"] {
    display: none;
}

html[data-mode="view"] .params-panel {
    display: none !important;
}

.params-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.params-panel-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.9;
}

.params-panel-close {
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.params-panel-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.params-section {
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.params-section:last-of-type {
    border-bottom: none;
}

.params-section h4 {
    margin: 0 0 6px 0;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.9;
}

.params-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    font-size: 11px;
}

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

.params-name {
    flex-shrink: 0;
    width: 52px;
    opacity: 0.95;
}

.params-row input {
    min-width: 0;
    padding: 4px 6px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 11px;
}

.params-row input.params-single {
    max-width: 60px;
}

.params-row input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}
.param-camera-pos-x {
    width: 50px;
}
.param-camera-pos-y {
    width: 50px;
}
.param-camera-pos-z {
    width: 50px;
}

/* Límites cámara (colisión) */
.params-section-collision {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.params-collision-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.params-collision-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
}

.params-collision-toggle {
    width: 16px;
    height: 16px;
}

.params-collision-toggle-label {
    user-select: none;
}

.params-collision-hint {
    margin: 0 0 4px 0;
    font-size: 10px;
    opacity: 0.85;
    line-height: 1.3;
}

.collision-upload-btn {
    width: 100%;
    padding: 8px 12px;
    border: 1px dashed rgba(255, 255, 255, 0.4);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.collision-upload-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.5);
}

.params-collision-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.params-collision-filename {
    font-size: 11px;
    opacity: 0.9;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.collision-remove-btn {
    flex-shrink: 0;
    padding: 4px 10px;
    border: none;
    border-radius: 4px;
    background: rgba(220, 53, 69, 0.6);
    color: #fff;
    font-size: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.collision-remove-btn:hover {
    background: rgba(220, 53, 69, 0.9);
}

/* Toolbar show button (when toolbar is hidden) */
.toolbar-show-btn {
    position: fixed;
    bottom: 12px;
    right: 12px;
    left: auto;
    transform: none;
    z-index: 99;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border: none;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.toolbar-show-btn[aria-hidden="false"] {
    display: flex;
}

.toolbar-show-btn[aria-hidden="true"] {
    display: none;
}

html[data-mode="view"] .toolbar-show-btn {
    display: none !important;
}

.toolbar-show-btn:hover {
    background: rgba(0, 0, 0, 0.6);
}

/* Editor toolbar: above the bottom so it doesn't overlap the show button */
.editor-toolbar {
    position: fixed;
    bottom: 12px;
    right: 12px;
    left: auto;
    transform: none;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    z-index: 100;
}

.editor-toolbar[aria-hidden="false"] {
    display: flex;
}

html[data-mode="view"] .editor-toolbar:not(.has-mobile-gyro) {
    display: none !important;
}

html[data-mode="view"] .editor-toolbar {
    padding: 8px;
    gap: 0;
}

html[data-mode="view"] .editor-toolbar-label,
html[data-mode="view"] #tool-save-camera,
html[data-mode="view"] .toolbar-color-wrap,
html[data-mode="view"] .toolbar-hide-btn {
    display: none !important;
}

.editor-toolbar-label {
    display: none;
}

.toolbar-show-btn span {
    display: none;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.toolbar-btn:active {
    transform: scale(0.96);
}

.mobile-gyro-btn.is-active {
    background: rgba(46, 204, 113, 0.45);
    box-shadow: 0 0 0 1px rgba(46, 204, 113, 0.7), 0 0 14px rgba(46, 204, 113, 0.5);
}

.toolbar-hide-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-left: 4px;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
}

.toolbar-hide-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.toolbar-color-wrap {
    position: relative;
}

.toolbar-color-input {
    position: absolute;
    width: 48px;
    height: 48px;
    opacity: 0;
    cursor: pointer;
    left: 0;
    top: 0;
}

/* Save camera dialog */
.save-camera-dialog {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    background: rgba(0, 0, 0, 0.5);
}

.save-camera-dialog[aria-hidden="false"] {
    display: flex;
}

.save-camera-dialog-content {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    min-width: 280px;
}

.save-camera-dialog-content p {
    margin: 0 0 20px;
    font-size: 16px;
    color: #2c3e50;
}

.save-camera-name-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.save-camera-dialog-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.save-camera-dialog-actions .btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.save-camera-dialog-actions .btn-secondary {
    background: #f2f2f2;
    color: #333;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    cursor: pointer;
}

.viewpoints-toggle {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 65;
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
}

.viewpoints-toggle[aria-hidden="false"] {
    display: flex;
}

.viewpoints-toggle[aria-hidden="true"] {
    display: none;
}

.viewpoints-toggle:hover {
    background: rgba(0, 0, 0, 0.65);
}

.viewpoints-carousel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 64;
    display: none;
    padding: 10px 14px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0.12));
}

.viewpoints-carousel[aria-hidden="false"] {
    display: block;
}

.viewpoints-list {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.viewpoint-card {
    min-width: 150px;
    width: 150px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
}

.viewpoint-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.55);
}

.viewpoint-card img {
    width: 100%;
    height: 84px;
    object-fit: cover;
    display: block;
    background: #111;
}

.viewpoint-card span {
    display: block;
    font-size: 12px;
    padding: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.viewpoint-card-empty {
    width: 100%;
    height: 84px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    opacity: 0.7;
}

.viewpoints-editor-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.viewpoint-editor-item {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 6px;
    align-items: center;
}

.viewpoint-editor-item input {
    padding: 6px 8px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 11px;
}

.viewpoint-editor-item button {
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 11px;
    padding: 6px 8px;
    cursor: pointer;
}

.viewpoint-editor-item button:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Tour modal (editor) */
.tour-modal {
    position: fixed;
    inset: 0;
    z-index: 220;
    display: none;
    align-items: center;
    justify-content: center;
    background: transparent;
    pointer-events: none;
}

.tour-modal[aria-hidden="false"] {
    display: flex;
}

.tour-modal-content {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(1100px, 94vw);
    max-height: 88vh;
    overflow: auto;
    background: #141414;
    color: #fff;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 16px;
    pointer-events: auto;
}

.tour-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    cursor: move;
    user-select: none;
}

.tour-modal-close {
    border: none;
    background: transparent;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
}

.tour-modal-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 14px;
}

.tour-modal-section {
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
}

.tour-modal-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.tour-modal-actions .btn-primary,
.tour-modal-actions .btn-secondary {
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.tour-modal-actions .btn-primary {
    background: var(--primary-color);
    color: #fff;
}

.tour-modal-actions .btn-secondary {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.tour-modal-actions .btn-primary:hover,
.tour-modal-actions .btn-secondary:hover,
.tour-player-btn:hover,
.tour-list-item:hover,
.tour-modal-close:hover,
.tour-planar-close-btn:hover {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35), 0 0 16px rgba(220, 20, 60, 0.35);
    background: rgba(220, 20, 60, 0.3);
}

.tour-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tour-list-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 6px;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    padding: 8px 10px;
}

.tour-list-item-main {
    text-align: left;
    border: none;
    background: transparent;
    color: inherit;
    padding: 0;
    cursor: pointer;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tour-list-item-action {
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    padding: 5px 8px;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

.tour-list-item-action:hover {
    background: rgba(220, 20, 60, 0.3);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35), 0 0 14px rgba(220, 20, 60, 0.28);
}

.tour-list-item.is-active {
    border-color: rgba(220, 20, 60, 0.9);
    background: rgba(220, 20, 60, 0.2);
}

.tour-settings {
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    gap: 8px 12px;
    margin-bottom: 10px;
}

.tour-settings input[type="text"] {
    width: 100%;
    margin-top: 5px;
    padding: 7px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.tour-spline-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    font-size: 12px;
    margin-bottom: 8px;
}

.tour-spline-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 66;
    pointer-events: none;
    display: none;
}

.tour-spline-overlay.is-active {
    display: block;
    pointer-events: none;
}

.tour-spline-path {
    fill: none;
    stroke: rgba(0, 230, 255, 0.85);
    stroke-width: 2.2;
}

.tour-spline-handle {
    fill: rgba(255, 255, 255, 0.95);
    stroke: rgba(0, 0, 0, 0.85);
    stroke-width: 1.2;
    cursor: grab;
    pointer-events: all;
}

.tour-spline-handle.is-selected {
    fill: rgba(220, 20, 60, 0.95);
}

.tour-spline-handle:active {
    cursor: grabbing;
}

.tour-spline-label {
    fill: #fff;
    font-size: 11px;
    font-weight: 600;
    text-anchor: middle;
    pointer-events: none;
}

.tour-spline-name-label {
    fill: rgba(255, 255, 255, 0.95);
    font-size: 10px;
    font-weight: 500;
    text-anchor: start;
    pointer-events: none;
}

.tour-planar-editor {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 0 0 0;
}

.tour-planar-editor-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    color: #fff;
}

.tour-planar-editor-head-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tour-planar-editor-head strong {
    font-size: 12px;
}

.tour-planar-editor-head span {
    font-size: 11px;
    opacity: 0.85;
}

.tour-planar-editor-actions {
    display: flex;
    justify-content: flex-start;
}

.tour-planar-editor-actions .tour-player-btn {
    font-size: 12px;
    min-width: 0;
}

.tour-planar-canvas {
    width: 100%;
    height: 260px;
    border-radius: 8px;
    background: rgba(8, 8, 8, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.18);
    cursor: crosshair;
}

/* Tour player: experiencia limpia sin UI */
html[data-tour-player="true"] body {
    grid-template-columns: 1fr;
}

html[data-tour-player="true"] .sidebar,
html[data-tour-player="true"] .menu-toggle,
html[data-tour-player="true"] .sidebar-overlay,
html[data-tour-player="true"] .params-panel,
html[data-tour-player="true"] .params-panel-toggle,
html[data-tour-player="true"] .editor-toolbar,
html[data-tour-player="true"] .toolbar-show-btn,
html[data-tour-player="true"] .viewpoints-toggle,
html[data-tour-player="true"] .viewpoints-carousel,
html[data-tour-player="true"] .desktop-pointerlock-hint {
    display: none !important;
}

.tour-player-controls {
    position: absolute;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    z-index: 120;
    display: none;
    gap: 8px;
    padding: 8px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
}

.tour-player-controls[aria-hidden="false"] {
    display: flex;
}

.tour-player-btn {
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    min-width: 40px;
    padding: 8px 10px;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

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

/* ==========================================================================
   REDESIGN v3 – Dark Glass Premium UI (comprehensive overrides)
   Every property uses !important + high-specificity selectors to guarantee
   it overrides any rule from browser.css.
   ========================================================================== */

/* ---------- Root / Body ---------- */
html body {
    background: #070a12 !important;
    color: #e8edf6 !important;
    font-family: system-ui, -apple-system, 'Segoe UI', sans-serif !important;
}

/* ---------- Sidebar ---------- */
html body .sidebar {
    background: linear-gradient(180deg, #0c1120 0%, #080c16 100%) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.07) !important;
    box-shadow: 6px 0 28px rgba(0, 0, 0, 0.5) !important;
    color: #d6deef !important;
}

html body .sidebar .header {
    margin-bottom: 16px !important;
}

html body .sidebar .logo-full {
    filter: brightness(0.96) contrast(1.08) !important;
}

/* Upload button */
html body .sidebar .upload-button {
    border-radius: 8px !important;
    background: linear-gradient(180deg, #c4153a 0%, #9b0e2c 100%) !important;
    box-shadow: 0 6px 18px rgba(180, 16, 48, 0.35) !important;
    letter-spacing: 0.06em !important;
    text-transform: uppercase !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    color: #fff !important;
    border: none !important;
    padding: 12px 16px !important;
}

html body .sidebar .upload-button:hover {
    background: linear-gradient(180deg, #d91e4c 0%, #b5133a 100%) !important;
    box-shadow: 0 8px 24px rgba(200, 22, 54, 0.45) !important;
    transform: translateY(-1px) !important;
}

/* Search input */
html body .sidebar .search-input {
    background: rgba(0, 0, 0, 0.4) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #f0f4ff !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    padding: 9px 12px !important;
}

html body .sidebar .search-input::placeholder {
    color: rgba(200, 210, 230, 0.5) !important;
}

html body .sidebar .search-input:focus {
    border-color: rgba(180, 200, 255, 0.4) !important;
    outline: none !important;
}

/* Model count label */
html body .sidebar .model-count {
    color: rgba(200, 212, 235, 0.65) !important;
    font-size: 10px !important;
    letter-spacing: 0.12em !important;
    text-transform: uppercase !important;
    font-weight: 600 !important;
}

/* Model list scrollbar */
html body .sidebar .model-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12) !important;
    border-radius: 4px !important;
}
html body .sidebar .model-list::-webkit-scrollbar-track {
    background: transparent !important;
}

/* Model list items */
html body .sidebar .example-link {
    margin: 2px 0 !important;
    border-radius: 8px !important;
    padding: 10px 10px !important;
    color: #c8d4e8 !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    background: rgba(255, 255, 255, 0.02) !important;
    transition: background 0.15s ease, border-color 0.15s ease !important;
}

html body .sidebar .example-link:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    color: #e4ecff !important;
}

html body .sidebar .example-link.active {
    background: linear-gradient(180deg, rgba(40, 110, 240, 0.32), rgba(30, 85, 200, 0.22)) !important;
    border-color: rgba(100, 160, 255, 0.65) !important;
    color: #ffffff !important;
    box-shadow: inset 0 0 0 1px rgba(110, 170, 255, 0.35), 0 2px 12px rgba(40, 100, 220, 0.18) !important;
}

html body .sidebar .example-link .model-name-text {
    color: inherit !important;
}

html body .sidebar .example-link .delete-button,
html body .sidebar .example-link .edit-button,
html body .sidebar .example-link .qr-button,
html body .sidebar .example-link .open-in-new {
    color: rgba(200, 215, 240, 0.55) !important;
    background: none !important;
}

html body .sidebar .example-link .delete-button:hover,
html body .sidebar .example-link .edit-button:hover,
html body .sidebar .example-link .qr-button:hover,
html body .sidebar .example-link .open-in-new:hover {
    opacity: 1 !important;
    color: #fff !important;
    background: rgba(220, 20, 60, 0.6) !important;
}

html body .sidebar .example-link.active .delete-button,
html body .sidebar .example-link.active .edit-button,
html body .sidebar .example-link.active .qr-button,
html body .sidebar .example-link.active .open-in-new {
    color: rgba(255, 255, 255, 0.7) !important;
}

/* Rename input inside sidebar */
html body .sidebar .rename-input {
    background: rgba(0, 0, 0, 0.5) !important;
    border: 1px solid rgba(160, 190, 255, 0.4) !important;
    color: #f0f5ff !important;
    border-radius: 5px !important;
}

/* ---------- Main area ---------- */
html body .main {
    background: #080b14 !important;
}

html body .main #viewer-container {
    background: #090d16 !important;
}

html body .main .no-model-message {
    color: rgba(200, 215, 240, 0.55) !important;
}

html body .main .no-model-message svg {
    opacity: 0.3 !important;
    color: rgba(200, 215, 240, 0.4) !important;
    stroke: rgba(200, 215, 240, 0.4) !important;
}

/* ---------- Loading overlay ---------- */
html body .loading-overlay {
    background: rgba(8, 12, 22, 0.7) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
}

html body .loading-info {
    color: #c0ccdf !important;
}

html body .scan-circle {
    border-color: rgba(180, 30, 60, 0.25) !important;
}

/* ---------- Params panel (right) ---------- */
html body #params-panel.params-panel {
    top: 14px !important;
    right: 14px !important;
    width: 334px !important;
    max-height: calc(100vh - 28px) !important;
    padding: 12px 12px 14px 12px !important;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.09) 0%, rgba(255, 255, 255, 0.01) 20%, rgba(255, 255, 255, 0.01) 77%, rgba(255, 255, 255, 0.12) 100%),
        linear-gradient(180deg, rgba(11, 21, 34, 0.92), rgba(6, 14, 24, 0.9)) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 8px !important;
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.55) !important;
    backdrop-filter: blur(18px) !important;
    -webkit-backdrop-filter: blur(18px) !important;
    color: #dce6f7 !important;
}

html body #params-panel .params-panel-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.07) !important;
    padding: 2px 0 10px 0 !important;
    margin-bottom: 10px !important;
}

html body #params-panel .params-panel-label {
    font-size: 11px !important;
    letter-spacing: 0.18em !important;
    text-transform: uppercase !important;
    color: rgba(231, 239, 255, 0.95) !important;
    font-weight: 700 !important;
}

html body #params-panel .params-panel-close {
    width: 24px !important;
    height: 24px !important;
    background: transparent !important;
    border: none !important;
    color: rgba(235, 242, 255, 0.9) !important;
    border-radius: 0 !important;
    font-size: 22px !important;
    line-height: 1 !important;
    padding: 0 !important;
}

html body #params-panel .params-panel-close:hover {
    background: transparent !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

html body #params-panel .params-section {
    padding: 10px 0 12px 0 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
}

html body #params-panel .params-section h4 {
    font-size: 15px !important;
    letter-spacing: 0.13em !important;
    text-transform: uppercase !important;
    color: rgba(225, 234, 249, 0.88) !important;
    font-weight: 700 !important;
    margin: 0 0 10px 0 !important;
}

html body #params-panel .params-row {
    color: rgba(215, 227, 246, 0.78) !important;
    font-size: 10px !important;
    letter-spacing: 0.05em !important;
    margin-bottom: 9px !important;
}

html body #params-panel .params-name {
    color: rgba(218, 229, 247, 0.76) !important;
    width: 56px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.09em !important;
}

html body #params-panel .params-row input {
    background: rgba(4, 8, 16, 0.9) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    color: #f1f5fe !important;
    border-radius: 3px !important;
    min-height: 30px !important;
    padding: 4px 7px !important;
    font-size: 11px !important;
}

html body #params-panel .params-row input:focus {
    border-color: rgba(180, 202, 242, 0.78) !important;
    outline: none !important;
    box-shadow: 0 0 0 1px rgba(180, 202, 242, 0.25) !important;
}

html body #params-panel #param-camera-pos-x,
html body #params-panel #param-camera-pos-y,
html body #params-panel #param-camera-pos-z {
    width: 74px !important;
}

html body #params-panel #param-fov {
    width: calc(100% - 64px) !important;
}

html body #params-panel .viewpoint-editor-item input {
    min-height: 30px !important;
    background: rgba(4, 8, 16, 0.88) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    color: #e9f0ff !important;
    border-radius: 3px !important;
}

html body #params-panel .viewpoint-editor-item {
    grid-template-columns: minmax(0, 1fr) 30px 30px 30px !important;
    gap: 6px !important;
    align-items: center !important;
}

html body #params-panel .viewpoint-editor-item button,
html body #params-panel .viewpoint-editor-item .viewpoint-icon-btn {
    width: 30px !important;
    min-width: 30px !important;
    height: 30px !important;
    min-height: 30px !important;
    padding: 0 !important;
    background: rgba(11, 20, 36, 0.88) !important;
    border: 1px solid rgba(255, 255, 255, 0.22) !important;
    color: #e3ebfb !important;
    border-radius: 5px !important;
    font-size: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

html body #params-panel .viewpoint-editor-item .viewpoint-icon-btn svg {
    width: 14px !important;
    height: 14px !important;
    stroke-width: 1.9 !important;
}

html body #params-panel .viewpoint-editor-item button:hover {
    background: rgba(220, 20, 60, 0.24) !important;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.28), 0 0 10px rgba(220, 20, 60, 0.24) !important;
}

html body #params-panel .collision-upload-btn {
    min-height: 44px !important;
    background: rgba(255, 255, 255, 0.04) !important;
    border: 1px solid rgba(255, 255, 255, 0.22) !important;
    color: #e5edf9 !important;
    border-radius: 7px !important;
    letter-spacing: 0.09em !important;
    text-transform: uppercase !important;
    font-size: 11px !important;
    font-weight: 700 !important;
}

html body #params-panel .collision-upload-btn:hover {
    background: rgba(255, 255, 255, 0.09) !important;
    border-color: rgba(255, 255, 255, 0.35) !important;
}

html body #params-panel .collision-remove-btn {
    background: rgba(220, 40, 60, 0.5) !important;
    color: #fff !important;
}

html body #params-panel .collision-remove-btn:hover {
    background: rgba(220, 40, 60, 0.8) !important;
}

html body #params-panel .params-collision-hint {
    color: rgba(200, 215, 240, 0.66) !important;
    font-size: 10px !important;
    letter-spacing: 0.06em !important;
    text-transform: uppercase !important;
}

html body #params-panel .params-collision-toggle-wrap {
    color: rgba(221, 232, 250, 0.82) !important;
    font-size: 10px !important;
    letter-spacing: 0.12em !important;
    text-transform: uppercase !important;
}

html body #params-panel .params-collision-toggle {
    appearance: none !important;
    -webkit-appearance: none !important;
    width: 16px !important;
    height: 16px !important;
    border-radius: 4px !important;
    border: 1px solid rgba(255, 255, 255, 0.22) !important;
    background: rgba(2, 6, 14, 0.92) !important;
    position: relative !important;
}

html body #params-panel .params-collision-toggle:checked::after {
    content: "" !important;
    position: absolute !important;
    left: 4px !important;
    top: 1px !important;
    width: 4px !important;
    height: 8px !important;
    border-right: 2px solid #d63154 !important;
    border-bottom: 2px solid #d63154 !important;
    transform: rotate(40deg) !important;
}

/* ---------- Params panel toggle button ---------- */
html body .params-panel-toggle {
    top: 12px !important;
    right: 12px !important;
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    background: rgba(12, 20, 34, 0.75) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 10px !important;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    color: #e0e8f5 !important;
    overflow: visible !important;
}

html body .params-panel-toggle:hover {
    background: rgba(220, 20, 60, 0.25) !important;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3), 0 0 12px rgba(220, 20, 60, 0.25) !important;
}

/* ---------- Editor toolbar (bottom) ---------- */
html body #editor-toolbar.editor-toolbar {
    background: linear-gradient(180deg, rgba(14, 24, 40, 0.85), rgba(8, 14, 24, 0.82)) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 12px !important;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
}

html body #editor-toolbar .toolbar-btn {
    background: rgba(255, 255, 255, 0.07) !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    color: #e5edff !important;
    border-radius: 10px !important;
}

html body #editor-toolbar .toolbar-btn:hover {
    background: rgba(220, 20, 60, 0.25) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3), 0 0 14px rgba(220, 20, 60, 0.3) !important;
}

html body #editor-toolbar .toolbar-hide-btn {
    background: rgba(255, 255, 255, 0.07) !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    color: #e0e8f5 !important;
    border-radius: 8px !important;
}

html body #editor-toolbar .toolbar-hide-btn:hover {
    background: rgba(220, 20, 60, 0.25) !important;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3), 0 0 12px rgba(220, 20, 60, 0.25) !important;
}

/* Toolbar show button (when toolbar is hidden) */
html body #toolbar-show-btn.toolbar-show-btn {
    background: rgba(14, 24, 40, 0.8) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 10px !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    color: #e0e8f5 !important;
}

html body #toolbar-show-btn.toolbar-show-btn:hover {
    background: rgba(220, 20, 60, 0.25) !important;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3), 0 0 12px rgba(220, 20, 60, 0.25) !important;
}

/* ---------- Tour modal ---------- */
html body #tour-modal.tour-modal {
    background: rgba(4, 8, 16, 0.25) !important;
}

html body #tour-modal .tour-modal-content {
    width: min(1140px, 94vw) !important;
    max-height: 86vh !important;
    padding: 16px !important;
    border-radius: 14px !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    background: linear-gradient(180deg, rgba(14, 24, 40, 0.9), rgba(8, 14, 24, 0.88)) !important;
    box-shadow: 0 20px 55px rgba(0, 0, 0, 0.55) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    color: #e0e8f6 !important;
    transition: width 0.22s ease, max-width 0.22s ease !important;
}

html body #tour-modal .tour-modal-header {
    display: grid !important;
    grid-template-columns: 1fr auto auto !important;
    align-items: center !important;
    gap: 12px !important;
    margin-bottom: 12px !important;
    padding: 6px 8px 12px 8px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.02) 32%, rgba(255, 255, 255, 0.14) 100%) !important;
    border-radius: 10px 10px 0 0 !important;
}

html body #tour-modal .tour-modal-header h3 {
    color: #ecf3ff !important;
    font-size: 20px !important;
    line-height: 1 !important;
    text-transform: uppercase !important;
    font-weight: 700 !important;
    margin: 0 !important;
}

html body #tour-modal .tour-modal-title-wrap {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    min-width: 0 !important;
}

html body #tour-modal .tour-modal-title-icon {
    width: 20px !important;
    height: 20px !important;
    object-fit: contain !important;
    display: block !important;
    transform: translateY(-1px) !important;
}

html body #tour-modal .tour-modal-header-actions {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

html body #tour-modal .tour-list-collapse-btn {
    width: 20px !important;
    min-width: 20px !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 !important;
    font-size: 24px !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 999px !important;
}

html body #tour-modal .tour-modal-header-actions .btn-secondary,
html body #tour-modal .tour-modal-header-actions .btn-primary {
    min-height: 42px !important;
    padding: 0 16px !important;
    font-size: 12px !important;
    letter-spacing: 0.08em !important;
    text-transform: uppercase !important;
    font-weight: 700 !important;
    border-radius: 7px !important;
}

html body #tour-modal .tour-modal-header-actions .btn-secondary {
    background: rgba(255, 255, 255, 0.12) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: #dbe4f8 !important;
}

html body #tour-modal .tour-modal-header-actions .btn-primary {
    background: linear-gradient(180deg, #c4153a, #9b0e2c) !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    color: #ffffff !important;
}

html body #tour-modal .tour-modal-header-actions .btn-secondary:hover,
html body #tour-modal .tour-modal-header-actions .btn-primary:hover {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35), 0 0 14px rgba(220, 20, 60, 0.3) !important;
}

html body #tour-modal .tour-modal-close {
    width: 36px !important;
    height: 36px !important;
    border-radius: 999px !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    background: rgba(255, 255, 255, 0.05) !important;
    color: #f2f6ff !important;
    font-size: 25px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

html body #tour-modal .tour-modal-close:hover {
    background: rgba(220, 20, 60, 0.3) !important;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3), 0 0 14px rgba(220, 20, 60, 0.3) !important;
}

html body #tour-modal .tour-modal-grid {
    grid-template-columns: minmax(0, 360px) minmax(0, 1fr) !important;
    gap: 12px !important;
}

html body #tour-modal .tour-modal-content.is-tour-list-collapsed .tour-modal-grid {
    grid-template-columns: 0 minmax(0, 1fr) !important;
    gap: 0 !important;
}

html body #tour-modal .tour-modal-content.is-tour-list-collapsed {
    width: min(760px, 92vw) !important;
}

html body #tour-modal .tour-modal-content.is-tour-list-collapsed .tour-modal-grid > .tour-modal-section:first-child {
    overflow: visible !important;
    padding: 0 !important;
    border-width: 0 !important;
    opacity: 1 !important;
    pointer-events: none !important;
}

html body #tour-modal .tour-list-collapse-handle {
    position: absolute !important;
    right: -10px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 2 !important;
    background: rgba(20, 30, 46, 0.92) !important;
    border: 1px solid rgba(255, 255, 255, 0.22) !important;
    color: #d8e2f4 !important;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35) !important;
}

html body #tour-modal .tour-list-collapse-handle:hover {
    background: rgba(220, 20, 60, 0.25) !important;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.28), 0 0 10px rgba(220, 20, 60, 0.24) !important;
}

html body #tour-modal .tour-modal-grid > .tour-modal-section:first-child {
    position: relative !important;
}

html body #tour-modal .tour-modal-content.is-tour-list-collapsed .tour-modal-grid > .tour-modal-section:first-child .tour-list-collapse-handle {
    pointer-events: auto !important;
}

html body #tour-modal .tour-modal-content.is-tour-list-collapsed .tour-modal-grid > .tour-modal-section:first-child > :not(.tour-list-collapse-handle) {
    display: none !important;
}

html body #tour-modal .tour-modal-section {
    border-radius: 10px !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    background: rgba(0, 0, 0, 0.22) !important;
    padding: 12px !important;
}

html body #tour-modal .tour-modal-grid > .tour-modal-section:first-child {
    background: rgba(0, 0, 0, 0.34) !important;
}

html body #tour-modal .tour-modal-grid > .tour-modal-section:last-child {
    background: rgba(2, 6, 14, 0.76) !important;
}

/* Tour list items */
html body #tour-modal .tour-list-item {
    min-height: 50px !important;
    background: rgba(6, 12, 22, 0.74) !important;
    border: 1px solid rgba(255, 255, 255, 0.55) !important;
    border-radius: 7px !important;
}

html body #tour-modal .tour-list-item:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

html body #tour-modal .tour-list-item-main {
    color: #d8e2f4 !important;
    font-size: 12px !important;
    font-weight: 500 !important;
}

html body #tour-modal .tour-list-item.is-active {
    background: linear-gradient(180deg, rgba(43, 114, 214, 0.55), rgba(28, 80, 165, 0.38)) !important;
    border-color: rgba(173, 209, 255, 0.9) !important;
    box-shadow: inset 0 0 0 1px rgba(110, 170, 255, 0.2) !important;
}

html body #tour-modal .tour-list-item.is-active .tour-list-item-main {
    color: #fff !important;
}

html body #tour-modal .tour-list-item-action {
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    background: transparent !important;
    color: #d8e2f4 !important;
    border-radius: 6px !important;
    min-width: 28px !important;
    padding: 4px 6px !important;
}

html body #tour-modal .tour-list-item-action:hover {
    background: rgba(220, 20, 60, 0.24) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3), 0 0 12px rgba(220, 20, 60, 0.25) !important;
}

/* Tour modal buttons */
html body #tour-modal .tour-modal-actions .btn-primary {
    background: linear-gradient(180deg, #c4153a, #9b0e2c) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    font-size: 12px !important;
    letter-spacing: 0.04em !important;
    text-transform: uppercase !important;
}

html body #tour-modal .tour-modal-actions .btn-primary:hover {
    background: linear-gradient(180deg, #d91e4c, #b51338) !important;
    box-shadow: 0 4px 16px rgba(200, 22, 54, 0.4) !important;
}

html body #tour-modal .tour-modal-actions .btn-secondary {
    background: rgba(255, 255, 255, 0.07) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: #d8e2f4 !important;
    border-radius: 8px !important;
    font-size: 12px !important;
}

html body #tour-modal .tour-modal-actions .btn-secondary:hover {
    background: rgba(220, 20, 60, 0.25) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3), 0 0 12px rgba(220, 20, 60, 0.25) !important;
}

html body #tour-modal .tour-modal-actions-list .btn-primary {
    width: 100% !important;
    min-height: 46px !important;
    border-radius: 7px !important;
    border: 1px solid rgba(255, 255, 255, 0.22) !important;
    background: rgba(255, 255, 255, 0.08) !important;
    color: #eef3fe !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
}

html body #tour-modal .tour-modal-actions-list {
    display: flex !important;
    gap: 8px !important;
    align-items: stretch !important;
}

html body #tour-modal .tour-modal-actions-list .btn-primary:hover {
    background: rgba(255, 255, 255, 0.14) !important;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.32), 0 0 10px rgba(255, 255, 255, 0.15) !important;
}

/* Tour settings */
html body #tour-modal .tour-settings label {
    color: rgba(210, 225, 250, 0.8) !important;
    font-size: 11px !important;
    letter-spacing: 0.14em !important;
    text-transform: uppercase !important;
    font-weight: 600 !important;
}

html body #tour-modal .tour-settings input[type="text"] {
    background: rgba(0, 0, 0, 0.35) !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    color: #eaf0ff !important;
    border-radius: 6px !important;
    font-size: 13px !important;
}

html body #tour-modal .tour-settings input[type="text"]:focus {
    border-color: rgba(140, 180, 255, 0.45) !important;
    outline: none !important;
}

/* Tour spline row */
html body #tour-modal .tour-spline-row {
    color: rgba(200, 215, 240, 0.8) !important;
    font-size: 22px !important;
    font-weight: 700 !important;
    margin: 10px 0 6px 0 !important;
}

/* Tour planar editor */
html body #tour-modal .tour-planar-editor {
    border-radius: 10px !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    background: rgba(0, 0, 0, 0.18) !important;
    padding: 10px !important;
}

html body #tour-modal .tour-planar-editor-head {
    color: rgba(210, 225, 250, 0.85) !important;
}

html body #tour-modal .tour-planar-editor-head strong {
    font-size: 11px !important;
    letter-spacing: 0.06em !important;
    text-transform: uppercase !important;
    color: rgba(210, 225, 250, 0.9) !important;
}

html body #tour-modal .tour-planar-editor-head span {
    color: rgba(200, 215, 240, 0.6) !important;
    font-size: 13px !important;
    letter-spacing: 0.08em !important;
    text-transform: uppercase !important;
}

html body #tour-modal .tour-planar-canvas {
    height: 308px !important;
    border-radius: 8px !important;
    background: rgba(1, 4, 10, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
}

/* ---------- Save camera dialog ---------- */
html body #save-camera-dialog.save-camera-dialog {
    background: rgba(4, 8, 16, 0.4) !important;
}

html body #save-camera-dialog .save-camera-dialog-content {
    border-radius: 12px !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    background: linear-gradient(180deg, rgba(14, 24, 40, 0.92), rgba(8, 14, 24, 0.9)) !important;
    color: #e0e8f6 !important;
    backdrop-filter: blur(18px) !important;
    -webkit-backdrop-filter: blur(18px) !important;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5) !important;
}

html body #save-camera-dialog .save-camera-dialog-content p {
    color: #e0e8f6 !important;
    font-size: 14px !important;
    letter-spacing: 0.04em !important;
}

html body #save-camera-dialog .save-camera-name-input {
    background: rgba(0, 0, 0, 0.35) !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    color: #eaf0ff !important;
    border-radius: 8px !important;
}

html body #save-camera-dialog .save-camera-name-input:focus {
    border-color: rgba(140, 180, 255, 0.45) !important;
    outline: none !important;
}

html body #save-camera-dialog .save-camera-dialog-actions .btn-primary {
    background: linear-gradient(180deg, #c4153a, #9b0e2c) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
}

html body #save-camera-dialog .save-camera-dialog-actions .btn-primary:hover {
    background: linear-gradient(180deg, #d91e4c, #b51338) !important;
    box-shadow: 0 4px 14px rgba(200, 22, 54, 0.4) !important;
}

html body #save-camera-dialog .save-camera-dialog-actions .btn-secondary {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: #d8e2f4 !important;
    border-radius: 8px !important;
}

html body #save-camera-dialog .save-camera-dialog-actions .btn-secondary:hover {
    background: rgba(220, 20, 60, 0.25) !important;
}

/* ---------- Edit model modal ---------- */
html body #edit-model-modal {
    border-radius: 14px !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    background: linear-gradient(180deg, rgba(14, 24, 40, 0.94), rgba(8, 14, 24, 0.92)) !important;
    box-shadow: 0 20px 55px rgba(0, 0, 0, 0.55) !important;
}

html body #edit-model-modal::backdrop {
    background: rgba(4, 8, 16, 0.5) !important;
}

html body #edit-model-modal .edit-modal-content {
    color: #e0e8f6 !important;
}

html body #edit-model-modal .edit-modal-header h3 {
    color: #ecf3ff !important;
}

html body #edit-model-modal .edit-modal-close {
    color: #d0dcf0 !important;
}

html body #edit-model-modal .edit-section h4 {
    color: rgba(200, 80, 90, 0.95) !important;
}

html body #edit-model-modal .edit-grid label {
    color: #c0ccdf !important;
}

html body #edit-model-modal .edit-grid input[type="text"] {
    background: rgba(0, 0, 0, 0.35) !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    color: #eaf0ff !important;
    border-radius: 6px !important;
}

html body #edit-model-modal .edit-modal-actions {
    border-top-color: rgba(255, 255, 255, 0.1) !important;
}

html body #edit-model-modal .edit-modal-actions .primary {
    background: linear-gradient(180deg, #c4153a, #9b0e2c) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 8px !important;
}

html body #edit-model-modal .edit-modal-actions .secondary {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: #d8e2f4 !important;
    border-radius: 8px !important;
}

/* ---------- QR modal ---------- */
html body #qr-modal {
    border-radius: 12px !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    background: linear-gradient(180deg, rgba(14, 24, 40, 0.94), rgba(8, 14, 24, 0.92)) !important;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5) !important;
}

html body #qr-modal::backdrop {
    background: rgba(4, 8, 16, 0.5) !important;
}

html body #qr-modal .qr-modal-content p {
    color: #d0dcf0 !important;
}

/* ---------- Modal transparency test (professional glass effect) ---------- */
html body #tour-modal.tour-modal {
    background: rgba(4, 8, 16, 0.16) !important;
}

html body #tour-modal .tour-modal-content {
    background:
        linear-gradient(180deg, rgba(12, 22, 36, 0.62), rgba(7, 14, 24, 0.58)) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.48) !important;
    backdrop-filter: blur(22px) saturate(120%) !important;
    -webkit-backdrop-filter: blur(22px) saturate(120%) !important;
}

html body #tour-modal .tour-modal-header {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.2),
        rgba(255, 255, 255, 0.03) 34%,
        rgba(255, 255, 255, 0.18) 100%
    ) !important;
}

html body #tour-modal .tour-modal-grid > .tour-modal-section:first-child {
    background: rgba(0, 0, 0, 0.24) !important;
}

html body #tour-modal .tour-modal-grid > .tour-modal-section:last-child {
    background: rgba(2, 6, 14, 0.52) !important;
}

html body #save-camera-dialog.save-camera-dialog {
    background: rgba(4, 8, 16, 0.26) !important;
}

html body #save-camera-dialog .save-camera-dialog-content {
    background: linear-gradient(180deg, rgba(12, 22, 36, 0.62), rgba(7, 14, 24, 0.58)) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    backdrop-filter: blur(20px) saturate(115%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(115%) !important;
}

html body #edit-model-modal {
    background: linear-gradient(180deg, rgba(12, 22, 36, 0.68), rgba(7, 14, 24, 0.64)) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    backdrop-filter: blur(20px) saturate(115%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(115%) !important;
}

html body #edit-model-modal::backdrop {
    background: rgba(4, 8, 16, 0.28) !important;
}

html body #qr-modal {
    background: linear-gradient(180deg, rgba(12, 22, 36, 0.68), rgba(7, 14, 24, 0.64)) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    backdrop-filter: blur(20px) saturate(115%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(115%) !important;
}

html body #qr-modal::backdrop {
    background: rgba(4, 8, 16, 0.28) !important;
}

/* ---------- Tour player controls (floating) ---------- */
html body .tour-player-controls {
    background: linear-gradient(180deg, rgba(14, 24, 40, 0.8), rgba(8, 14, 24, 0.78)) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 12px !important;
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4) !important;
}

html body .tour-player-btn {
    background: rgba(255, 255, 255, 0.07) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    color: #e0e8f5 !important;
    border-radius: 8px !important;
}

html body .tour-player-btn:hover {
    background: rgba(220, 20, 60, 0.25) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3), 0 0 12px rgba(220, 20, 60, 0.25) !important;
}

/* ---------- Pointer lock hint ---------- */
html body .desktop-pointerlock-hint {
    background: rgba(10, 18, 30, 0.7) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 10px !important;
    color: #d0dcf0 !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
}

html body .desktop-pointerlock-hint.is-active {
    background: rgba(46, 180, 100, 0.35) !important;
    border-color: rgba(46, 204, 113, 0.5) !important;
}

/* ---------- Viewpoints toggle + carousel ---------- */
html body .viewpoints-toggle {
    background: rgba(12, 20, 34, 0.75) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 10px !important;
    color: #e0e8f5 !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
}

html body .viewpoints-toggle:hover {
    background: rgba(220, 20, 60, 0.25) !important;
}

html body .viewpoints-carousel {
    background: linear-gradient(to top, rgba(6, 10, 18, 0.8), rgba(6, 10, 18, 0.15)) !important;
}

html body .viewpoint-card {
    background: rgba(10, 18, 30, 0.7) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #d8e2f4 !important;
}

html body .viewpoint-card:hover {
    border-color: rgba(255, 255, 255, 0.4) !important;
}

/* ---------- Menu toggle (mobile) ---------- */
html body .menu-toggle {
    background: rgba(14, 24, 40, 0.85) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    color: #e0e8f5 !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
}

/* ---------- Sidebar overlay (mobile) ---------- */
html body .sidebar-overlay.open {
    background: rgba(4, 8, 16, 0.6) !important;
}

/* ==========================================================================
   TOOLBAR V5 - estilo final según referencia visual
   ========================================================================== */

html body #editor-toolbar.editor-toolbar {
    position: fixed !important;
    right: 24px !important;
    bottom: 24px !important;
    left: auto !important;
    transform: none !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 2px !important;
    padding: 10px 16px !important;
    min-height: 60px !important;
    border-radius: 999px !important;
    border: 1px solid rgba(157, 176, 210, 0.22) !important;
    background: linear-gradient(180deg, rgba(14, 20, 33, 0.95), rgba(10, 16, 28, 0.93)) !important;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.52) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    z-index: 120 !important;
}

html body #editor-toolbar.editor-toolbar[aria-hidden="false"] {
    display: inline-flex !important;
}

html body #editor-toolbar .editor-toolbar-label {
    display: none !important;
}

html body #editor-toolbar .toolbar-btn {
    width: 48px !important;
    height: 40px !important;
    border-radius: 10px !important;
    border: none !important;
    background: transparent !important;
    color: #93a4c2 !important;
    box-shadow: none !important;
}

html body #editor-toolbar .toolbar-btn svg {
    width: 26px !important;
    height: 26px !important;
    stroke-width: 1.9 !important;
}

html body #editor-toolbar .toolbar-btn:hover {
    color: #c9d8f2 !important;
    background: rgba(220, 20, 60, 0.25) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3), 0 0 14px rgba(220, 20, 60, 0.3) !important;
}

/* El color-picker invisible captura el puntero; por eso el hover se aplica al wrapper */
html body #editor-toolbar .toolbar-color-wrap:hover .toolbar-btn,
html body #editor-toolbar .toolbar-color-wrap:focus-within .toolbar-btn {
    color: #c9d8f2 !important;
    background: rgba(220, 20, 60, 0.25) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3), 0 0 14px rgba(220, 20, 60, 0.3) !important;
}

html body #editor-toolbar .toolbar-color-wrap {
    width: 64px !important;
    height: 54px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
}

html body #editor-toolbar .toolbar-color-input {
    width: 64px !important;
    height: 54px !important;
    border-radius: 10px !important;
    pointer-events: none !important;
}

/* Botón de minimizar (aspa) integrado en la pill */
html body #editor-toolbar #toolbar-hide-btn.toolbar-hide-btn {
    position: relative !important;
    width: 56px !important;
    height: 54px !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 10px !important;
    background: transparent !important;
    color: #8fa1bf !important;
    box-shadow: none !important;
    font-size: 42px !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transform: translateY(-1px) !important;
}

/* Separador vertical antes del botón X */
html body #editor-toolbar #toolbar-hide-btn.toolbar-hide-btn::before {
    content: "" !important;
    position: absolute !important;
    left: -1px !important;
    top: 13px !important;
    width: 1px !important;
    height: 28px !important;
    background: rgba(157, 176, 210, 0.22) !important;
}

html body #editor-toolbar #toolbar-hide-btn.toolbar-hide-btn:hover {
    color: #d0def6 !important;
    background: rgba(220, 20, 60, 0.22) !important;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.28), 0 0 12px rgba(220, 20, 60, 0.24) !important;
}

/* Botón de desplegar cuando la barra está minimizada */
html body #toolbar-show-btn.toolbar-show-btn {
    position: fixed !important;
    right: 24px !important;
    bottom: 24px !important;
    left: auto !important;
    transform: none !important;
    width: 58px !important;
    height: 58px !important;
    padding: 0 !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 999px !important;
    border: 1px solid rgba(157, 176, 210, 0.24) !important;
    background: linear-gradient(180deg, rgba(14, 20, 33, 0.98), rgba(10, 16, 28, 0.96)) !important;
    color: transparent !important;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55) !important;
    z-index: 121 !important;
}

html body #toolbar-show-btn.toolbar-show-btn[aria-hidden="false"] {
    display: flex !important;
}

html body #toolbar-show-btn.toolbar-show-btn svg,
html body #toolbar-show-btn.toolbar-show-btn span {
    display: none !important;
}

html body #toolbar-show-btn.toolbar-show-btn::before {
    content: "‹" !important;
    color: #8fa1bf !important;
    font-size: 36px !important;
    line-height: 1 !important;
    transform: translateX(-1px) !important;
}

html body #toolbar-show-btn.toolbar-show-btn:hover {
    background: linear-gradient(180deg, rgba(18, 26, 42, 0.98), rgba(12, 19, 32, 0.96)) !important;
    box-shadow: 0 0 0 1px rgba(157, 176, 210, 0.28), 0 16px 36px rgba(0, 0, 0, 0.58) !important;
}
