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

/* Global Font Reset for the Plugin */
#flyteam-root-container,
#flyteam-root-container h1, 
#flyteam-root-container h2, 
#flyteam-root-container h3, 
#flyteam-root-container h4,
#flyteam-root-container a,
#flyteam-root-container span,
#flyteam-root-container div,
#flyteam-root-container table,
#flyteam-root-container td,
#flyteam-root-container th,
#flyteam-root-container button {
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif !important;
  text-transform: none !important;
}

/* Increase specificity for the entire app to override theme styles */
#flyteam-root-container {
  display: block !important;
  background-color: transparent !important;
  color: #0f172a !important; /* text-slate-900 */
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
  line-height: 1.5 !important;
  box-sizing: border-box !important;
  position: relative !important;
  z-index: 1 !important;
}

#flyteam-root-container *, 
#flyteam-root-container *::before, 
#flyteam-root-container *::after {
  box-sizing: inherit !important;
}

/* Ensure Tailwind utilities have higher specificity */
#flyteam-root-container .bg-white,
#flyteam-root-container .bg-slate-50 { background-color: white !important; }
#flyteam-root-container .text-slate-900 { color: #0f172a !important; }
#flyteam-root-container .text-slate-500 { color: #64748b !important; }
#flyteam-root-container .border-slate-200 { border-color: #e2e8f0 !important; }

/* Robust button styles to counter aggressive WP themes */
#flyteam-root-container button {
  text-transform: none !important;
  letter-spacing: normal !important;
  box-shadow: none !important;
  border-width: 1px !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-family: inherit !important;
  margin: 0 !important;
  padding: 0.5rem 1rem !important;
  transition: all 0.2s !important;
  line-height: 1.2 !important;
  height: auto !important;
  width: auto !important;
  min-height: 0 !important;
  text-decoration: none !important;
}

#flyteam-root-container .w-full {
  width: 100% !important;
}

#flyteam-root-container .bg-blue-600 {
  background-color: #2563eb !important;
  color: white !important;
  border-color: transparent !important;
}

#flyteam-root-container .bg-blue-600:hover {
  background-color: #1d4ed8 !important;
}

#flyteam-root-container .bg-blue-50 {
  background-color: #eff6ff !important;
  color: #2563eb !important;
  border-color: transparent !important;
}

#flyteam-root-container .text-blue-600 {
  color: #2563eb !important;
}

#flyteam-root-container .rounded-lg,
#flyteam-root-container .rounded-xl,
#flyteam-root-container .rounded-2xl,
#flyteam-root-container .rounded-3xl,
#flyteam-root-container .rounded-full:not([class*="w-6"]), 
#flyteam-root-container [class*="rounded-"] {
  border-radius: 8px !important;
}

/* Ensure small circles stay circular */
#flyteam-root-container .rounded-full.w-3,
#flyteam-root-container .rounded-full.w-6,
#flyteam-root-container .rounded-full.w-8 {
  border-radius: 9999px !important;
}

#flyteam-root-container .shadow-lg {
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1) !important;
}

/* Reset for common WP theme leaks */
#flyteam-root-container p, 
#flyteam-root-container h1, 
#flyteam-root-container h2, 
#flyteam-root-container h3, 
#flyteam-root-container h4 {
  margin-bottom: 0 !important;
  margin-top: 0 !important;
  padding: 0 !important;
}

#flyteam-root-container ul, 
#flyteam-root-container li {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Mobile Responsiveness for Map & Table */
.flyteam-details-map,
.flyteam-details-map-viewer {
  display: block !important;
  width: 100% !important;
/*  height: 250px !important; */
/*  min-height: 200px !important; */
  position: relative !important;
  overflow: hidden !important;
  background-color: #f8fafc !important; /* bg-slate-50 */
}

@media (max-width: 768px) {
  /* High-specificity table container for mobile */
  #flyteam-root-container .flyteam-table-container {
    display: block !important;
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    margin-bottom: 1.5rem !important;
    position: relative !important;
    border-radius: 8px !important;
    box-shadow: inset 0 0 0 1px #e2e8f0 !important;
  }

  #flyteam-root-container .flyteam-table {
    display: table !important;
    width: 100% !important;
    min-width: 600px !important; /* Force content to be wide enough to scroll but stay readable */
    table-layout: fixed !important;
    border-collapse: collapse !important;
    margin: 0 !important;
  }

  /* Force headers and cells to be compact */
  #flyteam-root-container .flyteam-table th,
  #flyteam-root-container .flyteam-table td {
    padding: 0.75rem 0.5rem !important;
    font-size: 0.75rem !important;
    line-height: normal !important;
    vertical-align: middle !important;
    height: auto !important;
    white-space: normal !important; /* Allow wrapping within cells */
    word-break: break-word !important;
  }

  /* Date/Time specific stacking */
  #flyteam-root-container .flyteam-date-cell {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: center !important;
    gap: 2px !important;
    min-width: 70px !important;
  }

  #flyteam-root-container .flyteam-date-main {
    display: block !important;
    font-weight: 600 !important;
    color: #1e293b !important;
    font-size: 0.75rem !important;
    white-space: nowrap !important;
  }

  #flyteam-root-container .flyteam-date-sub {
    display: block !important;
    font-size: 0.65rem !important;
    color: #64748b !important;
    white-space: nowrap !important;
  }

  /* Spot/Location stacking */
  #flyteam-root-container .flyteam-spot-cell {
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
  }

  #flyteam-root-container .flyteam-spot-name {
    font-weight: 500 !important;
    display: block !important;
    color: #0f172a !important;
  }

  #flyteam-root-container .flyteam-country-name {
    font-size: 0.65rem !important;
    color: #94a3b8 !important;
    display: flex !important;
    align-items: center !important;
  }

  /* Column widths control */
  #flyteam-root-container .flyteam-table th:nth-child(2),
  #flyteam-root-container .flyteam-table td:nth-child(2) { width: 85px !important; }

  /* Detailed row adjustments */
  #flyteam-root-container .flyteam-details-row td {
    padding: 0 !important;
    background-color: #f8fafc !important;
  }

  #flyteam-root-container .flyteam-details-content {
    padding: 0 !important;
    width: 100% !important;
    border-top: 1px solid #e2e8f0 !important;
  }

  #flyteam-root-container .flyteam-details-info {
    padding: 1rem !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0.75rem !important;
  }

  #flyteam-root-container .flyteam-detail-item {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding-bottom: 0.5rem !important;
    border-bottom: 1px solid #f1f5f9 !important;
  }

  #flyteam-root-container .flyteam-detail-item:last-child {
    border-bottom: none !important;
  }

  #flyteam-root-container .flyteam-detail-label {
    font-size: 0.7rem !important;
    color: #64748b !important;
    display: flex !important;
    align-items: center !important;
  }

  #flyteam-root-container .flyteam-detail-value {
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    text-align: right !important;
  }

  /* Hide minor columns on narrow mobile */
  @media (max-width: 480px) {
    .hide-narrow {
      display: none !important;
    }
  }
}

/* Flexible Details Layout for Desktop */
#flyteam-root-container .flyteam-details-content {
  display: flex !important;
  flex-direction: row !important;
  width: 100% !important;
  min-height: 250px !important;
  background-color: white !important;
}

#flyteam-root-container .flyteam-details-map {
  flex: 1 !important;
  height: 100% !important;
  min-height: 250px !important;
  border-right: 1px solid #e2e8f0 !important;
}

#flyteam-root-container .flyteam-details-info {
  flex: 1 !important;
  padding: 1.5rem !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 1rem !important;
  background-color: white !important;
}

@media (max-width: 768px) {
  #flyteam-root-container .flyteam-details-content {
    flex-direction: column !important;
  }
  
  #flyteam-root-container .flyteam-details-map {
    width: 100% !important;
    height: 250px !important;
    border-right: none !important;
    border-bottom: 1px solid #e2e8f0 !important;
  }
}

/* Vertical Route Visualization - Final Refined */
#flyteam-root-container .flyteam-route-vertical {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.5rem !important;
  padding: 0 1rem !important;
  border-left: 1px dashed #e2e8f0 !important;
  border-right: 1px dashed #e2e8f0 !important;
  width: 150px !important;
  flex: 0 0 150px !important;
  background: #fcfcfd !important;
  margin: 0 auto !important;
}

#flyteam-root-container .flyteam-route-point {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 0.25rem !important;
  width: 100% !important;
}

#flyteam-root-container .flyteam-marker-start-static,
#flyteam-root-container .flyteam-marker-end-static,
#flyteam-root-container .flyteam-marker-dot {
  width: 10px !important;
  height: 10px !important;
  border-radius: 50% !important;
  flex-shrink: 0 !important;
  display: inline-block !important;
}

#flyteam-root-container .flyteam-marker-start-static,
#flyteam-root-container .flyteam-marker-start,
#flyteam-root-container .bg-green-500 {
  background-color: #10b981 !important; /* emerald-500 */
}

#flyteam-root-container .flyteam-marker-end-static,
#flyteam-root-container .flyteam-marker-finish,
#flyteam-root-container .bg-red-500 {
  background-color: #ef4444 !important; /* red-500 */
}

/* MapLibre Markers */
.flyteam-marker-start {
  width: 12px;
  height: 12px;
  background-color: #10b981;
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
  z-index: 10;
}

.flyteam-marker-end {
  width: 12px;
  height: 12px;
  background-color: #ef4444;
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
  z-index: 10;
}

#flyteam-root-container .flyteam-route-name {
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  color: #1e293b !important;
  text-align: center !important;
  max-width: 130px !important;
  word-break: break-word !important;
}

#flyteam-root-container .flyteam-route-dots {
  display: flex !important;
  flex-direction: column !important;
  gap: 5px !important;
  align-items: center !important;
  justify-content: center !important;
  height: 25px !important;
  margin: 2px 0 !important;
}

#flyteam-root-container .flyteam-route-dot {
  display: block !important;
  width: 3px !important;
  height: 3px !important;
  background-color: #cbd5e1 !important; /* slate-300 */
  border-radius: 50% !important;
}

#flyteam-root-container .flyteam-route-stats {
  font-size: 0.7rem !important;
  font-weight: 700 !important;
  color: #64748b !important;
  background: #ffffff !important;
  padding: 0.35rem 0.75rem !important;
  border-radius: 9999px !important;
  white-space: nowrap !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
  text-transform: uppercase !important;
  letter-spacing: 0.025em !important;
  line-height: normal !important;
}

@media (max-width: 768px) {
  #flyteam-root-container .flyteam-route-vertical {
    border-left: none !important;
    border-right: none !important;
    border-top: 1px dashed #e2e8f0 !important;
    border-bottom: 1px dashed #e2e8f0 !important;
    width: 100% !important;
    flex: 0 0 auto !important;
    padding: 1.5rem !important;
  }
}

@media (max-width: 1024px) {
  .hide-tablet {
    display: none !important;
  }
}

/* Unified Map Toolbar Concept */
.flyteam-map-toolbar {
  position: absolute !important;
  top: 10px !important;
  left: 10px !important;
  right: 10px !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: flex-start !important;
  pointer-events: none !important;
  z-index: 10 !important;
}

.flyteam-map-toolbar-group {
  display: flex !important;
  gap: 8px !important;
  pointer-events: auto !important;
}

.flyteam-map-switcher.flyteam-map-switcher {
  display: flex !important;
  background: rgba(255, 255, 255, 0.9) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  padding: 2px !important;
  border-radius: 9px !important;
  border: 1px solid rgba(255, 255, 255, 0.5) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
  gap: 1px !important;
  position: relative !important;
  top: 0 !important;
  left: 0 !important;
}

#flyteam-root-container .map-style-btn.map-style-btn {
  border: none !important;
  background: transparent !important;
  color: #64748b !important;
  padding: 0 !important;
  min-width: 58px !important;
  width: 58px !important;
  height: 24px !important;
  border-radius: 7px !important;
  font-size: 10px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  white-space: nowrap !important;
  text-align: center !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
}

#flyteam-root-container .map-style-btn.active.map-style-btn {
  background: #ffffff !important;
  color: #2563eb !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08) !important;
}

#flyteam-root-container .custom-fullscreen-btn.custom-fullscreen-btn {
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1px solid rgba(255, 255, 255, 0.5) !important;
  background: rgba(255, 255, 255, 0.9) !important;
  backdrop-filter: blur(8px) !important;
  border-radius: 9px !important;
  cursor: pointer !important;
  color: #64748b !important;
  transition: all 0.2s ease !important;
  margin: 0 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

#flyteam-root-container .custom-fullscreen-btn.custom-fullscreen-btn:hover {
  color: #2563eb !important;
  background: #ffffff !important;
  transform: translateY(-1px);
}

.custom-fullscreen-btn svg {
  width: 13px !important;
  height: 13px !important;
}

/* MapLibre Nav Control override - more generic because we move it */
.maplibregl-ctrl-group.maplibregl-ctrl {
  margin: 0 !important;
  border: 1px solid rgba(255, 255, 255, 0.5) !important;
  border-radius: 9px !important;
  overflow: hidden !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
  background: rgba(255, 255, 255, 0.9) !important;
  backdrop-filter: blur(8px) !important;
}

.maplibregl-ctrl-group button {
  width: 28px !important;
  height: 28px !important;
  background-color: transparent !important;
}

.maplibregl-ctrl-compass .maplibregl-ctrl-icon {
  opacity: 1 !important;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16.24 7.76a6 6 0 1 0-8.49 8.49 6 6 0 0 0 8.49-8.49Z'/%3E%3Cpath d='M12 7v10'/%3E%3Cpath d='M9 14 12 17 15 14'/%3E%3C/svg%3E") !important;
  background-size: 16px !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  filter: none !important;
}

.maplibregl-ctrl-compass .maplibregl-ctrl-icon[style*="transform"] {
    /* Preserve rotation set by MapLibre */
}
