/* =========================================
   LEGEND OPTIONS
   ========================================= */

/* OPTION 1: TOOLBAR (Pill Design) */
.hm-legend-style-toolbar {
  position: absolute;
  left: 16px; 
  bottom: 8px; /* Slightly lifted */
  display: flex;
  align-items: center;
  gap: 12px;
  
  /* Pill Container */
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(0, 0, 0, 0.08); /* Subtle border */
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03); /* Soft float */
}

/* Dark mode adjustment if needed, assuming variables handle it or we add specific overrides */

.hm-toolbar-divider {
  width: 1px;
  height: 14px;
  background: rgba(0, 0, 0, 0.15);
}

.matrix-download-btn-icon {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--secondary-text);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}
.matrix-download-btn-icon:hover {
  background: rgba(0,0,0,0.05);
  color: var(--hm-p-main);
}

.hm-legend-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hm-legend-label {
  font-size: 9px;
  font-weight: 800;
  color: var(--secondary-text);
  opacity: 0.8;
  letter-spacing: 0.5px;
}

/* OPTION 2: STACKED (Professional) - FINALIZED V2 */
.hm-legend-style-stacked {
  position: absolute;
  left: 50%; 
  transform: translateX(-50%);
  bottom: 8px;
  display: flex;
  flex-direction: row; 
  align-items: center; /* Center align items vertically */
  justify-content: center; /* Center horizontally */
  gap: 16px;
  
  background: none; 
  padding: 0;
  border: none;
  box-shadow: none;
  width: auto; 
  min-width: 350px; 
}

/* 1. Button Column (Left) - No longer used but keeping for compatibility */
.hm-stacked-button-col {
  display: flex;
  align-items: center; /* Center button in its column */
  padding-bottom: 0; /* Remove lift */
}

/* 2. Content Column (Right) */
.hm-stacked-content-col {
  display: flex;
  flex-direction: column;
  flex-grow: 0; /* Don't grow, let it be auto-width */
  justify-content: center; /* Center content vertically */
}

.hm-stacked-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--secondary-text);
  text-transform: uppercase;
  
  border-bottom: 1px solid rgba(0,0,0,0.06); 
  padding-bottom: 4px;
  margin-bottom: 4px;
  width: 100%;
  text-align: center; /* Center the title */
}

.hm-stacked-row {
  display: flex;
  align-items: center;
  justify-content: center; /* Center the legend items */
  gap: 24px; 
}

/* Combined Button */
.matrix-download-btn-combined {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.5); 
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 6px;
  padding: 0 14px;
  cursor: pointer;
  color: var(--secondary-text);
  transition: all 0.2s ease;
  height: 46px; /* Increased height to match the legend block proportion */
}

.matrix-download-btn-combined:hover {
  background: white;
  color: var(--hm-p-main);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

.matrix-download-btn-combined .btn-divider {
  width: 1px;
  height: 20px; /* Taller divider */
  background: rgba(0,0,0,0.1);
}

/* OPTION 3: MINIMAL (Inline) */
.hm-legend-style-minimal {
  position: absolute;
  left: 16px;
  bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.matrix-download-btn-minimal {
  background: transparent;
  border: 1px solid transparent; /* Invisible border until hover */
  border-radius: 4px;
  padding: 4px 6px;
  cursor: pointer;
  color: var(--secondary-text);
  transition: all 0.2s ease;
}

.matrix-download-btn-minimal:hover {
  border-color: rgba(0,0,0,0.1);
  background: rgba(255,255,255,0.4);
  color: var(--text-color);
}

.hm-minimal-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hm-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%; /* Circle */
  margin-right: 2px;
}

/* Overrides for specific styles */
.hm-legend-style-minimal .hm-legend-item {
  font-weight: 500; /* Lighter font */
  opacity: 0.8;
}
