/* ==========================================================================
   BIHAR 6-REGION MINI-MAP & DISTRICT SELECTION TRIGGER & POPOVER
   ========================================================================== */

.mini-map-trigger-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

/* Header Trigger Button */
.mini-map-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  color: #1e293b;
  border: 1.5px solid #cbd5e1;
  padding: 5px 12px 5px 8px;
  border-radius: 22px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.06);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  font-family: inherit;
}

.mini-map-trigger-btn:hover {
  background: linear-gradient(135deg, #f0fdf4 0%, #e2e8f0 100%);
  border-color: #0284c7;
  color: #0369a1;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.2);
}

.mini-map-trigger-btn.has-active {
  border-color: #0284c7;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  color: #0369a1;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.25);
}

.mini-map-trigger-btn.popover-open {
  border-color: #0284c7;
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.3);
}

/* Button Mini SVG Map */
.mini-map-btn-svg {
  width: 28px;
  height: 22px;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.15));
  flex-shrink: 0;
  overflow: visible;
}

.mini-svg-outline {
  fill: none;
  stroke: #64748b;
  stroke-width: 3;
  stroke-dasharray: 2, 2;
  opacity: 0.7;
}

.mini-btn-region-path {
  stroke: #ffffff;
  stroke-width: 1.5;
  opacity: 0.65;
  transition: all 0.2s ease;
  cursor: pointer;
}

.mini-btn-region-path:hover {
  opacity: 1;
  stroke: #0f172a;
  stroke-width: 2.5;
}

.mini-btn-region-path.active {
  opacity: 1;
  stroke: #0f172a;
  stroke-width: 2.5;
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.5));
}

.mini-map-btn-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.mini-map-btn-text i {
  color: #0284c7;
  font-size: 14px;
}

.region-active-badge {
  background: #0284c7;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 12px;
  letter-spacing: 0.3px;
  animation: pulseBadge 1.8s infinite;
}

@keyframes pulseBadge {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.mini-map-btn-arrow {
  font-size: 10px;
  color: #64748b;
  transition: transform 0.2s ease;
}

.mini-map-trigger-btn.popover-open .mini-map-btn-arrow {
  transform: rotate(180deg);
}

/* ==========================================================================
   FLOATING POPOVER DROPDOWN
   ========================================================================== */
.mini-map-popover-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 1050;
  width: 380px;
  max-width: 92vw;
  background: #ffffff;
  border-radius: 14px;
  border: 1.5px solid #cbd5e1;
  box-shadow: 0 12px 36px -4px rgba(15, 23, 42, 0.25), 0 4px 12px rgba(0, 0, 0, 0.08);
  animation: popoverSlideIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

@keyframes popoverSlideIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.sidebar-region-map-box {
  background: #ffffff;
  padding: 12px;
  color: #1e293b;
  font-family: inherit;
}

/* Header with Title & By District Checkbox Option */
.sidebar-selection-mode-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 2px 2px 8px 2px;
  border-bottom: 1px solid #e2e8f0;
  gap: 8px;
}

.selection-mode-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 800;
  color: #0369a1;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.selection-mode-title i {
  color: #f59e0b;
  font-size: 14px;
}

.sidebar-dist-count-badge {
  background: #e2e8f0;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  transition: all 0.2s ease;
}

.sidebar-dist-count-badge.has-selected {
  background: #10b981;
  color: #ffffff;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

/* By District Checkbox Badge Switch */
.by-district-toggle-box {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 20px;
  padding: 4px 10px;
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.by-district-toggle-box:hover {
  background: #f1f5f9;
  border-color: #0284c7;
  color: #0284c7;
  transform: translateY(-1px);
}

.by-district-toggle-box input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin: 0;
  cursor: pointer;
  accent-color: #0284c7;
}

.by-district-toggle-box.active {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.12) 0%, rgba(3, 105, 161, 0.18) 100%);
  border-color: #0284c7;
  color: #0369a1;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.2);
}

/* Quick Action Chips */
.popover-quick-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.popover-quick-label {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-right: 2px;
}

.popover-action-chip {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.popover-action-chip:hover {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}

.popover-action-chip.chip-active {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 0 8px rgba(2, 132, 199, 0.35);
}

.popover-action-chip.chip-clear {
  color: #dc2626;
  border-color: #fca5a5;
  background: #fef2f2;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.popover-action-chip.chip-clear:hover {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
}

/* VIEW 1: BY REGION */
.sidebar-map-stage {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  padding: 8px 6px 6px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.sidebar-interactive-svg {
  width: 100%;
  height: auto;
  max-height: 210px;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.08));
}

.popover-svg-outline {
  fill: #e2e8f0;
  stroke: #94a3b8;
  stroke-width: 2;
  stroke-linejoin: round;
}

.popover-region-path {
  fill: var(--reg-color, #1976d2);
  fill-opacity: 0.4;
  stroke: #ffffff;
  stroke-width: 2;
  stroke-linejoin: round;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.popover-region-path:hover,
.popover-region-path.hovered {
  fill-opacity: 0.85;
  stroke: #0f172a;
  stroke-width: 3;
}

.popover-region-path.active {
  fill-opacity: 0.95;
  stroke: #0f172a;
  stroke-width: 3.5;
  filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.35));
}

.popover-region-label {
  font-size: 13px;
  font-weight: 800;
  fill: #1e293b;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: all;
  cursor: pointer;
  text-shadow: 0 0 4px #ffffff, 0 0 4px #ffffff;
  user-select: none;
  transition: transform 0.2s ease;
}

.popover-region-label:hover {
  font-size: 14.5px;
  fill: #000000;
}

.popover-region-label.active {
  fill: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), 0 0 6px #000000;
}

.popover-map-hint {
  font-size: 11px;
  color: #64748b;
  text-align: center;
  margin-top: 6px;
  font-weight: 600;
}

/* Tiny Hide/Show Details Bar */
.tiny-details-bar {
  display: flex;
  justify-content: center;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed #e2e8f0;
}

.tiny-details-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.tiny-details-toggle-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #94a3b8;
}

/* Region Cards Column in Collapsible Details */
.popover-cards-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
  margin-top: 8px;
  padding-right: 4px;
}

.popover-cards-col::-webkit-scrollbar {
  width: 4px;
}

.popover-cards-col::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.region-card-item {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-left: 4.5px solid var(--theme-color, #1976d2);
  border-radius: 8px;
  padding: 6px 9px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.region-card-item:hover,
.region-card-item.hovered {
  border-color: var(--theme-color, #1976d2);
  transform: translateX(2px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}

.region-card-item.active {
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
  border-color: var(--theme-color, #1976d2);
  box-shadow: 0 0 0 1.5px var(--theme-color, #1976d2);
}

.region-card-header {
  display: flex;
  align-items: center;
  gap: 7px;
}

.region-card-pill {
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

.region-card-titles {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.region-title-en {
  font-size: 11.5px;
  color: #0f172a;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.region-title-hi {
  font-size: 10.5px;
  color: #64748b;
  font-weight: 500;
}

.region-dist-count-badge {
  font-size: 10px;
  color: #475569;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 600;
}

.region-checkbox-indicator {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1.5px solid #cbd5e1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: transparent;
  transition: all 0.2s ease;
}

.region-card-item.active .region-checkbox-indicator {
  background: #10b981;
  border-color: #10b981;
  color: #ffffff;
}

.region-card-districts {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 5px;
  padding-top: 4px;
  border-top: 1px dashed #f1f5f9;
}

.popover-dist-badge {
  font-size: 9.5px;
  padding: 1px 5px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  color: #334155;
  font-weight: 500;
}

.region-card-item.active .popover-dist-badge {
  background: #e0f2fe;
  border-color: #bae6fd;
  color: #0369a1;
  font-weight: 600;
}

/* VIEW 2: BY DISTRICT */
.by-district-view {
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: fadeInDistView 0.2s ease-in-out;
}

@keyframes fadeInDistView {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.district-search-bar-wrap {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 10px;
  gap: 8px;
  transition: border-color 0.2s;
}

.district-search-bar-wrap:focus-within {
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.district-search-icon {
  color: #64748b;
  font-size: 12px;
}

.district-search-input {
  border: none;
  outline: none;
  width: 100%;
  padding: 7px 0;
  font-size: 12px;
  font-family: inherit;
  background: transparent;
  color: #0f172a;
}

.district-search-clear-btn {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 12px;
  padding: 4px;
}

.district-search-clear-btn:hover {
  color: #ef4444;
}

.district-grid-container {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  padding: 6px;
}

.district-grid-container::-webkit-scrollbar {
  width: 5px;
}
.district-grid-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.district-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.district-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.district-checkbox:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.district-checkbox.selected {
  background: #eff6ff !important;
  border-color: #3b82f6 !important;
  color: #1d4ed8 !important;
  font-weight: 700 !important;
  box-shadow: 0 1px 4px rgba(59, 130, 246, 0.25);
}

.district-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #2563eb;
  cursor: pointer;
  margin: 0;
}

.popover-dist-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  cursor: pointer;
  accent-color: #0284c7;
}

.by-district-bottom-actions {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.btn-dist-action {
  flex: 1;
  padding: 6px 10px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  font-family: inherit;
}

.btn-dist-select-all {
  background: #e0f2fe;
  color: #0369a1;
  border-color: #bae6fd;
}

.btn-dist-select-all:hover {
  background: #0284c7;
  color: #ffffff;
}

.btn-dist-clear {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fecaca;
}

.btn-dist-clear:hover {
  background: #dc2626;
  color: #ffffff;
}
