.movie-header {
  height: auto;
  min-height: 30vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.timeline-container {
  position: relative;
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px 0;
}

.timeline-container::after {
  content: "";
  position: absolute;
  width: 4px;
  background-color: #e0e0e0;
  top: 0;
  bottom: 0;
  left: 20px;
  margin-left: -2px;
}

.timeline-item {
  position: relative;
  margin-bottom: 40px;
  padding-left: 50px;
}

.timeline-marker {
  position: absolute;
  left: 20px;
  top: 25px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: #00695c;
  border: 4px solid #fff;
  transform: translateX(-50%);
  z-index: 1;
  box-shadow: 0 0 0 3px #00695c;
  transition: background-color 0.3s ease;
}

.timeline-item:hover .timeline-marker {
  background-color: #02ddc3;
  box-shadow: 0 0 0 3px #02ddc3;
}

.timeline-content {
  background-color: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  border-left: 5px solid #00695c;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
}

.timeline-content:hover,
.timeline-content:focus {
  transform: translateY(-3px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
  outline: 2px solid #00695c;
  outline-offset: 2px;
}

.timeline-content:hover .toggle-icon,
.timeline-content:focus .toggle-icon {
  color: #00695c;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.timeline-year {
  font-size: clamp(1.5rem, 3vw, 1.75rem);
  font-weight: bold;
  color: #00695c;
  margin: 0;
}

.timeline-favorite {
  background-color: #e0f2f1;
  color: #004d40;
  padding: 10px 15px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  margin-top: 10px;
  width: fit-content;
  max-width: 100%;
}

.fav-label {
  font-size: 16px;
  text-transform: uppercase;
  opacity: 0.8;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 5px;
}

.fav-movie-title {
  font-size: 18px;
  font-weight: 900;
  line-height: 1.3;
}

.toggle-icon {
  font-size: 24px;
  color: #004d40;
  font-weight: 900;
  transition: transform 0.3s ease, color 0.3s ease;
  cursor: pointer;
}

.timeline-content:hover .toggle-icon {
  color: #00695c;
}

.movie-list-container {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.6s ease-out, opacity 0.4s ease;
  opacity: 0;
  margin-top: 0;
}

 .timeline-item.active .movie-list-container {
  opacity: 1;
  margin-top: 0; 
  border-top: none;
  padding-top: 20px;
}

.timeline-item.active .toggle-icon {
  transform: rotate(180deg);
  color: #00695c;
}

.timeline-stats {
  font-size: 14px;
  color: #666;
  margin-bottom: 15px;
  font-style: italic;
}

.movie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 20px;
}

.movie-card {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s ease;
  display: flex;
  flex-direction: column;
  height: auto;
}

.movie-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.poster-wrapper {
  width: 100%;
  aspect-ratio: 2/3;
  overflow: hidden;
  background-color: #ddd;
}

.poster-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s;
}

.movie-info {
  padding: 10px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.movie-title {
  font-size: 14px;
  font-weight: bold;
  color: #333;
  margin: 0 0 5px 0;
  line-height: 1.3;
}

.movie-date {
  font-size: 16px;
  color: #00695c;
  margin: 0;
  font-weight: 600;
}

.favorite-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 20px; 
  border-bottom: 1px solid #eee; 
  z-index: auto;
}

.favorite-label-large {
  font-size: 18px;
  font-weight: 900;
  color: #00695c;
  margin-bottom: 15px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.favorite-card {
  width: 180px;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 6px 12px rgba(0, 105, 92, 0.3);
  border: 2px solid #00695c;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}

.favorite-card:hover {
  transform: scale(1.02);
}

.vertical-scroll-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 15px;
  max-height: 500px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px;
  width: 100%;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: #00695c #f0f0f0;
}

.vertical-scroll-wrapper:focus {
  outline: 2px solid #00695c;
  outline-offset: -2px;
}

.vertical-scroll-wrapper::-webkit-scrollbar {
  width: 8px;
}
.vertical-scroll-wrapper::-webkit-scrollbar-track {
  background: #f0f0f0;
  border-radius: 4px;
}
.vertical-scroll-wrapper::-webkit-scrollbar-thumb {
  background-color: #00695c;
  border-radius: 4px;
}

@media screen and (min-width: 800px) {
  .timeline-container::after {
    left: 50%;
  }

  .timeline-marker {
    left: 50%;
  }

  .timeline-item {
    width: 50%;
    padding-left: 0;
    padding-right: 40px;
    margin-left: 0;
    box-sizing: border-box;
  }

  .timeline-item:nth-child(even) {
    margin-left: 50%;
    padding-right: 0;
    padding-left: 40px;
  }

  .timeline-item .timeline-marker {
    left: 100%;
    margin-left: 0;
    transform: translateX(-50%);
  }

  .timeline-item:nth-child(even) .timeline-marker {
    left: 0;
  }
}