/* JetBlue Route Mind Map Styles */
:root {
  --jetblue-blue: #0B5394;
  --jetblue-light: #4A90E2;
  --jetblue-dark: #003366;
  --fare-cheap: #22c55e;
  --fare-moderate: #f59e0b;
  --fare-expensive: #ef4444;
  --fare-premium: #8b5cf6;
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Header */
.app-header {
  background: linear-gradient(135deg, var(--jetblue-blue), var(--jetblue-light));
  color: white;
  padding: 1rem 2rem;
  box-shadow: var(--shadow-md);
}

.header-content h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.header-content p {
  opacity: 0.9;
  font-size: 0.95rem;
}

/* Controls */
.controls {
  background: var(--bg-secondary);
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.search-container {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.search-container input {
  padding: 0.5rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: 0.5rem;
  font-size: 0.95rem;
  min-width: 250px;
  transition: border-color 0.2s;
}

.search-container input:focus {
  outline: none;
  border-color: var(--jetblue-blue);
}

.action-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

button {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0.5rem;
  background: var(--jetblue-blue);
  color: white;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

button:hover {
  background: var(--jetblue-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

button:active {
  transform: translateY(0);
}

/* Main content */
.app-main {
  display: grid;
  grid-template-columns: 1fr 300px;
  min-height: calc(100vh - 200px);
  gap: 1rem;
  padding: 1rem 2rem;
}

.mindmap-container {
  background: var(--bg-secondary);
  border-radius: 0.75rem;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

#mindmap {
  width: 100%;
  height: 100%;
  min-height: 600px;
}

/* Loading overlay */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.loading-spinner {
  text-align: center;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-color);
  border-top: 4px solid var(--jetblue-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-overlay.hidden {
  display: none;
}

/* Info panel */
.info-panel {
  background: var(--bg-secondary);
  border-radius: 0.75rem;
  box-shadow: var(--shadow-md);
  padding: 1rem;
  height: fit-content;
  max-height: 80vh;
  overflow-y: auto;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.panel-header h3 {
  color: var(--jetblue-blue);
  font-size: 1.1rem;
}

.close-btn {
  background: none;
  color: var(--text-secondary);
  padding: 0.25rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  font-size: 1.2rem;
  line-height: 1;
}

.close-btn:hover {
  background: var(--bg-primary);
  color: var(--text-primary);
}

/* Footer */
.app-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 1rem 2rem;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.stats-display {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.legend h4 {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.legend-items {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.legend-item {
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  background: var(--bg-primary);
}

.legend-item.cheap { color: var(--fare-cheap); }
.legend-item.moderate { color: var(--fare-moderate); }
.legend-item.expensive { color: var(--fare-expensive); }
.legend-item.premium { color: var(--fare-premium); }

/* Search suggestions */
.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 0.5rem 0.5rem;
  box-shadow: var(--shadow-md);
  max-height: 200px;
  overflow-y: auto;
  z-index: 20;
  display: none;
}

.search-suggestions.show {
  display: block;
}

.suggestion-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.2s;
}

.suggestion-item:hover {
  background: var(--bg-primary);
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-code {
  font-weight: 600;
  color: var(--jetblue-blue);
}

.suggestion-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: var(--bg-secondary);
  border-radius: 0.75rem;
  box-shadow: var(--shadow-lg);
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-body {
  padding: 1rem;
}

/* SVG styles for mind map */
.node {
  cursor: pointer;
}

.node.expandable {
  cursor: pointer;
}

.node.not-expandable {
  cursor: default;
  opacity: 0.7;
}

.node circle {
  stroke: var(--jetblue-blue);
  stroke-width: 2px;
  transition: all 0.3s;
}

.node:hover circle {
  stroke-width: 3px;
  transform: scale(1.1);
}

.node text {
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  text-anchor: middle;
  pointer-events: none;
  fill: var(--text-primary);
}

.link {
  stroke: var(--text-secondary);
  stroke-width: 2px;
  fill: none;
  opacity: 0.7;
  transition: all 0.3s;
}

.link:hover {
  stroke-width: 3px;
  opacity: 1;
}

.link.cheap { stroke: var(--fare-cheap); }
.link.moderate { stroke: var(--fare-moderate); }
.link.expensive { stroke: var(--fare-expensive); }
.link.premium { stroke: var(--fare-premium); }

.fare-label {
  font-family: inherit;
  font-size: 10px;
  font-weight: 500;
  text-anchor: middle;
  pointer-events: none;
  fill: var(--text-primary);
  background: var(--bg-secondary);
}

/* Responsive design */
@media (max-width: 1024px) {
  .app-main {
    grid-template-columns: 1fr;
  }
  
  .info-panel {
    order: -1;
    max-height: 200px;
  }
}

@media (max-width: 768px) {
  .controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .search-container {
    flex-direction: column;
  }
  
  .search-container input {
    min-width: auto;
    width: 100%;
  }
  
  .action-buttons {
    justify-content: center;
  }
  
  .app-main {
    padding: 0.5rem;
  }
  
  .footer-content {
    flex-direction: column;
    text-align: center;
  }
}

/* Utility classes */
.hidden {
  display: none !important;
}

.fade-in {
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Message content styling */
.message-content {
  padding: 1rem;
  border-radius: 0.5rem;
  border-left: 4px solid;
  margin: 0.5rem 0;
}

.message-content.warning {
  background: #fef3cd;
  border-color: #f59e0b;
  color: #92400e;
}

.message-content.error {
  background: #fef2f2;
  border-color: #ef4444;
  color: #dc2626;
}

.message-content.info {
  background: #dbeafe;
  border-color: #3b82f6;
  color: #1d4ed8;
}

.message-tip {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid currentColor;
  opacity: 0.7;
}

/* Hierarchy styling */
.level-badge {
  background: var(--jetblue-light);
  color: white;
  padding: 0.125rem 0.375rem;
  border-radius: 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 0.5rem;
}

.hierarchy-info {
  margin: 0.5rem 0;
  padding: 0.5rem;
  background: var(--bg-primary);
  border-radius: 0.375rem;
  border-left: 3px solid var(--jetblue-blue);
}

.destination-list {
  max-height: 300px;
  overflow-y: auto;
}

.destination-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.375rem 0.5rem;
  margin: 0.25rem 0;
  border-radius: 0.25rem;
  background: var(--bg-primary);
  border-left: 3px solid;
}

.destination-item.cheap { border-color: var(--fare-cheap); }
.destination-item.moderate { border-color: var(--fare-moderate); }
.destination-item.expensive { border-color: var(--fare-expensive); }
.destination-item.premium { border-color: var(--fare-premium); }

.dest-city {
  font-weight: 600;
  color: var(--jetblue-blue);
}

.dest-fare {
  font-weight: 500;
  color: var(--text-secondary);
}
