/* Timeline Overlay for List Items */

/* ===== OVERLAY ===== */
.timeline-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at 50% 50%, #0d0d24 0%, #060612 50%, #010108 100%);
  z-index: 10001;
  display: flex;
  flex-direction: column;
  animation: timelineFadeIn 0.4s ease;
  overflow: hidden;
}

@keyframes timelineFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ===== INTRO SCREEN (shown before timeline reveals) ===== */
.timeline-intro {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 50%, #0d0d24 0%, #060612 50%, #010108 100%);
  pointer-events: none;
}

.timeline-intro-ring {
  width: 120px;
  height: 120px;
  border: 2px solid rgba(100, 140, 255, 0.5);
  border-top-color: rgba(180, 160, 255, 0.9);
  border-radius: 50%;
  animation: introSpin 0.8s linear infinite;
}

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

.timeline-intro-text {
  margin-top: 1.2rem;
  font-size: 1rem;
  font-weight: 600;
  color: rgba(180, 190, 255, 0.8);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-shadow: 0 0 20px rgba(100, 130, 255, 0.4);
  animation: introPulse 1s ease-in-out infinite alternate;
}

@keyframes introPulse {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

/* Intro lines that shoot outward */
.timeline-intro-lines {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.timeline-intro-line {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 0;
  background: linear-gradient(to bottom, rgba(100, 140, 255, 0.6), transparent);
  transform-origin: top center;
  animation: introLineShoot 0.7s ease-out forwards;
}

@keyframes introLineShoot {
  0%   { height: 0; opacity: 0.8; }
  100% { height: 200px; opacity: 0; }
}

/* Fade-out of intro */
.timeline-intro.fade-out {
  animation: introFadeOut 0.4s ease forwards;
}

@keyframes introFadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* Animated starfield canvas (injected by JS) */
.timeline-stars-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* Subtle nebula glow - animated drift */
.timeline-overlay::after {
  content: '';
  position: absolute;
  top: 25%;
  left: 15%;
  width: 70%;
  height: 50%;
  background:
    radial-gradient(ellipse at 30% 40%, rgba(20, 12, 60, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 60%, rgba(12, 20, 55, 0.08) 0%, transparent 55%);
  pointer-events: none;
  z-index: 0;
  animation: nebulaDrift 25s ease-in-out infinite alternate;
}

@keyframes nebulaDrift {
  0% { transform: translate(0, 0) scale(1); opacity: 0.6; }
  50% { transform: translate(10px, -6px) scale(1.03); opacity: 0.8; }
  100% { transform: translate(-8px, 5px) scale(0.98); opacity: 0.65; }
}

/* ===== HEADER ===== */
.timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  position: relative;
  z-index: 2;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  flex-shrink: 0;
}

.timeline-header h2 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
  color: #e0e0ff;
  text-shadow: 0 0 20px rgba(100, 130, 255, 0.4);
  flex: 1;
}

/* Logo in header */
.timeline-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  margin-right: 0.75rem;
  filter: brightness(0.9) drop-shadow(0 0 6px rgba(100, 130, 255, 0.3));
  flex-shrink: 0;
}

.timeline-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #aaa;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.timeline-close-btn:hover {
  background: rgba(255, 80, 80, 0.2);
  border-color: rgba(255, 80, 80, 0.4);
  color: #ff6666;
}

.timeline-close-btn .material-icons {
  font-size: 20px;
}

/* Header controls group */
.timeline-header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Music toggle button */
.timeline-music-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #b0b8ff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.timeline-music-btn:hover {
  background: rgba(100, 120, 255, 0.2);
  border-color: rgba(100, 120, 255, 0.4);
  color: #c0c8ff;
}

.timeline-music-btn .material-icons {
  font-size: 20px;
}

/* ===== MAIN CONTAINER ===== */
.timeline-container {
  flex: 1;
  position: relative;
  z-index: 1;
  overflow: hidden;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
}

.timeline-container:active {
  cursor: grabbing;
}

.timeline-container.dragging {
  cursor: grabbing;
}

/* ===== TIMELINE CANVAS ===== */
.timeline-canvas {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  transform-origin: 0 0;
  transition: none;
  will-change: transform;
}

/* ===== AXIS ===== */
.timeline-axis {
  position: absolute;
  bottom: 80px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, rgba(100, 140, 255, 0.5) 5%, rgba(100, 140, 255, 0.5) 95%, transparent 100%);
  z-index: 1;
}

/* Glow on axis */
.timeline-axis::before {
  content: '';
  position: absolute;
  top: -3px;
  left: 0;
  right: 0;
  height: 8px;
  background: linear-gradient(90deg, transparent 0%, rgba(100, 140, 255, 0.15) 5%, rgba(100, 140, 255, 0.15) 95%, transparent 100%);
  filter: blur(4px);
}

/* ===== TICK MARKS ===== */
.timeline-tick {
  position: absolute;
  bottom: 74px;
  width: 1px;
  height: 14px;
  background: rgba(100, 140, 255, 0.4);
  z-index: 2;
}

.timeline-tick-label {
  position: absolute;
  bottom: 45px;
  transform: translateX(-50%);
  color: rgba(180, 190, 255, 0.7);
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
  z-index: 2;
  text-shadow: 0 0 10px rgba(0, 0, 20, 0.8);
}

/* ===== LANE ROWS (for overlapping items) ===== */
.timeline-lanes {
  position: absolute;
  top: 1rem;
  bottom: 90px;
  left: 0;
  right: 0;
}

/* ===== DESCRIPTION PANEL (shown on click) ===== */
.timeline-item-desc-panel {
  position: absolute;
  top: 0;
  left: calc(100% + 8px);
  width: 200px;
  background: rgba(10, 10, 30, 0.92);
  border: 1px solid rgba(100, 140, 255, 0.25);
  border-radius: 8px;
  padding: 8px 10px;
  opacity: 0;
  transform: translateX(-6px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 20;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.timeline-item.desc-open .timeline-item-desc-panel {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.timeline-item-desc-text {
  font-size: 0.7rem;
  line-height: 1.45;
  color: rgba(200, 210, 255, 0.85);
}

/* ===== TIMELINE ITEM ===== */
.timeline-item {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(.22,.68,0,1.2), filter 0.25s ease;
  z-index: 3;
}

.timeline-item:hover {
  transform: translateX(-50%) scale(1.12) !important;
  z-index: 10;
  filter: brightness(1.15);
}

/* Item thumbnail */
.timeline-item-thumb {
  width: 70px;
  height: 95px;
  border-radius: 6px;
  overflow: hidden;
  box-shadow:
    0 2px 12px rgba(0, 0, 0, 0.6),
    0 0 15px rgba(80, 110, 255, 0.12);
  border: 1.5px solid rgba(100, 140, 255, 0.25);
  position: relative;
  background: #111;
  flex-shrink: 0;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Shine sweep effect on hover */
.timeline-item-thumb::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -60%;
  width: 40%;
  height: 200%;
  background: linear-gradient(
    105deg,
    transparent 30%,
    rgba(255, 255, 255, 0.18) 45%,
    rgba(255, 255, 255, 0.35) 50%,
    rgba(255, 255, 255, 0.18) 55%,
    transparent 70%
  );
  transform: rotate(25deg);
  transition: left 0.6s ease;
  pointer-events: none;
  z-index: 2;
}

.timeline-item:hover .timeline-item-thumb::after {
  left: 130%;
}

.timeline-item:hover .timeline-item-thumb {
  border-color: rgba(140, 170, 255, 0.8);
  box-shadow:
    0 0 18px rgba(100, 140, 255, 0.45),
    0 0 40px rgba(100, 140, 255, 0.15),
    0 4px 20px rgba(0, 0, 0, 0.5);
}

.timeline-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Connector line from item to axis */
.timeline-item-connector {
  width: 1px;
  background: linear-gradient(to bottom, rgba(100, 140, 255, 0.35), rgba(100, 140, 255, 0.08));
  flex-shrink: 0;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.timeline-item:hover .timeline-item-connector {
  background: linear-gradient(to bottom, rgba(140, 170, 255, 0.8), rgba(140, 170, 255, 0.3));
  box-shadow: 0 0 6px rgba(100, 140, 255, 0.4);
}

/* Time range bar on the axis */
.timeline-item-range {
  position: absolute;
  bottom: -6px;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(100, 140, 255, 0.5), rgba(150, 120, 255, 0.5));
  box-shadow: 0 0 6px rgba(100, 140, 255, 0.2);
  left: 0;
  right: 0;
  z-index: 1;
  transition: height 0.3s ease, background 0.3s ease, box-shadow 0.3s ease, bottom 0.3s ease;
}

.timeline-item:hover .timeline-item-range {
  height: 7px;
  bottom: -8px;
  background: linear-gradient(90deg, rgba(140, 180, 255, 0.9), rgba(180, 150, 255, 0.9));
  box-shadow:
    0 0 14px rgba(100, 140, 255, 0.6),
    0 0 30px rgba(100, 140, 255, 0.2);
}

/* Item label (below connector) */
.timeline-item-info {
  text-align: center;
  max-width: 120px;
  margin-top: 4px;
  flex-shrink: 0;
  transition: opacity 0.3s ease;
}

.timeline-item:hover .timeline-item-info {
  opacity: 1;
}

.timeline-item-title {
  font-size: 0.68rem;
  font-weight: 600;
  color: #d0d4ff;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.timeline-item-setting {
  font-size: 0.6rem;
  color: rgba(180, 190, 255, 0.6);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-item-time {
  font-size: 0.6rem;
  color: rgba(140, 160, 255, 0.7);
  margin-top: 1px;
  font-weight: 500;
}

/* ===== TOOLTIP ON HOVER ===== */
.timeline-item-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  background: rgba(10, 10, 30, 0.95);
  border: 1px solid rgba(100, 140, 255, 0.3);
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  min-width: 180px;
  max-width: 250px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 20;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
}

.timeline-item:hover .timeline-item-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.timeline-item-tooltip-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #e0e4ff;
  margin-bottom: 3px;
}

.timeline-item-tooltip-type {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(140, 160, 255, 0.9);
  background: rgba(100, 120, 255, 0.12);
  border: 1px solid rgba(100, 140, 255, 0.2);
  border-radius: 4px;
  padding: 1px 6px;
  margin-bottom: 4px;
}

.timeline-item-tooltip-setting {
  font-size: 0.75rem;
  color: rgba(180, 190, 255, 0.8);
}

.timeline-item-tooltip-time {
  font-size: 0.75rem;
  color: rgba(140, 160, 255, 0.9);
  font-weight: 500;
  margin-top: 2px;
}

/* ===== NO DATA MESSAGE ===== */
.timeline-no-data {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: rgba(180, 190, 255, 0.5);
  font-size: 1.1rem;
  text-align: center;
  padding: 2rem;
  z-index: 2;
  position: relative;
}

/* ===== TIMELINE BUTTON (curved square in list detail) ===== */
.timeline-list-btn {
  display: block;
  width: 100%;
  height: 138px;
  padding: 0;
  background: transparent;
  border: 2px solid rgba(99, 90, 200, 0.682);
  border-radius: 14px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}


.timeline-list-btn:hover {
  border-color: rgba(140, 120, 255, 0.7);
  transform: translateY(-2px);
  box-shadow:
    0 0 18px rgb(100, 80, 200),
    0 6px 20px rgba(100, 80, 200, 0.15);
}

.timeline-list-btn:active {
  transform: translateY(0);
  box-shadow: 0 0 8px rgba(100, 80, 200, 0.2);
}

/* Shine sweep on hover */
.timeline-list-btn::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -80%;
  width: 50%;
  height: 200%;
  background: linear-gradient(
    105deg,
    transparent 30%,
    rgba(200, 190, 255, 0.12) 45%,
    rgba(255, 255, 255, 0.22) 50%,
    rgba(200, 190, 255, 0.12) 55%,
    transparent 70%
  );
  transform: rotate(25deg);
  transition: left 0.6s ease;
  pointer-events: none;
  z-index: 2;
}

.timeline-list-btn:hover::after {
  left: 140%;
}

.timeline-btn-img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  object-fit: cover;
  transition: filter 0.3s ease, transform 0.3s ease;
}

.timeline-list-btn:hover .timeline-btn-img {
  filter: brightness(1.15);
  transform: scale(1.03);
}

/* ===== ZOOM CONTROLS ===== */
.timeline-zoom-controls {
  position: absolute;
  bottom: 12px;
  right: 16px;
  display: flex;
  gap: 6px;
  z-index: 5;
}

.timeline-zoom-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(20, 20, 40, 0.8);
  border: 1px solid rgba(100, 140, 255, 0.25);
  color: rgba(180, 190, 255, 0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  transition: all 0.2s;
  backdrop-filter: blur(6px);
}

.timeline-zoom-btn:hover {
  background: rgba(60, 60, 120, 0.6);
  border-color: rgba(100, 140, 255, 0.5);
  color: #c0c8ff;
}

/* ===== SCROLL HINT ===== */
.timeline-scroll-hint {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(150, 160, 255, 0.4);
  font-size: 0.72rem;
  white-space: nowrap;
  z-index: 2;
  animation: timelineHintPulse 2.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes timelineHintPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .timeline-header {
    padding: 0.8rem 1rem;
  }

  .timeline-header h2 {
    font-size: 1.1rem;
  }

  .timeline-item-thumb {
    width: 55px;
    height: 75px;
  }

  .timeline-item-info {
    max-width: 90px;
  }

  .timeline-item-title {
    font-size: 0.6rem;
  }

  .timeline-tick-label {
    font-size: 0.65rem;
  }

  .timeline-list-btn {
    height: 110px;
    border-radius: 10px;
  }

  .timeline-btn-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
  }
}
