@import url('https://fonts.googleapis.com/css2?family=Work+Sans:wght@400;600;700;800;900&display=swap');

:root{
  --gp-green: #66cc00;
  --gp-green-dark: #4fa300;
  --gp-black: #0b0f0a;
  --gp-white: #ffffff;
  --gp-gray: #e9efe6;
  
  /* New Design Tokens */
  --gp-panel-bg: #f5f2f2;
  --gp-text-dark: #0b0f0a;
}

html, body, .page {
  font-family: "Work Sans", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

html, body {
  height: 100%;
  width: 100%;
  margin: 0;
}

body {
  overflow: hidden;
}

/* Dash root containers must fill the screen */
#react-entry-point,
#_dash-app-content {
  height: 100%;
}

/* Make the page a flex column so the map can fill remaining space */
.page{
  height: 100vh;
  height: 100dvh;
  width: 100%;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden;
  background: var(--gp-black);
  color: var(--gp-white);
  display: flex;
  flex-direction: column;
}

/* Map Container */
.map-shell {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.map-graph {
  display: block;
}

/* -------------------------------------------------- */
/* OVERLAY CARD (Top Left Title)                      */
/* -------------------------------------------------- */
.map-overlay {
  position: absolute;
  top: 24px; 
  left: 24px;
  /* SAFETY RESETS: Prevents stretching/position conflicts */
  bottom: auto; 
  right: auto; 
  pointer-events: none; /* Let clicks pass through to map */
  z-index: 2000; /* Ensure it is above map tiles */
}

.overlay-card {
  background: rgba(11, 15, 10, 0.85);
  backdrop-filter: blur(8px);
  padding: 16px 24px;
  border-radius: 12px;
  border: 1px solid rgba(102, 204, 0, 0.3);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  pointer-events: auto;
}

.overlay-title {
  margin: 0;
  font-weight: 800;
  font-size: 2rem;
  line-height: 1.1;
  color: var(--gp-white);
  text-transform: uppercase;
  letter-spacing: -0.02em;
}

.overlay-subtitle {
  margin-top: 6px;
  font-size: 0.95rem;
  color: var(--gp-green);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* -------------------------------------------------- */
/* CUSTOM LEGEND (Bottom Right)                       */
/* -------------------------------------------------- */
.map-legend {
  position: absolute;
  bottom: 48px; /* Adjusted to sit above OSM attribution */
  right: 24px;
  z-index: 2000;
  
  /* Inherit overlay card styles for consistency */
  background: rgba(11, 15, 10, 0.85);
  backdrop-filter: blur(8px);
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(102, 204, 0, 0.3);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  color: var(--gp-white);
  
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 600;
}

.legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid white; /* Adds visibility for black dots on dark bg */
  display: block;
}

.dot-red { background-color: #ff2d2d; }
.dot-black { background-color: #0b0f0a; }

/* -------------------------------------------------- */
/* SIDE PANEL (Offcanvas)                             */
/* -------------------------------------------------- */

.gp-offcanvas {
  background-color: var(--gp-panel-bg) !important; 
  color: var(--gp-text-dark) !important;
  border-left: 1px solid rgba(0,0,0,0.05) !important;
  box-shadow: -10px 0 40px rgba(0,0,0,0.15) !important;
  width: 400px !important;
  max-width: 90vw !important;
  z-index: 3000 !important; /* Above everything */
}

.offcanvas-body {
    padding: 24px 28px !important;
}

/* Header & Title */
.gp-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.gp-panel-title {
  margin: 0;
  font-weight: 700;
  font-size: 2rem;
  line-height: 1.1;
  color: var(--gp-text-dark);
}

/* Close Button */
.gp-panel-close {
  background: transparent;
  border: 2px solid rgba(0,0,0,0.1);
  color: var(--gp-text-dark);
  font-size: 1.5rem;
  line-height: 1;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding-bottom: 4px; 
}

.gp-panel-close:hover {
  background: rgba(0,0,0,0.05);
  border-color: var(--gp-green);
  color: var(--gp-green-dark);
}

/* Content Text */
.gp-panel-desc {
  font-size: 1.05rem;
  line-height: 1.6;
  color: #333333;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* -------------------------------------------------- */
/* MEDIA & CAROUSEL                                   */
/* -------------------------------------------------- */

.gp-panel-media {
  margin-bottom: 20px;
}

/* Single Image */
.gp-panel-img {
  width: 100%;
  max-width: 100%;
  height: 260px;
  object-fit: cover;
  object-position: center;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 8px 20px rgba(0,0,0,0.12);
  display: block;
}

/* Carousel Images */
.gp-carousel .carousel-item img {
  width: 100%;
  height: 260px;
  object-fit: cover;
  object-position: center;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

/* Carousel Controls */
.gp-carousel .carousel-control-prev,
.gp-carousel .carousel-control-next {
  width: 15%;
  opacity: 0.9;
  filter: drop-shadow(0px 0px 3px rgba(0,0,0,0.5));
}

.gp-carousel .carousel-control-prev:hover,
.gp-carousel .carousel-control-next:hover {
  opacity: 1;
}

/* -------------------------------------------------- */
/* SCROLLBARS                                         */
/* -------------------------------------------------- */
.gp-offcanvas ::-webkit-scrollbar {
  width: 8px;
}
.gp-offcanvas ::-webkit-scrollbar-track {
  background: transparent;
}
.gp-offcanvas ::-webkit-scrollbar-thumb {
  background-color: rgba(0,0,0,0.2);
  border-radius: 4px;
}
.gp-offcanvas ::-webkit-scrollbar-thumb:hover {
  background-color: rgba(0,0,0,0.35);
}

/* -------------------------------------------------- */
/* ZOOM CONTROLS                                      */
/* -------------------------------------------------- */
.zoom-controls {
  position: absolute;
  bottom: 24px;
  left: 24px;
  /* SAFETY RESETS */
  top: auto; 
  right: auto;
  
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
}

.zoom-btn {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid rgba(102, 204, 0, 0.3);
  background: rgba(11, 15, 10, 0.9);
  color: var(--gp-white);
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
  padding-bottom: 4px;
}

.zoom-btn:hover {
  background: var(--gp-green);
  color: var(--gp-black);
  border-color: var(--gp-green);
  transform: translateY(-2px);
}

.zoom-btn:active {
  transform: translateY(0);
}

/* -------------------------------------------------- */
/* MOBILE RESPONSIVENESS                              */
/* -------------------------------------------------- */
@media (max-width: 768px) {
  .map-overlay {
    top: 12px;
    left: 12px;
    right: 12px;
    bottom: auto; 
    max-width: 100%;
  }

  .zoom-controls {
    bottom: 24px;
    left: 24px;
    top: auto;
  }
  
  /* On mobile, ensure legend sits nicely */
  .map-legend {
    bottom: 48px;
    right: 12px;
  }

  .overlay-card {
    padding: 10px 16px;
  }

  .overlay-title {
    font-size: 1.3rem;
  }

  .overlay-subtitle {
    font-size: 0.75rem;
    margin-top: 2px;
  }
  
  .gp-offcanvas {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 20px 20px 0 0;
  }
}