[x-cloak] {
  display: none;
}

.floorplan-custom {
  --c-standard:  #b7ab79;
  --c-standard2: #a8c39a;
  --c-su:        #f3c6da;
  --c-sme:       #f4e14a;
  --c-d:         #e6392f;
  --c-g:         #ffd447;
  --c-p:         #4a8fd1;
  --c-l:         #3f8f4a;
  --c-b2b:       #f3a35f;
  --c-ai:        #cfd3d8;
  --c-facility:  #d7dbe0;

  --state-selected: #4f46e5;
  --state-occupied: #111827;
}

.floorplan-custom .booth {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  border-radius: 2px;
  color: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(0, 0, 0, 0.15);
  cursor: pointer;
  user-select: none;
  position: relative;
  min-height: 50px;
  min-width: 25px;
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.1s ease;
}

.floorplan-custom .booth {
  touch-action: manipulation;
}

@media (hover: hover) {
  .floorplan-custom .booth:hover {
    transform: scale(1.12);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
    z-index: 5;
  }

  .floorplan-custom #front-3-copy:hover {
    transform: scale(1.12);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
    z-index: 5;
  }
}

.floorplan-custom #front-3-copy.is-selected {
  outline: 2px solid var(--state-selected);
  outline-offset: 1px;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.3);
  color: #fff;
  background-color: var(--state-selected) !important;
}

.floorplan-custom .booth.is-selected {
  outline: 2px solid var(--state-selected);
  outline-offset: 1px;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.3);
  color: #fff;
  background-color: var(--state-selected) !important;
}

.floorplan-custom .booth-empty {
  visibility: hidden;
}

.floorplan-custom .booth.is-occupied {
  background-color: var(--state-occupied) !important;
  color: #fff;
  border: 2px solid #000;
  cursor: default;
}

.floorplan-custom .booth.is-highlighted {
  outline: 3px solid #f59e0b;
  outline-offset: 2px;
  box-shadow: 0 0 0 6px rgba(245, 158, 11, 0.35);
  z-index: 6;
  animation: floorplan-highlight-pulse 1.6s ease-in-out infinite;
}

@keyframes floorplan-highlight-pulse {
  0%, 100% {
    box-shadow: 0 0 0 6px rgba(245, 158, 11, 0.35);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(245, 158, 11, 0.15);
  }
}

.floorplan-custom .booth.is-admin-clickable {
  cursor: pointer;
}

.floorplan-custom .booth.is-info-clickable {
  cursor: pointer;
}

.floorplan-custom .booth-logo {
  max-width: 85%;
  max-height: 85%;
  object-fit: contain;
  border-radius: 1px;
  pointer-events: none;
}

/* ── Dialog ──────────────────────────────────────────────────────── */
.floorplan-custom .dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.floorplan-custom .dialog-overlay.open {
  opacity: 1;
  visibility: visible;
}

.floorplan-custom .dialog-box {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  width: 380px;
  max-width: 92vw;
  padding: 24px;
  text-align: center;
  transform: scale(0.92);
  transition: transform 0.2s ease;
}

.floorplan-custom .dialog-overlay.open .dialog-box {
  transform: scale(1);
}

.floorplan-custom .dialog-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: #fff;
}

.floorplan-custom .dialog-icon.success { background: #16a34a; }
.floorplan-custom .dialog-icon.warning { background: #f59e0b; }
.floorplan-custom .dialog-icon.confirm { background: #4f46e5; }

.floorplan-custom .dialog-title {
  font-size: 18px;
  font-weight: 800;
  color: #111827;
  margin-bottom: 4px;
}

.floorplan-custom .dialog-msg {
  font-size: 14px;
  color: #4b5563;
  line-height: 1.5;
  margin-bottom: 6px;
}

.floorplan-custom .dialog-msg.dialog-success-text {
  color: #16a34a;
  font-weight: 600;
  font-size: 15px;
}

.floorplan-custom .dialog-booths {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  padding: 4px 0 12px;
}

.floorplan-custom .dialog-booth-chip {
  background: #eef2ff;
  color: #4338ca;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 9999px;
}

.floorplan-custom .dialog-btn {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: background 0.15s ease;
}

.floorplan-custom .dialog-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.floorplan-custom .dialog-btn-ok { color: #fff; background: #4f46e5; }
.floorplan-custom .dialog-btn-ok:hover { background: #4338ca; }

.floorplan-custom .dialog-btn-cancel {
  color: #374151;
  background: #e5e7eb;
  border: 1px solid #d1d5db;
}

.floorplan-custom .dialog-btn-cancel:hover { background: #d1d5db; }

/* ── Zone & facility layout ──────────────────────────────────────── */
.floorplan-custom .zone-box {
  border: 2.5px solid #111827;
  border-radius: 4px;
  padding: 6px;
  background: #fff;
}

.floorplan-custom .zone-label {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
}

.floorplan-custom .zone-label-h {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 15px;
  font-weight: 700;
  color: #111827;
}

.floorplan-custom .zone-label-horizontal {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
  transform: rotate(0deg);
}

.floorplan-custom .grid-fixed {
  display: grid;
  gap: 2px;
}

.floorplan-custom .facility {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: 6px;
  font-weight: 700;
  color: #374151;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

/* ── Subgrids ────────────────────────────────────────────────────── */
.floorplan-custom .zone4-subgrid,
.floorplan-custom .zone3-subgrid,
.floorplan-custom .zone1-subgrid,
.floorplan-custom .zone1-subgrid-2x2 {
  border: 1px dashed rgba(239, 68, 68, 0.6);
  border-radius: 4px;
  padding: 3px 2px 2px 2px;
  background: rgba(239, 68, 68, 0.02);
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
}

.floorplan-custom .zone1-subgrid {
  grid-template-columns: repeat(3, 1fr);
}

.floorplan-custom .zone4-subgrid::before,
.floorplan-custom .zone3-subgrid::before,
.floorplan-custom .zone1-subgrid::before,
.floorplan-custom .zone1-subgrid-2x2::before {
  content: attr(data-subgrid-label);
  position: absolute;
  top: -6px;
  left: 4px;
  font-size: 6px;
  font-weight: 800;
  color: #ef4444;
  background: #fff;
  padding: 0 2px;
  line-height: 1;
  z-index: 4;
}

.floorplan-custom .zone4-subgrid[data-subgrid-label="G25"],
.floorplan-custom .zone4-subgrid[data-subgrid-label="G26"] {
  padding-top: 15px;
}

/* ── Viewport & canvas (pan/zoom) ─────────────────────────────── */
.floorplan-custom .fp-viewport {
  position: relative;
  overflow: hidden;
  touch-action: none;
}

.floorplan-custom .fp-canvas {
  transform-origin: top left;
  will-change: transform;
  width: 100%;
  min-width: 1300px;
}

@media (min-width: 768px) {
  .floorplan-custom .fp-viewport {
    overflow-x: auto;
    touch-action: auto;
  }

  .floorplan-custom .fp-canvas {
    transform: none !important;
  }
}

/* ── Mobile zoom toolbar ──────────────────────────────────────── */
.floorplan-custom .fp-custom-toolbar {
  position: relative;
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  margin-bottom: 8px;
  background: transparent;
}

.floorplan-custom .fp-zoom-btn {
  min-width: 40px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  font-size: 16px;
  font-weight: 700;
  color: #374151;
  cursor: pointer;
  user-select: none;
}

.floorplan-custom .fp-zoom-btn:active {
  background: #f3f4f6;
}

.floorplan-custom .fp-zoom-reset {
  min-width: auto;
  padding: 0 14px;
  font-size: 13px;
}

/* ── Legend toggle (<details>) ────────────────────────────────── */
.floorplan-custom .fp-legend {
  padding: 6px;
}

.floorplan-custom .fp-legend-toggle {
  list-style: none;
}

.floorplan-custom .fp-legend-toggle::-webkit-details-marker {
  display: none;
}

.floorplan-custom .fp-legend-toggle::before {
  content: '▸ ';
  font-size: 12px;
  transition: transform 0.15s ease;
  display: inline-block;
}

.floorplan-custom .fp-legend[open] .fp-legend-toggle::before {
  transform: rotate(90deg);
}

@media (min-width: 768px) {
  .floorplan-custom .fp-legend-toggle {
    pointer-events: none;
    cursor: default;
  }

  .floorplan-custom .fp-legend-toggle::before {
    content: none;
  }
}

/* ── Mobile touch targets ─────────────────────────────────────── */
@media (max-width: 767px) {
  .floorplan-custom .booth {
    min-height: 44px;
    min-width: 22px;
    font-size: 11px;
  }

  .floorplan-custom #front-3-copy {
    min-height: 100px;
  }
}
