/* === public_html/css/map.css === */
/* History of Kurds — Map Page Styles */

/* ─── Map Page Layout ─────────────────────────────────────────────── */
.map-page {
  padding-top: var(--navbar-height);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.map-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 0;
}

@media (max-width: 1024px) {
  .map-layout { grid-template-columns: 1fr; }
}

/* ─── Map Control Panel ───────────────────────────────────────────── */
.map-panel {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-light);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

[dir="rtl"] .map-panel {
  border-right: none;
  border-left: 1px solid var(--border-light);
}

@media (max-width: 1024px) {
  .map-panel {
    max-height: 40vh;
    border-right: none;
    border-bottom: 1px solid var(--border-light);
  }
}

.map-panel-header {
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-primary);
  flex-shrink: 0;
}

.map-panel-header h1 {
  font-size: 1.25rem;
  margin-bottom: var(--space-xs);
}

.map-panel-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0;
}

.map-panel-body {
  padding: var(--space-lg) var(--space-xl);
  flex: 1;
}

/* Year slider */
.year-slider-section {
  margin-bottom: var(--space-xl);
}

.year-display {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--color-kurdish-red);
  line-height: 1;
  margin-bottom: var(--space-xs);
}

.year-era {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-md);
}

#year-slider {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  background: var(--border-medium);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

#year-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--color-kurdish-red);
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid white;
  box-shadow: 0 2px 6px rgba(200,16,46,0.4);
  transition: transform var(--transition-fast);
}

#year-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

#year-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--color-kurdish-red);
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid white;
  box-shadow: 0 2px 6px rgba(200,16,46,0.4);
}

.year-range-labels {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-ui);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

/* Animate button */
.animate-btn {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-kurdish-green);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: var(--space-md);
  transition: all var(--transition-base);
  justify-content: center;
}

.animate-btn:hover { background: #005A25; }

.animate-btn.playing {
  background: var(--color-kurdish-red);
}

.animate-btn.playing:hover { background: #A00020; }

/* Layer controls */
.layer-controls {
  margin-bottom: var(--space-xl);
}

.layer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border-light);
}

.layer-item:last-child { border-bottom: none; }

.layer-info {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.layer-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.layer-name {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Period context box */
.period-context {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  margin-top: var(--space-md);
}

.period-context-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.period-context-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 0;
}

/* ─── Map Container ───────────────────────────────────────────────── */
#map-container {
  flex: 1;
  position: relative;
  min-height: 400px;
}

#map {
  width: 100%;
  height: 100%;
  background: #e8e0d0;
}

/* Dark mode map filter */
.dark #map {
  filter: invert(1) hue-rotate(200deg) brightness(0.85) saturate(0.8);
}

/* ─── Leaflet Customization ───────────────────────────────────────── */
.leaflet-container {
  font-family: var(--font-ui) !important;
}

/* Custom popup */
.leaflet-popup-content-wrapper {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-xl) !important;
  border: 1px solid var(--border-medium) !important;
  padding: 0 !important;
}

.leaflet-popup-content {
  margin: 0 !important;
  min-width: 240px;
}

.leaflet-popup-tip {
  background: var(--bg-card) !important;
}

.leaflet-popup-close-button {
  color: var(--text-muted) !important;
  top: 8px !important;
  right: 8px !important;
  font-size: 18px !important;
}

.map-popup-inner {
  padding: var(--space-lg);
}

.map-popup-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.map-popup-years {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--color-kurdish-red);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-sm);
}

.map-popup-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 0;
}

/* Custom marker clusters */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background-clip: padding-box;
}

.marker-cluster-small div  { background-color: rgba(0, 122, 51, 0.75); }
.marker-cluster-medium div { background-color: rgba(255, 107, 53, 0.75); }
.marker-cluster-large div  { background-color: rgba(200, 16, 46, 0.75); }

.marker-cluster div {
  color: white !important;
  font-family: var(--font-ui) !important;
  font-weight: 700 !important;
}

/* Custom city marker icon */
.city-marker-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Battle site marker */
.battle-marker {
  background: var(--color-kurdish-red);
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(200,16,46,0.5);
}

/* ─── Map Info Overlay ────────────────────────────────────────────── */
.map-overlay-title {
  position: absolute;
  top: var(--space-md);
  left: var(--space-md);
  z-index: var(--z-raised);
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  pointer-events: none;
}

[dir="rtl"] .map-overlay-title { left: auto; right: var(--space-md); }

/* Map legend */
.map-legend {
  position: absolute;
  bottom: var(--space-lg);
  right: var(--space-md);
  z-index: var(--z-raised);
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  min-width: 150px;
  box-shadow: var(--shadow-md);
}

[dir="rtl"] .map-legend { right: auto; left: var(--space-md); }

.map-legend-title {
  font-family: var(--font-ui);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 3px 0;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.legend-color {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
  opacity: 0.8;
}

/* Accessible table view for map */
#map-table-view {
  display: none;
  padding: var(--space-xl);
  max-height: 70vh;
  overflow-y: auto;
}

#map-table-view.visible { display: block; }

/* ─── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .map-legend { display: none; }

  .map-panel-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
  }

  .year-slider-section,
  .layer-controls { grid-column: span 2; }
}

@media (max-width: 480px) {
  .map-panel-body { grid-template-columns: 1fr; }
  .year-slider-section,
  .layer-controls { grid-column: 1; }
}
