@import url("https://fonts.googleapis.com/css2?family=Ubuntu+Mono:ital,wght@0,400;0,700;1,400;1,700&display=swap");

:root {
  --font-family: "Ubuntu Mono", monospace;
  --secondary-color: #00bfff;
  --splitter-height: 12px;
  --sidebar-width: 20rem;
  --mobile-panel-height: 40%;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  min-height: 100vh;
  font-family: "Ubuntu Mono", monospace;
  font-size: 16px;
  line-height: 1em;
  color: white;
  background: black;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

input,
button,
select,
textarea {
  font-family: var(--font-family);
}

/* Wind Visualization Elements */
.wind-arrow-3d {
  position: absolute;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 16px solid var(--secondary-color);
  transform-origin: center bottom;
  pointer-events: none;
  z-index: 1 !important;
  filter: none;
  transition: transform 0.1s ease;
}

.wind-cube-cell {
  transition: opacity 0.2s ease;
}

.wind-cube-cell:hover {
  opacity: 1 !important;
}

/* Labels & Tooltips */
#demo-label {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.8);
  color: black;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  border-radius: 0.25rem;
  z-index: 10000;
  pointer-events: none;
  user-select: none;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}


#tooltip {
  position: fixed;
  background-color: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  font-size: 0.8rem;
  pointer-events: none;
  z-index: 1000;
  display: none;
  white-space: nowrap;
  border: 2px solid white;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

#tooltip.visible {
  display: block;
}

/* App Layout */
#app-container {
  display: flex;
  width: calc(100vw - var(--sidebar-width) - var(--splitter-height));
  height: 100vh;
  overflow: hidden;
  flex-direction: column;
  margin: 0;
  padding: 0;
  position: fixed;
  top: 0;
  left: 0;
}

@media screen and (max-width: 800px) {
  #app-container {
    width: 100vw;
    height: calc(100% - var(--mobile-panel-height) - var(--splitter-height));
    position: absolute;
    top: 0;
    left: 0;
  }
}

#map-panel {
  width: 100%;
  height: 50%;
  position: relative;
  background: black;
  border-right: none;
  border-bottom: none;
  min-height: 20%;
}

/* Splitter base styles */
#splitter,
#controls-splitter {
  background: #111;
  flex-shrink: 0;
  transition: background-color 0.2s ease;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#splitter:hover,
#splitter:active,
#controls-splitter:hover,
#controls-splitter:active {
  background: #333;
}

#splitter::after,
#controls-splitter::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #666;
  border-radius: 999px;
}

#splitter {
  width: 100%;
  height: var(--splitter-height);
  cursor: ns-resize;
  position: relative;
  z-index: 10;
}

#splitter::after {
  width: 3rem;
  height: 0.25rem;
}

#canvas-panel {
  width: 100%;
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 20%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#canvas-panel canvas {
  width: 100% !important;
  height: 100% !important;
  display: block !important;
}

#leaflet-map-main {
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Pan Controls */
#pan-controls {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  pointer-events: none;
}

.pan-btn {
  position: absolute;
  width: 2rem;
  height: 2rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.25rem;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  pointer-events: auto;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.pan-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
}

.pan-btn:active {
  background: rgba(255, 255, 255, 0.15);
}

.pan-btn i {
  pointer-events: none;
}

.pan-up {
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
}

.pan-up:hover {
  transform: translateX(-50%) scale(1.05);
}

.pan-up:active {
  transform: translateX(-50%) scale(0.95);
}

.pan-down {
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
}

.pan-down:hover {
  transform: translateX(-50%) scale(1.05);
}

.pan-down:active {
  transform: translateX(-50%) scale(0.95);
}

.pan-left {
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
}

.pan-left:hover {
  transform: translateY(-50%) scale(1.05);
}

.pan-left:active {
  transform: translateY(-50%) scale(0.95);
}

.pan-right {
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
}

.pan-right:hover {
  transform: translateY(-50%) scale(1.05);
}

.pan-right:active {
  transform: translateY(-50%) scale(0.95);
}

/* Custom GUI Panel */
.custom-gui {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: black;
  padding: 1.5rem;
  padding-bottom: 6rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1000;
}

.custom-gui::-webkit-scrollbar {
  width: 0.5rem;
}

.custom-gui::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
}

.custom-gui::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 0.25rem;
}

.custom-gui::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

@media screen and (max-width: 800px) {
  .custom-gui {
    position: absolute;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--mobile-panel-height);
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
  }
}

/* Controls Splitter */
#controls-splitter {
  position: fixed;
  z-index: 1001;
  top: 0;
  bottom: 0;
  right: var(--sidebar-width);
  left: auto;
  width: var(--splitter-height);
  height: auto;
  cursor: ew-resize;
}

#controls-splitter::after {
  width: 0.25rem;
  height: 3rem;
}

@media screen and (max-width: 800px) {
  #controls-splitter {
    position: absolute;
    top: auto;
    bottom: var(--mobile-panel-height);
    left: 0;
    right: 0;
    width: 100%;
    height: var(--splitter-height);
    cursor: ns-resize;
  }

  #controls-splitter::after {
    width: 3rem;
    height: 0.25rem;
  }
}

/* GUI Sections */
.gui-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: fit-content;
}

.gui-section-title {
  color: #fff;
  font-size: 0.8rem;
  margin: 0;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.gui-section-subtitle {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.625rem;
  margin: 0.25rem 0 0 0;
  font-weight: 700;
  font-style: italic;
}

/* GUI Controls */
.gui-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: stretch;
}

.gui-control {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.gui-control label {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.75rem;
  font-weight: 400;
}

.gui-control select,
.gui-control input[type="range"],
.gui-control input[type="text"] {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.375rem;
  color: #fff;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.gui-control select:hover,
.gui-control input[type="range"]:hover,
.gui-control input[type="text"]:hover {
  background-color: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
}

.gui-control select:focus,
.gui-control input[type="range"]:focus,
.gui-control input[type="text"]:focus {
  background-color: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.4);
}

.gui-control select {
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='rgba(255,255,255,0.7)' d='M0 0l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.625rem center;
  background-size: 0.625rem;
  appearance: none;
}

.gui-control select option {
  background: #1a1a1a;
  color: #fff;
  padding: 0.5rem;
}

.gui-control input[type="range"] {
  padding: 0;
  height: 0.375rem;
  appearance: none;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 0.25rem;
  cursor: pointer;
}

.gui-control input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 1.125rem;
  height: 1.125rem;
  background: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.3),
    0 0 0 0.125rem rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
}

.gui-control input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.4),
    0 0 0 0.125rem rgba(255, 255, 255, 0.2);
}

.gui-control input[type="range"]::-webkit-slider-thumb:active {
  transform: scale(1.05);
}

.gui-control input[type="range"]::-moz-range-thumb {
  appearance: none;
  width: 1.125rem;
  height: 1.125rem;
  background: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.3),
    0 0 0 0.125rem rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
}

.gui-control input[type="text"] {
  cursor: text;
}

.gui-control-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

.gui-control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.gui-control-row label {
  flex-shrink: 0;
}

.gui-control-value {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.75rem;
  text-align: right;
  min-width: 3rem;
}

/* GUI Time Control */
.gui-time-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.gui-time-control .gui-time-value {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  text-align: center;
  color: #fff;
  font-size: 0.875rem;
}

.gui-time-control button {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.375rem;
  color: #fff;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 2.5rem;
}

.gui-time-control button:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
}

.gui-time-control button:active {
  transform: scale(0.95);
}

/* GUI Buttons & Status */
.gui-status {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.375rem;
  padding: 0.75rem;
  text-align: center;
  color: yellow;
  font-size: 0.8rem;
  font-style: italic;
}

.gui-button {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.375rem;
  color: #fff;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  width: 100%;
  font-weight: 500;
}

.gui-button:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
}

.gui-button:active {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(0.98);
}

/* GUI Checkbox */
.gui-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.gui-checkbox input[type="checkbox"] {
  width: 1.125rem;
  height: 1.125rem;
  cursor: pointer;
  appearance: none;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.25rem;
  position: relative;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.gui-checkbox input[type="checkbox"]:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
}

.gui-checkbox input[type="checkbox"]:checked {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.9);
}

.gui-checkbox input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 0.25rem;
  top: 0.0625rem;
  width: 0.375rem;
  height: 0.625rem;
  border: solid #000;
  border-width: 0 0.125rem 0.125rem 0;
  transform: rotate(45deg);
}

.gui-checkbox label {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.875rem;
  cursor: pointer;
  margin: 0;
}

@media screen and (max-width: 800px) {
  #map-panel {
    height: 35%;
    min-height: 80px;
  }
  #canvas-panel {
    min-height: 40%;
  }
  #demo-label {
    display: none;
  }
}
