html, body {
  margin: 0;
  height: 100%;
  background: #fafafa;
  font-family: Arial, sans-serif;
  color: #333;
  overflow: hidden;
}

#map {
  height: calc(100vh - 50px);
  z-index: 1;
}

#controls {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 50px;
  background: #f5f7fa;
  padding: 0 20px 8px 20px;
  z-index: 1000;
  border-top: 1px solid #ccc;
  box-shadow: 0 -1px 4px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  box-sizing: border-box;
}



.timeline-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: 3px;
  height: 25px;
  z-index: 1;
  margin-bottom: 6px;
}

#dateSlider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: #d0d4db;
  border-radius: 3px;
  outline: none;
  margin: 0;
  vertical-align: middle;
  cursor: pointer;
}

#dateSlider::-webkit-slider-runnable-track { height: 6px; background: #d0d4db; border-radius: 3px; }
#dateSlider::-moz-range-track { height: 6px; background: #d0d4db; border-radius: 3px; }

#dateSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 4px;
  height: 18px;
  background: #e74c3c;
  border-radius: 2px;
  cursor: pointer;
  margin-top: -6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  border: none;
  transition: all 0.2s ease;
  z-index: 10;
  position: relative;
}

#dateSlider::-webkit-slider-thumb:hover { 
  background: #c0392b;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transform: scaleY(1.2);
}

#dateSlider::-webkit-slider-thumb:active { 
  background: #a93226;
  transform: scaleY(0.9);
}

#dateSlider::-moz-range-thumb {
  width: 4px;
  height: 18px;
  background: #e74c3c;
  border-radius: 2px;
  cursor: pointer;
  border: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
  z-index: 10;
  position: relative;
}

#dateSlider::-moz-range-thumb:hover { 
  background: #c0392b;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

#dateSlider::-moz-range-thumb:active { 
  background: #a93226;
}

#playBtn { 
  padding: 6px 10px; 
  font-size: 14px; 
  cursor: pointer; 
  border: 1px solid #ccc; 
  border-radius: 4px; 
  background: white; 
  transition: all 0.2s ease;
}

#playBtn:hover {
  background: #f0f0f0;
  border-color: #4a90e2;
}

#speedSelect { 
  padding: 4px 6px; 
  font-size: 14px; 
  cursor: pointer; 
  border: 1px solid #ccc; 
  border-radius: 4px; 
  background: white; 
  transition: all 0.2s ease;
}

#speedSelect:hover {
  border-color: #4a90e2;
}
#view-controls { position: absolute; top: 10px; right: 80px; z-index: 1000; background: rgba(255,255,255,0.9); padding: 10px; border-radius: 5px; box-shadow: 0 1px 5px rgba(0,0,0,0.4); text-align: center; }
.operation-title { font-weight: bold; font-size: 20px; color: #333; margin-bottom: 10px; text-align: center; padding: 8px 12px; }
.view-button { background-color: #4a90e2; color: white; border: none; padding: 8px 12px; font-size: 14px; border-radius: 4px; cursor: pointer; }
.view-button:hover { background-color: #357ABD; }
.drilldown-button { background-color: #4a90e2; color: white; border: none; padding: 8px 12px; font-size: 14px; border-radius: 4px; cursor: pointer; margin: 0; display: block; margin-left: auto; margin-right: auto; }
.drilldown-button:hover { background-color: #357ABD; }

.event-marker {
	box-sizing: border-box;
	background-color: #4a90e2;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	border: 2px solid white;
	box-shadow: 0 0 5px rgba(0,0,0,0.5);
	cursor: pointer;
	position: relative;
	z-index: 799;
}

.event-marker.stacked {
	background-color: #ff6b6b;
	border-color: #ff4757;
}

.event-marker.stacked::after {
	content: attr(data-count);
	position: absolute;
	top: -8px;
	right: -8px;
	background: #ff4757;
	color: white;
	border-radius: 50%;
	width: 16px;
	height: 16px;
	font-size: 10px;
	font-weight: bold;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 800;
}

.event-count-label {
	background: #ff4757;
	color: white;
	border-radius: 50%;
	width: 16px;
	height: 16px;
	font-size: 10px;
	font-weight: bold;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 0 3px rgba(0,0,0,0.3);
	cursor: pointer;
}

.timeline-scale {
    width: 100%;
    height: 15px;
    position: relative;
    margin: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    font-size: 11px;
    color: #666;
    font-family: monospace;
    padding-bottom: 1px;
}

.ship-icon {
  /* Removed transform here. The iconAnchor in JS handles positioning. */
  z-index: 1000 !important;
}

.ship-icon.click-through {
  pointer-events: none;
}



.leaflet-tooltip.ship-label-tooltip {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

.leaflet-tooltip-bottom.ship-label-tooltip:before,
.leaflet-tooltip-top.ship-label-tooltip:before,
.leaflet-tooltip-left.ship-label-tooltip:before,
.leaflet-tooltip-right.ship-label-tooltip:before {
  display: none;
}

.ship-label-tooltip-inner {
  background: rgba(0,0,0,0.7);
  color: white;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: bold;
  white-space: nowrap;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  display: inline-block;
  margin-top: 4px;
}

.leaflet-popup-content-wrapper { background: #f9f9f9; border-radius: 6px; box-shadow: 0 2px 6px rgba(0,0,0,0.15); padding: 6px 10px; max-width: 260px; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-size: 13px; color: #222; line-height: 1.3; }
.leaflet-popup-tip { background: #f9f9f9; border: 1px solid #ddd; box-shadow: none; margin-left: 14px; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.1)); }
.leaflet-popup-content { margin: 0; }
.leaflet-popup-content b { font-weight: 700; color: #1a1a1a; display: block; margin-bottom: 3px; font-size: 15px; }
.leaflet-popup-content br { margin-bottom: 6px; content: ""; display: block; }
.leaflet-popup-close-button { color: #888; font-size: 18px; font-weight: 700; line-height: 1; opacity: 0.6; transition: opacity 0.2s ease; position: absolute; top: 5px; right: 5px; }
.leaflet-popup-close-button:hover { opacity: 1; color: #333; }


/* NavAtlas Logo */
.navatlas-logo {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 1501;
  background: rgba(0, 0, 0, 0.8);
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(5px);
  transition: left 0.2s ease;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.navatlas-logo.panel-open {
  left: 36px; /* Center within the 300px panel - calculated: (300px - 228px) / 2 = 36px */
}

.navatlas-logo .logo-image {
  height: 56px !important;
  width: auto !important;
  display: block !important;
  max-width: none !important;
}

/* Info Panel */
.info-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 95%;
  max-width: 800px;
  max-height: 80vh;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  z-index: 2000;
  display: none;
  overflow: hidden;
}

.info-panel.show {
  display: block;
}

.info-header {
  background: #2c3e50;
  color: white;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.info-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
}

.close-button {
  background: none;
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

.close-button:hover {
  background: rgba(255, 255, 255, 0.2);
}

.info-content {
  padding: 20px;
  max-height: 60vh;
  overflow-y: auto;
  line-height: 1.5;
  font-size: 14px;
}

.info-content h3 {
  color: #2c3e50;
  margin-top: 20px;
  margin-bottom: 10px;
  font-size: 16px;
  font-weight: 600;
}

.info-content h3:first-child {
  margin-top: 0;
}

.info-content p {
  margin-bottom: 15px;
  color: #333;
  font-size: 14px;
}

.info-content ul {
  margin-bottom: 15px;
  padding-left: 20px;
}

.info-content li {
  margin-bottom: 8px;
  color: #555;
  font-size: 14px;
}

.info-content strong {
  color: #2c3e50;
  font-weight: 600;
}

.info-content a {
  color: #3498db;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.2s ease;
  font-weight: 500;
}

.info-content a:hover {
  color: #2980b9;
  border-bottom-color: #2980b9;
}

/* Info Button */
.info-button {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(5px);
  transition: background-color 0.2s ease;
}

.info-button:hover {
  background: rgba(44, 62, 80, 0.9);
}

/* Move zoom controls to bottom right */
.leaflet-top.leaflet-left {
  position: absolute !important;
  bottom: 40px !important;
  right: 20px !important;
  top: auto !important;
  left: auto !important;
  z-index: 1001 !important;
}

.floating-box {
  background: rgba(245, 247, 250, 0.95);
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 2000;
  backdrop-filter: blur(5px);
  pointer-events: auto;
  height: 50px;
  box-sizing: border-box;
}

.date-controls-fixed {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 55px;
}

.playback-controls-fixed {
  position: fixed;
  bottom: 55px;
  right: calc(50% + 300px);
}

.date-controls-fixed input#timeHour {
  margin-left: 50px;
}



.separator {
  color: #666;
  font-weight: 500;
  font-size: 14px;
  margin: 0 2px;
}

input[type="number"] {
  transition: all 0.2s ease;
  border: 2px solid #ddd;
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 14px;
  font-weight: 600;
  background: white;
  text-align: center;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: #333;
  min-width: 50px;
  box-shadow: none;
  margin: 0;
  /* Hide default spinner buttons */
  -webkit-appearance: none;
  -moz-appearance: textfield;
}

/* Remove spinner buttons for webkit browsers */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Custom spinner container */
.spinner-container {
  position: relative;
  display: inline-block;
}

/* Custom spinner buttons */
.spinner-btn {
  position: absolute;
  right: 0;
  width: 16px;
  height: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #666;
  transition: background-color 0.2s ease;
  z-index: 10;
}

.spinner-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.spinner-btn:active {
  background: rgba(0, 0, 0, 0.1);
}

.spinner-btn-up {
  top: 0;
}

.spinner-btn-down {
  bottom: 0;
}

.spinner-btn::before {
  content: '';
  width: 0;
  height: 0;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.spinner-container:hover .spinner-btn::before {
  opacity: 1;
}

.spinner-btn-up::before {
  border-bottom: 5px solid #666;
}

.spinner-btn-down::before {
  border-top: 5px solid #666;
}

input[type="number"]:hover {
  border-color: #4a90e2;
  box-shadow: 0 0 5px rgba(74, 144, 226, 0.15);
}

input[type="number"]:focus {
  border-color: #4a90e2;
  box-shadow: 0 0 8px rgba(74, 144, 226, 0.18);
  outline: none;
}

#dateYear {
  min-width: 70px;
  font-size: 15px;
}

/* Collapsible Left Panel */
.left-panel {
  position: fixed;
  left: 0;
  top: 0;
  width: 300px;
  height: calc(100vh - 50px); /* Subtract timeline height */
  background: rgba(245, 247, 250, 0.95);
  border-right: 1px solid #ccc;
  box-shadow: 2px 0 8px rgba(0,0,0,0.1);
  z-index: 1500;
  backdrop-filter: blur(5px);
  transform: translateX(-100%);
  transition: transform 0.2s ease;
  overflow-y: auto;
}

.left-panel.open {
  transform: translateX(0);
}

.panel-toggle {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  border: none;
  width: 30px;
  height: 60px;
  border-radius: 0 8px 8px 0;
  font-size: 16px;
  cursor: pointer;
  z-index: 1501;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.panel-toggle:hover {
  background: rgba(74, 144, 226, 0.9);
  width: 35px;
}

.panel-toggle.open {
  left: 300px;
  border-radius: 0 8px 8px 0;
}

.panel-content {
  padding: 20px;
  padding-top: 120px; /* Add top margin to leave space for the logo */
}

.panel-content h3 {
  margin-top: 0;
  color: #4a90e2;
  font-size: 18px;
  margin-bottom: 15px;
}

/* Ship Filter Styles */
.filter-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.filter-btn {
  background: #4a90e2;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: background-color 0.2s ease;
}

.filter-btn:hover {
  background: #357abd;
}

.ship-filters {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ship-filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: #f8f9fa;
  border-radius: 4px;
  border: 1px solid #dee2e6;
  transition: background-color 0.2s ease;
}

.ship-filter-item:hover {
  background: #e9ecef;
}

.ship-filter-item input[type="checkbox"] {
  width: auto;
  margin: 0;
  cursor: pointer;
}

.ship-filter-item label {
  margin: 0;
  font-weight: normal;
  cursor: pointer;
  flex: 1;
  font-size: 14px;
}

/* Modal styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  display: none;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(2px);
}

.modal-overlay.show {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  max-width: 90%;
  max-height: 90%;
  width: 800px;
  overflow: hidden;
  position: relative;
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  background: #f8f9fa;
  padding: 20px 25px;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  color: #2c3e50;
  font-size: 24px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #6c757d;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: #e9ecef;
  color: #495057;
}

.modal-body {
  padding: 25px;
  max-height: 70vh;
  overflow-y: auto;
  line-height: 1.6;
}

.modal-body h1 {
  color: #2c3e50;
  font-size: 28px;
  margin-bottom: 20px;
  border-bottom: 2px solid #3498db;
  padding-bottom: 10px;
}

.modal-body h2 {
  color: #34495e;
  font-size: 22px;
  margin: 25px 0 15px 0;
  border-left: 4px solid #3498db;
  padding-left: 15px;
}

.modal-body h3 {
  color: #2c3e50;
  font-size: 18px;
  margin: 20px 0 10px 0;
}

.modal-body p {
  margin: 15px 0;
  color: #333;
}

.modal-body ul {
  margin: 15px 0;
  padding-left: 25px;
}

.modal-body li {
  margin: 8px 0;
  color: #333;
}

.modal-body strong {
  color: #2c3e50;
  font-weight: 600;
}

.modal-body code {
  background: #f8f9fa;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  color: #e74c3c;
}

.modal-body pre {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 5px;
  overflow-x: auto;
  border-left: 4px solid #3498db;
  margin: 15px 0;
  white-space: pre;
}

.modal-body blockquote {
  border-left: 4px solid #3498db;
  padding-left: 15px;
  margin: 15px 0;
  color: #666;
  font-style: italic;
}

.modal-body a {
  color: #3498db;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.2s ease;
  font-weight: 500;
}

.modal-body a:hover {
  color: #2980b9;
  border-bottom-color: #2980b9;
}

.info-byline {
  display: block;
  color: #b0b8c1;
  font-size: 13px;
  font-weight: 400;
  margin-top: 4px;
  margin-left: 2px;
  margin-bottom: 0;
  text-align: left;
  letter-spacing: 0.01em;
}

.info-title-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}




