/* split-view.css — map + attribute table side-by-side layout for admins.
   Defaults: map 60%, table 40%. Drag divider to resize; persisted to localStorage. */

/* When split is active, map-wrapper shrinks; container holds the table below. */
body.wm-split-active #map-wrapper {
  height: calc(var(--wm-split-map-pct, 60) * 1vh - var(--wm-banner-clearance, 0px));
  min-height: 200px;
}

#wm-split-container {
  display: none;
  flex-direction: column;
  background: #fff;
  border-top: 1px solid #d1d5db;
  position: relative;
  height: calc((100 - var(--wm-split-map-pct, 60)) * 1vh);
  min-height: 120px;
  z-index: 5;
}

body.wm-split-active #wm-split-container {
  display: flex;
}

#wm-split-divider {
  height: 8px;
  background: #e5e7eb;
  cursor: ns-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  user-select: none;
  transition: background-color .15s ease;
}
#wm-split-divider:hover,
#wm-split-divider.is-dragging {
  background: #d1d5db;
}
#wm-split-divider::before {
  content: '';
  width: 32px;
  height: 3px;
  background: #9ca3af;
  border-radius: 2px;
}

#wm-split-toolbar {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .35rem .65rem;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
  font-size: .85rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}
#wm-split-count { font-weight: 600; }
#wm-split-toolbar .form-check { margin: 0; }
#wm-split-toolbar .form-check-label { font-size: .8rem; cursor: pointer; }

#wm-split-table-wrap {
  flex: 1 1 auto;
  overflow: auto;
  background: #fff;
}

#wm-split-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
#wm-split-table thead th {
  position: sticky;
  top: 0;
  background: #f3f4f6;
  border-bottom: 1px solid #d1d5db;
  padding: .4rem .55rem;
  text-align: left;
  font-weight: 600;
  font-size: .75rem;
  text-transform: uppercase;
  color: #4b5563;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  z-index: 1;
}
#wm-split-table thead th:hover { background: #e5e7eb; }
#wm-split-table thead th.sorted-asc::after  { content: ' ▲'; font-size: .7em; color: #6b7280; }
#wm-split-table thead th.sorted-desc::after { content: ' ▼'; font-size: .7em; color: #6b7280; }

#wm-split-table tbody tr {
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
}
#wm-split-table tbody tr:hover { background: #fef3c7; }
#wm-split-table tbody tr.is-selected {
  background: #fef08a;
  outline: 1px solid #ca8a04;
}
#wm-split-table tbody tr.flash-row {
  animation: split-row-flash 1.2s ease-out;
}
@keyframes split-row-flash {
  0%   { background: #fde047; }
  100% { background: transparent; }
}

#wm-split-table td {
  padding: .35rem .55rem;
  vertical-align: top;
}
#wm-split-table td.td-trunc {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#wm-split-table .conf-badge {
  font-size: .7rem;
  padding: .15rem .4rem;
  border-radius: 4px;
  white-space: nowrap;
}
.conf-badge.conf-unlocatable { background: #fee2e2; color: #b91c1c; }
.conf-badge.conf-low         { background: #fef3c7; color: #92400e; }
.conf-badge.conf-high        { background: #e5e7eb; color: #4b5563; }

/* Mobile fallback: below 700px, hide split. The toggle button itself stays
   visible — clicking it could open full-screen table in a future iteration. */
@media (max-width: 699.98px) {
  body.wm-split-active #map-wrapper { height: calc(var(--wm-banner-clearance, 0px) + 60vh); }
  #wm-split-container { display: none !important; }
}

/* Bulk-action toolbar — appears below the main toolbar when ≥1 row selected */
#wm-split-bulk-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .65rem;
  background: #fef3c7;
  border-bottom: 1px solid #fde68a;
  font-size: .85rem;
  flex-wrap: wrap;
}
#wm-split-bulk-bar .wm-bulk-count { font-weight: 600; color: #92400e; }

#wm-split-table th.td-check,
#wm-split-table td.td-check {
  text-align: center;
  padding: .35rem .25rem;
}
#wm-split-table .wm-row-check { cursor: pointer; }

/* Map cursor + banner during "pick a location" mode */
#wm-split-pick-banner {
  display: none;
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, .9);
  color: #fff;
  padding: .55rem 1rem;
  border-radius: 6px;
  font-size: .85rem;
  z-index: 9999;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
#wm-split-pick-banner a {
  color: #fcd34d;
  text-decoration: underline;
  margin-left: .5rem;
}

/* Confirmation modal for bulk-move */
#wm-bulk-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}
.wm-bulk-modal {
  background: #fff;
  border-radius: 8px;
  padding: 1.25rem;
  width: min(440px, calc(100vw - 32px));
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}

/* Mapbox custom control button for the toggle. */
.mapboxgl-ctrl button.wm-split-toggle-btn {
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mapboxgl-ctrl button.wm-split-toggle-btn.is-active {
  background: #fde68a;
  color: #92400e;
}
