/* ============================================
   FleetLeaks Terminal Archive Styles
   ============================================ */

/* Archive Container */
.fl-terminal-archive {
  max-width: min(1400px, 94vw);
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* Hero Introduction */
.fl-term-hero {
  max-width: 900px;
  margin: 0 auto 3rem;
  padding: 2rem;
  background: linear-gradient(135deg, #f8fafc 0%, #eef2f7 100%);
  border-radius: 12px;
  line-height: 1.7;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.fl-term-hero p {
  margin-bottom: 1rem;
  color: #1e293b;
  font-size: 1.05rem;
}

.fl-term-hero p:last-child {
  margin-bottom: 0;
}

/* Statistics Dashboard */
.fl-term-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.25rem;
  margin-bottom: 3rem;
}

.fl-stat-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 1.75rem 1.5rem;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fl-stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.fl-stat-card.fl-stat-major {
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
}

.fl-stat-card.fl-stat-active {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.fl-stat-card.fl-stat-sanction {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.fl-stat-number {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.5rem;
  font-variant-numeric: tabular-nums;
}

.fl-stat-label {
  font-size: 0.9rem;
  opacity: 0.95;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* Map Container */
.fl-term-map-container {
  position: relative;
  margin-bottom: 3rem;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

#fl-terminal-map {
  height: 600px;
  width: 100%;
  z-index: 1;
}

/* Map Legend */
.fl-map-legend {
  position: absolute;
  bottom: 20px;
  left: 20px;
  background: white;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  min-width: 200px;
}

.fl-legend-title {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  color: #1e293b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.fl-legend-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  border-radius: 6px;
  transition: background-color 0.2s ease;
  user-select: none;
}

.fl-legend-item:hover {
  background-color: #f8fafc;
}

.fl-legend-item:last-child {
  margin-bottom: 0;
}

.fl-legend-item.fl-legend-inactive {
  opacity: 0.4;
}

.fl-legend-marker {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.fl-legend-item span:last-child {
  font-size: 0.9rem;
  color: #475569;
}

/* Custom Marker Styles */
.fl-custom-marker {
  background: transparent;
  border: none;
}

.fl-terminal-marker {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  position: relative;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.fl-terminal-marker:hover {
  transform: scale(1.2);
  z-index: 1000;
}

.fl-marker-pulse {
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  border-radius: 50%;
  animation: fl-pulse 2s ease-out infinite;
  opacity: 0;
}

@keyframes fl-pulse {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

/* Marker Cluster Styles */
/*
.fl-marker-cluster {
  background-color: rgba(102, 126, 234, 0.6);
  border-radius: 50%;
  text-align: center;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.fl-marker-cluster div {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.fl-marker-cluster span {
  color: white;
  font-weight: 700;
  font-size: 14px;
}

.fl-cluster-small {
  width: 40px !important;
  height: 40px !important;
}

.fl-cluster-medium {
  width: 50px !important;
  height: 50px !important;
  background-color: rgba(237, 137, 54, 0.6);
}

.fl-cluster-large {
  width: 60px !important;
  height: 60px !important;
  background-color: rgba(220, 38, 38, 0.6);
}
*/
/* Popup Styles */
.fl-terminal-popup {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.fl-terminal-popup .leaflet-popup-content-wrapper {
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
}

.fl-terminal-popup .leaflet-popup-content {
  margin: 0;
  min-width: 250px;
}

.fl-popup-header {
  position: relative;
}

.fl-popup-img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
}

.fl-popup-header h3 {
  margin: 0;
  padding: 1rem;
  font-size: 1.1rem;
  line-height: 1.3;
}

.fl-popup-header h3 a {
  color: #1e293b;
  text-decoration: none;
  transition: color 0.2s ease;
}

.fl-popup-header h3 a:hover {
  color: #667eea;
}

.fl-popup-category {
  display: inline-block;
  margin: 0.5rem 1rem;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.fl-popup-body {
  padding: 0 1rem 1rem;
}

.fl-popup-body p {
  margin: 0.5rem 0;
  font-size: 0.9rem;
  color: #475569;
}

.fl-popup-body strong {
  color: #1e293b;
}

.fl-sanction-flag {
  color: #dc2626;
  font-weight: 600;
}

.fl-popup-link {
  display: inline-block;
  margin-top: 0.5rem;
  color: #667eea;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease;
}

.fl-popup-link:hover {
  color: #4f46e5;
  text-decoration: underline;
}

/* Filters Section */
.fl-term-filters {
  background: #f8fafc;
  padding: 1.75rem;
  border-radius: 12px;
  margin-bottom: 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.fl-term-filters form {
  display: flex;
  gap: 0.75rem;
  align-items: end;
  flex-wrap: wrap;
}

.fl-filter-group {
  flex: 1;
  min-width: 140px;
}

.fl-filter-search {
  flex: 1.5;
  min-width: 200px;
}

.fl-filter-group {
  display: flex;
  flex-direction: column;
}

.fl-filter-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.fl-filter-group select,
.fl-filter-group input[type="text"] {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.95rem;
  background: white;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.fl-filter-group select:focus,
.fl-filter-group input[type="text"]:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.fl-filter-search {
  grid-column: span 2;
}

.fl-filter-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

.fl-btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.fl-btn-reset {
  background: #ef4444;
  color: white;
}

.fl-btn-reset:hover {
  background: #dc2626;
}
/* Terminal Table */
.fl-term-table-wrapper {
  margin-bottom: 3rem;
  overflow-x: auto;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.fl-term-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.fl-term-table thead {
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
}

.fl-term-table th {
  padding: 1rem;
  text-align: left;
  font-weight: 700;
  color: #1e293b;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
  border-right: 1px solid #e2e8f0;
}

.fl-term-table th:last-child {
  border-right: none;
}

.fl-term-table tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: background-color 0.2s ease;
}

.fl-term-table tbody tr:hover {
  background: #f8fafc;
}

.fl-term-table tbody tr:last-child {
  border-bottom: none;
}

.fl-term-table td {
  padding: 1rem;
  color: #475569;
  border-right: 1px solid #f1f5f9;
}

.fl-term-table td:last-child {
  border-right: none;
}


.fl-term-calls {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* Table category marker */
.fl-term-category-marker {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Sortable column headers */
.fl-term-table th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 2rem;
}

.fl-term-table th.sortable:hover {
  background: #eef2f7;
}

.fl-term-table th.sortable::after {
  content: '⇅';
  position: absolute;
  right: 0.5rem;
  color: #cbd5e1;
  font-size: 0.9rem;
}

.fl-term-table th.sortable.sort-asc::after {
  content: '↑';
  color: #667eea;
}

.fl-term-table th.sortable.sort-desc::after {
  content: '↓';
  color: #667eea;
}

.fl-term-capacity {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.fl-term-table .fl-no-results {
  text-align: center;
  padding: 3rem;
  color: #64748b;
  font-style: italic;
}
/* Terminal Grid */
.fl-term-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

/* Terminal Card */
.fl-term-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
}

.fl-term-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.fl-term-card-header {
  width: 100%;
  height: 180px;
  overflow: hidden;
  background: #e2e8f0;
}

.fl-term-card-header a {
  display: block;
  width: 100%;
  height: 100%;
}

.fl-term-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.fl-term-card:hover .fl-term-card-img {
  transform: scale(1.05);
}

.fl-term-card-body {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.fl-term-card-title {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  line-height: 1.3;
}

.fl-term-card-title a {
  color: #1e293b;
  text-decoration: none;
  transition: color 0.2s ease;
}

.fl-term-card-title a:hover {
  color: #667eea;
}

.fl-term-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.fl-badge {
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-block;
}

.fl-badge-major {
  background: #dc2626;
  color: white;
}

.fl-badge-regional {
  background: #f97316;
  color: white;
}

.fl-badge-local {
  background: #facc15;
  color: #78350f;
}

.fl-badge-sanction {
  background: #fef3c7;
  color: #d97706;
  border: 1px solid #fbbf24;
}

.fl-badge-default {
  background: #e2e8f0;
  color: #475569;
}

.fl-badge-area {
  background: #64748b;
  color: white;
}

.fl-term-card-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  flex: 1;
}

.fl-term-card-meta > div {
  display: flex;
  gap: 0.5rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid #f1f5f9;
}

.fl-term-card-meta > div:last-child {
  border-bottom: none;
}

.fl-term-card-meta dt {
  font-weight: 600;
  color: #64748b;
  min-width: 80px;
}

.fl-term-card-meta dd {
  margin: 0;
  color: #1e293b;
  flex: 1;
}


/* No Results */
.fl-no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
  color: #64748b;
  font-size: 1.1rem;
}

/* Pagination */
.fl-term-pagination {
  margin: 3rem 0;
  text-align: center;
}

.fl-term-pagination .page-numbers {
  display: inline-block;
  padding: 0.5rem 1rem;
  margin: 0 0.25rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  color: #475569;
  text-decoration: none;
  transition: all 0.2s ease;
}

.fl-term-pagination .page-numbers:hover {
  border-color: #667eea;
  color: #667eea;
  background: #f8fafc;
}

.fl-term-pagination .page-numbers.current {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

/* Basin Overview Section */
.fl-term-basins {
  margin: 4rem 0 3rem;
}

.fl-term-basins > h2 {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
  color: #1e293b;
  max-width: min(1400px, 94vw);
  margin-left: auto;
  margin-right: auto;
}

.fl-basin-section {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  margin-bottom: 1rem;
  background: white;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  max-width: min(1400px, 94vw);
  margin-left: auto;
  margin-right: auto;
}

.fl-basin-section summary {
  padding: 1.25rem 1.5rem;
  font-weight: 700;
  font-size: 1.1rem;
  cursor: pointer;
  background: #f8fafc;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background-color 0.2s ease;
}

.fl-basin-section summary:hover {
  background: #eef2f7;
}

.fl-basin-section summary::after {
  content: '▸';
  font-size: 1.2rem;
  color: #64748b;
  transition: transform 0.2s ease;
}

.fl-basin-section[open] summary::after {
  transform: rotate(90deg);
}

.fl-basin-section p {
  padding: 1.5rem;
  margin: 0;
  line-height: 1.7;
  color: #475569;
  border-top: 1px solid #e2e8f0;
}

/* Basin expanded content */
.fl-basin-content {
  border-top: 1px solid #e2e8f0;
}

.fl-basin-overview {
  display: block;
  padding: 1.5rem;
}

.fl-basin-map {
  height: 400px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 1.5rem;
}

.fl-basin-description {
  line-height: 1.7;
  color: #475569;
  padding: 1rem;
  background: #f8fafc;
  border-radius: 8px;
}

.fl-basin-terminals-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  padding: 0 1.5rem 1.5rem;
}

/* FAQ Section */
.fl-term-faq {
  margin: 4rem 0 3rem;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.fl-term-faq > h2 {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
  color: #1e293b;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .fl-terminal-archive {
    padding: 1rem 0.5rem;
  }
  
  #fl-terminal-map {
    height: 400px;
  }
  
  .fl-map-legend {
    bottom: 10px;
    left: 10px;
    padding: 0.75rem;
    font-size: 0.85rem;
  }
  
  .fl-term-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
  
  .fl-term-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .fl-term-filters form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .fl-filter-group,
  .fl-filter-search,
  .fl-filter-actions {
    min-width: unset;
  }
  
  .fl-filter-actions {
    flex-direction: row;
    justify-content: center;
  }
  
  .fl-term-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .fl-term-table {
    min-width: 600px;
  }
  
  .fl-basin-overview {
    grid-template-columns: 1fr;
  }
  
  .fl-basin-map {
    height: 250px;
  }
  
  .fl-basin-terminals-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

@media (max-width: 480px) {
  .fl-term-stats {
    grid-template-columns: 1fr;
  }
  
  .fl-stat-number {
    font-size: 2rem;
  }
  
  .fl-term-hero {
    padding: 1.25rem;
  }
  
  .fl-term-card-header {
    height: 140px;
  }
}

@media (max-width: 1200px) {
  .fl-basin-terminals-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}