/**
 * viewport.css — Multi-pane viewport system styles
 */

/* ── Viewport grid container ─────────────────────────────────── */
.vp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  width: 100%;
  height: 100%;
  gap: 0;
}

/* ── Pane cell ───────────────────────────────────────────────── */
.vp-cell {
  position: relative;
  overflow: hidden;
  background: var(--bg-viewport, #080d14);
  border: 1px solid var(--border, rgba(255,255,255,0.05));
  transition: flex 0.2s ease-out;
}

.vp-cell:first-child { border-right-width: 0; }
.vp-cell:last-child  { border-left-width: 0; }

/* ── Pane wrap ───────────────────────────────────────────────── */
.vp-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity 0.2s, outline 0.15s;
}

.vp-wrap:hover { opacity: 1; }

/* ── Per-pane canvas ────────────────────────────────────────── */
.vp-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* ── Pane toolbar (top-left) ────────────────────────────────── */
.vp-toolbar {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(8,13,20,0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 4px 6px;
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.2s;
}

.vp-wrap:hover .vp-toolbar,
.vp-wrap.in-edit-mode .vp-toolbar {
  opacity: 1;
}

.vp-pill {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
  padding: 0 4px;
}

.vp-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}

.vp-btn:hover {
  color: rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.08);
}

/* ── Hide button (edit mode) ────────────────────────────────── */
.vp-hide-btn {
  display: none !important;
}

/* ── Edit mode ──────────────────────────────────────────────── */
.vp-wrap.in-edit-mode {
  outline: 2px solid rgba(74,141,245,0.8);
  outline-offset: -2px;
}

.vp-wrap.in-edit-mode .vp-hide-btn {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.vp-wrap.dimmed { opacity: 0.55; }

/* ── Dividers ───────────────────────────────────────────────── */
.vp-divider {
  position: relative;
  z-index: 10;
  background: var(--border, rgba(255,255,255,0.08));
  flex-shrink: 0;
  transition: background 0.15s;
  cursor: col-resize;
  border: none;
}

.vp-divider:hover,
.vp-divider.dragging {
  background: rgba(74,141,245,0.6) !important;
}

.vp-divider-col {
  width: 5px;
  min-width: 5px;
  cursor: col-resize;
}

.vp-divider-row {
  height: 5px;
  min-height: 5px;
  cursor: row-resize;
}

/* ── Add viewport button ─────────────────────────────────────── */
.vp-add-btn {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 20;
  width: 28px;
  height: 28px;
  background: rgba(74,141,245,0.8);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.15s;
}

.vp-add-btn:hover {
  background: rgba(74,141,245,1);
  transform: scale(1.1);
}

/* ── Layout menu ─────────────────────────────────────────────── */
#vp-layout-menu {
  display: none;
}

#vp-layout-menu.open {
  display: block;
}

.vp-layout-opt:hover {
  background: rgba(255,255,255,0.08);
}

.vp-layout-opt.active {
  color: #6ba3ff;
  background: rgba(74,141,245,0.15);
}

/* ── Mobile tab strip ────────────────────────────────────────── */
.vp-mobile-strip {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  background: rgba(8,13,20,0.85);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
  align-items: center;
  flex-shrink: 0;
}

.vp-tab-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.15s;
  white-space: nowrap;
}

.vp-tab-btn.active {
  background: rgba(74,141,245,0.3);
  border-color: rgba(74,141,245,0.5);
  color: #6ba3ff;
}

/* ── Fullscreen overlay ─────────────────────────────────────── */
.vp-fullscreen {
  position: fixed !important;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 500;
  width: 100vw !important;
  height: 100vh !important;
}

/* ── View label overlay ─────────────────────────────────────── */
.vp-view-label {
  position: absolute;
  bottom: 8px;
  left: 8px;
  z-index: 5;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.3);
  pointer-events: none;
}

/* ── Pane border indicator (for edit mode border) ─────────────── */
.vp-border-indicator {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 2px solid transparent;
  border-radius: 0;
  transition: border-color 0.15s;
  z-index: 8;
}

.vp-wrap.in-edit-mode .vp-border-indicator {
  border-color: rgba(74,141,245,0.8);
}

/* ── Long-press cursor ───────────────────────────────────────── */
.vp-wrap.can-edit {
  cursor: pointer;
}

/* ── Swap target highlight ──────────────────────────────────── */
.vp-wrap.drag-target {
  outline: 2px solid rgba(74,141,245,0.7) !important;
  outline-offset: -4px;
}