/* src/styles/WaypointPanel.css */

/* Heading display styling (aviation standard) */
.heading-row {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 0.75rem;
  margin-top: 0.75rem;
}

.heading-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.heading-mode-indicator {
  color: #888;
  font-size: 0.8rem;
  font-style: italic;
}

.edit-heading-mode {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.edit-select {
  padding: 0.4rem 0.6rem;
  background: #2a2d3a;
  border: 1px solid #3a3f4b;
  color: #e0e4e7;
  border-radius: 4px;
  font-size: 0.8rem;
}

.edit-select:focus {
  border-color: #00d4ff;
  outline: none;
}

.waypoint-panel {
  width: 380px;
  background-color: #1f2128;
  color: #a2a5b9;
  display: flex;
  flex-direction: column;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  transition: all 0.3s ease;
}

.waypoint-panel.collapsed {
  width: 300px;
}

.waypoint-panel.mobile {
  width: 100%;
  max-height: 50vh;
}

.waypoint-panel.mobile.collapsed {
  max-height: 120px;
}

.waypoint-panel-header {
  padding: 1rem 1.5rem;
  background-color: #2a2d3a;
  border-bottom: 1px solid #3a3f4b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
}

.header-title-section {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
}

.panel-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.collapse-toggle {
  background: none;
  border: none;
  color: #6c757d;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 4px;
  font-size: 1rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
}

.collapse-toggle:hover {
  color: #a2a5b9;
  background-color: rgba(255, 255, 255, 0.05);
}

.collapse-toggle.collapsed {
  transform: rotate(-90deg);
}

.speed-warning-summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #ffc107;
}

.warning-text {
  font-size: 0.75rem;
}

.waypoint-panel-header h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: white;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-icon {
  color: #00d4ff;
}

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  color: #6c757d;
}

.empty-state p {
  margin: 0.5rem 0;
}

.empty-state .hint {
  font-size: 0.875rem;
  color: #4a4f5b;
}

.waypoint-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  transition: opacity 0.3s ease;
}

.waypoint-panel.collapsed .waypoint-list {
  display: none;
}

.waypoint-item {
  background-color: #2a2d3a;
  border: 1px solid #3a3f4b;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  transition: all 0.2s ease;
}

.waypoint-item.editing {
  border-color: #00d4ff;
  box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.2);
}

.waypoint-item.speed-warning {
  border-left: 4px solid #ffc107;
}

.waypoint-item:hover {
  background-color: #33384a;
  border-color: #4a4f5b;
}

.waypoint-item.selected {
  background-color: #00458b;
  border-color: #0056b3;
  box-shadow: 0 0 0 2px rgba(0, 213, 255, 0.2);
}

.waypoint-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  cursor: pointer;
}

.waypoint-name-section {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.waypoint-actions {
  display: flex;
  gap: 0.25rem;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.waypoint-item:hover .waypoint-actions {
  opacity: 1;
}

.expand-btn {
  background: none;
  border: none;
  color: #6c757d;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  transition: color 0.2s ease;
}

.expand-btn:hover {
  color: #a2a5b9;
}

.waypoint-number {
  background-color: #4a4f5b;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: bold;
  flex-shrink: 0;
}

.waypoint-number.start {
  background-color: #28a745;
}

.waypoint-number.end {
  background-color: #dc3545;
}

.waypoint-item.selected .waypoint-number {
  background-color: #ffc107;
  color: #000;
}

.waypoint-name {
  flex: 1;
  background: transparent;
  border: 1px solid transparent;
  color: inherit;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 500;
}

.waypoint-name:focus {
  outline: none;
  background-color: rgba(255, 255, 255, 0.05);
  border-color: #4a4f5b;
}

.waypoint-actions {
  display: flex;
  gap: 0.25rem;
}

.action-btn {
  background: transparent;
  border: none;
  color: #6c757d;
  padding: 0.375rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.875rem;
  border-radius: 4px;
  min-width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fly-btn:hover {
  color: #00d4ff;
  background-color: rgba(0, 212, 255, 0.1);
}

.delete-btn:hover {
  color: #dc3545;
  background-color: rgba(220, 53, 69, 0.1);
}

.speed-indicator {
  font-size: 0.875rem;
  margin-left: 0.5rem;
}

.speed-indicator.speed-feasible {
  color: #28a745;
}

.speed-indicator.speed-marginal {
  color: #ffc107;
}

.speed-indicator.speed-impossible {
  color: #dc3545;
}

.action-btn:hover {
  color: #a2a5b9;
  background-color: rgba(255, 255, 255, 0.05);
}

.waypoint-summary {
  display: flex;
  gap: 1rem;
  padding: 1rem 1.5rem;
  font-size: 0.75rem;
  color: #6c757d;
  background-color: #2a2d3a;
  border-top: 1px solid #3a3f4b;
  flex-wrap: wrap;
  transition: all 0.3s ease;
}

.waypoint-summary.collapsed {
  gap: 0.5rem;
  padding: 0.75rem 1rem;
}

.summary-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: fit-content;
}

.summary-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.7;
}

.summary-value {
  font-size: 0.875rem;
  font-weight: 500;
  color: #a2a5b9;
}

.waypoint-details {
  padding: 0 0.75rem 0.75rem 0.75rem;
  border-top: 1px solid #3a3f4b;
}

.detail-row.speed-row {
  border-left: 3px solid transparent;
  padding-left: 0.5rem;
  margin-left: -0.5rem;
}

.detail-row.speed-row .speed-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.speed-value.speed-feasible {
  color: #28a745;
}

.speed-value.speed-marginal {
  color: #ffc107;
}

.speed-value.speed-impossible {
  color: #dc3545;
}

.speed-warning-text {
  font-size: 0.75rem;
  color: #6c757d;
}

.waypoint-speed-warning {
  padding: 0.5rem 0.75rem;
  background-color: rgba(255, 193, 7, 0.1);
  border-top: 1px solid rgba(255, 193, 7, 0.2);
  font-size: 0.75rem;
  color: #ffc107;
}

.start-point .detail-value.start-indicator {
  color: #28a745;
  font-weight: 500;
}

.end-point .detail-value.end-indicator {
  color: #dc3545;
  font-weight: 500;
}

.detail-section {
  margin-top: 0.75rem;
}

.detail-section:first-child {
  margin-top: 0;
}

.detail-section h4 {
  margin: 0 0 0.5rem 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: #00d4ff;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-row {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.detail-label {
  flex: 0 0 100px;
  color: #6c757d;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.detail-value {
  flex: 1;
  color: #a2a5b9;
}

.detail-value.editable {
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.detail-value.editable:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.edit-single, .edit-coordinates {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.edit-input {
  background-color: #1f2128;
  border: 1px solid #3a3f4b;
  color: white;
  padding: 0.375rem 0.5rem;
  border-radius: 4px;
  font-size: 0.875rem;
  flex: 1;
}

.edit-input:focus {
  outline: none;
  border-color: #00d4ff;
  box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.1);
}

.edit-input-small {
  max-width: 100px;
}

.edit-buttons {
  display: flex;
  gap: 0.25rem;
}

.edit-btn {
  background: none;
  border: none;
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s ease;
}

.save-btn {
  color: #28a745;
  background-color: rgba(40, 167, 69, 0.1);
}

.save-btn:hover {
  background-color: rgba(40, 167, 69, 0.2);
}

.cancel-btn {
  color: #6c757d;
  background-color: rgba(108, 117, 125, 0.1);
}

.cancel-btn:hover {
  background-color: rgba(108, 117, 125, 0.2);
}

.edit-help {
  padding: 0.5rem 0.75rem;
  background-color: rgba(0, 212, 255, 0.05);
  border-top: 1px solid rgba(0, 212, 255, 0.1);
  font-size: 0.75rem;
  color: #00d4ff;
}

.edit-instructions {
  padding: 1rem 1.5rem;
  background-color: rgba(0, 212, 255, 0.02);
  border-top: 1px solid #3a3f4b;
  font-size: 0.75rem;
  color: #6c757d;
  text-align: center;
}

.detail-value.small {
  font-size: 0.75rem;
  line-height: 1.4;
}

.detail-value.highlight {
  color: #00d4ff;
  font-weight: 500;
}

.detail-input {
  flex: 1;
  background-color: #1f2128;
  border: 1px solid #3a3f4b;
  color: white;
  padding: 0.375rem 0.5rem;
  border-radius: 4px;
  font-size: 0.875rem;
  width: auto;
}

.detail-input:focus {
  outline: none;
  border-color: #00d4ff;
  box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.1);
}

.detail-unit {
  flex: 0 0 30px;
  color: #6c757d;
  text-align: left;
  margin-left: 0.5rem;
}

/* Scrollbar styling */
.waypoint-list::-webkit-scrollbar {
  width: 8px;
}

.waypoint-list::-webkit-scrollbar-track {
  background: #1f2128;
}

.waypoint-list::-webkit-scrollbar-thumb {
  background: #3a3f4b;
  border-radius: 4px;
}

.waypoint-list::-webkit-scrollbar-thumb:hover {
  background: #4a4f5b;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .waypoint-panel {
    width: 320px;
  }
  
  .waypoint-panel.collapsed {
    width: 280px;
  }
}

@media (max-width: 768px) {
  .waypoint-panel {
    width: 100%;
    max-height: 50vh;
    position: relative;
    border-radius: 12px 12px 0 0;
  }
  
  .waypoint-panel.collapsed {
    max-height: 120px;
  }

  .waypoint-panel-header {
    padding: 0.75rem 1rem;
    min-height: 50px;
  }
  
  .waypoint-panel-header h3 {
    font-size: 1rem;
  }
  
  .waypoint-list {
    max-height: calc(50vh - 120px);
    padding: 0.25rem;
  }
  
  .waypoint-item {
    margin-bottom: 0.375rem;
  }
  
  .waypoint-header {
    padding: 0.5rem;
  }
  
  .waypoint-details {
    padding: 0 0.5rem 0.5rem 0.5rem;
  }
  
  .detail-row {
    font-size: 0.8125rem;
  }
  
  .detail-label {
    flex: 0 0 80px;
    font-size: 0.75rem;
  }
  
  .waypoint-summary {
    padding: 0.5rem 1rem;
    gap: 0.75rem;
  }
  
  .waypoint-summary.collapsed {
    padding: 0.5rem 1rem;
    gap: 0.5rem;
  }
  
  .summary-item {
    flex: 1;
    min-width: auto;
  }
  
  .edit-instructions {
    padding: 0.75rem 1rem;
    font-size: 0.6875rem;
  }
}

@media (max-width: 480px) {
  .waypoint-panel-header {
    padding: 0.5rem 0.75rem;
  }
  
  .header-title-section {
    gap: 0.5rem;
  }
  
  .waypoint-panel-header h3 {
    font-size: 0.9375rem;
  }
  
  .waypoint-summary {
    gap: 0.5rem;
  }
  
  .summary-item {
    min-width: 70px;
  }
  
  .summary-label {
    font-size: 0.625rem;
  }
  
  .summary-value {
    font-size: 0.8125rem;
  }
}
