/**
 * Timeline Plugin Frontend Styles
 *
 * @package Timeline_Plugin
 */

/* ==========================================================================
   CSS Variables
   ========================================================================== */

:root {
  --timeline-line-color: #00bcd4;
  --timeline-year-bg: #00bcd4;
  --timeline-year-text: #ffffff;
  --timeline-card-bg: #ffffff;
  --timeline-card-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --timeline-connector-size: 18px;
  --timeline-line-width: 4px;
}

/* ==========================================================================
   Timeline Container
   ========================================================================== */

.timeline-container {
  position: relative;
  max-width: 1200px;
  margin: 40px auto;
  padding: 20px 0;
}

/* ==========================================================================
   Vertical Line
   ========================================================================== */

.timeline-line {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: var(--timeline-line-width);
  background-color: var(--timeline-line-color);
  transform: translateX(-50%);
}

/* ==========================================================================
   Year Markers
   ========================================================================== */

.timeline-year-marker {
  position: relative;
  display: flex;
  justify-content: center;
  margin: 30px 0;
  z-index: 2;
}

.year-badge {
  display: inline-block;
  padding: 10px 24px;
  background-color: var(--timeline-year-bg);
  color: var(--timeline-year-text);
  font-size: 18px;
  font-weight: 700;
  border-radius: 25px;
  box-shadow: var(--timeline-card-shadow);
}

/* ==========================================================================
   Timeline Entries
   ========================================================================== */

.timeline-entry {
  position: relative;
  display: flex;
  align-items: flex-start;
  margin: 30px 0;
  width: 100%;
}

/* Right-positioned entries */
.timeline-entry-right {
  flex-direction: row;
  padding-left: calc(50% + 30px);
}

/* Left-positioned entries */
.timeline-entry-left {
  flex-direction: row-reverse;
  padding-right: calc(50% + 30px);
}

/* ==========================================================================
   Connector Dots
   ========================================================================== */

.timeline-connector {
  position: absolute;
  left: 50%;
  top: 20px;
  transform: translateX(-50%);
  z-index: 3;
}

.connector-dot {
  display: block;
  width: var(--timeline-connector-size);
  height: var(--timeline-connector-size);
  background-color: var(--timeline-line-color);
  border: 3px solid #ffffff;
  border-radius: 50%;
  box-shadow: var(--timeline-card-shadow);
}

/* ==========================================================================
   Date Labels
   ========================================================================== */

.timeline-date {
  position: absolute;
  top: 18px;
  font-size: 14px;
  font-weight: 600;
  color: #666666;
  white-space: nowrap;
}

.timeline-entry-right .timeline-date {
  right: calc(50% + 30px);
  text-align: right;
}

.timeline-entry-left .timeline-date {
  left: calc(50% + 30px);
  text-align: left;
}

/* ==========================================================================
   Entry Cards
   ========================================================================== */

.timeline-card {
  background-color: var(--timeline-card-bg);
  border-radius: 8px;
  box-shadow: var(--timeline-card-shadow);
  overflow: hidden;
  max-width: 400px;
  width: 100%;
}

.timeline-entry-right .timeline-card {
  margin-left: 0;
}

.timeline-entry-left .timeline-card {
  margin-right: 0;
  margin-left: auto;
}

/* Clickable Card Link */
a.timeline-card-link,
a.timeline-card-link:hover,
a.timeline-card-link:focus,
a.timeline-card-link:active,
.entry-content a.timeline-card-link,
.ast-single-post .entry-content a.timeline-card-link {
  display: block;
  text-decoration: none !important;
  color: inherit;
  cursor: pointer;
}

a.timeline-card-link .timeline-title,
a.timeline-card-link .timeline-text,
a.timeline-card-link .timeline-text p {
  text-decoration: none !important;
}

/* Card Header with Colored Background */
.timeline-card-header {
  padding: 15px 20px;
  color: #ffffff;
}

.timeline-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  color: #ffffff;
  text-decoration: none;
}

.timeline-title a {
  color: #ffffff;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.timeline-title a:hover {
  opacity: 0.85;
  text-decoration: none;
}

/* Card Body */
.timeline-card-body {
  padding: 15px 20px;
}

.timeline-card-body:empty {
  display: none;
}

/* Entry Text */
.timeline-text {
  margin-top: 10px;
}

.timeline-text p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: #555555;
}

/* Entry Images */
.timeline-image {
  margin: 0;
}

.timeline-image img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
}

/* ==========================================================================
   Empty State
   ========================================================================== */

.timeline-empty {
  text-align: center;
  padding: 60px 20px;
  color: #666666;
  font-size: 16px;
}

.timeline-empty p {
  margin: 0;
}

/* ==========================================================================
   Scroll-Triggered Animations
   ========================================================================== */

/* Initial hidden state for entries */
.timeline-entry {
  opacity: 0;
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

/* Slide-in from right for right-positioned entries */
.timeline-entry-right {
  transform: translateX(50px);
}

/* Slide-in from left for left-positioned entries */
.timeline-entry-left {
  transform: translateX(-50px);
}

/* Visible state when entry comes into view */
.timeline-entry.timeline-visible {
  opacity: 1;
  transform: translateX(0);
}

/* Year marker animations */
.timeline-year-marker {
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.timeline-year-marker.timeline-visible {
  opacity: 1;
  transform: scale(1);
}

/* Card hover effects */
.timeline-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.timeline-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Connector dot pulse animation */
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 188, 212, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(0, 188, 212, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 188, 212, 0);
  }
}

.timeline-entry.timeline-visible .connector-dot {
  animation: pulse 2s ease-out;
}

/* ==========================================================================
   Responsive Mobile Styles
   ========================================================================== */

@media screen and (max-width: 768px) {
  /* Container adjustments */
  .timeline-container {
    padding: 20px 15px;
  }

  /* Move timeline line to the left */
  .timeline-line {
    left: 20px;
    transform: none;
  }

  /* Year markers aligned to left */
  .timeline-year-marker {
    justify-content: flex-start;
    padding-left: 40px;
  }

  .year-badge {
    font-size: 16px;
    padding: 8px 18px;
  }

  /* Stack all entries vertically (no alternating) */
  .timeline-entry,
  .timeline-entry-right,
  .timeline-entry-left {
    flex-direction: row;
    padding-left: 50px;
    padding-right: 0;
  }

  /* Connector dots aligned to left line */
  .timeline-connector {
    left: 20px;
    transform: none;
  }

  /* Date labels positioned above cards */
  .timeline-date {
    position: relative;
    top: auto;
    left: auto !important;
    right: auto !important;
    text-align: left !important;
    margin-bottom: 8px;
  }

  /* Cards take full width */
  .timeline-card {
    max-width: 100%;
  }

  .timeline-entry-left .timeline-card,
  .timeline-entry-right .timeline-card {
    margin-left: 0;
    margin-right: 0;
  }

  /* Adjust card header and body padding */
  .timeline-card-header {
    padding: 12px 15px;
  }

  .timeline-title {
    font-size: 16px;
  }

  .timeline-card-body {
    padding: 12px 15px;
  }

  /* Animation adjustments for mobile - all slide from left */
  .timeline-entry-right,
  .timeline-entry-left {
    transform: translateX(-30px);
  }

  .timeline-entry.timeline-visible {
    transform: translateX(0);
  }
}

/* Extra small screens */
@media screen and (max-width: 480px) {
  .timeline-container {
    padding: 15px 10px;
  }

  .timeline-line {
    left: 15px;
  }

  .timeline-connector {
    left: 15px;
  }

  .timeline-year-marker {
    padding-left: 35px;
  }

  .timeline-entry,
  .timeline-entry-right,
  .timeline-entry-left {
    padding-left: 40px;
  }

  .year-badge {
    font-size: 14px;
    padding: 6px 14px;
  }

  .timeline-title {
    font-size: 15px;
  }

  .timeline-date {
    font-size: 13px;
  }
}
