/* ========================================
   Map Overlay & Zone Info Panel
   MGH ED Patient Portal
   ======================================== */

/* ========================================
   Map Overlay (Full-screen modal)
   ======================================== */

.map-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background-color: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm);
}

.map-overlay[hidden] {
  display: none;
}

.map-container {
  background-color: var(--bg);
  border-radius: var(--border-radius);
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  position: relative;
}

/* ========================================
   Map Header
   ======================================== */

.map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.map-header-text {
  display: flex;
  flex-direction: column;
}

.map-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  margin: 0;
}

.map-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin: 0;
}

.map-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--min-touch-target);
  height: var(--min-touch-target);
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text);
  border-radius: var(--border-radius-sm);
  transition: background-color var(--transition-fast);
}

.map-close-btn:hover {
  background-color: var(--bg-surface);
}

.map-close-btn svg {
  width: var(--icon-size);
  height: var(--icon-size);
}

/* ========================================
   Map Body
   ======================================== */

.map-body {
  flex: 1;
  overflow: auto;
  padding: var(--space-sm);
  touch-action: pinch-zoom;
  -webkit-overflow-scrolling: touch;
}

#map-svg-container {
  width: 100%;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#map-svg-container svg {
  width: 100%;
  height: auto;
}

.map-error {
  text-align: center;
  color: var(--text-muted);
  padding: var(--space-xl);
}

/* ========================================
   SVG Map Zone Styles
   ======================================== */

.zone {
  cursor: pointer;
  transition: opacity var(--transition-fast), filter var(--transition-fast);
}

.zone:hover {
  opacity: 0.8;
  filter: brightness(1.1);
}

.zone:focus-visible {
  outline: var(--focus-outline);
  outline-offset: var(--focus-offset);
}

.zone-selected {
  outline: 3px solid var(--brand-primary);
  outline-offset: 1px;
  opacity: 0.9;
  filter: brightness(1.15);
}

.zone-label {
  font-size: 12px;
  font-weight: 600;
  fill: var(--text);
  pointer-events: none;
  user-select: none;
}

/* ========================================
   Zone Info Panel (Modal sheet - slides up)
   ======================================== */

.zone-info-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--bg);
  border-top: 1px solid var(--border);
  padding: 0 var(--space-md) calc(var(--space-md) + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.15);
  border-radius: 16px 16px 0 0;
  transform: translateY(0);
  transition: transform 0.3s cubic-bezier(0.2, 0, 0, 1);
  z-index: 1001;
  touch-action: none;
  overflow-y: auto;
  max-width: 800px;
  margin: 0 auto;
}

.zone-info-panel[hidden] {
  display: block;
  transform: translateY(100%);
  pointer-events: none;
}

.zone-info-panel.dragging {
  transition: none;
}

.zone-info-handle-area {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm) 0 var(--space-xs);
  cursor: grab;
}

.zone-info-handle {
  width: 36px;
  height: 4px;
  background-color: var(--text-muted);
  border-radius: 2px;
  opacity: 0.4;
}

.zone-info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-xs);
}

.zone-info-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--min-touch-target);
  height: var(--min-touch-target);
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-secondary);
  border-radius: var(--border-radius-sm);
  flex-shrink: 0;
  margin-right: calc(-1 * var(--space-xs));
}

.zone-info-close:hover {
  color: var(--text);
  background-color: var(--bg-surface);
}

.zone-info-close svg {
  width: 20px;
  height: 20px;
}

.zone-info-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  margin: 0;
}

.zone-info-rooms {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.zone-info-description {
  color: var(--text-secondary);
  margin-bottom: 0;
}

/* ========================================
   Mobile Adjustments
   ======================================== */

@media (max-width: 480px) {
  .map-container {
    max-height: 100vh;
    border-radius: 0;
    height: 100%;
  }

  .map-overlay {
    padding: 0;
  }
}
