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

#app {
  display: flex;
  height: 100vh;
}

#sidebar {
  width: 300px;
  padding: 20px;
  background: #f5f5f5;
  border-right: 1px solid #ddd;
  overflow-y: auto;
  font-size: 14px;
}

#sidebar p {
  text-align: justify;
}

#viewDiv {
  flex: 1;
}

/* ==========================================================================
   LAYER CONTROL PANEL
   ========================================================================== */

#layer-panel {
  background: #ffffff;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.85rem;
  max-height: 70vh;
  overflow-y: auto;
}

#layer-panel-toggle {
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
  user-select: none;
}

#layer-panel-toggle:hover {
  background: #f0f0f0;
  border-radius: 4px;
}

/* When collapsed, hide the checkbox list */
.layer-panel-collapsed #layer-panel-content {
  display: none;
}

/* When expanded, show the checkbox list */
.layer-panel-expanded #layer-panel-content {
  display: block;
  padding: 4px 12px 10px 12px;
  border-top: 1px solid #e0e0e0;
}

/* Each layer row */
.layer-row {
  display: block;
  padding: 5px 0;
  cursor: pointer;
  white-space: nowrap;
}

.layer-row:hover {
  color: #0079c1;
}

/* Indented sub-layers */
.layer-indent {
  padding-left: 20px;
  font-size: 0.8rem;
}

/* Disabled state for layers that require zooming in */
.layer-row-disabled {
  opacity: 0.45;
  cursor: default;
}

.layer-row-disabled:hover {
  color: inherit;
}

.layer-checkbox {
  margin-right: 6px;
  vertical-align: middle;
}

.clear-all-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 5px 8px;
  font-size: 0.8rem;
  text-align: left;
  cursor: pointer;
  background: #f5f5f5;
  border: 1px solid #ccc;
  border-radius: 3px;
  color: #333;
}

.clear-all-btn:hover {
  background: #e8e8e8;
  border-color: #999;
}

/* ==========================================================================
   3D SHADOW TOOLS PANEL (in sidebar)
   ========================================================================== */

/* Hidden state (when in 2D mode) */
.tools-3d-hidden {
  display: none;
}

/* Visible state (when in 3D mode) */
.tools-3d-visible {
  display: block;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid #ddd;
}

.tools-3d-visible h3 {
  margin-top: 0;
  margin-bottom: 8px;
}

.tools-3d-description {
  font-size: 0.85rem;
  color: #555;
  margin-bottom: 12px;
}

/* Radio button group for tool selection */
.tool-radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tool-radio-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  background: #fff;
  transition: border-color 0.2s, background 0.2s;
}

.tool-radio-row:hover {
  border-color: #0079c1;
  background: #f7fbff;
}

.tool-radio-row input[type="radio"] {
  margin-top: 3px;
  flex-shrink: 0;
}

.tool-radio-label {
  font-size: 0.85rem;
  line-height: 1.4;
}

.tool-radio-label strong {
  font-size: 0.9rem;
}

.tool-radio-detail {
  color: #666;
  font-size: 0.8rem;
}

/* ==========================================================================
   LEGEND (bottom-left, inside Expand widget)
   ========================================================================== */

/* Container for per-layer Legend widget instances.
   max-height prevents the legend from extending beyond the map edge;
   overflow-y enables scrolling when many layers are active.
   No double-scrollbar risk here because the per-layer Legend widgets
   do not have their own scroll containers. */
/* ==========================================================================
   DATA LAYERS ACCORDION (details/summary in sidebar)
   ========================================================================== */

#sidebar details {
  margin-bottom: 5px;
}

#sidebar details summary {
  font-weight: bold;
  cursor: pointer;
}

/* ==========================================================================
   LEGEND (bottom-left, inside Expand widget)
   ========================================================================== */

#legend-container {
  background: #ffffff;
  max-height: 60vh;
  overflow-y: auto;
  overflow-x: hidden;
  max-width: 200px;
}
