/* --- Global Base Styles --- */
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  padding-bottom: 20px;
  color: #333;
  line-height: 1.6;
}

h2 {
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: #2c3e50;
}

hr {
  border: 0;
  height: 1px;
  background-color: #eaeaea;
  margin-bottom: 2rem;
}

/* Dashboard layout */
.dashboard-container {
  display: flex;
  gap: 30px;
  max-width: 1200px;
  flex-wrap: wrap;
}

.map-container {
  flex: 3;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  overflow: hidden;
  background-color: #f9f9f9;
  min-width: 600px;
}

.controls-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 15px;
  min-width: 300px;
}


.country, .state, .region, .province {
  fill: #69b3a2;
  stroke: #fff;
  stroke-width: 0.2;
  cursor: pointer;
  transition: fill 0.2s ease-in-out;
}

.country.deselected, 
.state.deselected,
.region.deselected,
.province.deselected {
  fill: #ccc !important;
}

.country:hover, 
.state:hover,
.region:hover,
.province:hover {
  fill: #45a095;
}

.state {
  stroke-width: 1;
}


.buttons-container {
  display: flex;
  gap: 10px;
  margin-bottom: 5px;
}

.toggle-button, .action-button {
  color: white;
  border: none;
  border-radius: 4px;
  padding: 10px 15px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  flex: 1;
}

.toggle-button {
  background-color: #3498db;
}

.toggle-button:hover {
  background-color: #2980b9;
}

.action-button {
  background-color: #2ecc71;
}

.action-button:hover {
  background-color: #27ae60;
}

.toggle-button:active, .action-button:active {
  transform: translateY(1px);
}

.country-list {
  max-height: 450px;
  overflow-y: auto;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
  background-color: white;
  border: 1px solid #ccc;
}

#country-table, #state-table, #region-table {
  width: 100%;
  border-collapse: collapse;
}

#country-table th, #country-table td, 
#state-table th, #state-table td,
#region-table th, #region-table td {
  border: 1px solid #ddd;
  padding: 8px 10px;
  text-align: left;
}

#country-table th, #state-table th, #region-table th {
  background-color: #f2f2f2;
  position: sticky;
  top: 0;
  font-weight: 500;
  border-bottom: 1px solid #ddd;
  z-index: 2;
}

#country-table td, #state-table td, #region-table td {
  border-bottom: 1px solid #f0f0f0;
}

#country-table tr:last-child td, #state-table tr:last-child td, #region-table tr:last-child td {
  border-bottom: none;
}

#country-table tbody tr, #state-table tbody tr, #region-table tbody tr {
  transition: background-color 0.2s ease-in-out;
}

#country-table tbody tr.selected, #state-table tbody tr.selected, #region-table tbody tr.selected {
  background-color: #e0f2f1;
  font-weight: bold;
}

#country-table tr:hover, #state-table tr:hover, #region-table tr:hover {
  background-color: #f9f9f9;
}

.country-group-row {
  background: #d1d1d1;
  font-weight: bold;
  font-size: 1.1em;
  text-transform: uppercase;
  border-top: 2px solid #aaa;
  border-bottom: 1px solid #aaa;
  height: 40px;
  color: #444;
}

.country-group-row td, .country-group-row th {
  padding: 10px 12px;
}

#region-table input[type="checkbox"], 
#country-table input[type="checkbox"],
#state-table input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #ccc;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  position: relative;
  vertical-align: middle;
}

#region-table input[type="checkbox"]:checked,
#country-table input[type="checkbox"]:checked,
#state-table input[type="checkbox"]:checked {
  background-color: #3498db;
  border-color: #3498db;
}

#region-table input[type="checkbox"]:checked:after,
#country-table input[type="checkbox"]:checked:after,
#state-table input[type="checkbox"]:checked:after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.country-list::-webkit-scrollbar {
  width: 8px;
}

.country-list::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 8px;
}

.country-list::-webkit-scrollbar-thumb {
  background: #bbb;
  border-radius: 8px;
}

.country-list::-webkit-scrollbar-thumb:hover {
  background: #999;
}

.app-footer {
  margin-top: 30px;
  text-align: center;
  color: #7f8c8d;
  font-size: 14px;
  padding: 10px 0;
  border-top: 1px solid #eaeaea;
}

.app-footer a {
  color: #3498db;
  text-decoration: none;
  transition: color 0.2s;
}

.app-footer a:hover {
  color: #2980b9;
  text-decoration: underline;
}

@media (max-width: 1100px) {
  .dashboard-container {
    flex-direction: column;
  }
  
  .map-container,
  .controls-container {
    width: 100%;
    min-width: unset;
  }
  
  .country-list {
    max-height: 300px;
  }
}

.tooltip {
  position: absolute;
  z-index: 9999;
  pointer-events: none;
  background: rgba(44, 62, 80, 0.95);
  color: #fff;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(44,62,80,0.15);
  opacity: 0;
  transition: opacity 0.2s;
  white-space: nowrap;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
