/* ===============================
   Estilos Visualizador VDL
   =============================== */

.vdl-root {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  font-family: Arial, sans-serif;
}

/* ---------- Toolbar ---------- */

.vdl-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.vdl-btn {
  padding: 10px 15px;
  background: #f0f0f0;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid #ccc;
  font-size: 14px;
  user-select: none;
}

.vdl-btn:hover {
  background: #e6e6e6;
}

.vdl-btn.warn {
  background: #ffe2e2;
  border-color: #ffb7b7;
}

.vdl-btn.warn:hover {
  background: #ffcccc;
}

.vdl-btn.success {
  background: #e2ffe4;
  border-color: #b6ffbf;
}

.vdl-btn.success:hover {
  background: #caffd3;
}

/* ---------- Canvas + Scroll ---------- */

.vdl-canvas-wrap {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 6px;
  position: relative;

  /* SCROLL RESPONSIVE */
  overflow-y: auto !important;
  overflow-x: hidden;
  max-height: 100vh;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y !important;
}

/* CANVAS RESPONSIVE */
#vdl-canvas {
  display: block;
  width: 100% !important; 
  height: auto !important;

  /* Fabric controla los gestos táctiles sobre objetos, pero no el scroll */
  touch-action: none !important;
}

/* ---------- Placeholder ---------- */

.vdl-placeholder {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 20px;
  font-size: 16px;
  color: #777;
  pointer-events: none;
}

/* ---------- Modal ---------- */

.vdl-modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.55);
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.vdl-modal-content {
  background: #fff;
  padding: 20px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  border-radius: 8px;
}

.vdl-modal-close {
  float: right;
  cursor: pointer;
  background: transparent;
  border: none;
  font-size: 20px;
}

/* ---------- Product Grid ---------- */

.vdl-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 15px;
  margin-top: 20px;
}

.vdl-product-item {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 10px;
  text-align: center;
  cursor: pointer;
  background: #f9f9f9;
  transition: 0.2s;
}

.vdl-product-item:hover {
  background: #efefef;
  transform: scale(1.03);
}

.vdl-product-item img {
  width: 100%;
  height: auto;
  object-fit: contain;
  margin-bottom: 8px;
}

/* ---------- Mobile Tweaks ---------- */

@media(max-width: 480px) {
  .vdl-btn {
    flex: 1 1 calc(50% - 8px);
    text-align: center;
  }
}
