/* Base styles */
body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  /* Added for fullscreen */
  background-color: #f8f8f8;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  box-sizing: border-box;
}

*, *:before, *:after {
  box-sizing: inherit;
}


/* Navigation toggle */
.nav-toggle {
  display: none; /* Hidden by default on larger screens */
  width: 100%;
  padding: 10px;
  background: #f3f4f6;
  border: none;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: fixed; /* Keep it fixed */
  top: 0;
  left: 0; /* Ensure it spans full width */
  z-index: 100;
  flex-shrink: 0; /* Prevent shrinking */
}

.nav-toggle svg {
  width: 20px;
  height: 20px;
}

/* Controls container */
.controls-container {
  background: white;
  border-bottom: 1px solid #e5e7eb;
  padding: 8px;
  position: fixed; /* Keep controls fixed */
  top: 0;
  left: 0;
  right: 0;
  z-index: 99; /* Below nav toggle */
  flex-shrink: 0; /* Prevent shrinking */
  transition: transform 0.3s ease-in-out, max-height 0.3s ease-in-out; /* Added transform */
}

.control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

/* Form controls styling */
select, input[type="text"], .control-button /* Style new buttons */ {
  padding: 4px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 14px;
  background-color: #fff; /* Ensure background */
}
.control-button { /* Add cursor */
  cursor: pointer;
  float: right;
  margin-left: 30px;
}
.control-button:hover {
    background-color: #f0f0f0;
}

.range-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

input[type="range"] {
  width: 120px;
}

/* Graph container */
#ultra_graph {
  /* Adjusted margin-top calculation needed due to fixed controls */
  margin-top: 55px; /* Estimate based on typical control height, adjust if needed */
  /* Let the graph grow to fill remaining space */
  flex-grow: 1;
  min-height: 300px; /* Ensure minimum height */
}

/* --- Mobile styles --- */
@media (max-width: 768px) {
  .nav-toggle {
    display: flex; /* Show toggle on mobile */
  }

  .controls-container {
    /* Hide controls off-screen initially */
    transform: translateY(-100%);
    top: 40px; /* Position below the toggle button */
    max-height: calc(100vh - 40px); /* Limit height */
    overflow-y: auto; /* Allow scrolling if needed */
    border-bottom: none; /* Remove border when hidden */
  }

  .controls-container.open {
    /* Bring controls into view */
    transform: translateY(0);
    border-bottom: 1px solid #e5e7eb; /* Add border back */
  }

  #ultra_graph {
     /* Adjust graph margin when controls might be open or closed */
     margin-top: 40px; /* Only space for the toggle button */
  }

  .control-row {
    flex-direction: column;
    align-items: stretch;
  }

  .range-control {
    flex-direction: column;
    align-items: stretch;
  }

  input[type="range"] {
    width: 100%;
  }
}
