:root {
  /* Light mode colors */
  --body-bg: #f8f9fa;
  --card-bg: #ffffff;
  --text-color: #212529;
  --border-color: rgba(0, 0, 0, 0.125);
  --navbar-bg: #ffffff;
  --navbar-color: #212529;
  --chart-bg: #ffffff;
  --chart-text: #212529;
  --overlay-bg: rgba(0, 0, 0, 0.2);
  --shadow: 0 .125rem .25rem rgba(0,0,0,.075);
}

/* Dark mode colors */
[data-bs-theme="dark"] {
  --body-bg: #121212;
  --card-bg: #1e1e1e;
  --text-color: #e1e1e1;
  --border-color: rgba(255, 255, 255, 0.125);
  --navbar-bg: #1e1e1e;
  --navbar-color: #e1e1e1;
  --chart-bg: #1e1e1e;
  --chart-text: #e1e1e1;
  --overlay-bg: rgba(0, 0, 0, 0.4);
  --shadow: 0 .125rem .25rem rgba(255,255,255,.05);
}

/* Theme transition */
body, .card, .navbar, button, a, .alert, .chart-container {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Base styles */
body {
  background-color: var(--body-bg);
  color: var(--text-color);
  padding-top: 96px; /* 56px navbar + 40px ticker */
}

.navbar {
  background-color: var(--navbar-bg);
  color: var(--navbar-color);
}

.navbar-dark .navbar-brand,
.navbar-dark .nav-link {
  color: var(--navbar-color);
}

/* Apply Material Design look */
.card {
  background-color: var(--card-bg);
  color: var(--text-color);
  border: none;
  border-radius: 8px;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.btn {
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* Chart container and canvas styling */
.chart-container {
  position: relative;
  height: 250px;
  width: 100%;
  margin-bottom: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
  background-color: var(--chart-bg);
  color: var(--chart-text);
  border-radius: 8px;
  overflow: hidden;
}

.chart-container canvas {
  display: block;
  box-sizing: border-box;
}

/* Improve chart hover effect */
.chart-container:hover::after {
  content: '🔍 Click to enlarge';
  position: absolute;
  top: 99%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(0,0,0,0.7);
  color: white;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 14px;
  z-index: 10;
  pointer-events: none;
}

.chart-container:hover canvas {
  opacity: 0.8;
}

.modal-navigation-hint {
  font-size: 12px;
  color: #6c757d;
  text-align: center;
  margin-bottom: 10px;
}

/* Card image styling */
.card-img-top {
  height: 200px; /* Adjust as needed */
  object-fit: contain; /* Maintains aspect ratio */
}

/* Main layout styling */
body {
  background-color: var(--body-bg);
  color: var(--text-color);
  padding-top: 96px; /* 56px navbar + 40px ticker */
}

h1, h2 {
  color: var(--text-color);
  margin-bottom: 1.5rem;
  font-weight: 500;
}

.nav-link.active {
  font-weight: 600;
  position: relative;
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: #007bff;
}

#content-container {
  min-height: 500px; /* Ensure container has minimum height */
}

/* Loading indicator styling */
.loading-indicator {
  display: none;
  text-align: center;
  padding: 2rem;
}

.htmx-request .loading-indicator {
  display: block;
}

.htmx-request.loading-indicator {
  display: block;
}

/* Alert Styling with Material Design */
.alert-card {
  border: none;
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
  position: relative;
}

.alert-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  border-radius: 4px 0 0 4px;
}

.alert-card[data-severity="extreme"]::before {
  background-color: #d00;
}

.alert-card[data-severity="severe"]::before {
  background-color: #f70;
}

.alert-card[data-severity="moderate"]::before {
  background-color: #fc3;
}

.alert-card[data-severity="minor"]::before {
  background-color: #09d;
}

.alert-card[data-severity="unknown"]::before {
  background-color: #777;
}

/* Severity badge styling */
.severity-badge {
  margin-left: 8px;
  font-size: 0.75rem;
  border-radius: 12px;
  padding: 4px 8px;
}

.severity-extreme {
  background-color: #d00 !important;
  color: white !important;
}

.severity-severe {
  background-color: #f70 !important;
  color: white !important;
}

.severity-moderate {
  background-color: #fc3 !important;
  color: black !important;
}

.severity-minor {
  background-color: #09d !important;
  color: white !important;
}

.severity-unknown {
  background-color: #777 !important;
  color: white !important;
}

/* TTS Button Styling */
.tts-button {
  transition: all 0.2s ease;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tts-button.active {
  background-color: #0d6efd;
  color: white;
  border-color: #0d6efd;
}

.tts-button:hover {
  transform: scale(1.1);
}

.area-filter {
  transition: all 0.2s ease;
  margin: 0.2rem;
  border-radius: 16px;
  padding: 4px 12px;
  font-weight: 500;
}

.area-filter:hover {
  transform: scale(1.05);
}

.affected-areas-tags {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
}

.area-tag {
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 16px;
  margin-right: 4px;
  margin-bottom: 4px;
}

.area-tag:hover {
  transform: scale(1.1);
  opacity: 0.9;
}

.image-container {
  position: relative;
  background-color: var(--card-bg);
  overflow: hidden;
  aspect-ratio: 4/3;
  border-radius: 8px 8px 0 0;
}

.image-container img.thumb {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  filter: blur(10px);
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
  object-fit: cover;
}

.image-container img.main {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1s ease-in-out;
  object-fit: cover;
}

.image-container.loaded img.main {
  opacity: 1;
}

.image-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--overlay-bg);
  transition: opacity 0.3s ease-out;
}

.image-container.loaded .image-overlay {
  opacity: 0;
  pointer-events: none;
}

/* Theme toggle button styling */
#theme-toggle {
  width: 40px;
  height: 40px;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#theme-icon {
  font-size: 1.2rem;
}

/* Breaking News Ticker Styling */
.breaking-news-ticker {
  display: flex;
  width: 100%;
  height: 40px;
  background-color: var(--navbar-bg);
  position: fixed;
  top: 56px; /* Position below navbar */
  left: 0;
  right: 0;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.ticker-label {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #dc3545;
  color: white;
  font-weight: bold;
  padding: 0 15px;
  min-width: 140px;
  text-transform: uppercase;
  font-size: 0.9rem;
  letter-spacing: 0.5px;
  animation: pulse 2s infinite; /* Add subtle pulsing effect */
}

.ticker-content {
  flex: 1;
  overflow: hidden;
  position: relative;
  height: 100%;
}

.ticker-wrapper {
  display: flex;
  align-items: center;
  position: absolute;
  white-space: nowrap;
  height: 100%;
}

/* Modified ticker items styling for consistent animation */
.ticker-items {
  display: inline-flex;
  animation: ticker-scroll 40s linear infinite; /* Slowed down and renamed for clarity */
  padding-left: 0; /* Changed from 100% to show first alert immediately */
  white-space: nowrap;
}

/* Simplified animation with consistent speed */
@keyframes ticker-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

/* Add alert fading effect for better readability */
.ticker-item {
  opacity: 1;
  transition: opacity 0.3s ease;
  display: inline-flex;
  align-items: center;
  padding: 0 20px;
  color: var(--text-color);
  font-weight: 500;
  height: 100%;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ticker-item:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

[data-bs-theme="dark"] .ticker-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.ticker-item .ticker-severity {
  display: inline-block;
  border-radius: 3px;
  padding: 2px 5px;
  margin-right: 8px;
  font-size: 0.75rem;
  font-weight: bold;
  text-transform: uppercase;
}

.ticker-item .ticker-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 300px;
}

.ticker-severity-extreme {
  background-color: #d00;
  color: white;
}

.ticker-severity-severe {
  background-color: #f70;
  color: white;
}

.ticker-severity-moderate {
  background-color: #fc3;
  color: black;
}

.ticker-severity-minor {
  background-color: #09d;
  color: white;
}

.ticker-severity-unknown {
  background-color: #777;
  color: white;
}

/* Simplified animation with consistent speed */
@keyframes ticker-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

/* Pause animation on hover */
.ticker-items:hover {
  animation-play-state: paused;
}

/* Alert modal styling */
#alertDetailModal .modal-header {
  border-bottom: none;
}

#alertDetailModal .modal-body {
  padding-top: 0;
}

#alertDetailModal .alert-card {
  box-shadow: none;
  padding: 0 0 0 15px; /* Add left padding of 15px to prevent text overlap with line */
  position: relative; /* Ensure positioning context for the vertical line */
}

#alertDetailModal .alert-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  border-radius: 0; /* Remove border radius for cleaner look in modal */
}

#alertDetailModal .alert-description p {
  margin-bottom: 0.5rem;
}

#alertDetailModal .alert-instruction {
  background-color: rgba(0, 0, 0, 0.05);
  padding: 10px;
  border-radius: 4px;
}

[data-bs-theme="dark"] #alertDetailModal .alert-instruction {
  background-color: rgba(255, 255, 255, 0.05);
}

#alertDetailModal .tts-button {
  transition: all 0.2s ease;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#alertDetailModal .tts-button.active {
  background-color: #0d6efd;
  color: white;
  border-color: #0d6efd;
}

/* Add this at the end of the style.css file */

/* Footer styling with theme support */
.site-footer {
  background-color: var(--card-bg);
  color: var(--text-color);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
  transition: background-color 0.3s ease, color 0.3s ease;
}

.footer-text {
  color: var(--text-color);
  opacity: 0.8;
  font-size: 0.85rem;
}

.api-limits {
  display: inline-flex;
  align-items: center;
}

.limit-badge {
  background-color: rgba(0, 123, 255, 0.15);
  color: var(--text-color);
  padding: 2px 6px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  display: inline-block;
  margin: 0 2px;
}

[data-bs-theme="dark"] .limit-badge {
  background-color: rgba(13, 110, 253, 0.25);
}

/* Make sure footer stays at the bottom for short pages */
html, body {
  min-height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#content-container {
  flex: 1;
}

/* Footer positioning system - ensures footer stays at bottom */
html {
  height: 100%;
  box-sizing: border-box;
}

body {
  position: relative;
  min-height: 100vh;
  padding-bottom: 100px; /* Padding bottom = footer height + some extra space */
  margin: 0;
  display: flex;
  flex-direction: column;
}

main, #content-container {
  flex: 1 0 auto; /* Don't shrink, do grow, auto basis */
}

.site-footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: auto;
  min-height: 60px; /* Set minimum height of footer */
  background-color: var(--card-bg);
  color: var(--text-color);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Ensure footer styling is correct */
.footer-text {
  color: var(--text-color);
  opacity: 0.8;
  font-size: 0.85rem;
}

.api-limits {
  display: inline-flex;
  align-items: center;
}

.limit-badge {
  background-color: rgba(0, 123, 255, 0.15);
  color: var(--text-color);
  padding: 2px 6px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  display: inline-block;
  margin: 0 2px;
}

[data-bs-theme="dark"] .limit-badge {
  background-color: rgba(13, 110, 253, 0.25);
}

/* Add responsive adjustments for smaller screens */
@media (max-width: 768px) {
  body {
    padding-bottom: 140px; /* Increase padding for mobile to accommodate larger footer */
  }
}

@keyframes pulse {
  0% { background-color: #dc3545; }
  50% { background-color: #bd2130; }
  100% { background-color: #dc3545; }
}

/* Add at the end of the existing style.css file */

/* Interactive Radar Styling */
.interactive-radar-container {
  position: relative;
  min-height: 300px;
  background-color: var(--body-bg);
  border-radius: 0.25rem;
  margin: 0 auto;
  overflow: hidden;
  width: fit-content; /* Add this to make container fit content */
}

.interactive-radar-image {
  display: none;
  width: 100%;
  height: auto;
  margin: 0 auto;
}

/* Add this new class */
.radar-card {
  width: fit-content;
  margin: 0 auto;
}

.interactive-radar-frame {
  border: none;
  border-radius: 0.25rem;
  width: 100%;
  height: 100%;
}

.radar-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.radar-error {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  text-align: center;
  padding: 1rem;
  color: #842029;
  background-color: #f8d7da;
  border-color: #f5c2c7;
}

[data-bs-theme="dark"] .radar-error {
  color: #ea868f;
  background-color: #2c0b0e;
  border-color: #842029;
}

.radar-timestamp {
  position: absolute;
  bottom: 25px;
  left: 10px;
  background: rgba(255, 255, 255, 0.7);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
}

[data-bs-theme="dark"] .radar-timestamp {
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
}

/* Responsive adjustments for radar */
@media (max-width: 768px) {
  .interactive-radar-container {
    min-height: 200px;
  }
}

/* Add these styles to the existing CSS file */

.card-title {
  margin-bottom: 0;
  display: flex;
  align-items: center;
  transition: height 0.3s ease;
  overflow: hidden;
  font-size: 1rem;
  line-height: 1.2;
}

/* Update the existing card-body class or add if not present */
.card-body {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
}