/* ═══════════════════════════════════════════════════════════════
   PortalDialog – Split Pane extension
   Allows a tab pane to be split into two sub-panes (H or V)
   ═══════════════════════════════════════════════════════════════ */

/* ── Split container (replaces normal pane flow when split) ── */

.portal-dialog-pane.pdlg-split {
  flex-direction: row; /* horizontal split = left|right */
}

.portal-dialog-pane.pdlg-split.pdlg-split-vertical {
  flex-direction: column; /* vertical split = top|bottom */
}

/* ── Sub-panes ── */

.pdlg-split-pane {
  flex: 1 1 0%;
  min-width: 0;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pdlg-split-pane > iframe,
.pdlg-split-pane > .map-dialog-sandbox-container {
  width: 100%;
  height: 100%;
  flex: 1 1 auto;
  min-height: 0;
  border: none;
}

/* ── Close button per sub-pane ── */

/* ── Sub-pane toolbar (close + pop-out buttons) ── */

.pdlg-split-pane-toolbar {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 20;
  display: flex;
  gap: 3px;
  opacity: 0;
  transition: opacity 0.15s;
}

.pdlg-split-pane:hover .pdlg-split-pane-toolbar {
  opacity: 0.7;
}

.pdlg-split-pane-toolbar:hover {
  opacity: 1 !important;
}

.pdlg-split-pane-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: none;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s;
}

.pdlg-split-pane-close:hover {
  background: rgba(200, 0, 0, 0.8);
}

.pdlg-split-pane-popout:hover {
  background: rgba(51, 122, 183, 0.85);
}

/* ── Splitter (draggable divider) ── */

.pdlg-splitter {
  flex: 0 0 5px;
  background: #e0e0e0;
  position: relative;
  z-index: 10;
  transition: background 0.12s;
}

.pdlg-splitter:hover,
.pdlg-splitter.pdlg-splitter-active {
  background: #337ab7;
}

/* Horizontal (left/right) → vertical bar, resize cursor E-W */
.portal-dialog-pane.pdlg-split:not(.pdlg-split-vertical) > .pdlg-splitter {
  cursor: col-resize;
  width: 5px;
}

/* Vertical (top/bottom) → horizontal bar, resize cursor N-S */
.portal-dialog-pane.pdlg-split.pdlg-split-vertical > .pdlg-splitter {
  cursor: row-resize;
  height: 5px;
}

/* ── Drag overlay (prevents iframe stealing mouse events during resize) ── */

.pdlg-split-drag-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 50;
  cursor: col-resize;
}

.pdlg-split-vertical > .pdlg-split-drag-overlay {
  cursor: row-resize;
}

/* ── Tab header split indicator ── */

.portal-dialog-tab-split-indicator {
  display: inline-block;
  font-size: 10px;
  color: #337ab7;
  margin-left: 4px;
  opacity: 0.7;
}

/* ═══════════════════════════════════════════════════════════════
   Drag & Drop – Tab reordering and split-by-drag
   ═══════════════════════════════════════════════════════════════ */

/* ── Full-viewport overlay during drag (catches mouse over iframes) ── */

.pdlg-drag-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  z-index: 9998;
  background: transparent;
  cursor: grabbing;
}

/* ── Ghost tab (floating clone following cursor) ── */

.pdlg-drag-ghost {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  background: #fff;
  border-radius: 4px 4px 0 0;
  cursor: grabbing;
}

/* ── Source tab dimmed during drag ── */

.pdlg-tab-dragging-source {
  opacity: 0.35;
}

/* ── Drop zone container (positioned over body area via JS) ── */

.pdlg-drop-zones {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
}

/* ── Individual drop zones ── */

.pdlg-drop-zone {
  position: absolute;
  background: rgba(51, 122, 183, 0.06);
  border: 2px dashed rgba(51, 122, 183, 0.25);
  box-sizing: border-box;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pdlg-drop-zone-active {
  background: rgba(51, 122, 183, 0.18);
  border-color: #337ab7;
  border-style: solid;
  box-shadow: inset 0 0 20px rgba(51, 122, 183, 0.1);
}

/* Zone positioning (within the drop-zones container) */

.pdlg-drop-zone-left {
  top: 4px; left: 4px; bottom: 4px;
  width: calc(50% - 6px);
}

.pdlg-drop-zone-right {
  top: 4px; right: 4px; bottom: 4px;
  width: calc(50% - 6px);
}

.pdlg-drop-zone-top {
  top: 4px; left: 4px; right: 4px;
  height: calc(50% - 6px);
}

.pdlg-drop-zone-bottom {
  bottom: 4px; left: 4px; right: 4px;
  height: calc(50% - 6px);
}

/* ── Zone labels ── */

.pdlg-drop-zone-label {
  font-size: 13px;
  font-weight: 600;
  color: rgba(51, 122, 183, 0.5);
  text-transform: uppercase;
  letter-spacing: 1px;
  pointer-events: none;
  user-select: none;
}

.pdlg-drop-zone-active .pdlg-drop-zone-label {
  color: #337ab7;
}

/* ── Tab insertion indicator (vertical line in tab bar) ── */

.pdlg-tab-insert-line {
  position: absolute;
  width: 2px;
  background: #337ab7;
  z-index: 100;
  pointer-events: none;
  border-radius: 1px;
}

/* ── Grab cursor on tab headers (when 2+ tabs exist) ── */
/* v30: default cursor normally, grabbing only on mousedown */

.portal-dialog-tab a {
  cursor: default;
}

.portal-dialog-tab a:active {
  cursor: grabbing;
}
