.groups-legend-compact {
  margin-left: auto;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  display: flex;
  align-items: center;
}

.legend-items-compact {
  display: flex;
  align-items: center;
  gap: 12px;
}

.legend-item-compact {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: #ffffff;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  transition: all 0.2s ease;
}

.legend-item-compact:hover {
  border-color: #d1d5db;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.legend-color-compact {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.legend-color-compact.level-1 {
  background: linear-gradient(135deg, #9333ea, #7c3aed);
}

.legend-color-compact.level-2 {
  background: linear-gradient(135deg, #db2777, #be185d);
}

.legend-color-compact.level-3 {
  background: linear-gradient(135deg, #ffffff, #f8fafc);
  border: 1px solid #d1d5db;
}

.legend-label-compact {
  font-family: 'Bio Sans Bold', Arial, sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: #374151;
  min-width: 18px;
  text-align: center;
}

@media (max-width: 1024px) {
  .groups-legend-compact {
    padding: 6px 10px;
  }

  .legend-items-compact {
    gap: 10px;
  }

  .legend-item-compact {
    padding: 3px 6px;
    gap: 4px;
  }

  .legend-color-compact {
    width: 14px;
    height: 14px;
  }

  .legend-label-compact {
    font-size: 10px;
    min-width: 16px;
  }
}

@media (max-width: 768px) {
  .groups-legend-compact {
    display: none;
  }
}

.zone-shape.grouping-selected {
  fill: rgba(245, 158, 11, 0.5);
  stroke: #f59e0b;
  stroke-width: 3;
  filter: drop-shadow(0 0 12px rgba(245, 158, 11, 0.7));
}

.zone-label.grouping-selected {
  fill: #f59e0b;
  font-weight: 700;
  font-size: 13px;
  filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.8));
}


.zone-shape.level-1 {
  stroke: #9333ea;
  stroke-width: 2;
}
.zone-shape.level-1.group-highlight {
  stroke: #9333ea !important;
  stroke-width: 3 !important;
  fill: rgba(147, 51, 234, 0.3) !important;
  filter: drop-shadow(0 0 8px rgba(147, 51, 234, 0.6));
}

.zone-shape.level-2 {
  stroke: #db2777;
  stroke-width: 2;
}
.zone-shape.level-2.group-highlight {
  stroke: #db2777 !important;
  stroke-width: 3 !important;
  fill: rgba(219, 39, 119, 0.3) !important;
  filter: drop-shadow(0 0 8px rgba(219, 39, 119, 0.6));
}

.zone-shape.level-3 {
  stroke: #ffffff;
  stroke-width: 2;
  filter: drop-shadow(0 0 2px rgba(0,0,0,0.5));
}
.zone-shape.level-3.group-highlight {
  stroke: #ffffff !important;
  stroke-width: 3 !important;
  fill: rgba(255, 255, 255, 0.3) !important;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.8));
}

.zone-label.group-highlight.level-1 { fill: #9333ea !important; }
.zone-label.group-highlight.level-2 { fill: #db2777 !important; }
.zone-label.group-highlight.level-3 {
  fill: #ffffff !important;
  text-shadow: 0 0 4px #000000;
}

.zone-label.group-highlight {
  fill: #9333ea !important;
  font-weight: 700;
  font-size: 14px;
  text-shadow: 0 0 4px rgba(255, 255, 255, 0.8);
}

.group-info {
  margin: 0 0 12px 0;
  font-family: 'Bio Sans', Arial, sans-serif;
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.4;
}

.group-zones-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.group-zone-tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  background: linear-gradient(135deg, var(--color-primary), #c41e3a);
  color: var(--color-white);
  border-radius: 16px;
  font-family: 'Bio Sans', Arial, sans-serif;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(225, 36, 36, 0.2);
}
@media (max-width: 480px) {
  .group-zones-list {
    padding: 8px;
    gap: 6px;
  }

  .group-zone-tag {
    padding: 4px 10px;
    font-size: 11px;
  }
}

@keyframes breathing {
  0% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(34, 197, 94, 0)); }
  50% { transform: scale(1.1); filter: drop-shadow(0 0 4px rgba(34, 197, 94, 0.6)); }
  100% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(34, 197, 94, 0)); }
}

.breathing-icon svg {
  animation: breathing 2s infinite ease-in-out;
  color: #22c55e;
}

@media (max-width: 1024px) {
  .dashboard-layout {
    grid-template-rows: 60px auto;
  }
  .zone-management-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
  }
}

/* ======================================================
   LEGEND ACTIVE STATE IMPROVEMENT
   ====================================================== */

.legend-item-compact.active {
  border-color: #111827;
  box-shadow: 0 0 0 2px rgba(17, 24, 39, 0.15);
  background: #ffffff;
  transform: translateY(-1px);
}

.legend-item-compact.active .legend-label-compact {
  color: #111827;
}


/* ======================================================
   BASE POLYGON COLORS (NEUTRAL + SELECTED)
   ====================================================== */

/* Neutral = Green (default visible state) */
.zone-shape.neutral {
  fill: rgba(34, 197, 94, 0.25);
  stroke: #22c55e;
  stroke-width: 2;
}

.zone-label.neutral {
  fill: #16a34a;
  font-weight: 600;
}

/* Selected Zone = Blue */
.zone-shape.selected {
  fill: rgba(59, 130, 246, 0.35) !important;
  stroke: #2563eb !important;
  stroke-width: 3 !important;
  filter: drop-shadow(0 0 8px rgba(37, 99, 235, 0.6));
}

.zone-label.selected {
  fill: #2563eb !important;
  font-weight: 700;
}


/* ======================================================
   GROUP LEVEL VISUAL STATES (NO DIMMING)
   ====================================================== */

/* Level 1 – Purple */
.zone-shape.active-level-1,
.zone-shape.legend-level-1 {
  fill: rgba(147, 51, 234, 0.28);
  stroke: #7c3aed;
  stroke-width: 3;
  filter: drop-shadow(0 0 8px rgba(147, 51, 234, 0.5));
}

.zone-label.active-level-1,
.zone-label.legend-level-1 {
  fill: #7c3aed;
  font-weight: 700;
}

/* Level 2 – Pink */
.zone-shape.active-level-2,
.zone-shape.legend-level-2 {
  fill: rgba(219, 39, 119, 0.28);
  stroke: #be185d;
  stroke-width: 3;
  filter: drop-shadow(0 0 8px rgba(219, 39, 119, 0.5));
}

.zone-label.active-level-2,
.zone-label.legend-level-2 {
  fill: #be185d;
  font-weight: 700;
}

/* Level 3 – White */
.zone-shape.active-level-3,
.zone-shape.legend-level-3 {
  fill: rgba(255, 255, 255, 0.28);
  stroke: #ffffff;
  stroke-width: 3;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.8));
}

.zone-label.active-level-3,
.zone-label.legend-level-3 {
  fill: #ffffff;
  font-weight: 700;
  text-shadow: 0 0 4px #000000;
}


/* ======================================================
   REMOVE ANY DIMMED EFFECT COMPLETELY
   ====================================================== */

.zone-shape.dimmed {
  opacity: 1 !important;
  filter: none !important;
}

.zone-label.dimmed {
  opacity: 1 !important;
}/* ======================================================
   HARD OVERRIDE – SOLID GROUP HIGHLIGHT
   (NO TRANSPARENCY – FULL VISIBILITY)
   ====================================================== */

/* Remove any previous fill influence */
.zone-shape.active-level-1,
.zone-shape.active-level-2,
.zone-shape.active-level-3 {
  opacity: 1 !important;
  filter: none !important;
}

/* ---------- LEVEL 1 (Purple) ---------- */
.zone-shape.active-level-1 {
  fill: #9333ea !important;
  stroke: #4c1d95 !important;
  stroke-width: 4 !important;
}

.zone-label.active-level-1 {
  fill: #ffffff !important;
  font-weight: 800 !important;
  font-size: 14px !important;
}

/* ---------- LEVEL 2 (Pink) ---------- */
.zone-shape.active-level-2 {
  fill: #db2777 !important;
  stroke: #831843 !important;
  stroke-width: 4 !important;
}

.zone-label.active-level-2 {
  fill: #ffffff !important;
  font-weight: 800 !important;
  font-size: 14px !important;
}

/* ---------- LEVEL 3 (White) ---------- */
.zone-shape.active-level-3 {
  fill: #ffffff !important;
  stroke: #000000 !important;
  stroke-width: 4 !important;
}

.zone-label.active-level-3 {
  fill: #000000 !important;
  font-weight: 800 !important;
  font-size: 14px !important;
}