body { margin: 0; padding: 0; font-family: Arial, sans-serif; }
#map { height: 100vh; width: 100%; }
/* Header */
#app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 10px; background: rgb(250 253 231);
  backdrop-filter: blur(5px);
  z-index: 1100; box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
#logo-container { display: flex; align-items: center; gap: 8px; }
#logo-container img { width: 100px; height: auto; }
.header-buttons { display: flex; gap: 8px; }
.header-buttons button {
  padding: 6px 10px; border: 1px solid #ccc; border-radius: 4px; background:#fff; cursor:pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.header-buttons button:hover { background:#f4f4f4; }
/* Old Save View button hidden; replaced by Tools drawer */
#saveView { display: none; }
.leaflet-control-layers { box-shadow: 0 1px 5px rgba(0,0,0,0.4); }
.zoom-display {
  background: rgba(255,255,255,0.8);
  box-shadow: 0 1px 5px rgba(0,0,0,0.4);
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
}
/* Drawers */
.drawer { position: fixed; top: 56px; bottom: 0; width: 300px; background: rgba(255,255,255,0.97); backdrop-filter: blur(6px); box-shadow: 0 4px 16px rgba(0,0,0,0.2); z-index: 1090; overflow:auto; transform: translateX(-110%); transition: transform 0.25s ease; }
.drawer.right { right: 0; left: auto; transform: translateX(110%); }
.drawer.open.left { transform: translateX(0); }
.drawer.open.right { transform: translateX(0); }
.drawer .drawer-header { position: sticky; top:0; background: rgba(255,255,255,0.98); display:flex; align-items:center; justify-content: space-between; padding: 10px; border-bottom: 1px solid #e0e0e0; font-weight: bold; }
.drawer .drawer-content { padding: 10px; }
.drawer h4 { margin: 10px 0 6px; }
.drawer .section { margin-bottom: 12px; }
.drawer .section label { display:block; margin: 6px 0; }

#side-menu { position: static; width: auto; background: transparent; box-shadow: none; padding: 0; font-size: 14px; }
#side-menu h3 {
  margin: 0 0 10px 0;
  font-size: 16px;
  border-bottom: 1px solid #ccc;
  padding-bottom: 5px;
}
#nearest-fire-info, #danger-level-info, #live-wind-info {
  font-size: 1.1em;
  font-weight: bold;
  margin: 5px 0;
}
#nearest-fire-info { color: #333; }
.help-text { font-size: 12px; color: #666; margin-top: 4px; }
.fire-popup-heading {
  font-size: 1.2em;
  font-weight: bold;
  margin: 0 0 10px 0;
  padding-bottom: 5px;
  border-bottom: 1px solid #eee;
  color: #d9534f;
}
.popup-content-table { width: 100%; border-spacing: 0; }
.popup-content-table td { padding: 3px 0; vertical-align: top; }
.popup-content-table td:first-child { font-weight: bold; padding-right: 10px; }
.temp-overlay {
  color: white; font-weight: bold; font-size: 14px; text-shadow: 2px 2px 4px black;
  background: rgba(0,0,0,0.3); border-radius: 4px; padding: 2px 6px; border: none;
  pointer-events: none; white-space: nowrap; text-align: center;
}

.temp-overlay.temp-no-data {
  background: rgba(100,100,100,0.7);
  color: #cccccc;
  font-size: 12px;
  font-weight: normal;
}

/* Modal prompting user to drop a pin */
.modal-backdrop { 
  position: fixed !important; 
  inset: 0 !important; 
  background: rgba(0,0,0,0.45) !important; 
  display: none; 
  align-items: center !important; 
  justify-content: center !important; 
  z-index: 4000 !important; 
}
.modal { background: #fff; padding: 18px 20px; border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,0.25); max-width: 420px; width: calc(100% - 40px); text-align: center; font-size: 15px; }
.modal h4 { margin: 0 0 8px 0; font-size: 18px; }
.modal p { margin: 0 0 14px 0; }
.modal button { padding: 8px 14px; border: 1px solid #ccc; background: #f7f7f7; border-radius: 6px; cursor: pointer; }
.modal button:hover { background: #efefef; }

/* Larger content modal for About/Privacy/Terms */
.modal.modal-lg {
  /* Fill most of the viewport; override base modal limits */
  max-width: none !important;
  max-height: none !important;
  width: calc(100vw - 100px) !important;   /* ~50px margins */
  height: calc(100vh - 100px) !important;
  padding: 0 !important;
  overflow: hidden !important;
  text-align: left !important;
  background: #ffffff !important;
  display: flex !important; 
  flex-direction: column !important;
  box-sizing: border-box !important;
}
.modal.modal-lg .modal-header {
  display:flex; align-items:center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid #e5e5e5; font-weight: 600;
}
.modal.modal-lg #content-modal-close {
  border: none; background: rgba(0,0,0,0.05); width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; font-size: 18px; line-height: 1; cursor: pointer;
}
.modal.modal-lg .modal-body { flex: 1; min-height: 0; }
.modal.modal-lg .modal-body iframe { 
  width: 100% !important; 
  height: 100% !important; 
  border: 0 !important; 
  display: block !important; 
  background: transparent !important;
}

/* Content modal styles (for About/Privacy/Terms) */
.modal.content-modal {
  max-width: none !important;
  max-height: none !important;
  width: calc(100vw - 100px) !important;
  height: calc(100vh - 100px) !important;
  padding: 0 !important;
  overflow: hidden !important;
  text-align: left !important;
  background: #ffffff !important;
  display: flex !important;
  flex-direction: column !important;
  box-sizing: border-box !important;
}

.modal.content-modal .modal-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 12px 14px !important;
  border-bottom: 1px solid #e5e5e5 !important;
  font-weight: 600 !important;
}

.modal.content-modal #content-modal-close {
  border: none !important;
  background: rgba(0,0,0,0.05) !important;
  width: 28px !important;
  height: 28px !important;
  border-radius: 50% !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 18px !important;
  line-height: 1 !important;
  cursor: pointer !important;
}

.modal.content-modal iframe {
  width: 100% !important;
  height: 100% !important;
  border: 0 !important;
  display: block !important;
  background: transparent !important;
  flex: 1 !important;
  min-height: 0 !important;
}

@media (max-width: 640px) {
  .modal.modal-lg { width: calc(100vw - 24px); height: calc(100vh - 24px); }
  .modal.content-modal { width: calc(100vw - 24px) !important; height: calc(100vh - 24px) !important; }
}

/* Modal links */
.modal-link {
  color: #007bff;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s ease;
}

.modal-link:hover {
  color: #0056b3;
  text-decoration: underline;
}

/* Modal links in app drawer - keep app-link styling but ensure proper behavior */
.app-link.modal-link {
  /* Keep the app-link card styling, just ensure it's clickable */
  cursor: pointer;
}

.app-link.modal-link:hover {
  /* Keep the app-link hover effects */
  background: rgba(255,255,255,0.85) !important;
  box-shadow: 0 6px 18px rgba(0,0,0,0.18) !important;
}

/* Document pages (About / Privacy / Terms) */
.wrap {margin: 32px auto; padding: 0 16px; }
.wrap h1 { font-size: 28px; margin: 0 0 8px; }
.wrap h2 { font-size: 20px; margin: 24px 0 10px; }
.wrap p { margin: 10px 0; }
.wrap ul { margin: 8px 0 0 18px; }
.muted { color: #4b5563; }
.wrap a { color: #1a73e8; text-decoration: none; }
.wrap a:hover { text-decoration: underline; }
.card { background: #ffffff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 16px 18px; box-shadow: 0 6px 18px rgba(0,0,0,.06); }
.wrap footer { margin: 32px 0 24px; color: #4b5563; font-size: 14px; }

/* Toast message */
#toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.8); color: #fff; padding: 10px 14px; border-radius: 6px; font-size: 14px; z-index: 2500; display: none; }

/* Legend UI */
/* Removed old floating legend panel/buttons in favor of Tools drawer */

/* Group info panel */
#groupInfoPanel { position: fixed; bottom: 20px; right: 10px; width: 320px; background: #fff; border: 1px solid #ccc; border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,0.25); padding: 8px 10px; z-index: 1200; }
#groupInfoPanel .groupinfo-header { display: flex; align-items: center; justify-content: space-between; font-weight: bold; margin-bottom: 6px; }
#groupInfoClose { border: none; background: transparent; font-size: 18px; cursor: pointer; line-height: 1; }
#groupInfoBody { font-size: 13px; line-height: 1.4; }

/* Fire group label styling */
.fire-group-label { background: rgba(255, 255, 255, 0.95); color: #333; border: 1px solid #ddd; border-radius: 6px; padding: 4px 8px; font-size: 12px; line-height: 1.2; box-shadow: 0 1px 3px rgba(0,0,0,0.2); white-space: nowrap; display: inline-block; width: auto !important; height: auto !important; }

/* Simple danger tag for high-confidence, high-FRP groups (styling can be refined later) */
.danger-fire-label { background: rgba(183,28,28,0.92); color: #fff; border: 1px solid rgba(0,0,0,0.15); border-radius: 6px; padding: 3px 8px; font-size: 12px; font-weight: 800; line-height: 1.2; box-shadow: 0 1px 3px rgba(0,0,0,0.25); white-space: nowrap; display: inline-block; transform: translateY(-18px); }

/* Data health */
#dataBtn { position: fixed; top: 150px; right: 10px; z-index: 1000; padding: 6px 10px; background: #fff; border: 1px solid #ccc; border-radius: 4px; cursor: pointer; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
#dataBtn:hover { background: #f0f0f0; }
#dataPanel { position: fixed; top: 200px; right: 10px; width: 300px; background: #fff; border: 1px solid #ccc; border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,0.25); padding: 8px; z-index: 1200; }

/* Floating logo over map */
#mapLogo { position: absolute; top: 0px; left: 42px; z-index: 1050; pointer-events: none; }
#mapLogo img { width: 120px; height: auto; display: block; }

/* Floating action buttons over map */
.map-buttons { position: absolute; top: 15px; right: 70px; display: flex; gap: 8px; z-index: 1080; }
.floating-btn { padding: 8px 12px; border: 1px solid rgba(0,0,0,0.1); border-radius: 10px; background: rgba(255,255,255,0.6); backdrop-filter: blur(8px); box-shadow: 0 6px 18px rgba(0,0,0,0.2); cursor: pointer; font-weight: 600; letter-spacing: 0.2px; transition: background 0.18s ease, transform 0.08s ease; }
.floating-btn:hover { background: rgba(255,255,255,0.75); }
.floating-btn:active { transform: translateY(1px); }

/* Days slider removed - now shows latest reliable fire data automatically */

/* Custom attribution/footer (bottom-right) */
#mapAttribution { position: absolute; right: 100px; bottom: 8px; z-index: 1080; background: rgba(255,255,255,0.6); backdrop-filter: blur(6px); border: 1px solid rgba(0,0,0,0.08); border-radius: 8px; padding: 6px 10px; font-size: 12px; color: #222; box-shadow: 0 4px 12px rgba(0,0,0,0.2); line-height: 1.2; }
#mapAttribution a { color: #1a73e8; text-decoration: none; }
#mapAttribution a:hover { text-decoration: underline; }

/* Modernized Status (Info) drawer */
#statusDrawer { width: 360px; height:380px; left: 12px; right: auto; top: 80px; bottom: 220px; background: rgba(255,255,255,0.52); backdrop-filter: blur(8px); border-radius: 12px; box-shadow: 0 12px 28px rgba(0,0,0,0.25); border: 1px solid rgba(0,0,0,0.08); overflow: hidden; transform: translateX(calc(-100% - 24px)); }
#statusDrawer.open { transform: translateX(0); }
#statusDrawer .drawer-header { background: rgba(255,255,255,0.6); border-bottom: 1px solid rgba(0,0,0,0.06); padding: 12px 14px; font-weight: 600; letter-spacing: 0.2px; }
#statusDrawer .drawer-content { padding: 14px 14px 16px; }
#statusDrawer #statusClose { border: none; background: rgba(0,0,0,0.05); width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; line-height: 1; cursor: pointer; transition: background 0.18s ease, transform 0.08s ease; }
#statusDrawer #statusClose:hover { background: rgba(0,0,0,0.1); }
#statusDrawer #statusClose:active { transform: scale(0.96); }

/* Info drawer app links */
#info-links h4 { margin-top: 14px; }
.app-links { display: flex; flex-direction: column; gap: 8px; }
.app-link { display: flex; align-items: center; justify-content: space-between; text-decoration: none; color: #222; background: rgba(255,255,255,0.6); backdrop-filter: blur(6px); border: 1px solid rgba(0,0,0,0.08); border-radius: 10px; padding: 10px 12px; transition: background 0.18s ease, transform 0.06s ease, box-shadow 0.18s ease; }
.app-link:hover { background: rgba(255,255,255,0.85); box-shadow: 0 6px 18px rgba(0,0,0,0.18); }
.app-link:active { transform: translateY(1px); }
.app-link .chev { color: #888; font-size: 18px; line-height: 1; }

/* Fire update countdown */
.fire-update {
  margin-top: 22px;
  padding: 10px 14px;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 9999px; /* pill */
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(6px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.12);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  width: auto;
  max-width: fit-content;
  margin-left: auto; margin-right: auto; /* center in drawer */
}
.fire-update-label { font-size: 12px; color: #444; }
.fire-update-timer { font-weight: 800; font-size: 18px; letter-spacing: 0.4px; color: #111; font-variant-numeric: tabular-nums; }

/* Modernized Tools drawer */
#toolsDrawer { width: 360px;height: 440px; right: 12px; left: auto; top: 68px; bottom: 20px; background: rgba(255,255,255,0.52); backdrop-filter: blur(8px); border-radius: 12px; box-shadow: 0 12px 28px rgba(0,0,0,0.25); border: 1px solid rgba(0,0,0,0.08); overflow: hidden; transform: translateX(calc(100% + 24px)); }
#toolsDrawer.open { transform: translateX(0); }
#toolsDrawer .drawer-header { background: rgba(255,255,255,0.6); border-bottom: 1px solid rgba(0,0,0,0.06); padding: 12px 14px; font-weight: 600; letter-spacing: 0.2px; }
#toolsDrawer .drawer-content { padding: 14px 14px 16px; }
#toolsDrawer #toolsClose { border: none; background: rgba(0,0,0,0.05); width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; line-height: 1; cursor: pointer; transition: background 0.18s ease, transform 0.08s ease; }
#toolsDrawer #toolsClose:hover { background: rgba(0,0,0,0.1); }
#toolsDrawer #toolsClose:active { transform: scale(0.96); }


/* Emergency Alert Subscribe Button */
.alert-subscribe-btn {
  padding: 8px 16px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  width: auto;
  display: inline-block;
}

.alert-subscribe-btn:hover {
  background-color: #0056b3;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.alert-subscribe-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Modal buttons */
.modal .btn-primary, .modal .btn-secondary {
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.modal .btn-primary {
  background-color: #0056b3 !important;
  color: white !important;
}

.modal .btn-primary:hover {
  background-color: #004085 !important;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15) !important;
}

.modal .btn-primary:active {
  transform: translateY(1px) !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1) !important;
}

.modal .btn-secondary {
  background-color: #495057 !important;
  color: white !important;
}

.modal .btn-secondary:hover {
  background-color: #343a40 !important;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15) !important;
}

.modal .btn-secondary:active {
  transform: translateY(1px) !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1) !important;
}

/* Enhanced Login Required Modal */
#login-required-modal .modal {
  max-width: 400px;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

#login-required-modal .modal h4 {
  color: #2c3e50;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  text-align: center;
}

#login-required-modal .modal p {
  color: #6c757d;
  font-size: 15px;
  line-height: 1.5;
  text-align: center;
  margin-bottom: 20px;
}

#login-required-modal .form-buttons {
  justify-content: center;
  gap: 16px;
}

#login-required-modal a[href="/alerts-explained.php"] {
  display: inline-block;
  margin-top: 16px;
  color: #007bff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

#login-required-modal a[href="/alerts-explained.php"]:hover {
  text-decoration: underline;
}

/* Enhanced Emergency Alert Subscription Form */
#subscribe-modal .modal {
  max-width: 520px;
  width: 90vw;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

#subscribe-modal .modal h4 {
  color: #2c3e50;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  text-align: center;
}

#subscribe-modal .modal p {
  color: #6c757d;
  font-size: 15px;
  line-height: 1.5;
  text-align: center;
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #2c3e50;
  font-size: 14px;
  line-height: 1.4;
}

.form-group input[type="tel"] {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e1e8ed;
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  box-sizing: border-box;
  transition: all 0.2s ease;
  background-color: #fff;
}

.form-group input[type="tel"]:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
  background-color: #f8f9fa;
}

.form-group input[type="tel"]:invalid {
  border-color: #dc3545;
  background-color: #fff5f5;
}

.form-group input[type="tel"]::placeholder {
  color: #adb5bd;
  opacity: 1;
}

/* Phone input group styling */
.phone-input-group {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.phone-input-group select {
  flex: 0 0 200px;
  padding: 12px 16px;
  border: 2px solid #e1e8ed;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background-color: #fff;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.phone-input-group select:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

.phone-input-group input[type="tel"] {
  flex: 1;
  min-width: 120px;
  max-width: 200px;
}

.phone-preview {
  margin-top: 8px;
  font-size: 14px;
  color: #6c757d;
  font-weight: 500;
  min-height: 20px;
}

/* Terms checkbox styling */
.form-group label[style*="display: flex"] {
  margin-bottom: 0;
  font-weight: 500;
  font-size: 13px;
  color: #495057;
}

.form-group input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-right: 8px;
  accent-color: #007bff;
  cursor: pointer;
}

.form-group a {
  color: #007bff;
  text-decoration: none;
  font-weight: 600;
}

.form-group a:hover {
  text-decoration: underline;
}

.form-buttons {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #e9ecef;
}

/* Loading state for submit button */
.btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  pointer-events: none;
}

/* Subscribe modal info link */
#subscribe-modal a[href="/alerts-explained.php"] {
  display: inline-block;
  margin-top: 16px;
  color: #007bff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

#subscribe-modal a[href="/alerts-explained.php"]:hover {
  text-decoration: underline;
}

/* Mobile layout for map buttons */
@media (max-width: 768px) {
  .map-buttons {
    position: fixed;
    top: 70px; /* Below app launcher button */
    right: 20px; /* Aligned with app launcher button */
    display: flex;
    flex-direction: column; /* Stack vertically */
    gap: 8px;
    z-index: 1080;
    align-items: flex-end; /* Right-align all buttons */
  }

  .map-buttons .floating-btn {
    min-width: 60px; /* Ensure consistent button width */
    text-align: center;
  }

  /* Days slider removed from mobile layout */

