html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

/* Reduce horizontal padding in main content area */
.nav-md .container.body .right_col {
  padding: 10px 10px 0 !important;
}

/* Reduce page title height */
.page-title {
  height: 35px !important;
  padding: 5px 0 !important;
  margin-bottom: 5px !important;
}

.page-title .title_left h3 {
  margin: 3px 0 !important;
  font-size: 20px !important;
  line-height: 1.2 !important;
}

.map-app {
  position: relative;
  width: 100%;
  height: 70vh;
  min-height: 520px;
  overflow: hidden;
  background: #f4f6f9;
  color: #101828;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
}

#political-app,
#assembly-app {
  height: calc(100vh - 220px);
  min-height: 480px;
}

#map-root,
#map {
  width: 100%;
  height: 100%;
}

#map-root {
  flex: 1;
  min-height: 0;
}

#political-map-root,
#political-map,
#assembly-map-root,
#assembly-map {
  width: 100%;
  height: 100%;
}

#political-map-root,
#assembly-map-root {
  flex: 1;
  min-height: 0;
}

#map {
  display: block;
}

#page-title {
  position: absolute;
  top: 16px;
  left: 20px;
  margin: 0;
  padding: 8px 12px;
  font-size: 18px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
  z-index: 2;
}

#political-title {
  position: absolute;
  top: 16px;
  left: 20px;
  margin: 0;
  padding: 8px 12px;
  font-size: 18px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
  z-index: 4;
}

#back-button {
  position: absolute;
  top: 16px;
  right: 20px;
  padding: 8px 14px;
  border: none;
  border-radius: 999px;
  background: #111827;
  color: #ffffff;
  font-size: 14px;
  cursor: pointer;
  z-index: 2;
}

#back-button:hover {
  background: #1f2937;
}

#status {
  position: absolute;
  left: 20px;
  bottom: 18px;
  padding: 6px 10px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 8px;
  color: #475467;
  z-index: 2;
}

#political-status {
  position: absolute;
  left: 20px;
  bottom: 18px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.92);
  color: #475467;
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
  z-index: 2;
}

#assembly-status {
  position: absolute;
  left: 20px;
  bottom: 18px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.92);
  color: #475467;
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
  z-index: 2;
}

#assembly-title {
  position: absolute;
  top: 16px;
  right: 20px;
  margin: 0;
  padding: 8px 14px;
  font-size: 16px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
  z-index: 2;
}

#assembly-controls {
  position: absolute;
  top: 16px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12), 0 2px 8px rgba(15, 23, 42, 0.08);
  z-index: 3;
  border: 1px solid rgba(255, 255, 255, 0.8);
}

#assembly-controls label {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#assembly-state-select {
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 32px 8px 14px;
  font-size: 14px;
  font-weight: 500;
  background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23374151' d='M2 4l4 4 4-4'/%3E%3C/svg%3E") no-repeat right 12px center;
  background-size: 12px;
  color: #111827;
  cursor: pointer;
  transition: all 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
  min-width: 180px;
}

#assembly-state-select:hover {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#assembly-state-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.tooltip {
  position: absolute;
  pointer-events: none;
  padding: 6px 10px;
  background: rgba(17, 24, 39, 0.92);
  color: #f9fafb;
  font-size: 12px;
  border-radius: 6px;
  transform: translate(8px, -12px);
  opacity: 0;
  transition: opacity 120ms ease;
  z-index: 3;
  white-space: nowrap;
}

.state {
  stroke: #ffffff;
  stroke-width: 0.8;
  cursor: pointer;
  transition: fill 120ms ease, stroke-width 120ms ease;
}

.state--focused {
  stroke-width: 1.4;
}

/* Zoom Controls */
.zoom-controls {
  position: absolute;
  bottom: 60px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 3;
}

.zoom-controls button {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
  color: #374151;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12), 0 1px 3px rgba(15, 23, 42, 0.08);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.zoom-controls button:hover {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.16), 0 2px 4px rgba(15, 23, 42, 0.1);
}

.zoom-controls button:active {
  transform: scale(0.95);
  background: #e2e8f0;
}

/* Fullscreen mode styles */
.map-app:fullscreen {
  background: #f4f6f9;
  padding: 20px;
}

.map-app:fullscreen #map-root,
.map-app:fullscreen #political-map-root,
.map-app:fullscreen #assembly-map-root {
  height: calc(100vh - 100px);
}

.map-app:fullscreen .zoom-controls {
  bottom: 80px;
}

/* Feedback Link - Compact Size */
.feedback-link {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  padding: 6px 14px !important;
  margin: 8px 0 !important;
  color: #fff !important;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.2px;
  background: linear-gradient(135deg, #1ABB9C 0%, #16a085 100%);
  border-radius: 20px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(26, 187, 156, 0.3);
}

.feedback-link:hover,
.feedback-link.active {
  color: #fff !important;
  text-decoration: none;
  background: linear-gradient(135deg, #16a085 0%, #138d75 100%);
  box-shadow: 0 4px 12px rgba(26, 187, 156, 0.5);
  transform: translateY(-2px);
}

.feedback-link:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(26, 187, 156, 0.3);
}

.feedback-link i {
  font-size: 14px;
}

/* Responsive Feedback Link */
@media (max-width: 768px) {
  .feedback-link {
    padding: 6px 12px !important;
    font-size: 12px;
    border-radius: 18px;
    margin: 6px 0 !important;
  }
  
  .feedback-link i {
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .feedback-link {
    padding: 6px 10px !important;
    gap: 4px;
    border-radius: 16px;
  }
  
  .feedback-link span {
    display: none;
  }
  
  .feedback-link i {
    margin: 0;
    font-size: 14px;
  }
}

/* ============================================
   Seat Info Popup - Rich Tooltip Component
   ============================================ */

.seat-info-popup {
  position: fixed;
  width: 380px;
  max-width: 95vw;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25),
              0 12px 24px -8px rgba(0, 0, 0, 0.15),
              0 0 0 1px rgba(0, 0, 0, 0.05);
  z-index: 1000;
  overflow: hidden;
  animation: popupSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Loading Spinner */
.loading-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #e5e7eb;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

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

/* Popup Header */
.seat-info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 100%);
  color: white;
}

.seat-info-header h4 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.popup-close-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  font-size: 20px;
  font-weight: 300;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.popup-close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.1);
}

/* Popup Body */
.seat-info-body {
  padding: 20px;
}

/* Member Section */
.member-section {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e5e7eb;
}

.member-photo-container {
  flex-shrink: 0;
}

.member-photo {
  width: 100px;
  height: 120px;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 3px solid #ffffff;
  background: #f3f4f6;
}

.member-details {
  flex: 1;
  min-width: 0;
}

.member-details h5 {
  margin: 0 0 10px 0;
  font-size: 17px;
  font-weight: 700;
  color: #111827;
  line-height: 1.3;
}

.party-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: #f3f4f6;
  border-radius: 8px;
}

.party-symbol {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 4px;
}

.party-info span {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.term-info,
.district-info {
  margin: 0 0 6px 0;
  font-size: 13px;
  color: #6b7280;
}

.term-info strong,
.district-info strong {
  color: #374151;
}

/* Election Stats */
.election-stats {
  background: #f9fafb;
  border-radius: 12px;
  padding: 16px;
}

.election-stats h6 {
  margin: 0 0 14px 0;
  font-size: 13px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stats-row {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}

.stat-item {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  text-align: center;
}

.stat-item.winner {
  background: linear-gradient(135deg, #dcfce7 0%, #d1fae5 100%);
  border: 1px solid #86efac;
}

.stat-item.runner {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1px solid #fcd34d;
}

.stat-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.stat-value {
  display: block;
  font-size: 18px;
  font-weight: 800;
  color: #111827;
}

.stat-share {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #059669;
  margin-top: 2px;
}

.stat-item.runner .stat-share {
  color: #b45309;
}

.runner-name {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.total-votes {
  padding: 10px 14px;
  background: white;
  border-radius: 8px;
  font-size: 14px;
  color: #374151;
  text-align: center;
  border: 1px solid #e5e7eb;
}

.total-votes strong {
  color: #111827;
  font-size: 16px;
}

/* Popup Footer */
.seat-info-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: #f3f4f6;
  border-top: 1px solid #e5e7eb;
}

.election-year {
  font-size: 13px;
  color: #6b7280;
}

.election-year span {
  font-weight: 700;
  color: #111827;
}

.reservation-badge {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .seat-info-popup {
    width: 95vw;
    max-height: 80vh;
    overflow-y: auto;
  }
  
  .member-section {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  
  .member-details {
    width: 100%;
  }
  
  .stats-row {
    flex-direction: column;
  }
}

/* ==========================================
   ACCESSIBILITY STYLES
   ========================================== */

/* Skip Link - Hidden until focused */
.skip-link {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: #2A3F54;
  color: #fff;
  padding: 12px 24px;
  text-decoration: none;
  font-weight: 600;
  border-radius: 0 0 8px 8px;
  z-index: 10000;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid #1ABB9C;
  outline-offset: 2px;
}

/* Focus Indicators - Visible focus rings for keyboard users */
*:focus {
  outline: 2px solid #1ABB9C;
  outline-offset: 2px;
}

*:focus:not(:focus-visible) {
  outline: none;
}

*:focus-visible {
  outline: 3px solid #1ABB9C;
  outline-offset: 2px;
}

/* Map paths focus styling */
svg path:focus {
  outline: none;
  stroke: #1ABB9C !important;
  stroke-width: 3px !important;
}

/* Button focus states */
button:focus-visible,
.btn:focus-visible {
  outline: 3px solid #1ABB9C;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(26, 187, 156, 0.25);
}

/* Link focus states */
a:focus-visible {
  outline: 3px solid #1ABB9C;
  outline-offset: 2px;
}

/* Form input focus */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #1ABB9C;
  outline-offset: 0;
  border-color: #1ABB9C;
}

/* Reduced Motion - Respect user preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .skip-link {
    transition: none;
  }
}

/* Screen Reader Only - Visually hidden but accessible */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================
   PARTY VISUALIZATION CONTROLS
   ========================================== */

/* Visualization Controls - Vertical Layout */
.viz-controls-wrapper {
  position: absolute;
  top: 90px;
  left: 20px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 250px;
}

.viz-section {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
  border: 1px solid rgba(226, 232, 240, 0.8);
  backdrop-filter: blur(8px);
}

.viz-section-label {
  font-size: 11px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.viz-section-label i {
  font-size: 12px;
  color: #3b82f6;
}

.viz-section-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.viz-section-buttons.horizontal {
  flex-direction: row;
  flex-wrap: wrap;
}

.viz-toggle-btn {
  padding: 10px 14px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  background: white;
  color: #374151;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  text-align: left;
}

.viz-toggle-btn:hover {
  background: #f9fafb;
  border-color: #cbd5e1;
  transform: translateX(2px);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}

.viz-toggle-btn.active {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border-color: #3b82f6;
  box-shadow: 0 3px 10px rgba(59, 130, 246, 0.3);
  font-weight: 700;
}

.viz-toggle-btn i {
  margin-right: 6px;
}

.viz-toggle-btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

.viz-toggle-btn .spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 6px;
  vertical-align: middle;
}

.viz-toggle-btn:not(.active) .spinner {
  border: 2px solid rgba(55, 65, 81, 0.3);
  border-top-color: #374151;
}

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

/* Party Legend */
.party-legend {
  position: absolute;
  top: 70px;
  right: 20px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15);
  max-height: calc(100vh - 150px);
  overflow-y: auto;
  z-index: 3;
  min-width: 240px;
  display: none;
}

.party-legend.visible {
  display: block;
}

/* Custom scrollbar for party legend */
.party-legend::-webkit-scrollbar {
  width: 8px;
}

.party-legend::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 4px;
}

.party-legend::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.party-legend::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.party-legend h4 {
  margin: 0 0 16px 0;
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #e5e7eb;
  padding-bottom: 10px;
  padding-right: 30px;
  text-align: center;
  position: relative;
}

.legend-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.legend-item:hover {
  background: #f9fafb;
}

.legend-item[style*="cursor: pointer"]:hover {
  background: #e0f2fe;
  transform: translateX(2px);
  transition: all 0.2s ease;
}

.legend-color {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.legend-info {
  flex: 1;
  min-width: 0;
}

.legend-party-name {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.legend-party-abbr {
  font-size: 11px;
  color: #6b7280;
  display: block;
}

.legend-count {
  font-size: 14px;
  font-weight: 700;
  color: #374151;
  padding: 4px 8px;
  background: #f3f4f6;
  border-radius: 6px;
}

/* Statistics Panel */
.stats-panel {
  position: absolute;
  top: 70px;
  right: 20px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15);
  z-index: 3;
  display: none;
  min-width: 280px;
}

.stats-panel.visible {
  display: block;
}

.stats-panel h4 {
  margin: 0 0 12px 0;
  font-size: 13px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.stat-box {
  padding: 12px;
  background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
  border-radius: 8px;
  text-align: center;
  border: 1px solid #e5e7eb;
}

.stat-box-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.stat-box-value {
  display: block;
  font-size: 24px;
  font-weight: 800;
  color: #111827;
}

.stat-box.highlight {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  border-color: #60a5fa;
}

.stat-box.highlight .stat-box-value {
  color: #1e40af;
}

/* Top parties list */
.top-parties {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #e5e7eb;
}

.top-parties-title {
  font-size: 12px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.top-party-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: #f9fafb;
  border-radius: 6px;
  margin-bottom: 6px;
  border-left: 4px solid #3b82f6;
}

.top-party-name {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
}

.top-party-seats {
  font-size: 15px;
  font-weight: 800;
  color: #3b82f6;
}

/* Legend Close Button */
.legend-close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.1);
  color: #374151;
  font-size: 18px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.legend-close-btn:hover {
  background: rgba(0, 0, 0, 0.2);
  transform: scale(1.1);
  color: #111827;
}

.legend-close-btn:active {
  transform: scale(0.95);
}

/* For party legend */
.party-legend .legend-close-btn {
  top: 14px;
  right: 14px;
}

/* For states legend header */
.states-legend-header .legend-close-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  top: 50%;
  transform: translateY(-50%);
  right: 18px;
}

.states-legend-header .legend-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-50%) scale(1.1);
  color: white;
}

.states-legend-header .legend-close-btn:active {
  transform: translateY(-50%) scale(0.95);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  #political-title {
    left: 10px;
    top: 10px;
  }
  
  .party-legend,
  .stats-panel {
    max-width: calc(100vw - 40px);
  }
  
  .viz-controls-wrapper {
    top: 80px;
    left: 10px;
    max-width: 220px;
  }
  
  .viz-section {
    width: 100%;
  }
  
  .viz-toggle-btn {
    padding: 8px 12px;
    font-size: 12px;
  }
  
  .viz-toggle-btn i {
    margin-right: 4px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  #political-title {
    left: 10px;
    top: 10px;
    font-size: 16px;
  }
  
  .party-legend {
    top: 70px;
    left: 10px;
    right: 10px;
    max-height: 50vh;
  }
  
  .stats-panel {
    display: none !important;
  }
  
  .viz-controls-wrapper {
    position: relative;
    top: 0;
    left: 0;
    margin-bottom: 12px;
    max-width: 100%;
  }
  
  .viz-section-buttons {
    width: 100%;
  }
  
  .viz-toggle-btn {
    padding: 10px;
    font-size: 12px;
  }
}

/* ==========================================
   STATES LEGEND PANEL
   ========================================== */

.states-legend {
  position: absolute;
  top: 16px;
  right: 20px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 14px;
  padding: 0;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.15), 0 4px 16px rgba(15, 23, 42, 0.08);
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  z-index: 3;
  width: 280px;
  border: 1px solid rgba(226, 232, 240, 0.8);
  backdrop-filter: blur(12px);
}

/* Custom scrollbar for states legend */
.states-legend::-webkit-scrollbar {
  width: 8px;
}

.states-legend::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 4px;
}

.states-legend::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.states-legend::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.states-legend-header {
  position: sticky;
  top: 0;
  background: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 100%);
  color: white;
  padding: 16px 18px;
  border-radius: 14px 14px 0 0;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.states-legend-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 36px;
  position: relative;
}

.states-legend-header i {
  font-size: 18px;
}

.legend-summary {
  display: flex;
  gap: 12px;
  margin-top: 10px;
  font-size: 12px;
  font-weight: 600;
}

.legend-summary-item {
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-summary-number {
  font-size: 15px;
  font-weight: 800;
  color: #fbbf24;
}

.states-legend-body {
  padding: 16px;
}

.legend-section {
  margin-bottom: 20px;
}

.legend-section:last-child {
  margin-bottom: 0;
}

.legend-section-title {
  font-size: 12px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.legend-section-count {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 800;
}

.legend-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.legend-list-item {
  padding: 8px 10px;
  background: #f9fafb;
  border-radius: 8px;
  font-size: 13px;
  color: #374151;
  font-weight: 500;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.legend-list-item:hover {
  background: #e0f2fe;
  border-left-color: #3b82f6;
  transform: translateX(3px);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.legend-list-item.state-item {
  border-left-color: #10b981;
}

.legend-list-item.state-item:hover {
  background: #d1fae5;
  border-left-color: #059669;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
}

.legend-list-item.ut-item {
  border-left-color: #f59e0b;
}

.legend-list-item.ut-item:hover {
  background: #fef3c7;
  border-left-color: #d97706;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
}

.legend-item-color {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  flex-shrink: 0;
  border: 2px solid rgba(0, 0, 0, 0.1);
}

.legend-item-name {
  flex: 1;
  font-weight: 600;
}

.legend-item-capital {
  font-size: 11px;
  color: #6b7280;
  display: block;
  margin-top: 2px;
  font-weight: 400;
}

/* Hide legend when back button is present (district view) */
#back-button:not([hidden]) ~ .states-legend {
  display: none;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .states-legend {
    width: 260px;
  }
}

@media (max-width: 768px) {
  .states-legend {
    width: 240px;
    top: 14px;
    right: 10px;
    max-height: calc(100vh - 80px);
  }
}

@media (max-width: 640px) {
  .states-legend {
    position: fixed;
    top: 70px;
    right: 10px;
    left: 10px;
    width: auto;
    max-height: 65vh;
  }
  
  .states-legend-header h4 {
    font-size: 14px;
  }
  
  .legend-list-item {
    padding: 6px 8px;
    font-size: 12px;
  }
}

/* ==========================================
   STATE INFORMATION PANEL
   ========================================== */

.state-info-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 420px;
  max-height: calc(100vh - 140px);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25),
              0 12px 24px -8px rgba(0, 0, 0, 0.15),
              0 0 0 1px rgba(0, 0, 0, 0.05);
  z-index: 1000;
  overflow: hidden;
  animation: slideInUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.state-info-header {
  background: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 100%);
  color: white;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 16px 16px 0 0;
}

.state-info-header h3 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.state-info-close-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  font-size: 24px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.state-info-close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.1);
}

.state-info-close-btn:active {
  transform: scale(0.95);
}

.state-info-body {
  padding: 24px;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
}

/* Custom scrollbar for state info panel */
.state-info-body::-webkit-scrollbar {
  width: 8px;
}

.state-info-body::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 4px;
}

.state-info-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.state-info-body::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Loading State */
.state-info-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

.state-info-loading p {
  margin: 16px 0 0 0;
  color: #6b7280;
  font-size: 14px;
}

/* Info Sections */
.info-section {
  margin-bottom: 24px;
}

.info-section:last-child {
  margin-bottom: 0;
}

.info-section-title {
  font-size: 14px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e5e7eb;
}

/* Basic Info Cards */
.info-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.info-card {
  padding: 16px;
  background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
  border-radius: 12px;
  border: 1px solid #e5e7eb;
}

.info-card-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.info-card-value {
  display: block;
  font-size: 18px;
  font-weight: 800;
  color: #111827;
  line-height: 1.2;
}

.info-card-value.small {
  font-size: 15px;
}

.info-card.highlight {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  border-color: #60a5fa;
}

.info-card.highlight .info-card-value {
  color: #1e40af;
}

/* Info Row */
.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #f9fafb;
  border-radius: 8px;
  margin-bottom: 8px;
  transition: background 0.2s ease;
}

.info-row:hover {
  background: #f3f4f6;
}

.info-row:last-child {
  margin-bottom: 0;
}

.info-row-label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.info-row-value {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
}

/* Badge */
.info-badge {
  display: inline-block;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-badge.state {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
}

.info-badge.ut {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
}

/* List */
.info-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.info-list li {
  padding: 6px 12px;
  background: #f3f4f6;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
}

/* Cities List */
.cities-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.city-tag {
  padding: 6px 10px;
  background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
  border: 1px solid #c4b5fd;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #5b21b6;
}

/* Symbols Grid */
.symbols-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.symbol-item {
  padding: 10px 12px;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 8px;
}

.symbol-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: #92400e;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.symbol-value {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #78350f;
}

/* Political Section */
.political-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.political-card {
  padding: 14px;
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border: 1px solid #fecaca;
  border-radius: 10px;
}

.political-label {
  font-size: 11px;
  font-weight: 600;
  color: #991b1b;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.political-name {
  font-size: 14px;
  font-weight: 700;
  color: #7f1d1d;
  line-height: 1.3;
}

/* Stats Bar */
.stats-bar {
  display: flex;
  gap: 8px;
  padding: 16px;
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border: 1px solid #86efac;
  border-radius: 10px;
  margin-bottom: 16px;
}

.stat-item-inline {
  flex: 1;
  text-align: center;
}

.stat-item-inline .info-card-label {
  font-size: 10px;
  margin-bottom: 4px;
}

.stat-item-inline .info-card-value {
  font-size: 16px;
  color: #065f46;
}

/* Responsive */
@media (max-width: 768px) {
  .state-info-panel {
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: auto;
    max-height: calc(100vh - 100px);
  }
  
  .info-cards {
    grid-template-columns: 1fr;
  }
  
  .political-info {
    grid-template-columns: 1fr;
  }
  
  .symbols-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .state-info-header {
    padding: 16px 18px;
  }
  
  .state-info-header h3 {
    font-size: 18px;
  }
  
  .state-info-body {
    padding: 16px;
  }
  
  .stats-bar {
    flex-direction: column;
  }
}

/* ========================================
   Color By Controls (States Page)
   ======================================== */

.color-by-controls {
  position: absolute;
  top: 70px;
  left: 20px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15);
  z-index: 4;
  min-width: 160px;
  backdrop-filter: blur(10px);
}

.color-by-header {
  font-size: 13px;
  font-weight: 700;
  color: #374151;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.color-by-header i {
  color: #3b82f6;
  font-size: 14px;
}

.color-by-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.color-by-buttons .viz-toggle-btn {
  font-size: 12px;
  padding: 8px 12px;
}

/* Color Scale Legends */
.color-scale-legend {
  position: absolute;
  top: 70px;
  right: 20px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15);
  z-index: 3;
  min-width: 280px;
  max-width: 320px;
  backdrop-filter: blur(10px);
}

.color-scale-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #e5e7eb;
}

.color-scale-header h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-scale-header h4 i {
  color: #3b82f6;
  font-size: 16px;
}

.color-scale-body {
  padding: 8px 0;
}

.color-scale-gradient {
  height: 30px;
  border-radius: 6px;
  margin-bottom: 12px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.1);
  position: relative;
}

.color-scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #6b7280;
  font-weight: 600;
  padding: 0 4px;
}

.color-scale-label {
  text-align: center;
}

.color-scale-label-value {
  display: block;
  font-weight: 700;
  color: #374151;
  margin-bottom: 2px;
}

.color-scale-label-text {
  display: block;
  font-size: 10px;
  color: #9ca3af;
}

/* Responsive adjustments for color controls */
@media (max-width: 768px) {
  .color-by-controls {
    top: 60px;
    left: 12px;
    min-width: 140px;
    padding: 12px;
  }
  
  .color-by-header {
    font-size: 11px;
    margin-bottom: 10px;
  }
  
  .color-by-buttons .viz-toggle-btn {
    font-size: 11px;
    padding: 6px 10px;
  }
  
  .color-scale-legend {
    top: 60px;
    right: 12px;
    min-width: 240px;
    padding: 12px;
  }
  
  .color-scale-header h4 {
    font-size: 12px;
  }
  
  .color-scale-gradient {
    height: 24px;
  }
}

@media (max-width: 480px) {
  .color-by-controls {
    top: 50px;
    left: 8px;
    min-width: 120px;
    padding: 10px;
  }
  
  .color-by-header {
    font-size: 10px;
  }
  
  .color-by-buttons .viz-toggle-btn {
    font-size: 10px;
    padding: 5px 8px;
  }
  
  .color-by-buttons .viz-toggle-btn i {
    font-size: 10px;
    margin-right: 4px;
  }
  
  .color-scale-legend {
    top: 50px;
    right: 8px;
    min-width: 200px;
    max-width: 240px;
    padding: 10px;
  }
  
  .color-scale-header h4 {
    font-size: 11px;
  }
  
  .color-scale-gradient {
    height: 20px;
  }
  
  .color-scale-labels {
    font-size: 9px;
  }
}

/* ========================================
   Top 5 Legend (Left Side)
   ======================================== */

.top5-legend {
  position: absolute;
  top: 70px;
  left: 200px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15);
  z-index: 4;
  min-width: 240px;
  max-width: 280px;
  backdrop-filter: blur(10px);
  border: 2px solid #fbbf24;
}

.top5-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 2px solid #f59e0b;
}

.top5-header h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 6px;
}

.top5-header h4 i {
  color: #f59e0b;
  font-size: 14px;
}

.top5-body {
  padding: 2px 0;
}

.top5-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.show-more-btn {
  width: 100%;
  padding: 8px 12px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.show-more-btn:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.show-more-btn i {
  font-size: 10px;
}

/* ========================================
   Top 10 Legend (Right Side, Below Color Scale)
   ======================================== */

.top10-legend-right {
  position: absolute;
  top: 220px;
  right: 20px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15);
  z-index: 3;
  min-width: 280px;
  max-width: 320px;
  backdrop-filter: blur(10px);
  border: 2px solid #e5e7eb;
  max-height: calc(100vh - 260px);
  overflow-y: auto;
}

.top10-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #f59e0b;
}

.top10-header h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 8px;
}

.top10-header h4 i {
  color: #f59e0b;
  font-size: 16px;
}

.top10-body {
  padding: 4px 0;
}

.top10-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.top10-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  transition: all 0.2s ease;
  cursor: pointer;
}

.top10-item:hover {
  background: linear-gradient(135deg, #f3f4f6 0%, #f9fafb 100%);
  border-color: #d1d5db;
  transform: translateX(-3px);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.1);
}

.top10-rank {
  font-size: 16px;
  font-weight: 800;
  color: #6b7280;
  min-width: 28px;
  text-align: center;
}

.top10-item:nth-child(1) .top10-rank {
  color: #f59e0b;
  font-size: 18px;
}

.top10-item:nth-child(2) .top10-rank {
  color: #94a3b8;
  font-size: 17px;
}

.top10-item:nth-child(3) .top10-rank {
  color: #cd7f32;
  font-size: 17px;
}

.top10-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.top10-name {
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top10-value {
  font-size: 11px;
  font-weight: 700;
  color: #3b82f6;
  display: flex;
  align-items: center;
  gap: 4px;
}

.top10-badge {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Medal Icons for Top 3 */
.top10-item:nth-child(1) {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-color: #fbbf24;
}

.top10-item:nth-child(2) {
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
  border-color: #94a3b8;
}

.top10-item:nth-child(3) {
  background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
  border-color: #f97316;
}

.top10-item:nth-child(1):hover,
.top10-item:nth-child(2):hover,
.top10-item:nth-child(3):hover {
  transform: translateX(-5px) scale(1.02);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

/* Responsive adjustments for Top 5 and Top 10 */
@media (max-width: 768px) {
  .top5-legend {
    top: 60px;
    left: 12px;
    min-width: 200px;
    max-width: 240px;
    padding: 10px;
  }
  
  .top5-header h4 {
    font-size: 12px;
  }
  
  .top10-legend-right {
    top: 180px;
    right: 12px;
    min-width: 240px;
    max-width: 280px;
    padding: 12px;
  }
  
  .top10-header h4 {
    font-size: 12px;
  }
  
  .top10-item {
    padding: 8px 10px;
    gap: 8px;
  }
  
  .top10-rank {
    font-size: 14px;
    min-width: 24px;
  }
  
  .top10-name {
    font-size: 12px;
  }
  
  .top10-value {
    font-size: 10px;
  }
  
  .show-more-btn {
    font-size: 11px;
    padding: 6px 10px;
  }
}

@media (max-width: 480px) {
  .top5-legend {
    top: 50px;
    left: 8px;
    min-width: 160px;
    max-width: 200px;
    padding: 8px;
  }
  
  .top5-header h4 {
    font-size: 11px;
  }
  
  .top10-legend-right {
    top: 160px;
    right: 8px;
    min-width: 200px;
    max-width: 240px;
    padding: 10px;
  }
  
  .top10-header h4 {
    font-size: 11px;
  }
  
  .top10-item {
    padding: 6px 8px;
    gap: 6px;
  }
  
  .top10-rank {
    font-size: 13px;
    min-width: 22px;
  }
  
  .top10-name {
    font-size: 11px;
  }
  
  .top10-value {
    font-size: 9px;
  }
  
  .show-more-btn {
    font-size: 10px;
    padding: 5px 8px;
  }
}
