/* ============================================================
   1. GLOBAL RESET & MOBILE SCROLL LOCK
   ============================================================ */
html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  /* CRITICAL: Stops the "sliding screen" bug on mobile */
  overflow-x: hidden; 
  position: relative;
  background: #050510;
  color: #f5f5f5;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

#app {
  position: relative;
  z-index: 1;
  display: flex;
  height: 100vh;
  width: 100vw;
  /* Prevents sidebar from stretching the screen width */
  overflow: hidden; 
}

/* ============================================================
   2. SIDEBAR SYSTEM (RIGHT-SIDE LOCKED)
   ============================================================ */
#sidebar {
  width: 320px;
  background: radial-gradient(circle at top left, #151530, #050510 60%);
  border-left: 1px solid rgba(0, 255, 255, 0.25);
  padding: 16px;
  overflow-y: auto;
  
  /* Use FIXED to sit ON TOP of the map, not next to it */
  position: fixed; 
  top: 0;
  right: 0; 
  height: 100vh;
  z-index: 10000;

  /* Hidden State: 100% to the right */
  transform: translateX(100%); 
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* JavaScript Toggles this class */
#sidebar.open {
  transform: translateX(0) !important;
}

/* Desktop: Always visible on large screens */
@media (min-width: 901px) {
  #sidebar {
    transform: translateX(0);
  }
  /* Push map to the left so sidebar doesn't cover data on PC */
  #map {
    margin-right: 320px;
  }
}

/* Mobile: Hide button on desktop, show on mobile */
.sidebar-toggle {
  display: none; 
  position: fixed;
  top: 15px;
  right: 15px;
  z-index: 20000; /* Stays above the sidebar (10000) */
  background: #00eaff;
  color: #000;
  padding: 12px 15px;
  border: none;
  border-radius: 5px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0, 234, 255, 0.5);
}

@media (max-width: 900px) {
  .sidebar-toggle {
    display: block;
  }
  #sidebar {
    width: 280px; /* Slightly slimmer for phones */
  }
}

/* ============================================================
   3. SIDEBAR CONTENT TYPOGRAPHY
   ============================================================ */
#sidebar h1 {
  font-size: 1.3rem;
  margin-bottom: 12px;
  color: #00eaff;
  text-shadow: 0 0 8px rgba(0, 234, 255, 0.7);
}

#sidebar section {
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

#sidebar h2 {
  font-size: 1rem;
  margin-bottom: 8px;
  color: #ff9bff;
  text-shadow: 0 0 6px rgba(255, 155, 255, 0.6);
}

/* ============================================================
   4. MAP & LEAFLET TWEAKS
   =========================================================== */
#map {
  flex: 1;
  height: 100%;
  width: 100%;
  z-index: 0 !important;
}

.leaflet-container {
  background: #02020a;
}

/* Force Drawing Tools to stay on left and stay visible */
.leaflet-draw {
  z-index: 1001 !important;
  position: absolute;
  left: 10px;
  top: 70px;
}

/* ============================================================
   5. ALERT POPUPS (HUD STYLE)
   ============================================================ */
.leaflet-popup {
  position: fixed !important;
  bottom: 20px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  margin: 0 !important;
  z-index: 999999 !important;
}

.alert-popup {
  background: rgba(5, 5, 15, 0.92);
  border-radius: 10px;
  border: 2px solid transparent;
  width: 340px;
  max-width: 90vw;
}

/* Hazard Colors */
.alert-popup.alert-tornado { border-color: #ff0000; animation: popupPhase 2.4s infinite; }
.alert-popup.alert-severe-thunderstorm { border-color: #ff9900; animation: popupPhase 2.4s infinite; }

@keyframes popupPhase {
  0%   { box-shadow: 0 0 14px currentColor; }
  50%  { box-shadow: 0 0 14px #fff; }
  100% { box-shadow: 0 0 14px currentColor; }
}

/* ============================================================
   6. FORECAST OVERLAY
   ============================================================ */
#forecast-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999; /* Above map and sidebar */
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow-y: auto;
  padding-top: 40px;
  background: radial-gradient(circle at top, #0b1e3a 0%, #030a18 100%);
}

#forecast-content {
  width: 90%;
  max-width: 1100px;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 255, 255, 0.35);
  border-radius: 20px;
  padding: 30px;
}

/* Theme layer (between bg + content) */
#theme-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.15;
}

/* ============================= */
/* TYPOGRAPHY                    */
/* ============================= */

.fc-section-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: #00eaff;
  margin: 25px 0 10px;
  text-shadow: 0 0 10px rgba(0, 255, 255, 0.6);
}

.fc-title,
.fc-location,
.fc-temp,
.fc-desc,
.fc-details span,
.fc-risk-card,
.fc-hour span,
.fc-day span {
  color: #eaffff;
  text-shadow: 0 0 8px rgba(0, 255, 255, 0.4);
}

/* ============================= */
/* HOURLY FORECAST               */
/* ============================= */

#hourly-scroll,
.fc-hourly-scroll {
  display: flex !important;
  flex-direction: row !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  gap: 12px;
  padding: 10px 0;
  white-space: nowrap;
}

.fc-hour {
  flex: 0 0 120px !important;
  width: 120px !important;
  min-width: 120px !important;

  background: rgba(0, 0, 0, 0.35);
  border-radius: 12px;
  border: 1px solid rgba(0, 255, 255, 0.25);
  padding: 12px;
  text-align: center;

  color: #eaffff;
  font-size: 0.9rem;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.15);
}

.fc-hour span {
  display: block;
  margin: 3px 0;
  line-height: 1.2;
}

.fc-alert-card {
  padding: 12px;
  margin-bottom: 10px;
  border-radius: 8px;
  font-size: 0.9rem;
  color: #fff;
  box-shadow: 0 0 12px rgba(0,0,0,0.4);
}

/* Severe Warning */
.alert-warning {
  background: rgba(255, 0, 0, 0.25);
  border-left: 4px solid #ff0000;
}

/* Watch */
.alert-watch {
  background: rgba(255, 165, 0, 0.25);
  border-left: 4px solid #ffa500;
}

/* Advisory */
.alert-advisory {
  background: rgba(0, 150, 255, 0.25);
  border-left: 4px solid #0096ff;
}

/* Statement */
.alert-statement {
  background: rgba(200, 200, 200, 0.25);
  border-left: 4px solid #cccccc;
}

#radar-preview {
  width: 100%;
  height: 200px;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

.fc-risk-card {
  padding: 12px;
  border-radius: 10px;
  font-weight: 600;
  margin-bottom: 10px;
  transition: background 0.3s ease, border 0.3s ease;
}

.fc-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.photo-card {
  background: #111;
  border-radius: 8px;
  overflow: hidden;
  padding: 6px;
  color: white;
}

.photo-img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 6px;
}

.photo-info {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.3;
}

.photo-location {
  font-weight: bold;
}

.photo-age {
  opacity: 0.8;
}

.photo-date {
  opacity: 0.6;
}

.photo-sort {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.photo-sort button {
  background: #222;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
}

.photo-sort button:hover {
  background: #444;
}

.photo-sort button.active {
  background: #0af;
  color: #000;
  font-weight: bold;
}
.photo-filter {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.photo-filter button {
  background: #222;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
}

.photo-filter button.active {
  background: #0af;
  color: #000;
  font-weight: bold;
}

/* FULLSCREEN VIEWER */
#photoViewer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: none;
  background: rgba(0,0,0,0.9);
  z-index: 99999;

  /* mobile-safe centering */
  display: flex;
  justify-content: center;
  align-items: center;

  padding: 0;
  margin: 0;
}

/* IMAGE INSIDE VIEWER */
#viewerImage {
  max-width: 100vw;
  max-height: 100vh;
  width: auto;
  height: auto;
  object-fit: contain;   /* keeps full image visible */
  display: block;
}



#viewerClose {
  margin-top: 10px;
  padding: 8px 16px;
  background: #0af;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
}

/* INFO TEXT */
#viewerInfo {
  position: absolute;
  bottom: 20px;
  left: 0;
  width: 100%;
  text-align: center;
  color: white;
  font-size: 14px;
  padding: 0 10px;
}



/* thumbnail container: fixed square, responsive */
/* gallery grid */
#photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  align-items: start;
  margin: 0;
  padding: 0;
}

/* card layout */
.photo-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0; /* prevents flex children from stretching */
}

/* thumbnail container: reserve space and keep aspect ratio */
.photo-thumb-wrap {
  width: 100%;
  aspect-ratio: 4 / 3;        /* consistent shape across devices */
  overflow: hidden;
  border-radius: 6px;
  background: #f3f3f3;
  display: block;
  min-height: 0;
}

/* image fills container without distortion */
.photo-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  max-width: 100%;
  -webkit-user-drag: none;
}

/* photo meta area (keeps layout compact) */
.photo-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 0;
}

/* mobile-specific: two columns and slightly taller thumbnails */
@media (max-width: 480px) {
  #photo-gallery { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .photo-thumb-wrap { aspect-ratio: 3 / 2; } /* taller on phones */
}

/* defensive: ensure no parent forces image stretch */
.photo-card, .photo-meta, .photo-thumb-wrap {
  min-height: 0;
}

.sidebar-btn {
    width: 100%;
    padding: 12px;
    margin-top: 20px;
    background-color: #007bff; /* Professional Blue */
    color: white;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.sidebar-btn:hover {
    background-color: #0056b3;
}





