#distance-calculator .unit-heading {
  width: auto;
}

/* Style for the autocomplete container */
.autocomplete-container {
  position: relative;
}

/* Style for the input field itself */
.autocomplete-container input {
  width: 100%;
  padding: 8px;
  box-sizing: border-box;
}

/* This is our custom dropdown container */
.autocomplete-items {
  position: absolute;
  border: 1px solid #d4d4d4;
  border-bottom: none;
  border-top: none;
  z-index: 99;
  top: 100%;
  left: 0;
  right: 0;
  background-color: #fff;
}

/* Style for each suggestion item */
.autocomplete-items div {
  padding: 10px;
  cursor: pointer;
  background-color: #fff;
  border-bottom: 1px solid #d4d4d4;
}

/* Hover effect for suggestion items */
.autocomplete-items div:hover {
  background-color: #e9e9e9;
}

/* UPDATED: Styles for the new Results Card */
.results-container {
  background-color: #f9f9f9;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 20px;
  margin: 25px 0;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* NEW: Style for the Results heading container */
.results-container .unit-group-heading {
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
}

/* Style for the h2 inside the heading container */
.results-container .unit-group-heading h2 {
  margin: 0; /* Reset any theme margins */
  font-size: 1.4em;
  color: #333;
}

/* New structure for each result item */
.result-item {
  display: flex;
  flex-direction: column; /* Stack header and main content vertically */
  gap: 5px; /* Space between header and main content */
  background-color: #fff;
  padding: 15px;
  border-radius: 6px;
  border: 1px solid #eee;
}

.result-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.result-icon {
  flex-shrink: 0;
  color: #555;
}

.result-label {
  font-size: 0.9em;
  color: #777;
}

.result-main {
  display: flex;
  align-items: flex-end; /* Align button to bottom of the number */
  justify-content: space-between; /* Pushes button to the right */
}

.result-value-container {
  display: flex;
  align-items: baseline; /* Aligns number and unit nicely */
  gap: 5px;
}

.result-value {
  font-weight: bold;
  color: #333;
  line-height: 1;
}

/* Style for the unit (km, mi) */
.result-unit {
  font-size: 0.8em;
  font-weight: normal;
  color: #888;
}

/* Grid layout for the result groups */
.primary-results,
.secondary-results {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.primary-results .result-value {
  font-size: 1.8em;
}

.secondary-results {
  border-top: 1px solid #eee;
  padding-top: 15px;
}

.secondary-results .result-value {
  font-size: 1.2em;
}

/* --- UPDATED COPY BUTTON STYLES --- */
.copy-btn {
  position: relative; /* Needed for the popup positioning */
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
  border-radius: 5px;
  color: #4caf50; /* Changed to green for better visibility */
  transition: background-color 0.2s, color 0.2s;
}

.copy-btn:hover {
  background-color: #e8f5e9; /* Light green background on hover */
  color: #45a049; /* Darker green icon color on hover */
}
/* --- END OF UPDATED STYLES --- */

/* UPDATED: Styles for the "Copied!" popup with fade animation */
.copy-popup {
  position: absolute;
  /* top & left are set via inline styles in JS to anchor the popup.
     We use transform to position the popup relative to that anchor point. */
  transform: translateX(-50%) translateY(calc(-100% - 8px)); /* Position bottom of popup 8px above the anchor */
  background-color: #333;
  color: #fff;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 0.8em;
  white-space: nowrap;
  opacity: 0;
  /* Only transition opacity for a clean fade-in/fade-out effect */
  transition: opacity 0.3s ease-in-out;
  pointer-events: none; /* Prevents the popup from being interactive */
  z-index: 10000; /* Ensure it's on top of other elements */
}

.copy-popup.show {
  opacity: 1;
  /* No other style changes are needed for a simple fade */
}

/* Responsive styles */
@media (max-width: 767px) {
  .primary-results,
  .secondary-results {
    grid-template-columns: 1fr;
  }
}
