/* Make the main container fill the viewport height */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: Arial, sans-serif;
}

/* Main Container Setup */
.main-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Top Row: Four Panels take 50% of the height */
.top-row {
  display: flex;
  height: 70%;  /* explicitly set the top row to occupy 50% of the container height */
  padding: 1rem;
  gap: 1rem;
}

/* Common Panel Styling */
.panel {
  background: #fff;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  overflow: hidden;
}

/* Panel Headers */
.panel h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
}

/* Map Panel & Canvas */
.map-panel {
  flex: 1;  /* fill available width */
  display: flex;
  flex-direction: column;
}
.map-canvas {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 200px; /* Ensure minimum height for map */
  position: relative; /* Important for MapLibre */
  border-radius: 4px;
  overflow: hidden; /* Important for MapLibre */
}

/* Make Parameters panel narrower (20% of total width) */
.params-panel {
  flex: 0 0 20%;  /* do not grow or shrink, fixed at 20% */
}
/* Panel Heading */
.params-panel h2 {
  margin-bottom: 1rem;
}

/* Title, Material, and form rows */
.project-title-row,
.material-row,
.form-row {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
}

/* Provide some space between label and input */
.project-title-row label,
.material-row label,
.form-row label {
  margin-right: 0.5rem;
}

/* Optional: If you want inputs to grow in width */
.form-row input[type="text"],
.form-row input[type="number"],
.project-title-row input[type="text"] {
  flex: 1;
}

/* Unit label spacing */
.unit-label {
  margin-left: 0.5rem;
}

/* Fieldsets */
.dimensions-fieldset,
.height-fieldset,
.details-fieldset {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
}

/* Slider Panel: Fixed width remains */
.slider-panel {
  width: 120px;
  flex: 0 0 auto;
}

/* Preview Panel: take remaining space */
.preview-panel {
  flex: 1;
}

/* Bottom Row for 2D Drawing remains as is */
.bottom-row {
  background: #fff;
  margin: 1rem;
  padding: 1rem;
  height: 200px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* MapLibre Specific Fixes */
.maplibregl-canvas-container {
  height: 100%;
  width: 100%;
}

.maplibregl-canvas {
  outline: none;
}

#three-panel {
  position: relative;
}

#three-panel canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Geoman Control Style Fixes
.maplibregl-ctrl-top-left .mapboxgl-ctrl-group,
.maplibregl-ctrl-top-right .mapboxgl-ctrl-group {
  box-shadow: 0 0 0 2px rgba(0,0,0,0.1);
}
*/


/* Slider Panel: Fixed width */
.slider-panel {
  width: 120px;
}

/* Bottom Row for 2D Drawing */
.bottom-row {
  background: #fff;
  margin: 1rem;
  padding: 1rem;
  height: 200px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Placeholder styling for preview areas */
.placeholder {
  flex: 1;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #777;
  font-style: italic;
}

/* Parameters Table */
.param-table {
  border-collapse: collapse;
  margin-top: 10px;
  width: 100%;
}
.param-table td {
  padding: 0.5rem;
}
.param-table label {
  font-weight: bold;
}
.param-table input {
  padding: 4px;
  border: 1px solid #ddd;
  border-radius: 3px;
}

/* --- Vertical Slider Styles --- */
#slider-container {
  position: relative;
  width: 120px;
  height: 100%;
}
.track {
  position: absolute;
  left: 30px;
  width: 4px;
  height: 100%;
  background: #ddd;
  border-radius: 2px;
}
.range-highlight {
  position: absolute;
  left: 30px;
  width: 4px;
  background: #aaa;
  border-radius: 2px;
}
.ticks {
  position: absolute;
  right: 0;
  width: 60px;
  height: 100%;
  pointer-events: none;
}
.tick-mark {
  position: absolute;
  right: 45px;
  width: 10px;
  height: 1px;
  background: #333;
}
.tick-label {
  position: absolute;
  right: 5px;
  transform: translateY(-50%);
  font-size: 0.8rem;
  color: #333;
  pointer-events: none;
}

/* Slider Wrappers and Inputs */
/* Slider Wrappers */
.slider-wrapper {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* For the slider inputs, enable pointer events and apply distinct transforms */
.slider-wrapper-min input[type="range"] {
  pointer-events: auto;
  position: absolute;
  width: 300px; /* original horizontal slider length */
  top: 50%;
  left: 30px;
  transform-origin: center;
  -webkit-appearance: none;
  background: transparent;
  /* Offset to the left */
  transform: translate(calc(-50% - 10px), -50%) rotate(-90deg);
  z-index: 2; /* higher z-index so that when handles overlap, this one is on top */
}

.slider-wrapper-max input[type="range"] {
  pointer-events: auto;
  position: absolute;
  width: 300px; /* original horizontal slider length */
  top: 50%;
  left: 30px;
  transform-origin: center;
  -webkit-appearance: none;
  background: transparent;
  /* Offset to the right */
  transform: translate(calc(-50% + 10px), -50%) rotate(-90deg);
  z-index: 1;
}

/* Custom range input styling */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #4CAF50;
  cursor: pointer;
  border: none;
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #4CAF50;
  cursor: pointer;
  border: none;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  cursor: pointer;
  background: transparent;
  border: none;
}

input[type="range"]::-moz-range-track {
  height: 4px;
  cursor: pointer;
  background: transparent;
  border: none;
}

/* Slider values display */
.slider-values {
  margin-top: 10px;
  font-size: 14px;
  text-align: center;
}