/* editor-mapas.css */

/* ============================
   CANVAS
   ============================ */
#grid-canvas-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #0f1115;
  touch-action: none;
}
#grid-canvas-viewport.canvas-grid-bg {
  background-image:
    linear-gradient(to right, rgba(255,255,255,.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,.06) 1px, transparent 1px);
}
#canvas-world {
  position: absolute;
  top: 0; left: 0;
  width: 5000px; height: 5000px;
  transform-origin: 0 0;
}

/* ============================
   ELEMENTOS
   ============================ */
.elemento-seleccionado {
  outline: 2px dashed #0d6efd;
  outline-offset: 3px;
  z-index: 5;
}
.seat-row, .stage-element, .table-element, .label-element {
  cursor: grab;
}
.seat-row.dragging, .stage-element.dragging, .table-element.dragging {
  cursor: grabbing;
  opacity: .9;
}
.stage-element {
  background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
  border: 1px solid #374151;
  color: #e5e7eb;
  border-radius: 6px;
}
.bg-purple { background-color: #6f42c1 !important; }

/* ============================
   TOAST
   ============================ */
.editor-toast {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #10b981; color: white;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 14px;
  opacity: 0;
  transition: all .25s ease;
  z-index: 9999;
}
.editor-toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.editor-toast--error { background: #ef4444; }

/* ============================
   LAYOUT DEL EDITOR
   ============================ */
.map-editor {
  display: flex;
  flex-direction: column;
  height: 70vh;
  min-height: 500px;
  border: 1px solid #2a2f3a;
  border-radius: 6px;
  overflow: hidden;
}

.map-editor__toolbar {
  flex-shrink: 0;
  border-bottom: 1px solid #2a2f3a;
}

.map-editor__body {
  display: flex;
  flex-direction: row;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.map-editor__canvas {
  flex: 1;
  min-width: 0;
  position: relative;
  overflow: hidden;
}

/* ============================
   PANEL DE PROPIEDADES
   ============================ */
.props-panel {
  width: 0;
  flex-shrink: 0;
  background: #14171c;
  border-left: 1px solid transparent;
  overflow: hidden;
  transition: width .2s ease, border-color .2s ease;
  display: flex;
  flex-direction: column;
}
.props-panel.is-open {
  width: 320px;
  border-left-color: #2a2f3a;
  overflow-y: auto;
}

.props-panel__header {
  padding: 14px 16px;
  border-bottom: 1px solid #2a2f3a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.props-panel__title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: #9ca3af;
  margin: 0;
  white-space: nowrap;
}

.props-panel__body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.props-panel__footer {
  padding: 12px 16px;
  border-top: 1px solid #2a2f3a;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  margin-top: auto;
}

/* ============================
   CAMPOS DEL PANEL
   ============================ */
.props-field label {
  font-size: 11px;
  font-weight: 500;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: .3px;
  margin-bottom: 4px;
  display: block;
}
.props-field .form-control,
.props-field .form-select {
  font-size: 13px;
  background: #0f1115;
  border: 1px solid #2a2f3a;
  color: #e5e7eb;
}
.props-field .form-control:focus,
.props-field .form-select:focus {
  background: #0f1115;
  border-color: #0d6efd;
  color: #e5e7eb;
  box-shadow: 0 0 0 2px rgba(13, 110, 253, .15);
}
.props-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.props-empty {
  padding: 40px 20px;
  text-align: center;
  color: #6b7280;
  font-size: 13px;
}
.props-empty i {
  font-size: 32px;
  display: block;
  margin-bottom: 8px;
  opacity: .4;
}

/* ============================
   SWATCHES DE COLOR
   ============================ */
.props-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.props-swatch {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .1s;
}
.props-swatch:hover { transform: scale(1.1); }
.props-swatch.active { border-color: #fff; }

/*==========Previsualización===================*/
/* ============================
   VISTA PREVIA COMPRADOR
   ============================ */
.preview-layout {
  display: flex;
  gap: 16px;
  height: 70vh;
  min-height: 500px;
}

.preview-canvas {
  flex: 1;
  min-width: 0;
  position: relative;
  overflow: hidden;
  background-color: #0f1115;
  border: 1px solid #2a2f3a;
  border-radius: 6px;
}

.preview-summary {
  width: 320px;
  flex-shrink: 0;
  background: #14171c;
  border: 1px solid #2a2f3a;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.preview-summary__header {
  padding: 14px 16px;
  border-bottom: 1px solid #2a2f3a;
  flex-shrink: 0;
}

.preview-summary__body {
  padding: 16px;
  flex: 1;
  overflow-y: auto;
}

.preview-summary__footer {
  padding: 16px;
  border-top: 1px solid #2a2f3a;
  flex-shrink: 0;
}

.preview-empty {
  text-align: center;
  padding: 40px 10px;
  color: #6b7280;
  font-size: 13px;
}
.preview-empty i {
  font-size: 36px;
  opacity: .4;
  display: block;
}

/* Grupos por sector en el resumen */
.preview-group {
  margin-bottom: 16px;
}
.preview-group__header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
  color: #9ca3af;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid #2a2f3a;
  display: flex;
  justify-content: space-between;
}
.preview-group__seats {
  font-size: 12px;
  color: #d1d5db;
  margin-bottom: 4px;
  line-height: 1.5;
}
.preview-group__total {
  font-size: 13px;
  color: #fff;
  font-weight: 600;
  text-align: right;
}

/* Butacas en modo vista previa */
.preview-canvas .butaca-node {
  cursor: pointer !important;
  transition: transform .12s ease, box-shadow .12s ease;
}
.preview-canvas .butaca-node:hover {
  transform: scale(1.15);
  box-shadow: 0 0 0 2px rgba(13, 110, 253, .5);
}
.preview-canvas .butaca-node.selected {
  background: #10b981 !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, .4);
  transform: scale(1.1);
}
.preview-canvas .seat-row,
.preview-canvas .stage-element,
.preview-canvas .table-element,
.preview-canvas .label-element {
  cursor: default !important;
}
.preview-canvas .element-toolbar {
  display: none !important;
}


/*===========Campo======================*/
/* Swatches de color para el modal de Campo */
.campo-color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .1s ease, border-color .1s ease;
}
.campo-color-swatch:hover {
  transform: scale(1.1);
}
.campo-color-swatch.active {
  border-color: #fff;
}
/* ============================
   CAMPO (zona de pie)
   ============================ */
.field-element {
  cursor: grab;
  transition: box-shadow .15s ease;
}
.field-element:hover {
  box-shadow: 0 0 0 2px rgba(255,255,255,.15);
}
.field-element.dragging {
  cursor: grabbing;
  opacity: .9;
}
.field-element .field-element__name {
  pointer-events: none;
}
.field-element .field-element__meta {
  pointer-events: none;
}