/* Main layout styles */
#map { 
  height: 100vh; 
  width: 100vw; 
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1;
}

body { 
  font-family: sans-serif; 
  margin: 0; 
  padding: 0; 
  overflow: hidden;
}

#controls { 
  position: fixed;
  top: 10px;
  right: 10px;
  padding: 15px; 
  background: rgba(255, 255, 255, 0.95); 
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  z-index: 1000;
  max-width: 300px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

input { 
  margin-right: 10px; 
}

.section { 
  margin-bottom: 10px; 
}

.active-button { 
  background-color: #4CAF50; 
  color: white; 
}

/* Waypoint styles */
.waypoint { 
  background: #fff;
  padding: 8px;
  margin: 4px 0;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.waypoint-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  font-size: 16px;
}

.waypoint-controls {
  display: flex;
  gap: 4px;
}

.waypoint-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.waypoint-inputs {
  display: grid;
  grid-template-columns: auto auto auto;
  gap: 4px;
  align-items: start;
}

.waypoint-fields label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 14px;
  color: #000;
  text-align: left;
}

.waypoint-fields input {
  width: 55px;
  padding: 2px 4px;
  font-size: 13px;
  text-align: left;
}

.waypoint-info {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-top: 1px solid #eee;
}

.waypoint-heading {
  font-weight: bold;
  color: #2196F3;
  font-size: 13px;
  text-align: left;
}

.waypoint-distance {
  font-weight: bold;
  color: #4CAF50;
  font-size: 13px;
  text-align: right;
}

.reset-section {
  margin-top: 10px;
  text-align: left;
}

/* Search result styles */
.search-result {
  padding: 8px;
  margin: 2px 0;
  background: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 3px;
  cursor: pointer;
  font-size: 14px;
}

.search-result:hover {
  background: #e9e9e9;
}

.search-result.selected {
  background: #cce7ff;
  border-color: #2196F3;
}

/* Map control button styles */
.leaflet-control-map-button {
  background: white;
  border: 2px solid rgba(0,0,0,0.2);
  border-radius: 4px;
  box-shadow: 0 1px 5px rgba(0,0,0,0.4);
}

.leaflet-control-map-button button {
  display: block;
  padding: 6px 12px;
  border: none;
  background: white;
  cursor: pointer;
  font-size: 14px;
  color: #333;
  border-radius: 2px;
  white-space: nowrap;
  font-weight: bold;
  width: 120px;
  text-align: center;
}

.leaflet-control-map-button button:hover {
  background: #f4f4f4;
}

/* Wind icon button specific styles */
#windIconToggleBtn {
  transition: all 0.2s ease;
  background-size: 100% 100% !important;
  background-position: center !important;
}

#windIconToggleBtn.toggled-on {
  background-color: #1976d2 !important; /* Strong blue */
  box-shadow: 0 0 0 2px #1976d2 inset;
}
#windIconToggleBtn.toggled-off {
  background-color: #f0f0f0 !important; /* Light gray */
  box-shadow: none;
}

#windIconToggleBtn:hover {
  background-color: #1565c0 !important;
  transform: scale(1.05);
}

#windIconToggleBtn:active {
  transform: scale(0.95);
}

/* Modal dialog styles */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  touch-action: none;
  overflow: hidden;
}

/* Prevent body scrolling when modal is open */
body.modal-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

.modal-content {
  background-color: #fefefe;
  margin: 5% auto;
  padding: 20px;
  border: 1px solid #888;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid #ddd;
  padding-bottom: 10px;
  flex-shrink: 0;
}

.modal-header h2 {
  margin: 0;
  color: #333;
}

.close {
  color: #aaa;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
}

.close:hover,
.close:focus {
  color: #000;
  text-decoration: none;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding-right: 8px;
}

.modal-form button {
  padding: 6px 12px;
  font-size: 13px;
  margin: 4px 0;
}

/* Direction controls styling */
.direction-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.direction-input-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.direction-input-group input {
  width: 40px;
  margin-right: 2px;
}

.direction-select {
  padding: 2px 4px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  background-color: white;
  cursor: pointer;
  width: 70px;
  text-align: left;
}

/* Specific widths for different input types */
.waypoint-altitude {
  width: 55px !important;
}

.waypoint-angle {
  width: 40px;
}

.waypoint-glide {
  width: 40px;
}

.modal-section {
  margin-top: 20px;
  padding: 15px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  background-color: #f9f9f9;
}

.modal-section h4 {
  margin: 0 0 15px 0;
  color: #333;
  font-size: 16px;
  font-weight: bold;
  border-bottom: 1px solid #ddd;
  padding-bottom: 8px;
}

.offset-controls {
  display: flex;
  gap: 5px;
  align-items: flex-end;
  margin-bottom: 15px;
}

  .offset-controls label {
    flex: 0 0 auto;
    min-width: 120px;
    width: 140px;
  }

.modal-form select {
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  background-color: white;
  cursor: pointer;
}

/* Position zoom controls in the middle of the left side */
.leaflet-bottom.leaflet-left .leaflet-control-zoom {
  margin-bottom: 50vh;
  transform: translateY(50%);
}

/* Add space above zoom control when positioned in top-left */
.leaflet-top.leaflet-left .leaflet-control-zoom {
  margin-top: 20vh;
}

/* Center zoom controls vertically when positioned on the right */
.leaflet-top.leaflet-right .leaflet-control-zoom {
  margin-top: 50vh;
  transform: translateY(-50%);
}

.leaflet-bottom.leaflet-right .leaflet-control-zoom {
  margin-bottom: 50vh;
  transform: translateY(50%);
}

.modal-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid #ddd;
}

.modal-buttons button {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.btn-primary {
  background-color: #4CAF50;
  color: white;
}

.btn-primary:hover {
  background-color: #45a049;
}

.btn-secondary {
  background-color: #ddd;
  color: #333;
}

/* Deployment point specific styles */
.deployment-fields {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}

.deployment-fields label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
}

.deployment-fields input {
  width: 50px;
  padding: 2px 4px;
  font-size: 13px;
  text-align: center;
}

.deployment-distance {
  font-weight: bold;
  color: #4CAF50;
  font-size: 13px;
  text-align: right;
}

/* Jump Run dialog specific input styling */
#jumpRunForm label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
  white-space: nowrap;
  margin-bottom: 15px;
}

#jumpRunForm .direction-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0;
}

#jumpRunForm .direction-row label:first-child {
  margin-bottom: 0;
}

#jumpRunForm .competition-mode-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 20px;
  margin-bottom: 0;
  padding-top: 2px;
}

#jumpRunForm .competition-mode-controls input[type="checkbox"] {
  margin: 0;
}

#jumpRunForm input[type="number"] {
  width: 50px;
  padding: 6px 8px;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 4px;
  text-align: left;
}

#jumpRunForm select {
  width: auto;
  padding: 6px 8px;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

#jumpRunForm .offset-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 15px;
  flex-direction: row;
}

#jumpRunForm .offset-controls label {
  width: 120px;
  flex-shrink: 0;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

#jumpRunForm .start-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 15px;
  flex-direction: row;
}

#jumpRunForm .start-controls label {
  width: 120px;
  flex-shrink: 0;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

#jumpRunForm .modal-section {
  margin-top: 8px;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

#jumpRunForm .modal-section h4 {
  margin: 0 0 12px 0;
}

#jumpRunForm .modal-section label {
  margin-bottom: 12px;
}

#jumpRunForm .modal-section label:last-child {
  margin-bottom: 0;
}

/* Mobile responsive styles */
@media screen and (max-width: 768px) {
  .modal-content {
    margin: 2% auto;
    padding: 15px;
    width: 95%;
    max-height: 95vh;
  }
  
  /* Flight Pattern dialog specific mobile styling */
  #flightPatternModal .modal-content {
    max-height: 80vh;
    overflow-y: auto;
  }
  
  /* Waypoints dialog specific mobile styling */
  #waypointsModal .modal-content {
    max-height: 80vh;
    overflow-y: auto;
  }
  
  .modal-header {
    margin-bottom: 15px;
    padding-bottom: 8px;
  }
  
  .modal-form {
    gap: 15px;
  }
  
  .modal-form label {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  
  .modal-form input[type="number"] {
    padding: 4px 6px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
  }
  
  .modal-form select {
    padding: 12px 8px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    width: 100%;
    box-sizing: border-box;
  }
  
  .modal-section {
    margin-top: 15px;
    padding: 12px;
  }
  
  .offset-controls {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }
  
  .offset-controls label {
    min-width: auto;
  }
  
  .offset-controls div {
    width: 100%;
  }
  
  .close {
    font-size: 32px;
    padding: 5px;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Override jump run form inputs for mobile consistency */
  #jumpRunForm input[type="number"] {
    padding: 4px 6px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
  }
  
  /* Override waypoint form inputs for mobile consistency */
  .waypoint-fields input[type="number"] {
    padding: 4px 6px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
  }
  
  .waypoint-inputs input[type="number"] {
    padding: 4px 6px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
  }
  
  .direction-input-group input[type="number"] {
    padding: 4px 6px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
  }
  
  /* Override exit point controls for mobile consistency */
  .exit-point-controls input[type="number"] {
    padding: 4px 6px !important;
    font-size: 16px !important;
    border: 2px solid #ddd !important;
    border-radius: 6px !important;
  }
  
  /* Prevent auto-zoom on dropzone search input */
  #dropzoneSearch {
    padding: 8px 12px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    width: 100%;
    box-sizing: border-box;
  }
  
  /* Make specific buttons taller on mobile */
  .remove-waypoint,
  #addWaypointBtn,
  #searchBtn,
  #resetDropzoneBtn,
  #removeTargetBtn,
  #resetBtn {
    padding: 10px 16px;
    font-size: 16px;
    min-height: 44px;
  }
  
  /* Add space above Search button on mobile */
  #searchBtn {
    margin-top: 10px;
  }
  
  /* Ensure deployment fields stay horizontal on mobile */
  .deployment-fields {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .deployment-fields label {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
  }
}

/* Target popup styles */
.target-popup {
  text-align: center;
  padding: 8px;
  min-width: 120px;
}

.target-popup-title {
  font-weight: bold;
  margin-bottom: 8px;
  color: #333;
  font-size: 14px;
}

.target-remove-btn {
  background-color: #f44336;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
  transition: background-color 0.2s;
}

.target-remove-btn:hover {
  background-color: #d32f2f;
}

.target-remove-btn:active {
  background-color: #b71c1c;
}

/* Wind arrow icon styling */
.wind-arrow-icon {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  pointer-events: none !important;
}

.wind-arrow-icon svg {
  filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.3));
}

/* Flight Pattern dialog specific styles */
.exit-point-controls {
  margin-bottom: 20px;
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background-color: #f9f9f9;
}

.exit-point-controls h3 {
  margin: 0 0 15px 0;
  color: #333;
  font-size: 16px;
  font-weight: bold;
}

.exit-point-controls label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.exit-point-controls input[type="number"] {
  width: 60px;
  padding: 4px;
  font-size: 14px;
}

/* Style the popup close button for waypoint removal */
.leaflet-popup-close-button {
  color: red !important;
  font-weight: bold !important;
  font-size: 18px !important;
}

.leaflet-popup-close-button:hover {
  color: darkred !important;
  background-color: rgba(255, 0, 0, 0.1) !important;
}

.leaflet-control-hamburger button.active {
  background: #4CAF50;
  color: white;
}

/* Wind icon button specific styles */
#windIconToggleBtn {
  transition: all 0.2s ease;
}

#windIconToggleBtn:hover {
  background-color: #f4f4f4 !important;
  transform: scale(1.05);
}

#windIconToggleBtn:active {
  transform: scale(0.95);
}

/* Target selection button specific styles */
#targetSelectionBtn {
  transition: all 0.2s ease;
  background-size: 100% 100% !important;
  background-position: center !important;
}

#targetSelectionBtn.toggled-on {
  background-color: #d32f2f !important; /* Strong red */
  box-shadow: 0 0 0 2px #d32f2f inset;
}
#targetSelectionBtn.toggled-off {
  background-color: #f0f0f0 !important; /* Light gray */
  box-shadow: none;
}

#targetSelectionBtn:hover {
  background-color: #f4f4f4 !important;
  transform: scale(1.05);
}

#targetSelectionBtn:active {
  transform: scale(0.95);
}

/* Add waypoint button specific styles */
#addWaypointMapBtn {
  transition: all 0.2s ease;
  background-size: 100% 100% !important;
  background-position: center !important;
}

#addWaypointMapBtn:hover {
  background-color: #f4f4f4 !important;
  transform: scale(1.05);
}

#addWaypointMapBtn:active {
  transform: scale(0.95);
}

/* Position wind icon button to the right of hamburger menu */
.leaflet-control-hamburger + .leaflet-control-map-button {
  position: absolute !important;
  left: 50px !important;
  top: 0 !important;
}

/* Position target selection button to the right of wind icon button */
.leaflet-control-hamburger + .leaflet-control-map-button + .leaflet-control-map-button {
  position: absolute !important;
  left: 100px !important;
  top: 0 !important;
}

/* Position add waypoint button to the right of target selection button */
.leaflet-control-hamburger + .leaflet-control-map-button + .leaflet-control-map-button + .leaflet-control-map-button {
  position: absolute !important;
  left: 150px !important;
  top: 0 !important;
}

/* Mobile responsive styles for hamburger button */
@media screen and (max-width: 768px) {
  .leaflet-control-hamburger button {
    width: 50px;
    padding: 4px 8px;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  #windIconToggleBtn {
    width: 50px !important;
    height: 50px !important;
    background-size: 40px 40px !important;
  }
  
  #targetSelectionBtn {
    width: 50px !important;
    height: 50px !important;
    background-size: 40px 40px !important;
  }
  
  #addWaypointMapBtn {
    width: 50px !important;
    height: 50px !important;
    background-size: 40px 40px !important;
  }
  
  /* Adjust positioning for mobile */
  .leaflet-control-hamburger + .leaflet-control-map-button {
    left: 60px !important;
  }
  
  .leaflet-control-hamburger + .leaflet-control-map-button + .leaflet-control-map-button {
    left: 120px !important;
  }
  
  .leaflet-control-hamburger + .leaflet-control-map-button + .leaflet-control-map-button + .leaflet-control-map-button {
    left: 180px !important;
  }
} 