body {
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: #f5f5f5;
  margin: 0;
  padding: 20px;
  color: #333;
}

.container {
  max-width: 1300px;
  margin: 0 auto;
}

/* --- Header Styling --- */
header {
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: white;
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

/* Top Row */
.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 15px;
}

.ps-logo {
  height: 60px;
  width: auto;
}

#status-text {
  margin-top: 5px;
  color: #666;
  font-size: 0.9rem;
}

h1 {
  margin: 0;
  font-size: 1.5rem;
  color: #2c3e50;
}

button#download-btn {
  background-color: #27ae60;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 0.9rem;
}

button#download-btn:hover {
  background-color: #219150;
}

button#download-btn:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

/* Bottom Row: Key Stats */
.header-stats {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-top: 15px;
  border-top: 1px solid #eee;
  flex-wrap: wrap; /* Allows wrapping on small screens */
}

.stat-box {
  display: flex;
  flex-direction: column;
  min-width: 100px; /* Ensures boxes don't get too squished */
}

.stat-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #7f8c8d;
  font-weight: 600;
  margin-bottom: 5px;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: #2c3e50;
}

/* --- Card & Layout --- */
.card {
  background: white;
  padding: 25px;
  padding-bottom: 40px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

h2 {
  margin-top: 0;
  font-size: 1.2rem;
  color: #444;
  margin-bottom: 15px;
}

.grid-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
}

.chart-header img {
  width: 24px;
  height: 24px;
}

.chart-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #555;
}

/* --- Table Styles --- */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

th {
  background-color: #f8f9fa;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

th:hover {
  background-color: #e9ecef;
}

th::after {
  content: ' \2195';
  color: #ccc;
  font-size: 0.8em;
  margin-left: 5px;
}

th.sorted-asc::after {
  content: ' \2193';
  color: #333;
}

th.sorted-desc::after {
  content: ' \2191';
  color: #333;
}

tr:hover {
  background-color: #f9f9f9;
}

.text-right {
  text-align: right;
}

tfoot tr {
  background-color: #eff0f1;
  font-weight: bold;
  border-top: 2px solid #ddd;
}

tfoot td {
  border-bottom: none;
}

.text-muted {
  color: #999;
  font-style: italic;
}

a.city-link {
  color: #3498db;
  text-decoration: none;
  font-weight: 600;
}

a.city-link:hover {
  text-decoration: underline;
  color: #2980b9;
}

/* --- Chart Containers & Loader --- */
.chart-container {
  position: relative;
  height: 400px;
  width: 100%;
}

.chart-container.small {
  height: 300px;
}

.loader {
  border: 3px solid #f3f3f3;
  border-top: 3px solid #3498db;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  animation: spin 1s linear infinite;
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* --- Map Link Styles --- */
.map-footer-link {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  text-align: center;
  z-index: 2;
}

.map-footer-link a {
  color: #548177;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.9);
  padding: 4px 12px;
  border-radius: 4px;
}

.map-footer-link a:hover {
  text-decoration: underline;
  color: #78B9AB;
}