/**
 * SELN Map Timeline Styles
 * Responsive design for mobile, tablet, and desktop
 */

/* CSS Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --member-color: #5D9632;
  --non-member-color: #CCCCCC;
  --text-dark: #333333;
  --text-light: #666666;
  --background: #FFFFFF;
  --border-color: #DDDDDD;
  --focus-color: #0066CC;
}

body {
  font-family: Verdana, Geneva, Tahoma, sans-serif;
  color: var(--text-dark);
  background-color: var(--background);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Screen Reader Only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
/* no screen reader */
.no-sr{
color: var(--member-color);

} 

/* Main Container */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 30px;
}

h1 {
font-weight: 900;
  font-size: 3rem;
  color: #0178AF;
  margin-bottom: 10px;
}

h2 {
  color: #0178AF;
}

/* Map and Controls Section */
.map-section {
  background-color: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 30px;
}

/* Controls Section */
.controls {
  background-color: #F8F9FA;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.slider-container {
  max-width: 800px;
  margin: 0 auto;
}

.slider-label {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
}

.slider-label span {
  font-size: 0.95rem;
  color: var(--text-light);
}

#current-year {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--member-color);
  margin-left: 1rem;
}

/* Year Slider */
#year-slider {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, var(--non-member-color) 0%, var(--member-color) 100%);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

#year-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--member-color);
  cursor: pointer;
  border: 3px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease;
}

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

#year-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--member-color);
  cursor: pointer;
  border: 3px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease;
}

#year-slider::-moz-range-thumb:hover {
  transform: scale(1.1);
}

#year-slider:focus {
  outline: 2px solid var(--focus-color);
  outline-offset: 2px;
}

/* Year Range Labels */
.year-range {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-light);
}

/* Map Container */
#map-container {
  background-color: white;
  min-height: 500px;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* D3.js SVG */
#map-svg {
  max-width: 100%;
  height: auto;
  display: block;
}

/* D3 State Paths */
#map-svg .state {
  transition: fill 0.3s ease, opacity 0.2s ease;
}

#map-svg .state:hover {
  opacity: 0.8;
}

/* D3 State Labels */
#map-svg .state-label {
  font-family: Verdana, Geneva, sans-serif;
  user-select: none;
}

/* External labels for small states */
#map-svg .external-label {
  font-weight: bold;
}

/* Leader lines for small states */
#map-svg .leader-line {
  stroke: #666;
  stroke-width: 1;
  fill: none;
}

/* Legend */
.legend {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 30px;
  margin-bottom: 30px;
  padding: 20px;
  background-color: #F8F9FA;
  border-radius: 8px;
  flex-wrap: wrap;
}

/* Years of Membership Section */
.years-section {
  background-color: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 30px;
}

.years-section header {
  text-align: left;
  margin-bottom: 20px;
}

.years-section h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #0178AF;
  margin: 0;
}

#years-content {
  min-height: 100px;
}

.loading-text {
  text-align: center;
  color: var(--text-light);
  font-style: italic;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.legend-color {
  width: 30px;
  height: 30px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.legend-color.member {
  background-color: var(--member-color);
}

.legend-color.non-member {
  background-color: var(--non-member-color);
}

.legend-text {
  font-size: 0.95rem;
  color: var(--text-dark);
}

/* Loading and Error States */
#loading,
#error {
  text-align: center;
  padding: 40px;
  font-size: 1.1rem;
}

#loading {
  color: var(--text-light);
}

#error {
  color: #D32F2F;
  background-color: #FFEBEE;
  border-radius: 8px;
  display: none;
}

/* Focus Styles for Accessibility */
*:focus-visible {
  outline: 2px solid var(--focus-color);
  outline-offset: 2px;
}

/* Responsive Design - Tablet */
@media (max-width: 1024px) {
  .container {
    padding: 15px;
  }

  h1 {
    font-size: 1.5rem;
  }

  #current-year {
    font-size: 1.3rem;
  }

  .controls {
    padding: 15px;
  }

  #map-container {
    padding: 15px;
    min-height: 350px;
  }
}

/* Responsive Design - Mobile */
@media (max-width: 768px) {
  .container {
    padding: 10px;
  }

  h1 {
    font-size: 1.25rem;
    line-height: 1.4;
  }

  #current-year {
    font-size: 1.2rem;
  }

  .controls {
    padding: 15px;
    margin-bottom: 20px;
  }

  .slider-label {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }

  #year-slider {
    height: 10px;
  }

  #year-slider::-webkit-slider-thumb {
    width: 28px;
    height: 28px;
  }

  #year-slider::-moz-range-thumb {
    width: 28px;
    height: 28px;
  }

  #map-container {
    padding: 10px;
    min-height: 300px;
  }

  .legend {
    gap: 20px;
    padding: 15px;
  }

  .legend-color {
    width: 24px;
    height: 24px;
  }

  .legend-text {
    font-size: 0.9rem;
  }
}

/* Responsive Design - Small Mobile */
@media (max-width: 480px) {
  h1 {
    font-size: 1.1rem;
  }

  #current-year {
    font-size: 1.1rem;
  }

  .controls {
    padding: 12px;
  }

  .slider-label span {
    font-size: 0.85rem;
  }

  .year-range {
    font-size: 0.75rem;
  }

  #map-container {
    min-height: 250px;
  }

  .legend {
    gap: 15px;
    padding: 12px;
  }

  .legend-item {
    gap: 8px;
  }

  .legend-color {
    width: 20px;
    height: 20px;
  }

  .legend-text {
    font-size: 0.85rem;
  }
}

/* Print Styles (basic, even though not required) */
@media print {
  .controls {
    display: none;
  }

  #map-container {
    border: none;
    page-break-inside: avoid;
  }
}
