/* font setup */
@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@300;400;600;700&display=swap');

/* global layout */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Source Sans 3", system-ui, sans-serif;
  overflow: hidden;
}

@media (max-width: 700px) {
  html, body {
    height: auto;
    overflow: auto;
  }
}

/* color variables (updated dynamically by js) */
:root {
  --alert-primary: #ffd54f;
  --alert-bg-light: #eeeeee;
  --alert-bg-dark: #222222;
  --alert-text: #fff;
}


/* map container */
#map {
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* leaflet background */
.leaflet-container {
  background: #d0d8e0;
}

/* fix zoom controls on mobile */
@media (max-width: 700px) {
  .leaflet-top.leaflet-left {
    margin-top: 0.5rem !important;
    margin-left: 0.5rem !important;
  }
}

/* alert panel (desktop default) */
#alert-panel {
  position: absolute;
  top: 1rem;
  left: 1rem;
  width: 320px;
  max-width: calc(100% - 2rem);
  background: #3c3c3c;
  color: var(--alert-text);
  padding: 1rem 1.2rem;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.25);
  backdrop-filter: blur(8px);
  z-index: 999;
  max-height: 80vh;
  overflow-y: auto;
  font-family: inherit;
}

/* test mode badge */
#test-mode-badge {
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.75rem;
  display: inline-block;
  margin: 0.25rem 0 0.4rem 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #d33;
}

/* expires + expired tag row */
#alert-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
  font-size: 0.82rem;
  opacity: 0.85;
}

#expired-badge {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #aaa;
  border: 1px solid #555;
  border-radius: 3px;
  padding: 1px 6px;
}

/* outlet logo */
#outlet-logo {
  margin-bottom: 0.75rem;
}

#outlet-logo img {
  max-height: 40px;
  max-width: 100%;
  object-fit: contain;
  display: block;
}

/* header text */
#alert-panel h1 {
  margin: 0 0 0.3rem 0;
  font-size: 1.35rem;
  color: var(--alert-primary) !important;
  font-weight: 700;
}

/* small metadata text */
#alert-panel small {
  font-size: 0.8rem;
  opacity: 0.85;
  display: block;
}

/* body text */
#alert-summary,
#alert-details,
.alert-body {
  margin-top: 0.75rem;
  font-size: 0.95rem;
  line-height: 1.45rem;
}

/* see more/less link */
#details-toggle {
  display: block;
  margin-top: 0.4rem;
  color: var(--alert-primary);
  font-size: 0.9rem;
  text-decoration: none;
}

#details-toggle:hover {
  text-decoration: underline;
}

/* issued by line at bottom */
#issued-by {
  margin-top: 1rem;
  font-size: 0.8rem;
  opacity: 0.7;
}

/* extra details section */
#alert-extra {
  display: none;
  margin-top: 1rem;
  border-top: 1px solid rgba(255,255,255,0.25);
  padding-top: 1rem;
}

/* mobile layout */
@media (max-width: 700px) {

  /* make panel a full-width block */
  #alert-panel {
    position: relative;
    top: 0;
    left: 0;
    width: 100%;
    max-width: none;
    border-radius: 0;
    padding: 1.25rem 1.4rem;
    max-height: none;
    overflow-y: visible;
  }

  /* move map below panel */
  #map {
    position: relative;
    inset: unset;
    height: 65vh;
    margin: 0;
    z-index: 1;
  }

  /* collapsed state */
  #alert-panel.collapsed #alert-extra {
    display: none;
  }

  #alert-panel.collapsed {
    padding: 0.8rem 1rem;
  }
}

/* map control buttons (theme + radar) */
#theme-toggle,
#radar-toggle {
  position: absolute;
  right: 1rem;
  z-index: 2000;
  background: rgba(0,0,0,0.5);
  color: #fff;
  border: none;
  padding: 0.45rem 0.7rem;
  font-size: 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

#theme-toggle {
  top: 1rem;
}

#radar-toggle {
  top: 3.2rem;
}

#radar-toggle.active {
  background: rgba(0, 120, 220, 0.75);
}


/* map container brightness tweak */
body.dark .leaflet-container {
  filter: brightness(0.9);
}

body.light .leaflet-container {
  filter: brightness(1);
}

body.light #alert-panel {
  background: #222222;
}
