/* Modern Seating Plan Editor – EventLive */

:root {
  --se-bg: #f8fafc;
  --se-panel: #ffffff;
  --se-border: #e2e8f0;
  --se-accent: #3b82f6;
  --se-accent-hover: #2563eb;
  --se-success: #10b981;
  --se-warning: #f59e0b;
  --se-danger: #ef4444;
  --se-text: #0f172a;
  --se-muted: #64748b;
  --se-seat: #f59e0b;
  --se-seat-selected: #3b82f6;
  --se-seat-sold: #64748b;
  --se-seat-disabled: #475569;
}

#modern-seating-editor-app {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 60px);
  background: var(--se-bg);
  color: var(--se-text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Toolbar */
.se-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--se-panel);
  color: var(--se-text);
  border-bottom: 1px solid var(--se-border);
  gap: 12px;
  flex-wrap: wrap;
  min-height: 52px;
}
.se-toolbar-left,
.se-toolbar-center,
.se-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.se-toolbar .btn {
  border-radius: 8px;
  font-weight: 500;
}
.se-toolbar .btn-outline-primary.active {
  background: var(--se-accent);
  color: #fff;
  border-color: var(--se-accent);
}

/* Workspace */
.se-workspace {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar */
.se-sidebar {
  width: 280px;
  background: var(--se-panel);
  color: var(--se-text);
  border-right: 1px solid var(--se-border);
  overflow-y: auto;
  flex-shrink: 0;
}
.se-sidebar-header {
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--se-muted);
  border-bottom: 1px solid var(--se-border);
  background: #f8fafc;
}
.se-sidebar-body {
  padding: 12px 14px;
}
.se-sidebar .form-label {
  color: var(--se-muted);
  margin-bottom: 2px;
}
.se-sidebar .form-control,
.se-sidebar .form-select {
  background: #ffffff;
  border-color: var(--se-border);
  color: var(--se-text);
  border-radius: 6px;
}
.se-sidebar .form-control:focus,
.se-sidebar .form-select:focus {
  border-color: var(--se-accent);
  box-shadow: 0 0 0 2px rgba(59,130,246,0.25);
}

/* Canvas area */
.se-canvas-wrap {
  flex: 1;
  position: relative;
  overflow: auto;
  background: #e9eef5;
  padding: 16px;
  overscroll-behavior: contain;
}
#se-canvas {
  width: 1200px;
  height: 800px;
  position: relative;
  background: #fff;
  box-shadow: 0 8px 28px rgba(15,23,42,.12);
  margin: 0 auto;
}
#se-canvas .canvas-container { box-shadow: none !important; }
#se-canvas canvas { display: block; touch-action: pan-x pan-y; }

/* Properties form extras */
.se-prop-group {
  margin-bottom: 12px;
}
.se-prop-group label {
  display: block;
  font-size: 12px;
  color: var(--se-muted);
  margin-bottom: 3px;
}
.se-color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 2px solid var(--se-border);
  cursor: pointer;
  display: inline-block;
  vertical-align: middle;
}

/* Preview */
.se-preview-map {
  min-height: 400px;
  background: #f8fafc;
  border-radius: 12px;
  position: relative;
  overflow: auto;
}

/* Seat status legend (buyer + editor preview) */
.se-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 10px 0;
  font-size: 13px;
  color: #475467;
}
.se-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.se-legend i {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  display: inline-block;
}
.se-legend .available { background: #f59e0b; }
.se-legend .selected  { background: #3b82f6; }
.se-legend .sold      { background: #64748b; }
.se-legend .held      { background: #a78bfa; }
.se-legend .disabled  { background: #94a3b8; }

/* Buyer seat map specific */
.buyer-seat-map {
  position: relative;
  user-select: none;
}
.buyer-seat {
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}
.buyer-seat:hover:not(.sold):not(.disabled):not(.held) {
  transform: scale(1.25);
  filter: brightness(1.15);
  z-index: 5;
}
.buyer-seat.selected {
  filter: drop-shadow(0 0 4px #3b82f6);
}
.buyer-seat.sold,
.buyer-seat.disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

/* Selected seats cart tray */
.seat-selection-tray {
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  padding: 12px 16px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
  z-index: 20;
}
.seat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 13px;
  margin: 2px;
}
.seat-chip button {
  border: none;
  background: transparent;
  color: #ef4444;
  font-weight: 700;
  cursor: pointer;
  padding: 0 2px;
}

/* Responsive */
@media (max-width: 900px) {
  .se-sidebar { width: 220px; }
  .se-toolbar { flex-direction: column; align-items: stretch; }
}

@media (max-width: 900px) {
  #modern-seating-editor-app { height: auto; min-height: calc(100vh - 60px); }
  .se-workspace { min-height: 70vh; overflow: auto; }
  .se-sidebar { width: 240px; }
  .se-canvas-wrap { min-width: 700px; min-height: 650px; }
  .se-toolbar-center { flex-wrap: wrap; }
}


/* ===== Masterpiece UX layer ===== */
.se-guide-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 16px;
  background: linear-gradient(90deg, #eff6ff, #f8fafc);
  border-bottom: 1px solid var(--se-border);
  font-size: 13px;
  color: #334155;
}
.se-guide-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #64748b;
}
.se-guide-step.active {
  border-color: #3b82f6;
  color: #1d4ed8;
  background: #dbeafe;
  font-weight: 600;
}
.se-guide-step.done {
  border-color: #86efac;
  color: #166534;
  background: #f0fdf4;
}
.se-capacity-panel {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 12px;
}
.se-capacity-panel .se-cap-total {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}
.se-capacity-panel ul {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}
.se-capacity-panel li {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  border-bottom: 1px dashed #e2e8f0;
  color: #475569;
}
.se-save-state {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #64748b;
}
.se-save-state.dirty { background: #fef3c7; color: #92400e; }
.se-save-state.saved { background: #d1fae5; color: #065f46; }
.se-save-state.error { background: #fee2e2; color: #991b1b; }
.se-empty-section-hint {
  position: absolute;
  pointer-events: none;
  font: 600 12px Inter, system-ui, sans-serif;
  color: #94a3b8;
  text-align: center;
}
.se-shortcut-hint {
  font-size: 11px;
  color: #94a3b8;
  padding: 8px 14px 12px;
}
.se-shortcut-hint kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  font-size: 10px;
  color: #475569;
}
.se-toolbar .btn.active {
  background: var(--se-accent);
  color: #fff !important;
  border-color: var(--se-accent);
}
#se-fill-grid-modal .modal-body label { font-size: 12px; color: #64748b; }
.se-action-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.se-action-strip .btn { font-size: 12px; }

/* Buyer seat labels – readable letter + number */
.buyer-seat {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  font-weight: 700 !important;
  text-shadow: 0 1px 1px rgba(0,0,0,.25);
  box-sizing: border-box;
  border: 1px solid rgba(255,255,255,.35);
}
.buyer-seat.selected {
  outline: 2px solid #1d4ed8;
  outline-offset: 1px;
}
.buyer-section small {
  font-variant-numeric: tabular-nums;
}
#ss-help strong { color: #0f172a; }
.seat-chip {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}


/* ===== Buyer seating overview + modals ===== */
.se-buyer-overview {
  position: relative;
  min-height: 320px;
  background: #f1f5f9;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  overflow: auto;
}
.seating-plan-preview-stage {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: #fff;
  font-weight: 700;
  z-index: 2;
  box-shadow: 0 4px 12px rgba(15,23,42,.15);
}
.seating-plan-preview-stage h6 { margin: 0; color: #fff; font-size: 14px; }
.seating-plan-preview-section {
  position: absolute;
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  z-index: 3;
  box-shadow: 0 2px 8px rgba(15,23,42,.08);
  transition: transform .12s ease, box-shadow .12s ease;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.seating-plan-preview-section:hover:not(.event-ticket-disabled) {
  transform: scale(1.02);
  box-shadow: 0 6px 16px rgba(15,23,42,.12);
  z-index: 4;
}
.seating-plan-preview-section h6 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}
.seating-plan-preview-section .se-section-price {
  font-size: 12px;
  color: #475569;
  margin-top: 2px;
}
.seating-plan-preview-section .se-section-cta {
  font-size: 11px;
  font-weight: 600;
  color: #2563eb;
  margin-top: 6px;
}
.seating-plan-preview-section.event-ticket-disabled {
  opacity: .55;
  cursor: not-allowed;
}
.seating-plan-preview-object {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  pointer-events: none;
  z-index: 1;
  opacity: .9;
  border: 1px solid #94a3b8;
}
.se-buyer-hint { padding: 0 4px; }

/* Modal seat grid */
.seating-plan-preview-section-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.seating-plan-row-label {
  width: 28px;
  flex-shrink: 0;
  text-align: center;
  font-weight: 700;
  font-size: 13px;
  color: #0f172a;
}
.seating-plan-row-seats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.seating-plan-preview-section-row-seat {
  min-width: 36px;
  min-height: 32px;
  padding: 4px 6px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  line-height: 1.1;
  box-shadow: 0 1px 2px rgba(0,0,0,.12);
  border: 1px solid rgba(255,255,255,.35);
  user-select: none;
  transition: transform .1s ease, outline .1s ease;
}
.seating-plan-preview-section-row-seat:hover:not(.is-unavailable) {
  transform: scale(1.08);
  z-index: 2;
}
.seating-plan-preview-section-row-seat.is-in-cart,
.seating-plan-preview-section-row-seat[data-choosen="yes"] {
  outline: 2px solid #1d4ed8;
  outline-offset: 1px;
  background: #3b82f6 !important;
}
.seating-plan-preview-section-row-seat.is-unavailable {
  cursor: not-allowed;
  opacity: .75;
}
.se-seat-label {
  display: block;
  text-align: center;
  text-shadow: 0 1px 1px rgba(0,0,0,.2);
  font-variant-numeric: tabular-nums;
}
.se-buyer-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  color: #475569;
}
.se-buyer-legend .se-leg {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  margin-right: 4px;
  vertical-align: -2px;
}
.se-leg-selected { background: #3b82f6; }
.se-leg-taken { background: #94a3b8; }
