/* src/styles/WaypointModal.css */
@import './DesignTokens.css';

/* =============================================== */
/* MODAL OVERLAY & CONTAINER */
/* =============================================== */

/* Heading section styling (aviation standard) */
.heading-section {
  margin-top: 1.5rem;
}

.heading-input-group {
  position: relative;
}

.heading-display {
  color: #00d4ff;
  font-weight: 500;
  margin-left: 0.5rem;
}

.heading-mode-selector {
  margin-bottom: 1rem;
}

.radio-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.radio-option {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid #3a3f4b;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.radio-option:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #00d4ff;
}

.radio-option input[type="radio"] {
  margin-right: 0.5rem;
  accent-color: #00d4ff;
}

.radio-label {
  color: #e0e4e7;
  font-size: 0.875rem;
}

.auto-heading-value {
  color: #00d4ff;
  font-weight: 500;
}

.disabled-input {
  background: rgba(255, 255, 255, 0.05) !important;
  color: #888 !important;
  cursor: not-allowed !important;
}

.heading-context {
  margin-top: 0.5rem;
}

.heading-note,
.auto-heading-note,
.manual-heading-note,
.first-waypoint-note {
  display: block;
  color: #888;
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

.auto-heading-note {
  color: #00d4ff;
}

.manual-heading-note {
  color: #ffc107;
}

.waypoint-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(4px);
  animation: backdropFadeIn 0.3s ease;
}

.waypoint-modal {
  background: #1f2128;
  border-radius: 12px;
  box-shadow: 
    0 20px 25px -5px rgba(0, 0, 0, 0.4),
    0 10px 10px -5px rgba(0, 0, 0, 0.2);
  width: 90%;
  max-width: 500px;
  max-height: 85vh;
  overflow: hidden;
  animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 2px solid #3a3f4b;
}

/* =============================================== */
/* MODAL HEADER */
/* =============================================== */

.waypoint-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #3a3f4b;
  background: linear-gradient(135deg, #2a2d3a, #1f2128);
}

.waypoint-modal-header h3 {
  margin: 0;
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 600;
}

.waypoint-modal-close {
  background: none;
  border: none;
  color: #a2a5b9;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: all 0.2s ease;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.waypoint-modal-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

/* =============================================== */
/* MODAL BODY */
/* =============================================== */

.waypoint-modal-body {
  padding: 1.5rem;
  max-height: 60vh;
  overflow-y: auto;
}

/* =============================================== */
/* LOCATION INFORMATION */
/* =============================================== */

.waypoint-location-info {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: rgba(0, 212, 255, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(0, 212, 255, 0.2);
}

.smart-defaults-info {
  padding: 0.75rem;
  background: rgba(0, 212, 255, 0.08);
  border-radius: 6px;
  border-left: 3px solid #00d4ff;
}

.defaults-note {
  font-size: 0.75rem;
  color: #00d4ff;
  font-weight: 500;
  margin: 0;
}

.location-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.location-item label {
  font-size: 0.75rem;
  color: #a2a5b9;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.location-item span {
  font-size: 0.9rem;
  color: #00d4ff;
  font-weight: 600;
  font-family: 'Monaco', 'Courier New', monospace;
}

/* =============================================== */
/* INPUT GROUPS */
/* =============================================== */

.waypoint-input-group,
.altitude-section,
.time-input-group {
  margin-bottom: 1.5rem;
}

.waypoint-input-group label,
.input-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: #ffffff;
}

.time-constraint {
  font-size: 0.75rem;
  color: #a2a5b9;
  font-weight: 400;
  margin-left: 0.5rem;
}

.waypoint-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: #2a2d3a;
  border: 2px solid #3a3f4b;
  border-radius: 8px;
  color: #ffffff;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  font-family: 'Monaco', 'Courier New', monospace;
}

.waypoint-input:focus {
  outline: none;
  border-color: #00d4ff;
  background: #1a1c23;
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.waypoint-input::placeholder {
  color: #6c757d;
}

.waypoint-input.validation-error,
.waypoint-input:invalid,
.waypoint-input.error {
  border-color: #dc3545;
  background: rgba(220, 53, 69, 0.1);
}

.waypoint-input.warning {
  border-color: #ffc107;
  background: rgba(255, 193, 7, 0.1);
}

.input-hint {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: #a2a5b9;
}

/* =============================================== */
/* ALTITUDE CONTEXT */
/* =============================================== */

.altitude-context {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem;
  background: #2a2d3a;
  border-radius: 6px;
  border-left: 4px solid #00d4ff;
  margin-top: 0.5rem;
}

.terrain-note,
.agl-note {
  font-size: 0.75rem;
  color: #a2a5b9;
  font-family: 'Monaco', 'Courier New', monospace;
}

.terrain-note strong,
.agl-note strong {
  color: #ffffff;
  font-weight: 600;
}

.terrain-warning {
  color: #ffc107;
  font-weight: 500;
}

.altitude-source {
  font-size: 0.75rem;
  color: #6c757d;
  font-style: italic;
  margin-top: 0.25rem;
}

.time-calculation {
  font-size: 0.75rem;
  color: #6c757d;
  margin-top: 0.5rem;
  font-style: italic;
}

.loading-indicator {
  color: #00d4ff;
  animation: spin 1s linear infinite;
}

/* =============================================== */
/* SPEED DISPLAY */
/* =============================================== */

.speed-section,
.speed-calculation {
  padding: 1rem;
  background: #2a2d3a;
  border-radius: 8px;
  border-left: 4px solid #00d4ff;
  margin-bottom: 1.5rem;
}

.speed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.speed-header label,
.speed-label {
  font-size: 0.9rem;
  /* color: #ffffff; */
  font-weight: 500;
}

.speed-value {
  font-family: 'Monaco', 'Courier New', monospace;
  font-weight: 600;
  font-size: 1rem;
}

.speed-kmh {
  font-size: 0.8rem;
  color: #a2a5b9;
  font-weight: normal;
  margin-left: 0.5rem;
}

.speed-note {
  font-size: 0.75rem;
  color: #6c757d;
  margin-top: 0.5rem;
  font-style: italic;
}

.speed-indicator {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.speed-indicator-green {
  background: rgba(40, 167, 69, 0.2);
  color: #28a745;
  border: 1px solid rgba(40, 167, 69, 0.3);
}

.speed-indicator-green::before {
  content: "✓";
}

.speed-indicator-yellow {
  background: rgba(255, 193, 7, 0.2);
  color: #ffc107;
  border: 1px solid rgba(255, 193, 7, 0.3);
}

.speed-indicator-yellow::before {
  content: "⚠";
}

.speed-indicator-red {
  background: rgba(220, 53, 69, 0.2);
  color: #dc3545;
  border: 1px solid rgba(220, 53, 69, 0.3);
}

.speed-indicator-red::before {
  content: "⚠";
}

.speed-indicator-gray {
  background: rgba(108, 117, 125, 0.2);
  color: #6c757d;
  border: 1px solid rgba(108, 117, 125, 0.3);
}

.speed-status {
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

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

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

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

.speed-warning,
.speed-warning-badge {
  font-size: 0.75rem;
  color: #dc3545;
  background: rgba(220, 53, 69, 0.1);
  padding: 0.5rem;
  border-radius: 4px;
  margin-top: 0.5rem;
  border-left: 3px solid #dc3545;
}

/* =============================================== */
/* VALIDATION MESSAGES */
/* =============================================== */

.validation-message,
.validation-error,
.validation-warning {
  padding: 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  margin-top: 0.5rem;
}

.validation-message.error,
.validation-error {
  background: rgba(220, 53, 69, 0.1);
  color: #dc3545;
  border-left: 4px solid #dc3545;
}

.validation-message.warning,
.validation-warning {
  background: rgba(255, 193, 7, 0.1);
  color: #ffc107;
  border-left: 4px solid #ffc107;
}

/* =============================================== */
/* MODAL FOOTER */
/* =============================================== */

.waypoint-modal-footer {
  display: flex;
  gap: 0.75rem;
  padding: 1.5rem;
  border-top: 1px solid #3a3f4b;
  background: rgba(0, 0, 0, 0.1);
}

.modal-btn {
  flex: 1;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-width: 100px;
}

.modal-btn-cancel,
.modal-btn.secondary {
  background: #3a3f4b;
  color: #a2a5b9;
  border: 1px solid #4a4f5b;
}

.modal-btn-cancel:hover,
.modal-btn.secondary:hover {
  background: #4a4f5b;
  color: #ffffff;
}

.modal-btn-confirm,
.modal-btn.primary {
  background: #00d4ff;
  color: #000000;
  border: 1px solid #00d4ff;
}

.modal-btn-confirm:hover:not(:disabled),
.modal-btn.primary:hover:not(:disabled) {
  background: #00a8cc;
  border-color: #00a8cc;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 212, 255, 0.3);
}

.modal-btn-confirm:disabled,
.modal-btn:disabled {
  background: #6c757d;
  color: #ffffff;
  border-color: #6c757d;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: 0.5;
}

/* =============================================== */
/* ANIMATIONS */
/* =============================================== */

@keyframes backdropFadeIn {
  from {
    opacity: 0;
    backdrop-filter: blur(0px);
  }
  to {
    opacity: 1;
    backdrop-filter: blur(4px);
  }
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes spin {
  to { 
    transform: rotate(360deg); 
  }
}

/* =============================================== */
/* RESPONSIVE DESIGN */
/* =============================================== */

@media (max-width: 768px) {
  .waypoint-modal {
    width: 95%;
    margin: 1rem;
  }
  
  .waypoint-modal-header,
  .waypoint-modal-body,
  .waypoint-modal-footer {
    padding: 1rem;
  }
  
  .waypoint-location-info {
    gap: 0.75rem;
  }
  
  .smart-defaults-info {
    padding: 0.5rem;
  }
  
  .speed-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .waypoint-modal-footer {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .waypoint-modal {
    width: 98%;
    margin: 0.5rem;
  }
  
  .location-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
}

/* =============================================== */
/* ACCESSIBILITY */
/* =============================================== */

@media (prefers-reduced-motion: reduce) {
  .waypoint-modal-overlay,
  .waypoint-modal,
  .loading-indicator {
    animation: none;
  }
  
  .modal-btn:hover {
    transform: none;
  }
}

@media (prefers-contrast: high) {
  .waypoint-modal {
    border-width: 3px;
  }
  
  .validation-message.error,
  .validation-error {
    border-left-width: 6px;
  }
  
  .modal-btn {
    border-width: 2px;
  }
}

/* Focus management */
.waypoint-input:focus-visible,
.modal-btn:focus-visible,
.waypoint-modal-close:focus-visible {
  outline: 2px solid #00d4ff;
  outline-offset: 2px;
}