/* Timeline Component Styles */

.timeline {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #051015;
  color: #efefef;
  font-family: t26-carbon, monospace;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s ease-in-out, visibility 0.6s ease-in-out;
}

.timeline.is-visible {
  opacity: 1;
  visibility: visible;
}

.timeline__container {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.timeline__header {
  margin-bottom: 1.5rem;
  text-align: center;
  padding: 1.5rem 1.5rem 0 1.5rem;
}

.timeline__title {
  font-size: 2.25rem;
  font-weight: 100;
  margin: 0;
  color: #efefef;
  letter-spacing: 0.1em;
}

.timeline__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background-color: #ffffff;
  border-radius: 0;
  padding: 1.5rem;
  box-shadow: none;
  width: 100%;
}

.timeline__content-main {
  display: flex;
  gap: 1.5rem;
  flex: 1;
  min-height: 0;
}

/* Years Container */
.timeline__years-container {
  width: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  height: 100%;
  background-color: #ffffff;
  border-radius: 0;
  padding: 0.75rem;
}

.timeline__years-label {
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  color: #333333;
  font-weight: bold;
  flex-shrink: 0;
}

.timeline__years-separator {
  width: 100%;
  height: 1px;
  background-color: #e9ecef;
  border: none;
  margin: 0 0 0.75rem 0;
  flex-shrink: 0;
}

.timeline__years-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  min-height: 300px;
  max-height: 375px;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  padding: 75px 0;
  mask: linear-gradient(
    to bottom,
    transparent 0%,
    black 20%,
    black 80%,
    transparent 100%
  );
  -webkit-mask: linear-gradient(
    to bottom,
    transparent 0%,
    black 20%,
    black 80%,
    transparent 100%
  );
}

.timeline__years-list::-webkit-scrollbar {
  display: none;
}

.timeline__years-list {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.timeline__years-list::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background-color: #cccccc;
  transform: translateX(-50%);
  z-index: 1;
}

.timeline__years-list::after {
  /* content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 15px;
  height: 1px;
  background-color: #00ffad;
  transform: translate(-50%, -50%);
  z-index: 2;
  box-shadow: 0 0 7px rgba(0, 255, 173, 0.5); */
}

.timeline__year {
  font-size: 0.825rem;
  color: #666;
  cursor: pointer;
  padding: 0.6rem 0.75rem;
  margin: 0.375rem 0;
  border-radius: 3px;
  transition: all 0.3s ease;
  position: relative;
  z-index: 3;
  background-color: white;
  min-width: 45px;
  text-align: center;
  flex-shrink: 0;
  border: 1px solid white;
}

.timeline__year:hover {
  color: #333333;
  transform: scale(1.05);
  border-color: white;
  background-color: #e9ecef;
}

.timeline__year--active {
  color: #0e242f;
  font-weight: 400;
  transform: scale(1.1);
  background-color: white;
  border: 1px solid white;
  box-shadow: 0 0 10px white;
  position: relative;
}

.timeline__year--center {
  color: #ffffff;
  font-weight: 500;
  transform: scale(1.15);
  background-color: #00cc88;
  border: 1px solid #00ffad;
  box-shadow: 0 0 15px rgba(0, 255, 173, 0.4);
}

/* Ensure active year arrows are visible even when center class is applied */
.timeline__year--active.timeline__year--center::before,
.timeline__year--active::before {
  content: "▲";
  position: absolute;
  left: 5px;
  top: 50%;
  transform: translateY(-50%);
  color: #0e242f;
  font-size: 12px;
  font-weight: bold;
  z-index: 1000;
}

.timeline__year--active.timeline__year--center::after,
.timeline__year--active::after {
  content: "▲";
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%) rotate(180deg);
  color: #0e242f;
  font-size: 12px;
  font-weight: bold;
  z-index: 1000;
}

.timeline__year-controls {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-top: 0.75rem;
}

.timeline__year-btn {
  background: #ffffff;
  /* border: 1px solid #cccccc; */
  color: #666;
  padding: 0.375rem;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timeline__year-btn:hover {
  /* border-color: #00ffad; */
  color: #00ffad;
  transform: translateY(-1px);
}

.timeline__year-btn:active {
  transform: translateY(0);
}

/* Visualization Container */
.timeline__visualization {
  flex: 1;
  position: relative;
  min-height: 0;
  background: radial-gradient(circle, #f8f9fa 0%, #e9ecef 100%);
}

.timeline__chart {
  position: relative;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, #f8f9fa 0%, #e9ecef 100%);
  border: 1px solid #e9ecef;
  border-radius: 0;
  overflow: hidden;
}

.timeline__events-axis {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  background-color: #f8f9fa;
  border-top: 1px solid #e9ecef;
}

.timeline__event-marker {
  font-size: 0.6rem;
  color: #666;
  text-align: center;
  padding: 0.375rem;
  position: relative;
}

.timeline__event-marker::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  width: 2px;
  height: 7px;
  background-color: #cccccc;
  transform: translateX(-50%);
}

/* Data Points */
.timeline__data-points {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 30px;
  padding: 0.75rem;
}

.timeline__data-point {
  position: absolute;
  width: 45px;
  height: 45px;
  cursor: pointer;
  transition: all 0.3s ease;
  transform-origin: center;
}

.timeline__data-point-icon {
  width: 100%;
  height: 100%;
  background: #051015;
  border: 2px solid #cccccc;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.3s ease;
}

.timeline__data-point-icon::before {
  content: "";
  width: 22px;
  height: 22px;
  background-image: url("../images/Vector0.png");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  transition: all 0.3s ease;
}

.timeline__data-point:hover {
  transform: scale(1.1);
  z-index: 10;
}

.timeline__data-point:hover .timeline__data-point-icon {
  border-color: white;
  box-shadow: 0 0 15px rgba(0, 255, 173, 0.4);
}

.timeline__data-point:hover .timeline__data-point-icon::before {
  background-image: url("../images/Vector1.png");
}

.timeline__data-point--active .timeline__data-point-icon {
  /* background: linear-gradient(135deg, #00ffad 0%, #00cc88 100%); */
  border-color: white;
  box-shadow: 0 0 20px white;
}

.timeline__data-point--active .timeline__data-point-icon::before {
  background-image: url("../images/Vector1.png");
}

.timeline__data-point-label {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.525rem;
  color: #666;
  white-space: nowrap;
  margin-top: 0.375rem;
  opacity: 0.8;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.timeline__data-point:hover .timeline__data-point-label {
  opacity: 1;
  color: #00ffad;
}

/* Details Panel */
.timeline__details {
  background-color: #ffffff;
  border: 1px solid #e9ecef;
  border-radius: 0;
  padding: 1.125rem;
  min-height: 90px;
  transition: all 0.3s ease;
  box-shadow: none;
}

.timeline__details-content {
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.timeline__details--active .timeline__details-content {
  opacity: 1;
}

.timeline__details-title {
  font-size: 1.05rem;
  margin: 0 0 0.375rem 0;
  color: #333333;
  font-weight: 100;
}

.timeline__details-description {
  font-size: 0.75rem;
  line-height: 1.4;
  margin: 0 0 0.75rem 0;
  color: #666666;
}

.timeline__details-meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.675rem;
  color: #666;
}

.timeline__details-meta-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.timeline__details-meta-label {
  font-weight: 400;
  color: #00ffad;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .timeline__container {
    padding: 0;
  }

  .timeline__header {
    padding: 1.125rem 1.125rem 0 1.125rem;
  }

  .timeline__content {
    padding: 1.125rem;
  }

  .timeline__title {
    font-size: 1.875rem;
  }

  .timeline__content {
    gap: 1.125rem;
  }

  .timeline__years-container {
    width: 112px;
  }
}

@media (max-width: 768px) {
  .timeline__container {
    padding: 0;
  }

  .timeline__header {
    padding: 0.75rem;
  }

  .timeline__title {
    font-size: 1.5rem;
  }

  .timeline__content {
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.75rem;
  }

  .timeline__content-main {
    flex-direction: column;
    gap: 0.75rem;
  }

  .timeline__years-container {
    width: 100%;
    height: auto;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: 0.5rem;
    background-color: #ffffff;
    border-radius: 0;
    padding: 0.75rem;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .timeline__years-label {
    font-size: 0.8rem;
    margin-bottom: 0;
    margin-right: 0.5rem;
    flex-shrink: 0;
  }

  .timeline__years-separator {
    display: none;
  }

  .timeline__years-list {
    flex-direction: row;
    min-height: auto;
    max-height: none;
    gap: 0.375rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0;
    mask: none;
    -webkit-mask: none;
    flex: 1;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .timeline__years-list::-webkit-scrollbar {
    display: none;
  }

  .timeline__years-list::before {
    display: none;
  }

  .timeline__year {
    font-size: 0.675rem;
    padding: 0.375rem 0.75rem;
    min-width: 50px;
    flex-shrink: 0;
    text-align: center;
  }

  .timeline__year-controls {
    flex-direction: row;
    margin-top: 0;
    margin-left: 0.5rem;
    gap: 0.25rem;
    flex-shrink: 0;
  }

  .timeline__year-btn {
    padding: 0.25rem;
    font-size: 0.75rem;
  }

  .timeline__visualization {
    min-height: 300px;
    order: 2;
  }

  .timeline__data-point {
    width: 40px;
    height: 40px;
    touch-action: manipulation;
  }

  .timeline__data-point-icon {
    border-width: 2px;
  }

  .timeline__data-point-icon::before {
    width: 18px;
    height: 18px;
  }

  .timeline__data-point-label {
    font-size: 0.6rem;
    margin-top: 0.25rem;
  }

  /* Touch-friendly hover states for mobile */
  .timeline__data-point:active {
    transform: scale(1.05);
  }

  .timeline__year {
    touch-action: manipulation;
  }

  .timeline__year:active {
    transform: scale(1.02);
    background-color: #f0f0f0;
  }

  .timeline__details {
    margin-top: 0.75rem;
    padding: 0.75rem;
    min-height: 80px;
    background-color: #ffffff;
    border: 1px solid #e9ecef;
    box-shadow: none;
    order: 3;
  }

  .timeline__details-title {
    font-size: 0.95rem;
  }

  .timeline__details-description {
    font-size: 0.7rem;
    line-height: 1.5;
  }

  .timeline__details-meta {
    flex-direction: column;
    gap: 0.375rem;
  }
}

@media (max-width: 480px) {
  .timeline__header {
    padding: 0.5rem;
  }

  .timeline__title {
    font-size: 1.25rem;
  }

  .timeline__content {
    padding: 0.5rem;
    gap: 0.5rem;
  }

  .timeline__years-container {
    padding: 0.5rem;
    gap: 0.375rem;
  }

  .timeline__years-label {
    font-size: 0.75rem;
    margin-right: 0.375rem;
  }

  .timeline__year {
    font-size: 0.6rem;
    padding: 0.25rem 0.5rem;
    min-width: 40px;
  }

  .timeline__year-btn {
    padding: 0.2rem;
    font-size: 0.7rem;
  }

  .timeline__visualization {
    min-height: 250px;
  }

  .timeline__data-point {
    width: 35px;
    height: 35px;
    touch-action: manipulation;
  }

  .timeline__data-point-icon::before {
    width: 14px;
    height: 14px;
  }

  .timeline__data-point-label {
    font-size: 0.55rem;
    margin-top: 0.2rem;
  }

  /* Ensure touch targets are large enough */
  .timeline__year {
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .timeline__year-btn {
    min-width: 32px;
    min-height: 32px;
  }
}

/* Extra small devices (320px and below) */
@media (max-width: 320px) {
  .timeline__header {
    padding: 0.375rem;
  }

  .timeline__title {
    font-size: 1.1rem;
  }

  .timeline__content {
    padding: 0.375rem;
    gap: 0.375rem;
  }

  .timeline__years-container {
    padding: 0.375rem;
    gap: 0.25rem;
  }

  .timeline__years-label {
    font-size: 0.7rem;
    margin-right: 0.25rem;
  }

  .timeline__year {
    font-size: 0.55rem;
    padding: 0.2rem 0.375rem;
    min-width: 35px;
    min-height: 28px;
  }

  .timeline__year-btn {
    padding: 0.15rem;
    font-size: 0.65rem;
    min-width: 28px;
    min-height: 28px;
  }

  .timeline__visualization {
    min-height: 200px;
  }

  .timeline__data-point {
    width: 30px;
    height: 30px;
  }

  .timeline__data-point-icon::before {
    width: 12px;
    height: 12px;
  }

  .timeline__data-point-label {
    font-size: 0.5rem;
  }

  .timeline__details {
    padding: 0.375rem;
    min-height: 60px;
  }

  .timeline__details-title {
    font-size: 0.8rem;
  }

  .timeline__details-description {
    font-size: 0.6rem;
  }

  .timeline__event-marker {
    font-size: 0.45rem;
    padding: 0.15rem;
  }

  .timeline__details {
    padding: 0.375rem;
    min-height: 60px;
  }

  .timeline__details-title {
    font-size: 0.8rem;
  }

  .timeline__details-description {
    font-size: 0.6rem;
  }
}

/* Animation Classes */
.timeline__data-point--entering {
  animation: dataPointEnter 0.6s ease-out forwards;
}

.timeline__data-point--leaving {
  animation: dataPointLeave 0.3s ease-in forwards;
}

@keyframes dataPointEnter {
  from {
    opacity: 0;
    transform: scale(0) rotate(180deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

@keyframes dataPointLeave {
  from {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
  to {
    opacity: 0;
    transform: scale(0) rotate(-180deg);
  }
}

.timeline__year--changing {
  animation: yearChange 0.4s ease-in-out;
}

@keyframes yearChange {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1.1);
  }
}

/* Loading State */
.timeline__loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #333;
  font-size: 1rem;
}

.timeline__loading::after {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #e9ecef;
  border-top: 2px solid #00ffad;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 0.5rem;
  vertical-align: middle;
}

/* Error State */
.timeline__error {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #ff6b6b;
  font-size: 1rem;
  text-align: center;
}

/* Accessibility */
.timeline__data-point:focus {
  /* outline: 2px solid white; */
  outline-offset: 2px;
}

.timeline__year:focus {
  outline: 2px solid #00ffad;
  outline-offset: 2px;
}

.timeline__year-btn:focus {
  /* outline: 2px solid white; */
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .timeline__data-point-icon {
    border-width: 3px;
  }

  .timeline__year--active {
    border-width: 2px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .timeline__data-point,
  .timeline__year,
  .timeline__year-btn,
  .timeline__details {
    transition: none;
  }

  .timeline__data-point--entering,
  .timeline__data-point--leaving,
  .timeline__year--changing {
    animation: none;
  }
}
