/* ============================================================
   View it, Visit it — Design System
   Premium dark theme with glassmorphism and gradient accents
   ============================================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* --- Design Tokens --- */
:root {
  /* Background */
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.7);
  --bg-glass: rgba(255, 255, 255, 0.05);
  --bg-glass-hover: rgba(255, 255, 255, 0.08);

  /* Accent gradient */
  --accent-start: #667eea;
  --accent-end: #764ba2;
  --accent-gradient: linear-gradient(135deg, var(--accent-start), var(--accent-end));
  --accent-glow: rgba(102, 126, 234, 0.3);

  /* Text */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-accent: #a5b4fc;

  /* Status */
  --success: #34d399;
  --warning: #fbbf24;
  --error: #f87171;
  --info: #60a5fa;

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glass: rgba(255, 255, 255, 0.12);

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px var(--accent-glow);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Animated background gradient */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(102, 126, 234, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(118, 75, 162, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(52, 211, 153, 0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* --- Typography --- */
h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

/* --- App Shell --- */
#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

/* --- Header / Navbar --- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: rgba(10, 14, 26, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-size: 1.3rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.navbar-brand .logo-icon {
  font-size: 1.6rem;
}

.navbar-steps {
  display: flex;
  gap: 8px;
  align-items: center;
}

.step-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-base);
}

.step-indicator.active {
  color: #fff;
  background: var(--accent-gradient);
  border-color: transparent;
  box-shadow: var(--shadow-glow);
}

.step-indicator.completed {
  color: var(--success);
  border-color: rgba(52, 211, 153, 0.3);
  background: rgba(52, 211, 153, 0.1);
}

.step-connector {
  width: 24px;
  height: 2px;
  background: var(--border-subtle);
  border-radius: 1px;
}

.step-connector.completed {
  background: var(--success);
}

/* --- Phase Containers --- */
.phase {
  display: none;
  min-height: 100vh;
  padding-top: 80px;
  animation: phaseEnter 0.5s ease-out;
}

.phase.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

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

/* --- Phase 1: Image Upload --- */
.upload-container {
  max-width: 640px;
  width: 90%;
  text-align: center;
}

.upload-title {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 8px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.upload-subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-bottom: 40px;
  font-weight: 300;
}

.dropzone {
  position: relative;
  border: 2px dashed var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 60px 40px;
  cursor: pointer;
  transition: all var(--transition-base);
  background: var(--bg-glass);
  overflow: hidden;
}

.dropzone:hover,
.dropzone.drag-over {
  border-color: var(--accent-start);
  background: rgba(102, 126, 234, 0.05);
  box-shadow: var(--shadow-glow);
}

.dropzone-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  display: block;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.dropzone-text {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.dropzone-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* Target internal preview elements */
.dropzone .image-preview {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: var(--radius-md);
  margin-bottom: 0;
}

.dropzone.has-image {
  padding: 20px;
}

/* Origin badge */
.origin-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  font-size: 0.85rem;
  color: var(--text-secondary);
  animation: fadeInUp 0.5s ease-out;
}

.origin-badge .origin-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s infinite;
}

/* Analyze button */
.btn-analyze {
  display: none;
  margin-top: 28px;
  padding: 14px 48px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-full);
  background: var(--accent-gradient);
  color: #fff;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-md);
  letter-spacing: 0.02em;
}

.btn-analyze.visible {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  animation: fadeInUp 0.3s ease-out;
}

.btn-analyze:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow), var(--shadow-lg);
}

.btn-analyze:active {
  transform: translateY(0);
}

.btn-analyze:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* --- Phase 2: Voice Validation --- */
.voice-container {
  max-width: 800px;
  width: 90%;
  padding: 0 20px;
}

.voice-title {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
}

.voice-subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 36px;
  font-weight: 300;
}

/* AI Results cards */
.locations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}

.location-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition-base);
  animation: fadeInUp 0.4s ease-out both;
}

.location-card:nth-child(1) { animation-delay: 0.05s; }
.location-card:nth-child(2) { animation-delay: 0.1s; }
.location-card:nth-child(3) { animation-delay: 0.15s; }
.location-card:nth-child(4) { animation-delay: 0.2s; }
.location-card:nth-child(5) { animation-delay: 0.25s; }

.location-card:hover {
  background: var(--bg-glass-hover);
  border-color: var(--accent-start);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.location-card-city {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.location-card-country {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.location-card-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.location-card-meta span {
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.confidence-bar {
  width: 100%;
  height: 4px;
  background: var(--bg-secondary);
  border-radius: 2px;
  margin-top: 12px;
  overflow: hidden;
}

.confidence-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--accent-gradient);
  transition: width 0.8s ease-out;
}

/* Microphone button */
.mic-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.mic-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid var(--border-glass);
  background: var(--bg-glass);
  color: var(--text-primary);
  font-size: 2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
  position: relative;
}

.mic-btn:hover {
  border-color: var(--accent-start);
  background: rgba(102, 126, 234, 0.1);
  box-shadow: var(--shadow-glow);
}

.mic-btn.recording {
  border-color: var(--error);
  background: rgba(248, 113, 113, 0.15);
  animation: micPulse 1.5s infinite;
}

@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.4); }
  50% { box-shadow: 0 0 0 20px rgba(248, 113, 113, 0); }
}

.mic-status {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.mic-status.recording {
  color: var(--error);
}

.mic-status.processing {
  color: var(--warning);
}

/* Confirm button */
.btn-confirm {
  display: block;
  margin: 0 auto;
  padding: 14px 48px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-full);
  background: var(--accent-gradient);
  color: #fff;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-md);
}

.btn-confirm:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow), var(--shadow-lg);
}

.btn-confirm:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Transcript box */
.transcript-box {
  display: none;
  margin: 16px auto 24px;
  max-width: 600px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.2);
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-align: center;
}

.transcript-box.visible {
  display: block;
  animation: fadeInUp 0.3s ease-out;
}

.transcript-label {
  display: block;
  font-weight: 600;
  color: var(--success);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

/* --- Phase 3: Flight Dashboard --- */
.dashboard-container {
  width: 100%;
  min-height: 100vh;
  padding-top: 80px;
  position: relative;
}

#flight-map {
  width: 100%;
  height: calc(100vh - 80px);
  border-radius: 0;
}

/* --- Dashboard / Leaflet Customizations --- */
.leaflet-tile {
  /* Modo claro activado */
}

/* Custom Leaflet price markers */
.price-marker {
  background: var(--accent-gradient);
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 800;
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(0, 0, 0, 0.1);
  text-align: center;
  transform: translate(-50%, -50%);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: max-content;
}

.price-marker:hover {
  transform: translate(-50%, -50%) scale(1.15);
  box-shadow: var(--shadow-glow), var(--shadow-lg);
}

.price-marker.origin {
  background: linear-gradient(135deg, var(--success), #059669);
}

/* Destination detail panel */
.dest-panel {
  position: fixed;
  right: -420px;
  top: 80px;
  width: 400px;
  height: calc(100vh - 80px);
  background: rgba(10, 14, 26, 0.95);
  backdrop-filter: blur(20px);
  border-left: 1px solid var(--border-glass);
  z-index: 900;
  transition: right var(--transition-slow);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.dest-panel.open {
  right: 0;
}

.dest-panel-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  z-index: 2;
}

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

.dest-panel-image {
  width: 100%;
  height: 220px;
  object-fit: cover;
}

.dest-panel-body {
  padding: 24px;
  flex: 1;
}

.dest-panel-city {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.dest-panel-country {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.dest-panel-price {
  font-size: 2rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 24px;
}

.dest-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.dest-info-item {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
}

.dest-info-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.dest-info-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.dest-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  padding: 16px;
  background: var(--bg-glass);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

/* Restart button */
.btn-restart {
  position: fixed;
  bottom: 28px;
  left: 28px;
  z-index: 950;
  padding: 12px 24px;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  background: rgba(10, 14, 26, 0.9);
  backdrop-filter: blur(12px);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-restart:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
  border-color: var(--accent-start);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* --- Loading overlay --- */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(8px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.loading-overlay.visible {
  display: flex;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-glass);
  border-top-color: var(--accent-start);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* --- Utility Animations --- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-glass);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .navbar {
    padding: 12px 16px;
  }

  .navbar-brand {
    font-size: 1.1rem;
  }

  .step-indicator {
    font-size: 0.65rem;
    padding: 4px 10px;
  }

  .step-connector {
    width: 12px;
  }

  .upload-title {
    font-size: 1.8rem;
  }

  .dropzone {
    padding: 40px 24px;
  }

  .locations-grid {
    grid-template-columns: 1fr;
  }

  .dest-panel {
    width: 100%;
    right: -100%;
  }

  .dest-info-grid {
    grid-template-columns: 1fr;
  }
}
