html, body {
    height: 100%;
    margin: 0;
    font-family: sans-serif;
}

#filterPanel {
    overflow-y: auto;
    width: 280px;
    background: #ffffff;
    border-right: 1px solid #e5e5e5;
    padding: 16px;
}

#filterPanel h3 {
    margin-top: 0;
}

#filterPanel label {
    display: block;
    margin-bottom: 10px;
    font-size: 14px;
}

#filterPanel select,
#filterPanel input[type="range"] {
    width: 100%;
    margin-top: 4px;
}

.noUi-connect {
    background: lightblue !important;
    /* or: #add8e6 */
}

/* MAIN LAYOUT */
#mainLayout {
    display: flex;
    height: 100vh;
    width: 100%;
    flex-direction: row; /* left panel first, map second */
}

/* FEATURE PANEL (left) */
#featurePanel {
    overflow-y: auto;
    width: 360px;
    background: #ffffff;
    border-left: 1px solid #e5e5e5;
    padding: 16px;
}

/* MAP */
#map {
    flex: 1;
    height: 100%;
}

/* ===== FEATURE INFO ===== */

#featurePanel h3 {
    margin-top: 0;
}

#featurePanel table {
    width: 100%;
    border-collapse: collapse;
}

#featurePanel th {
    text-align: left;
    width: 40%;
}

#featurePanel td {
    width: 60%;
}

/* ===== CHART ===== */

#chartsContainer {
    margin-top: 10px;
}

#chartImage {
    width: 100%;
}

/* ===== BUTTON ===== */

button {
    margin-top: 8px;
    padding: 6px 10px;
    cursor: pointer;
}

.popup{
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;   /* ensures it sits above Leaflet */
}

.popupContent{
  background: white;
  padding: 20px;
  width: 420px;
  max-height: 80vh;
  overflow-y: auto;  /* allows scrolling if form grows */
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

#userEntriesTable th, 
#userEntriesTable td {
    border: 1px solid #ddd;
    padding: 4px;
    font-size: 12px;
}

#userEntriesTable tr:hover {
    background-color: #eee;
}

#filterPanel,
#featurePanel {
    box-shadow: 0 0 8px rgba(0,0,0,0.05);
    z-index: 500;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial;
    font-size: 14px;
    color: #333;
}

h3 {
    margin-bottom: 10px;
}

label {
    margin-bottom: 14px;
}

.section {
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.section h4 {
    margin-bottom: 6px;
    font-size: 13px;
    color: #666;
}

select, input, textarea {
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 6px;
    font-size: 13px;
    background: #fff;
}

select:focus, input:focus, textarea:focus {
    outline: none;
    border-color: #007bff;
}

button {
    background: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    transition: 0.2s;
}

button:hover {
    background: #0056b3;
}

.card {
    background: #fafafa;
    border-radius: 8px;
    padding: 10px;
    border: 1px solid #eee;
}

#userEntriesTable th {
    background: #f0f0f0;
    font-weight: 600;
}

#userEntriesTable td {
    font-size: 12px;
}

#userEntriesTable tr:hover {
    background-color: #f5faff;
}

.popup {
  animation: fadeIn 0.2s ease;
}

.popupContent {
  animation: scaleIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0 }
  to { opacity: 1 }
}

@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0 }
  to { transform: scale(1); opacity: 1 }
}

#chartsContainer {
    background: #fafafa;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #eee;
}

.collapsibleHeader {
    cursor: pointer;
    user-select: none;
}

.collapsibleHeader h3 {
    margin: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.collapsibleContent {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}

/* Expanded state */
.collapsible.open .collapsibleContent {
    max-height: 500px; /* enough to fit content */
}

/* Ensure full height for mobile layout */
@media (max-width: 900px) {

  /* Main layout becomes vertical */
  #mainLayout {
    display: flex;
    flex-direction: column;
    height: 100vh;       /* fill viewport */
  }

  /* Filter panel and feature panel stay scrollable */
  #filterPanel,
  #featurePanel {
    width: 100%;
    max-height: 30vh;    /* adjust height if needed */
    overflow-y: auto;    /* scrollable if content too tall */
    border-right: none;
    border-left: none;
    border-bottom: 1px solid #e5e5e5;
    border-top: 1px solid #e5e5e5;
  }

  /* Map fills remaining vertical space */
  #map {
    flex: 1;             /* take remaining space */
    min-height: 200px;   /* fallback for very small screens */
    height: auto;        /* ensure flex takes over */
  }
}

.form-row {
  margin-bottom: 10px;
}

.form-row label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.form-row input,
.form-row select,
.form-row textarea {
  flex: 1;
}