/* Estilos base existentes */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ESTRUCTURA PRINCIPAL - Layout fijo sin flexbox */
.container-fluid {
  position: relative !important;
  height: calc(100vh - 70px) !important;
  overflow: hidden !important;
  margin-top: 0 !important;
}

#mainContent {
  position: relative !important;
  width: 100% !important;
  height: 100% !important;
  overflow: hidden !important;
}

/* VISOR 3D - Tamaño fijo que nunca cambia */
.viewer {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: calc(100vh - 70px) !important;
  z-index: 1 !important;
  background: #f5f5f5;
}

#preview {
  width: 100% !important;
  height: 100% !important;
  position: relative !important;
  overflow: hidden !important;
}

#viewerContainer {
  position: relative !important;
  width: 100% !important;
  height: 100% !important;
  overflow: hidden !important;
}

#preview canvas {
  width: 100% !important;
  height: 100% !important;
  display: block !important;
}

/* PANEL IZQUIERDO - Overlay que se desliza */
#panel-izquierdo {
  position: fixed !important;
  top: 75px !important;
  left: 0 !important;
  width: 25% !important;
  height: calc(100vh - 70px) !important;
  background: white !important;
  border-right: 1px solid #dee2e6 !important;
  z-index: 100 !important;
  overflow-y: auto !important;
  padding: 10px !important;
  box-shadow: 2px 0 10px rgba(0,0,0,0.1) !important;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  transform: translateX(0) !important;
}

#panel-izquierdo.hidden-panel {
  transform: translateX(-100%) !important;
}

#tree-models{
  margin-left: -35px;
}

/* Para poder seleccionar el nombre del bucket
/* Permitir selección de texto en nombres de carpetas y archivos */
.tree-item.folder span,
.tree-item.file span {
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    cursor: text;
}

/* Evitar que otros elementos interfieran con la selección */
.expand-arrow,
.tree-icon {
    user-select: none;
    -webkit-user-select: none;
}

/* BOTONES FLOTANTES - Aparecen cuando se ocultan los paneles */
.toggle-btn-left {
  position: fixed !important;
  top: calc(50% + 35px) !important;
  transform: translateY(-50%) !important;
  z-index: 1000 !important;
  padding: 12px 8px !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
  transition: all 0.3s ease !important;
  font-size: 12px !important;
  line-height: 1 !important;
  min-width: auto !important;
  border: none !important;
  background: #007bff !important;
  color: white !important;
  cursor: pointer !important;
}

.toggle-btn-left {
  left: 0 !important;
  border-radius: 0 8px 8px 0 !important;
}


.toggle-btn-left:hover {
  transform: translateY(-50%) translateX(5px) !important;
  box-shadow: 0 6px 16px rgba(0,0,0,0.2) !important;
}

/* OPTIMIZACIONES DE RENDIMIENTO */
.viewer, #preview, #viewerContainer {
  transform: translateZ(0) !important;
  backface-visibility: hidden !important;
}

#panel-izquierdo {
  will-change: transform !important;
  backface-visibility: hidden !important;
}

/* ESTILOS PARA EL ÁRBOL DE ARCHIVOS */
.file-tree {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  flex-grow: 1;
}

.tree-item {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid #e9ecef;
  position: relative;
  font-size: 0.9em;
}

.tree-item:hover {
  background-color: #e9ecef;
}

.tree-item.selected {
  background-color: #0d6efd;
  color: white;
}

.tree-item.folder {
  font-weight: 500;
  background-color: #fff;
  border-bottom: 1px solid #dee2e6;
}

.tree-item.folder:hover {
  background-color: #f1f3f4;
}

.tree-item.file {
  padding-left: 32px;
  font-size: 0.9em;
}

.tree-icon {
  width: 16px;
  height: 16px;
  margin-right: 8px;
  flex-shrink: 0;
}

.tree-icon.folder {
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23ffc107"><path d="M10 4H4c-1.11 0-2 .89-2 2v12c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2h-8l-2-2z"/></svg>') no-repeat center;
  background-size: contain;
}

.tree-icon.folder.expanded {
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23ffc107"><path d="M10 4H4c-1.11 0-2 .89-2 2v12c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2h-8l-2-2z"/></svg>') no-repeat center;
  background-size: contain;
}

.tree-icon.file {
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%236c757d"><path d="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z"/></svg>') no-repeat center;
  background-size: contain;
}

.folder-children {
  background-color: #fff;
}

.folder-children.collapsed {
  display: none;
}

.expand-arrow {
  width: 12px;
  height: 12px;
  margin-right: 4px;
  cursor: pointer;
  transition: transform 0.2s;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23666"><path d="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z"/></svg>') no-repeat center;
  background-size: contain;
}

.expand-arrow.expanded {
  transform: rotate(90deg);
}

/* MENÚ CONTEXTUAL */
.context-menu {
  position: fixed;
  background: white;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  z-index: 10000;
  min-width: 120px;
  padding: 4px 0;
}

.context-menu-item {
  padding: 8px 16px;
  cursor: pointer;
  font-size: 0.9em;
  color: #333;
}

.context-menu-item:hover {
  background-color: #f8f9fa;
}

.context-menu-item.danger {
  color: #dc3545;
}

.context-menu-item.danger:hover {
  background-color: #f8d7da;
}

/* ESTADOS DE CARGA */
.loading {
  text-align: center;
  padding: 20px;
  color: #666;
}

/* OVERLAY Y NOTIFICACIONES */
#overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.notification {
  background: white;
  padding: 20px;
  border-radius: 8px;
  max-width: 500px;
  max-height: 70vh;
  overflow-y: auto;
  position: relative;
}

