/* --- Global Variables (if not already defined in your main CSS) --- */
:root {
  --bg-color-dark: #1f2125;
  --card-color-dark: #2c2f35;
  --text-color-light: #e0e1e3;
  --text-color-muted: #a0a1a3;
  --accent-color-orange: #ff9900;
  --accent-color-blue: #00bcd4;
  --success-color-green: #4caf50;
  --border-color-light: rgba(255, 255, 255, 0.1);
}

/* --- Compact Dashboard Popup Container --- */
.compact-dashboard-popup {
  /* Critical for Leaflet popup: define a width and max-height */
  width: 500px; /* Compact width */
  max-height: 450px; /* Allow vertical scroll if content slightly overflows */
  overflow-y: auto;
  background-color: var(
    --card-color-dark
  ); /* Card background for the whole popup */
  color: var(--text-color-light);
  border-radius: 10px;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  padding: 0; /* Remove internal padding to control layout directly */
  line-height: 1;
}

/* --- Popup Header --- */
.popup-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start; /* Align text to top */
  padding: 5px 20px;
  background-color: var(--bg-color-dark); /* Slightly darker header */
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  border-bottom: 1px solid var(--border-color-light);
}

.popup-header h2 {
  font-size: 1.1em;
  font-weight: 600;
  margin-bottom: 5px;
}

.popup-header .timestamp {
  font-size: 0.75em;
  color: var(--text-color-muted);
  margin-bottom: 0;
}

.popup-header .header-icon {
  font-size: 1.5em;
  color: var(--accent-color-orange);
  margin-left: 15px; /* Spacing */
  align-self: center; /* Center icon vertically */
}

/* --- Content Grid --- */
.popup-content-grid-2row {
  display: grid;
  grid-template-columns: 1.2fr 1fr; /* Main stats wider than secondary */
  gap: 0; /* No gap between the two main panels */
  padding: 0; /* No padding directly on grid */
  border-bottom: 1px solid var(--border-color-light);
}

.popup-content-grid-3row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr; /* Main stats wider than secondary */
  gap: 0; /* No gap between the two main panels */
  padding: 0; /* No padding directly on grid */
  border-bottom: 1px solid var(--border-color-light);
}

/* --- Chart --- */
.chart-wrapper {
  height: 250px;
}

/* --- Main Stats Panel (Left) --- */
.main-stats-panel {
  background-color: var(--card-color-dark); /* Same as popup background */
  padding: 10px 20px;
  border-right: 1px solid var(--border-color-light); /* Separator line */
  display: flex;
  flex-direction: column;
  justify-content: space-between; /* Pushes CMF to bottom */
}

.pv-value {
  font-size: 2.5em;
  font-weight: 700;
  color: var(--accent-color-orange);
  line-height: 1; /* Tighter line height */
  margin-left: auto;
}

.pv-unit {
  font-size: 0.9em;
  color: var(--text-color-muted);
  margin-bottom: 5px;
  margin-left: auto;
}

.pv-progress-wrapper {
  /* margin-top: auto; /* Pushes this to the bottom */
  padding: 5px 0px;
}

.pv-label {
  font-size: 0.85em;
  color: var(--text-color-light);
  margin-bottom: 5px;
  display: block;
}

.pv-progress-bar {
  height: 5px;
  background-color: #3f4249;
  border-radius: 3px;
  overflow: hidden; /* Ensures child doesn't break rounded corners */
}

.pv-progress-bar div {
  height: 100%;
  background-color: var(--accent-color-blue);
  border-radius: 3px;
  transition: width 0.3s ease-out;
}

.cmf-value {
  margin-top: auto;
}

.cmf-invalid {
  color: red;
}

/* --- Secondary Stats Panel (Right) --- */
.secondary-stats-panel {
  background-color: var(--card-color-dark);
  padding: 10px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}

.stat-row:last-of-type {
  border-bottom: none;
}

.stat-row p {
  font-size: 0.85em;
  margin: 0;
  color: var(--text-color-light);
}

.stat-row i {
  font-size: 1em;
  color: var(--text-color-muted); /* Default for icons */
  margin-left: 8px; /* Spacing for icons */
}

.stat-row i.fa-mountain {
  color: var(--text-color-muted);
} /* Adjust specific icon colors */
.stat-row i.fa-globe {
  color: var(--accent-color-blue);
}
.stat-row i.sun-angle-icon {
  color: var(--accent-color-orange);
}
.stat-row i.status-ok-icon {
  color: var(--success-color-green);
}

/* --- Popup Footer --- */
.popup-footer {
  padding: 15px 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  background-color: var(--card-color-dark); /* Match content background */
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
}

.shadow-map-preview {
  width: 150px;
  height: 150px;
  border-radius: 5px;
  overflow: hidden;
  flex-shrink: 0; /* Prevent it from shrinking */
  background-color: #e0e1e3; /* For the B&W image background */
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px solid rgba(0, 0, 0, 0.2);
  flex-direction: column;
}

.shadow-map-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* This gradient is a visual substitute for the black and white pattern in the actual image */
  background-image: repeating-linear-gradient(
    45deg,
    black 0 5px,
    white 5px 10px
  );
  display: block; /* Remove extra space below image */
}

.view-details-btn {
  flex-grow: 1; /* Take up remaining space */
  background-color: var(--accent-color-blue);
  color: var(--text-color-light);
  border: none;
  padding: 10px 15px;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85em;
  letter-spacing: 0.5px;
  transition: background-color 0.2s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.view-details-btn:hover {
  background-color: #0097a7;
}

/* --- Waiting screen --- */
#loading-popup {
  /* Basic dimensions and position (adjust as needed for your specific map) */
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 500px;
  padding: 15px;
  /*background: #ffffff;*/
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  font-family: Arial, sans-serif;
  text-align: center;
  z-index: 1000; /* Ensure it's above the map */
}

.icon-container {
  width: 500px;
  margin-left: auto;
  margin-right: auto;
  padding-bottom: 5px;
}

/* --- General Font Awesome Icon Styling (if not already set) --- */
.fas {
  /* Ensures icons are visible with the light text color */
  color: var(--text-color-light);
}

/* --- Leaflet Specific Overrides (Optional, if needed to prevent Leaflet default styles) --- */
/* .leaflet-popup-content-wrapper, .leaflet-popup-content {
    background-color: transparent !important;
    padding: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}
.leaflet-popup-tip {
    background-color: transparent !important;
} */
