/* FleetLeaks Timeline - Enhanced Styles */

/* ==========================================================================
   TIMELINE CONTAINER & BACKGROUND
   ========================================================================== */

.fl-timeline {
  max-width: min(1100px, 92vw);
  margin: 2.25rem auto 3rem;
  width: 100%;
  box-sizing: border-box;
  background: linear-gradient(to bottom, #faf8ff 0%, #ffffff 400px);
  padding: 2rem;
  border-radius: 1rem;
}

/* ==========================================================================
   HEADER & TITLE
   ========================================================================== */

.fl-tl-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid #e5e7eb;
}

.fl-tl-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.fl-tl-main-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  color: #111827;
  margin: 0;
  line-height: 1.2;
}

.fl-tl-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   ACTION BUTTONS (Toggle & Jump)
   ========================================================================== */

.fl-tl-toggle,
.fl-tl-jump {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  background: #fff;
  color: #374151;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.fl-tl-toggle:hover,
.fl-tl-jump:hover {
  background: #f9fafb;
  border-color: #d1d5db;
  transform: translateY(-1px);
}

.fl-tl-toggle svg,
.fl-tl-jump svg {
  opacity: 0.7;
}

.fl-tl-toggle[data-mode="compact"] {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #4f46e5;
}

/* ==========================================================================
   YEAR PILLS
   ========================================================================== */

.fl-tl-years {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.25rem;
}

.fl-pill {
  display: inline-block;
  padding: 0.45rem 0.85rem;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #f8fafc;
  color: #111827;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.fl-pill:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
  transform: scale(1.02);
}

.fl-pill.is-active {
  background: #111827;
  color: #fff;
  border-color: #111827;
  box-shadow: 0 2px 8px rgba(17, 24, 39, 0.2);
}

/* Active year sync while scrolling */
.fl-pill.is-viewing {
  background: #4f46e5;
  color: #fff;
  border-color: #4f46e5;
  transform: scale(1.05);
}

.fl-tl-meta {
  color: #6b7280;
  font-size: 0.875rem;
}

.fl-tl-meta strong {
  color: #374151;
}

/* ==========================================================================
   SPINE CONTAINER & VERTICAL LINE
   ========================================================================== */

.fl-tl-spine-container {
  position: relative;
  padding-left: 2rem;
}

.fl-tl-spine {
  position: absolute;
  left: 0.5rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, #e4e8fb 0%, #4f46e5 50%, #e8edff 100%);
  opacity: 0.6;
}

/* ==========================================================================
   DATE GROUPS & DOTS
   ========================================================================== */

.fl-tl-date-group {
  margin-bottom: 2rem;
  position: relative;
}

.fl-tl-date-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.fl-tl-dot {
  position: absolute;
  left: -2.2rem;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #4f46e5;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px #c7d2fe;
  z-index: 10;
}

.fl-tl-dot-unknown {
  background: #9ca3af;
  box-shadow: 0 0 0 2px #e5e7eb;
}

.fl-tl-date {
  font-size: 1.1rem;
  font-weight: 700;
  color: #111827;
  margin: 0;
}

/* ==========================================================================
   TIMELINE LIST
   ========================================================================== */

.fl-tl-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

/* ==========================================================================
   TIMELINE ITEM CARDS
   ========================================================================== */

.fl-tl-item {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 0.85rem;
  align-items: center;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.65rem;
  padding: 1rem 1.25rem 1rem 1.25rem;
  position: relative;
  box-sizing: border-box;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
  opacity: 0;
  transform: translateY(20px);
}

/* Scroll reveal animation */
.fl-tl-item.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.fl-tl-item::before {
  display: none !important;
}

.fl-tl-item * {
  box-sizing: border-box;
}

.fl-tl-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

/* Border strip (left edge) */
.fl-tl-border-strip {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 0.65rem 0 0 0.65rem;
}

.fl-tl-item.is-new .fl-tl-border-strip {
  background: linear-gradient(to bottom, #6366f1 0%, #4f46e5 100%);
}

.fl-tl-item.is-update {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.fl-tl-item.is-update .fl-tl-border-strip {
  background: linear-gradient(to bottom, #3b82f6 0%, #2563eb 100%);
}

/* Update badge */
.fl-update-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: #1e40af;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.2rem 0.5rem;
  border-radius: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  z-index: 5;
}

/* ==========================================================================
   TIMELINE ITEM CONTENT
   ========================================================================== */

.fl-tl-thumb {
  width: 240px; 
  height: 160px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.35rem;
  overflow: hidden;
}
.fl-tl-thumb img,
.fl-event-thumb {
    width: 240px;
    height: 160px;
    object-fit: cover;
    display: block;
}

.fl-tl-thumb .fl-thumb {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fl-tl-body {
  min-width: 0;
  line-height: 1.6;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.fl-tl-body * {
  margin: 0;
  padding: 0;
  max-width: 100%;
}

.fl-tl-name {
  font-weight: 600;
  color: #111827;
  text-decoration: none;
  display: inline-block;
  line-height: 1.4;
  max-width: 100%;
  overflow-wrap: break-word;
}

.fl-tl-name:hover {
  text-decoration: underline;
  color: #4f46e5;
}

.fl-type,
.fl-prog {
  color: #6b7280;
  font-size: 0.875rem;
}

/* ==========================================================================
   CHANGES & SOURCES
   ========================================================================== */

.fl-changes-wrapper {
  margin-top: 0.5rem;
}

.fl-changes {
  margin: 0;
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  max-width: 100%;
}

.fl-change-add {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  padding: 0.2rem 0.5rem;
  border-radius: 0.4rem;
  font-weight: 600;
  font-size: 0.8rem;
}

.fl-change-remove {
  background: #fff1f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  padding: 0.2rem 0.5rem;
  border-radius: 0.4rem;
  font-weight: 600;
  font-size: 0.8rem;
}

.fl-change-flag,
.fl-change-type,
.fl-change-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
  padding: 0.2rem 0.5rem;
  border-radius: 0.4rem;
  font-weight: 600;
  font-size: 0.8rem;
}

.fl-srcs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.fl-src {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border: 1px solid #e5e7eb;
  background: #f8fafc;
  border-radius: 0.45rem;
  padding: 0.15rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  max-width: 100%;
  overflow-wrap: break-word;
}

/* ==========================================================================
   COMPACT MODE
   ========================================================================== */

.fl-timeline[data-view-mode="compact"] .fl-changes-wrapper {
  display: none;
}

.fl-timeline[data-view-mode="compact"] .fl-prog {
  display: none;
}

.fl-timeline[data-view-mode="compact"] .fl-tl-item {
  padding: 0.6rem 0.75rem 0.6rem 0.75rem;
  gap: 0.65rem;
}

.fl-timeline[data-view-mode="compact"] .fl-tl-thumb {
  width: 44px;
  height: 44px;
}

.fl-timeline[data-view-mode="compact"] .fl-tl-thumb .fl-thumb {
  width: 100%;
  height: 100%;
}

.fl-timeline[data-view-mode="compact"] .fl-tl-item {
  grid-template-columns: 44px 1fr;
}

.fl-timeline[data-view-mode="compact"] .fl-tl-name {
  font-size: 0.95rem;
}

.fl-timeline[data-view-mode="compact"] .fl-type {
  font-size: 0.8rem;
}

.fl-timeline[data-view-mode="compact"] .fl-srcs {
  margin-top: 0.35rem;
}

.fl-timeline[data-view-mode="compact"] .fl-update-badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
}

/* ==========================================================================
   PAGINATION
   ========================================================================== */

.fl-timeline-pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.fl-timeline-pagination a,
.fl-timeline-pagination span {
  display: inline-block;
  padding: 0.5rem 0.85rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  background: #fff;
  color: #111827;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s;
}

.fl-timeline-pagination a:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.fl-timeline-pagination .current {
  background: #111827;
  color: #fff;
  border-color: #111827;
  font-weight: 600;
}

.fl-timeline-pagination .dots {
  border: none;
  background: transparent;
  cursor: default;
}

.fl-timeline-pagination .prev,
.fl-timeline-pagination .next {
  font-weight: 600;
}

/* ==========================================================================
   FILTERS & META
   ========================================================================== */

.fl-tl-filter {
  color: #6b7280;
  margin: 0.5rem 0;
  font-size: 0.875rem;
}

.fl-clear-filter {
  margin-left: 0.5rem;
  color: #4f46e5;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
}

.fl-clear-filter:hover {
  text-decoration: underline;
}

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

@media (max-width: 768px) {
  .fl-timeline {
    padding: 1.5rem 1rem;
  }

  .fl-tl-spine-container {
    padding-left: 1.5rem;
  }

  .fl-tl-spine {
    left: 0.25rem;
  }

  .fl-tl-dot {
    left: -1.3rem;
    width: 10px;
    height: 10px;
  }

  .fl-tl-title-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .fl-tl-actions {
    width: 100%;
  }

  .fl-tl-toggle,
  .fl-tl-jump {
    flex: 1;
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .fl-tl-item {
    grid-template-columns: 48px 1fr;
    gap: 0.65rem;
    padding: 0.85rem 1rem 0.85rem 1rem;
  }

  .fl-tl-thumb {
    width: 48px;
    height: 48px;
  }

  .fl-tl-thumb .fl-thumb {
    width: 100%;
    height: 100%;
  }

  .fl-update-badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
  }

  .fl-tl-years {
    gap: 0.35rem;
  }

  .fl-pill {
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
  }
}

/* ==========================================================================
   SCROLL HIGHLIGHT EFFECT
   ========================================================================== */

.fl-tl-date-group[data-highlight="true"] .fl-tl-date {
  background: linear-gradient(to right, #eef2ff 0%, transparent 100%);
  padding: 0.5rem;
  margin-left: -0.5rem;
  border-radius: 0.5rem;
  transition: background 0.3s ease;
}
/* ──────────────────────────────────────────────────────────────
   VIEW TOGGLE (Sanction Events / First Designated)
   Add these rules to fleetleaks-timeline.css
   ────────────────────────────────────────────────────────────── */

.fl-tl-view-toggle {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.fl-view-pill {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #f8fafc;
  color: #374151;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.fl-view-pill:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #4f46e5;
}

.fl-view-pill.is-active {
  background: #4f46e5;
  color: #fff;
  border-color: #4f46e5;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
}

/* Event sanctioner badge - highlighted */
.fl-src.fl-src-event {
  background: #4f46e5;
  color: #fff;
  border-color: #4338ca;
  font-weight: 700;
}

/* Other sanctioners shown muted in events view */
.fl-src.fl-src-muted {
  opacity: 0.45;
  font-size: 0.75rem;
}

@media (max-width: 640px) {
  .fl-tl-view-toggle {
    gap: 0.35rem;
  }
  .fl-view-pill {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
  }
}
