/* Zone Management Styles */

/* Zone Controls Section */
.realtime-theme .zone-controls {
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  padding: 12px 20px;
  min-height: 60px;
  display: flex;
  align-items: center;
}

.realtime-theme .zone-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

/* Drawing Tools Group */
.realtime-theme .drawing-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: rgba(59, 130, 246, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(59, 130, 246, 0.2);
  flex-wrap: wrap;
  margin-top: 8px;
}

.realtime-theme .drawing-tools .zone-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 13px;
  min-width: auto;
}

.realtime-theme .drawing-tools .zone-btn svg {
  width: 16px;
  height: 16px;
}

/* Create Zone Button */
.realtime-theme .create-zone-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--color-primary);
  color: var(--color-white);
  border: none;
  border-radius: 8px;
  font-family: 'Bio Sans', Arial, sans-serif;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.realtime-theme .create-zone-btn:hover {
  background: #c41e3a;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(225, 36, 36, 0.3);
}

/* Drawing Status */
.realtime-theme .drawing-status {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.realtime-theme .drawing-mode-indicator {
  font-family: 'Bio Sans', Arial, sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--color-primary);
}

.realtime-theme .drawing-instruction {
  font-family: 'Bio Sans', Arial, sans-serif;
  font-size: 12px;
  color: var(--color-text-secondary);
  font-style: italic;
}

/* Zone Buttons */
.realtime-theme .zone-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-family: 'Bio Sans', Arial, sans-serif;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.realtime-theme .zone-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.realtime-theme .zone-btn-primary {
  background: var(--color-primary);
  color: var(--color-white);
}

.realtime-theme .zone-btn-primary:hover:not(:disabled) {
  background: #c41e3a;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(225, 36, 36, 0.3);
}

.realtime-theme .zone-btn-success {
  background: var(--color-accent);
  color: var(--color-black);
}

.realtime-theme .zone-btn-success:hover:not(:disabled) {
  background: #d4a91a;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(230, 192, 31, 0.3);
}

.realtime-theme .zone-btn-danger {
  background: #ef4444;
  color: var(--color-white);
}

.realtime-theme .zone-btn-danger:hover:not(:disabled) {
  background: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

.realtime-theme .zone-btn-secondary {
  background: #6b7280;
  color: var(--color-white);
}

.realtime-theme .zone-btn-secondary:hover:not(:disabled) {
  background: #4b5563;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(107, 114, 128, 0.3);
}

/* Zone Info */
.realtime-theme .zone-info {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: 'Bio Sans', Arial, sans-serif;
  font-size: 14px;
  color: var(--color-text-secondary);
}

.realtime-theme .zone-count {
  font-weight: 600;
  color: var(--color-primary);
}

.realtime-theme .selected-zone {
  font-weight: 500;
  color: #22c55e;
}

/* Cursor styles for drawing */
.realtime-theme .cursor-crosshair {
  cursor: crosshair !important;
}

.realtime-theme .cursor-crosshair * {
  cursor: crosshair !important;
}

/* Zone polygon styles */
.realtime-theme .zone-polygon .zone-shape {
  fill: rgba(34, 197, 94, 0.2);
  stroke: #22c55e;
  stroke-width: 2;
  cursor: pointer;
  transition: all 0.2s ease;
}

.realtime-theme .zone-polygon .zone-shape:hover {
  fill: rgba(34, 197, 94, 0.4);
  stroke-width: 3;
}

.realtime-theme .zone-polygon .zone-shape.selected {
  fill: rgba(59, 130, 246, 0.3);
  stroke: #3b82f6;
  stroke-width: 3;
}

.realtime-theme .zone-label {
  fill: #22c55e;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Bio Sans', Arial, sans-serif;
  pointer-events: none;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.realtime-theme .zone-label.selected {
  fill: #3b82f6;
}

/* Current drawing polygon */
.realtime-theme .current-polygon .polygon-line {
  stroke: #ef4444;
  stroke-width: 2;
  pointer-events: none;
}

.realtime-theme .current-polygon .polygon-point {
  fill: #ef4444;
  stroke: #ffffff;
  stroke-width: 2;
  transition: all 0.2s ease;
}

.realtime-theme .current-polygon .polygon-point:hover {
  r: 6;
  stroke-width: 3;
}

.realtime-theme .current-polygon .start-point-indicator {
  fill: rgba(239, 68, 68, 0.3);
  stroke: #ef4444;
  stroke-width: 2;
  stroke-dasharray: 3,3;
  animation: pulse-start 2s ease-in-out infinite;
}

/* Shape preview */
.realtime-theme .shape-preview {
  fill: rgba(239, 68, 68, 0.3);
  stroke: #ef4444;
  stroke-width: 2;
  stroke-dasharray: 5,5;
  pointer-events: none;
  animation: dash 1s linear infinite;
}

@keyframes dash {
  to {
    stroke-dashoffset: -10;
  }
}

@keyframes pulse-start {
  0%, 100% {
    opacity: 0.6;
    r: 8;
  }
  50% {
    opacity: 1;
    r: 12;
  }
}

/* Cursor styles for drawing */
.realtime-theme .cursor-crosshair {
  cursor: crosshair !important;
}

.realtime-theme .cursor-crosshair * {
  cursor: crosshair !important;
}

.realtime-theme .cursor-not-allowed {
  cursor: not-allowed !important;
}

.realtime-theme .cursor-grab {
  cursor: grab !important;
}

.realtime-theme .cursor-grabbing {
  cursor: grabbing !important;
}

.realtime-theme .cursor-default {
  cursor: default !important;
}

/* Drawing mode visual feedback */
.realtime-theme .floor-plan-image-container.cursor-crosshair::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(239, 68, 68, 0.05);
  border: 2px dashed rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  pointer-events: none;
  z-index: 1;
}

/* Info panel updates */
.realtime-theme .info-icon-green {
  color: #22c55e;
}

.realtime-theme .info-icon-orange {
  color: #f59e0b;
}

/* Loading state */
.realtime-theme .loading-text {
  color: #f59e0b;
  font-style: italic;
  margin-left: 8px;
}

/* Drawing tools specific styles */
.realtime-theme .drawing-tools .zone-btn {
  padding: 6px 12px;
  font-size: 13px;
  min-width: auto;
}

.realtime-theme .drawing-tools .zone-btn svg {
  width: 14px;
  height: 14px;
}

/* Active drawing mode highlight */
.realtime-theme .drawing-tools .zone-btn.active {
  background: #3b82f6;
  color: var(--color-white);
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  .realtime-theme .zone-management-page .floor-plan-info-panel {
    width: 350px;
  }
}

@media (max-width: 1024px) {
  .realtime-theme .zone-toolbar {
    flex-wrap: wrap;
    gap: 8px;
    height: auto;
    padding: 4px 0;
  }
  
  .realtime-theme .drawing-tools {
    order: 1;
    flex: 1 1 auto; 
    justify-content: flex-start;
    min-width: 200px;
  }
  
  .realtime-theme .zone-info {
    order: 2;
    margin-left: auto;
    width: auto;
    margin-top: 0;
  }
  

  
  .realtime-theme .zone-btn {
    padding: 6px 12px;
    font-size: 13px;
  }
  
  .realtime-theme .drawing-tools .zone-btn {
    padding: 6px 10px;
  }
}

@media (max-width: 768px) {
  .realtime-theme .zone-controls {
    padding: 8px 16px;
    min-height: auto;
  }
  
  .realtime-theme .zone-toolbar {
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
  }
  
  .realtime-theme .zone-info {
    width: 100%;
    justify-content: space-between;
    margin-top: 8px;
    border-top: 1px solid var(--color-border);
    padding-top: 8px;
    margin-left: 0;
    order: 10;
  }
  
  .realtime-theme .zone-btn {
    padding: 8px 12px;
    font-size: 12px;
    white-space: nowrap;
  }
  
  .realtime-theme .zone-btn svg {
    width: 14px;
    height: 14px;
  }
  
  .realtime-theme .drawing-status {
    width: 100%;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--color-border);
    order: 9;
  }
  
  .realtime-theme .drawing-status .zone-btn {
    margin-left: 0 !important;
    margin-top: 8px;
    width: auto;
  }
  
  .realtime-theme .grouping-controls {
    flex-direction: column !important;
    gap: 8px !important;
    align-items: stretch !important;
  }
  
  .realtime-theme .grouping-controls span {
    text-align: center;
  }
  
  /* Stack main content vertically on tablets */
  .realtime-theme .zone-management-page .floor-plan-card {
    flex-direction: column;
  }

  .realtime-theme .zone-management-page .floor-plan-info-panel {
    width: 100%;
    height: 40vh;
    border-left: none;
    border-top: 1px solid var(--color-border);
  }
  
  .realtime-theme .zone-card {
    padding: 12px;
    min-height: 100px;
  }
  
  .realtime-theme .zone-stats-grid {
    gap: 8px;
  }
  
  .realtime-theme .stat-box {
    padding: 8px;
    min-height: 50px;
  }
}
/* =====================
   ZONE CANCEL BUTTON
   ===================== */

.realtime-theme .zone-btn-cancel {
  background: #e5e7eb;            /* neutral light gray */
  color: #374151;                 /* dark gray text */
  border: 1px solid #d1d5db;      /* subtle outline */
}

.realtime-theme .zone-btn-cancel:hover:not(:disabled) {
  background: #d1d5db;
  color: #111827;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(107, 114, 128, 0.25);
}

.realtime-theme .zone-btn-cancel:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(107, 114, 128, 0.2);
}

.realtime-theme .zone-btn-cancel:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

@media (max-width: 480px) {
  .realtime-theme .zone-controls {
    padding: 8px 12px;
  }
  
  .realtime-theme .drawing-tools .zone-btn {
    padding: 8px 10px;
    font-size: 11px;
  }
  
  .realtime-theme .drawing-tools .zone-btn svg {
    width: 16px;
    height: 16px;
  }
  
  .realtime-theme .zone-management-page .floor-plan-info-panel {
  width: 380px;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

  
  /* Popup styles moved to unified-popup.css */
  
  .realtime-theme .zone-card {
    padding: 10px;
  }
  
  .realtime-theme .zone-avatar {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
  
  .realtime-theme .zone-name {
    font-size: 14px;
  }
  
  .realtime-theme .zone-id {
    font-size: 11px;
  }
  
  .realtime-theme .stat-label {
    font-size: 9px;
  }
  
  .realtime-theme .stat-value {
    font-size: 12px;
  }
  
  .realtime-theme .tab-btn {
    padding: 8px 10px;
    font-size: 10px;
  }
  
  .realtime-theme .count-badge {
    font-size: 9px;
    padding: 1px 4px;
    min-width: 16px;
  }
}

/* AutoGrid area visualization */

/* =====================
   AUTOGRID GRID OVERLAY
   ===================== */

.realtime-theme .autogrid-grid {
  pointer-events: none;
}

.realtime-theme .autogrid-line {
  stroke: rgba(107, 114, 128, 0.35); /* subtle gray */
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.realtime-theme .autogrid-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.realtime-theme .autogrid-loading-card {
  background: #ffffff;
  padding: 24px;
  border-radius: 12px;
  width: 320px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.realtime-theme .autogrid-progress-bar {
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 12px;
}

.realtime-theme .autogrid-progress-fill {
  height: 100%;
  background: #ef4444;
  transition: width 0.2s ease;
}

.realtime-theme .autogrid-area .autogrid-area-shape {
  fill: rgba(59, 130, 246, 0.15);
  stroke: #3b82f6;
  stroke-width: 2;
  stroke-dasharray: 8,4;
  pointer-events: none;
  animation: autogrid-pulse 2s ease-in-out infinite;
}

.realtime-theme .autogrid-area .autogrid-area-label {
  fill: #3b82f6;
  font-size: 13px;
  font-weight: 700;
  font-family: 'Bio Sans', Arial, sans-serif;
  pointer-events: none;
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

@keyframes autogrid-pulse {
  0%, 100% {
    opacity: 0.7;
    stroke-width: 2;
  }
  50% {
    opacity: 1;
    stroke-width: 3;
  }
}

/* Smooth transitions for all interactive elements */
.realtime-theme .zone-btn,
.realtime-theme .zone-shape,
.realtime-theme .polygon-point {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Focus states for accessibility */
.realtime-theme .zone-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Popup styles moved to unified-popup.css */

/* Redraw, drawing method, and popup button styles moved to unified-popup.css */

/* Start point indicator animation */
.realtime-theme .start-point-indicator {
  animation: pulse-start 2s ease-in-out infinite;
}

@keyframes pulse-start {
  0%, 100% {
    opacity: 0.6;
    r: 8;
  }
  50% {
    opacity: 1;
    r: 12;
  }
}

/* Polygon lines */
.realtime-theme .polygon-line {
  pointer-events: none;
}
/* ======================================
   ZONE MANAGEMENT MAP LAYOUT ONLY
   ====================================== */

.realtime-theme .zone-management-page {
  height: calc(100vh - var(--navbar-height));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}


.realtime-theme .zone-management-page .dashboard-main {
  flex: 1;
  display: flex;
  padding: 16px;
  overflow: hidden;
}

.realtime-theme .zone-management-page .floor-plan-card {
  flex: 1;
  display: flex;
  flex-direction: row; /* Map on the left, panel on the right */
  height: 100%;
  background: var(--color-white);
  border-radius: 12px;
  overflow: hidden;
}

/* MAP AREA */
.realtime-theme .zone-management-page .floor-plan-image-container {
  position: relative;
  flex: 1;
  height: 100%;
  overflow: hidden;
  background: #f9fafb;
}

/* TRANSFORM LAYER */
.realtime-theme .zone-management-page .floor-plan-content {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
}

/* FLOOR IMAGE */
.realtime-theme .zone-management-page .floor-plan-image {
  position: absolute;
  top: 0;
  left: 0;
  user-select: none;
  pointer-events: none;
}

/* SVG OVERLAY */
.realtime-theme .zone-management-page .floor-plan-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: all;
}

/* RIGHT SIDE PANEL */
.realtime-theme .zone-management-page .floor-plan-info-panel {
  /* Fix the tab panel to the right side with a fixed width */
  flex: 0 0 380px;
  width: 380px;
  height: 100%;
  border-left: 1px solid var(--color-border);
  background: var(--color-white);
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 16px;
}

/* Zone Details Panel */
.realtime-theme .zone-details-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
}

.realtime-theme .zone-details-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 0;
  border-bottom: none;
}

.realtime-theme .tab-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}


.realtime-theme .header-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.realtime-theme .header-content svg {
  color: var(--color-primary);
}

.realtime-theme .zone-details-header h3 {
  margin: 0;
  font-family: 'Bio Sans', Arial, sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--color-text);
}

.realtime-theme .zone-count-badge {
  background: linear-gradient(135deg, var(--color-primary), #c41e3a);
  color: var(--color-white);
  padding: 6px 10px;
  border-radius: 16px;
  font-family: 'Bio Sans', Arial, sans-serif;
  font-weight: 700;
  font-size: 12px;
  min-width: 24px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(225, 36, 36, 0.2);
}

.realtime-theme .no-zones-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  flex: 1;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border-radius: 12px;
  border: 2px dashed var(--color-border);
}

.realtime-theme .empty-state-icon {
  margin-bottom: 16px;
  padding: 16px;
  background: rgba(225, 36, 36, 0.1);
  border-radius: 50%;
  color: var(--color-primary);
}

.realtime-theme .no-zones-message h4 {
  margin: 0 0 8px 0;
  font-family: 'Bio Sans', Arial, sans-serif;
  font-weight: 600;
  font-size: 16px;
  color: var(--color-text);
}

.realtime-theme .no-zones-message p {
  margin: 0;
  font-family: 'Bio Sans', Arial, sans-serif;
  font-size: 14px;
  color: var(--color-text-secondary);
  line-height: 1.4;
}

.realtime-theme .zone-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-right: 6px;
}


.realtime-theme .zone-list::-webkit-scrollbar {
  width: 8px;
}

.realtime-theme .zone-list::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
  margin: 4px 0;
}

.realtime-theme .zone-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}

.realtime-theme .zone-list::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.realtime-theme .zone-list::-webkit-scrollbar-thumb:active {
  background: #64748b;
}


.realtime-theme .autogrid-hint-inline {
  margin-left: 12px;
  padding: 6px 12px;

  background: #111827;
  color: #fff;

  font-size: 13px;
  border-radius: 14px;

  display: flex;
  align-items: center;

  opacity: 0.9;
}
.realtime-theme .zone-card {
  background: var(--color-white);
  border: 2px solid var(--color-border);
  border-radius: 12px;
  padding: 18px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  min-height: 140px;
  max-height: none;
  display: flex;
  flex-direction: column;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  flex-shrink: 0;
}

.realtime-theme .zone-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary), #c41e3a);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.realtime-theme .zone-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  border-color: var(--color-primary);
  z-index: 10; /* Bring to front on hover */
}

.realtime-theme .zone-card:hover::before {
  transform: scaleX(1);
}

.realtime-theme .zone-card.selected {
  border-color: var(--color-primary);
  background: #fffafa; /* Very light red tint */
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  transform: translateY(-2px);
  z-index: 20; /* Keep expanded card on top */
}

.realtime-theme .zone-card.selected::before {
  transform: scaleX(1);
}

.realtime-theme .zone-card-header {
  margin-bottom: 18px;
}

.realtime-theme .zone-info-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.realtime-theme .zone-name-section {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.realtime-theme .zone-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--color-primary), #c41e3a);
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bio Sans', Arial, sans-serif;
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 2px 8px rgba(225, 36, 36, 0.3);
  flex-shrink: 0;
}

/* Group avatar colors based on level */
.realtime-theme .zone-avatar.group-level-1 {
  background: linear-gradient(135deg, #9333ea, #7c3aed);
  color: var(--color-white);
  box-shadow: 0 2px 8px rgba(147, 51, 234, 0.3);
}

.realtime-theme .zone-avatar.group-level-2 {
  background: linear-gradient(135deg, #db2777, #be185d);
  color: var(--color-white);
  box-shadow: 0 2px 8px rgba(219, 39, 119, 0.3);
}

.realtime-theme .zone-avatar.group-level-3 {
  background: linear-gradient(135deg, #ffffff, #f8fafc);
  color: #1f2937;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 2px solid #e5e7eb;
}

.realtime-theme .zone-name-details {
  flex: 1;
  min-width: 0;
}

.realtime-theme .zone-name {
  margin: 0 0 2px 0;
  font-family: 'Bio Sans', Arial, sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: var(--color-text);
  word-break: break-word;
  line-height: 1.2;
}

.realtime-theme .zone-id {
  font-family: 'Bio Sans', Arial, sans-serif;
  font-size: 12px;
  color: var(--color-text-secondary);
  font-weight: 500;
}

.realtime-theme .zone-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.realtime-theme .zone-action-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.realtime-theme .zone-edit-btn {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.realtime-theme .zone-edit-btn:hover {
  background: rgba(59, 130, 246, 0.2);
  color: #2563eb;
  transform: scale(1.05);
}
/* =====================
   GHOST ZONE STYLE
   ===================== */

.realtime-theme .zone-polygon .zone-shape.ghost-zone {
  fill: rgba(156, 163, 175, 0.25);   /* soft grey fill */
  stroke: #6b7280;                   /* grey border */
  stroke-width: 2;
  stroke-dasharray: 6,4;             /* dashed like inactive */
}

/* Hover should still work */
.realtime-theme .zone-polygon .zone-shape.ghost-zone:hover {
  fill: rgba(156, 163, 175, 0.4);
  stroke-width: 3;
}

/* Selected ghost (blue override still applies) */
.realtime-theme .zone-polygon .zone-shape.ghost-zone.selected {
  fill: rgba(59, 130, 246, 0.3);     /* keep selected behavior */
  stroke: #3b82f6;
}
.realtime-theme .zone-shape.grouping-selected,
.realtime-theme .zone-shape.ghost-zone.grouping-selected {
  fill: rgba(251, 191, 36, 0.5); /* yellow */
  stroke: #f59e0b;
  stroke-width: 3;
}

/* =====================================================================
   ENTRY/EXIT ZONE GROUP-TAB OVERRIDES
   All three entry/exit types must yield to group-tab states:
   grouping-selected (yellow), active-level-* (solid fill), legend-level-*
   Specificity 0,4,0 beats .zone-polygon .zone-shape.entry-*-zone (0,3,0).
   ===================================================================== */

/* --- Grouping-selected: full yellow, no dashes --- */
.realtime-theme .zone-polygon .zone-shape.entry-exit-zone.grouping-selected,
.realtime-theme .zone-polygon .zone-shape.entry-zone.grouping-selected,
.realtime-theme .zone-polygon .zone-shape.exit-zone.grouping-selected {
  fill: rgba(251, 191, 36, 0.5) !important;
  stroke: #f59e0b !important;
  stroke-width: 3 !important;
  stroke-dasharray: none !important;
  filter: drop-shadow(0 0 12px rgba(245, 158, 11, 0.7));
}

/* --- Active-level-* (group highlighted on map): clear dashes, keep existing fill/stroke !important from zone-group.css --- */
.realtime-theme .zone-polygon .zone-shape.entry-exit-zone.active-level-1,
.realtime-theme .zone-polygon .zone-shape.entry-zone.active-level-1,
.realtime-theme .zone-polygon .zone-shape.exit-zone.active-level-1,
.realtime-theme .zone-polygon .zone-shape.entry-exit-zone.active-level-2,
.realtime-theme .zone-polygon .zone-shape.entry-zone.active-level-2,
.realtime-theme .zone-polygon .zone-shape.exit-zone.active-level-2,
.realtime-theme .zone-polygon .zone-shape.entry-exit-zone.active-level-3,
.realtime-theme .zone-polygon .zone-shape.entry-zone.active-level-3,
.realtime-theme .zone-polygon .zone-shape.exit-zone.active-level-3 {
  stroke-dasharray: none !important;
}

/* --- Legend-level-1 (purple): full override needed — no !important in zone-group.css for fill/stroke --- */
.realtime-theme .zone-polygon .zone-shape.entry-exit-zone.legend-level-1,
.realtime-theme .zone-polygon .zone-shape.entry-zone.legend-level-1,
.realtime-theme .zone-polygon .zone-shape.exit-zone.legend-level-1 {
  fill: rgba(147, 51, 234, 0.28) !important;
  stroke: #7c3aed !important;
  stroke-width: 3 !important;
  stroke-dasharray: none !important;
  filter: drop-shadow(0 0 8px rgba(147, 51, 234, 0.5));
}

/* --- Legend-level-2 (pink) --- */
.realtime-theme .zone-polygon .zone-shape.entry-exit-zone.legend-level-2,
.realtime-theme .zone-polygon .zone-shape.entry-zone.legend-level-2,
.realtime-theme .zone-polygon .zone-shape.exit-zone.legend-level-2 {
  fill: rgba(219, 39, 119, 0.28) !important;
  stroke: #be185d !important;
  stroke-width: 3 !important;
  stroke-dasharray: none !important;
  filter: drop-shadow(0 0 8px rgba(219, 39, 119, 0.5));
}

/* --- Legend-level-3 (white) --- */
.realtime-theme .zone-polygon .zone-shape.entry-exit-zone.legend-level-3,
.realtime-theme .zone-polygon .zone-shape.entry-zone.legend-level-3,
.realtime-theme .zone-polygon .zone-shape.exit-zone.legend-level-3 {
  fill: rgba(255, 255, 255, 0.28) !important;
  stroke: #ffffff !important;
  stroke-width: 3 !important;
  stroke-dasharray: none !important;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.8));
}


/* =====================
   ENTRY/EXIT LEGEND SWATCHES
   (reuse .legend-color-compact from zone-group.css)
   ===================== */

.realtime-theme .legend-color-compact.ee-entry-exit {
  background: rgba(6, 182, 212, 0.2);
  border: 2px dashed #06b6d4;
  box-shadow: none;
}

.realtime-theme .legend-color-compact.ee-entry {
  background: rgba(139, 92, 246, 0.2);
  border: 2px dashed #8b5cf6;
  box-shadow: none;
}

.realtime-theme .legend-color-compact.ee-exit {
  background: rgba(244, 63, 94, 0.2);
  border: 2px dashed #f43f5e;
  box-shadow: none;
}

.realtime-theme .legend-color-compact.ee-ghost {
  background: rgba(107, 114, 128, 0.2);
  border: 2px dashed #6b7280;
  box-shadow: none;
}

/* =====================
   Legend for entry exit
   ===================== */

.realtime-theme .zone-shape.legend-ee-entry-exit {
  fill: rgba(6, 182, 212, 0.35) !important;
  stroke: #06b6d4 !important;
  stroke-width: 3 !important;
  stroke-dasharray: 8, 4;
  filter: drop-shadow(0 0 8px rgba(6, 182, 212, 0.55));
}

.realtime-theme .zone-shape.legend-ee-entry {
  fill: rgba(139, 92, 246, 0.35) !important;
  stroke: #8b5cf6 !important;
  stroke-width: 3 !important;
  stroke-dasharray: 8, 4;
  filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.55));
}

.realtime-theme .zone-shape.legend-ee-exit {
  fill: rgba(244, 63, 94, 0.35) !important;
  stroke: #f43f5e !important;
  stroke-width: 3 !important;
  stroke-dasharray: 8, 4;
  filter: drop-shadow(0 0 8px rgba(244, 63, 94, 0.55));
}

.realtime-theme .zone-shape.legend-ee-ghost {
  fill: rgba(107, 114, 128, 0.35) !important;
  stroke: #6b7280 !important;
  stroke-width: 3 !important;
  stroke-dasharray: 6, 4;
  filter: drop-shadow(0 0 8px rgba(107, 114, 128, 0.55));
}

/* =====================
   ENTRY / EXIT ZONE STYLES
/* Entry + Exit combined */
.realtime-theme .zone-polygon .zone-shape.entry-exit-zone {
  fill: rgba(6, 182, 212, 0.18);
  stroke: #06b6d4;
  stroke-width: 2;
  stroke-dasharray: 8, 4;
}
.realtime-theme .zone-polygon .zone-shape.entry-exit-zone:hover {
  fill: rgba(6, 182, 212, 0.35);
  stroke-width: 3;
}
.realtime-theme .zone-polygon .zone-shape.entry-exit-zone.selected {
  fill: rgba(59, 130, 246, 0.3);
  stroke: #3b82f6;
  stroke-dasharray: none;
}

/* Entry only */
.realtime-theme .zone-polygon .zone-shape.entry-zone {
  fill: rgba(139, 92, 246, 0.18);
  stroke: #8b5cf6;
  stroke-width: 2;
  stroke-dasharray: 8, 4;
}
.realtime-theme .zone-polygon .zone-shape.entry-zone:hover {
  fill: rgba(139, 92, 246, 0.35);
  stroke-width: 3;
}
.realtime-theme .zone-polygon .zone-shape.entry-zone.selected {
  fill: rgba(59, 130, 246, 0.3);
  stroke: #3b82f6;
  stroke-dasharray: none;
}

/* Exit only */
.realtime-theme .zone-polygon .zone-shape.exit-zone {
  fill: rgba(244, 63, 94, 0.18);
  stroke: #f43f5e;
  stroke-width: 2;
  stroke-dasharray: 8, 4;
}
.realtime-theme .zone-polygon .zone-shape.exit-zone:hover {
  fill: rgba(244, 63, 94, 0.35);
  stroke-width: 3;
}
.realtime-theme .zone-polygon .zone-shape.exit-zone.selected {
  fill: rgba(59, 130, 246, 0.3);
  stroke: #3b82f6;
  stroke-dasharray: none;
}

/* =====================
   GHOST TOGGLE SWITCH
   ===================== */

.realtime-theme .ghost-toggle-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.realtime-theme .switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.realtime-theme .switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

/* Slider background */
.realtime-theme .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #d1d5db;
  border-radius: 999px;
  transition: 0.3s;
}

/* Toggle circle */
.realtime-theme .slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.3s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Checked state (ghost ON) */
.realtime-theme .switch input:checked + .slider {
  background-color: #6b7280; /* grey for ghost */
}

.realtime-theme .switch input:checked + .slider:before {
  transform: translateX(20px);
}

/* Labels */
.realtime-theme .active-label {
  font-weight: 600;
  color: #111827;
}

.realtime-theme .inactive-label {
  color: #9ca3af;
}

.realtime-theme .zone-redraw-btn {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.realtime-theme .zone-redraw-btn:hover {
  background: rgba(245, 158, 11, 0.2);
  color: #d97706;
  transform: scale(1.05);
}

.realtime-theme .zone-delete-btn {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.realtime-theme .zone-delete-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #dc2626;
  transform: scale(1.05);
}

.realtime-theme .zone-card-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.realtime-theme .zone-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.realtime-theme .stat-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  min-height: 60px;
}

.realtime-theme .stat-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.realtime-theme .points-icon {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
}

.realtime-theme .area-icon {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.realtime-theme .stat-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.realtime-theme .stat-label {
  font-family: 'Bio Sans', Arial, sans-serif;
  font-size: 10px;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.realtime-theme .stat-value-container {
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.realtime-theme .stat-value {
  font-family: 'Bio Sans', Arial, sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1;
}

.realtime-theme .stat-unit {
  font-family: 'Bio Sans', Arial, sans-serif;
  font-size: 9px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.realtime-theme .zone-expanded-details {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
  animation: expandIn 0.3s ease-out;
  background: rgba(248, 250, 252, 0.5);
  border-radius: 8px;
  padding: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
}


@keyframes expandIn {
  from {
    opacity: 0;
    max-height: 0;
    padding: 0;
    margin-top: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    max-height: 200px;
    padding: 12px;
    margin-top: 12px;
    transform: translateY(0);
  }
}

.realtime-theme .expanded-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 6px;
  margin-bottom: 6px;
  border: 1px solid rgba(226, 232, 240, 0.5);
}

.realtime-theme .expanded-stat-row:last-child {
  margin-bottom: 0;
}

.realtime-theme .expanded-label {
  font-family: 'Bio Sans', Arial, sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.realtime-theme .expanded-value {
  font-family: 'Bio Sans', Arial, sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text);
}

.realtime-theme .status-active {
  color: #22c55e !important;
  font-weight: 700 !important;
}

/* Info Stats - Updated */
.realtime-theme .info-stats {
  border-top: 1px solid var(--color-border);
  padding-top: 16px;
}

/* Info Controls - Updated */
.realtime-theme .info-controls {
  border-top: 1px solid var(--color-border);
}




.realtime-theme .group-zone-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #f8fafc;
  border: 2px solid var(--color-border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 8px;
  font-family: 'Bio Sans', Arial, sans-serif;
}

.realtime-theme .group-zone-item:hover {
  border-color: var(--color-primary);
  background: rgba(225, 36, 36, 0.05);
}

.realtime-theme .group-zone-item.selected {
  background: rgba(225, 36, 36, 0.1);
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(225, 36, 36, 0.1);
}

.realtime-theme .group-zone-item .zone-name {
  font-weight: 500;
  color: var(--color-text);
  flex: 1;
}

.realtime-theme .group-zone-item .check-mark {
  color: var(--color-primary);
  font-weight: 700;
  font-size: 18px;
  margin-left: 8px;
}


.realtime-theme .form-field {
  margin-bottom: 16px;
}

.realtime-theme .form-field label {
  display: block;
  font-family: 'Bio Sans', Arial, sans-serif;
  font-weight: 600;
  font-size: 13px;
  color: var(--color-text);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.realtime-theme .form-field input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--color-border);
  border-radius: 8px;
  font-family: 'Bio Sans', Arial, sans-serif;
  font-size: 14px;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

.realtime-theme .form-field input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(225, 36, 36, 0.1);
}

.realtime-theme .form-field input:disabled {
  background: #f1f5f9;
  cursor: not-allowed;
  opacity: 0.6;
}
.realtime-theme .zone-info-stats {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  background: #fafafa;
  border-top: 1px solid #e5e7eb;
  font-size: 13px;
}

.realtime-theme .zone-info-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  line-height: 1.45;
}

.realtime-theme .zone-info-stat span {
  white-space: normal;
  word-break: break-word;
}

.realtime-theme .zone-info-stat span:first-child {
  font-weight: 500;
  color: #111827;
}

.realtime-theme .zone-info-stats .zone-info-stat > span {
  font-size: 13px;
  color: #6b7280;
}


.realtime-theme .zone-info-stat + .zone-info-stat {
  padding-top: 6px;
  border-top: 1px dashed #e5e7eb;
}

.realtime-theme .zoom-btn {
  background: #dc2626; /* red */
  color: #ffffff;      /* THIS fixes + / - */
  font-weight: 700;
  font-size: 18px;

  display: flex;
  align-items: center;
  justify-content: center;
}
.realtime-theme .zone-shape.multi-selected {
  fill: rgba(249, 115, 22, 0.35); 
  stroke: #f97316;
  stroke-width: 3;
}

/* Fullscreen container */
.realtime-theme .improved-loading {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f8fafc, #eef2f7);
}

/* Card */
.realtime-theme .loading-card {
  width: 420px;
  padding: 40px;
  border-radius: 16px;
  background: white;
  box-shadow: 0 20px 60px rgba(0,0,0,0.08);
  text-align: center;
  animation: fadeIn 0.4s ease-out;
}

/* Spinner ring */
.realtime-theme .spinner-ring {
  width: 60px;
  height: 60px;
  margin: 0 auto 20px;
  border-radius: 50%;
  border: 5px solid #e5e7eb;
  border-top: 5px solid #6366f1;
  animation: spin 1s linear infinite;
}

/* Text styling */
.realtime-theme .loading-card h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #111827;
}

.realtime-theme .loading-card p {
  margin: 8px 0 20px;
  font-size: 14px;
  color: #6b7280;
}

/* Animated progress bar */
.realtime-theme .loading-progress-bar {
  width: 100%;
  height: 6px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

.realtime-theme .loading-progress-animated {
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  animation: progressMove 1.2s ease-in-out infinite alternate;
}

/* Animations */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes progressMove {
  from { transform: translateX(-40%); }
  to { transform: translateX(140%); }
}

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