/* ============================================================
   Timeline Widget for Elementor – Stylesheet
   ============================================================ */

.twe-timeline *,
.twe-timeline *::before,
.twe-timeline *::after {
  box-sizing: border-box;
}
.twe-timeline {
  position: relative;
  width: 100%;
  overflow-x: hidden;
}

/* ============================================================
   DOT
   ============================================================ */
.twe-dot {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a855f7, #6c2eff);
  box-shadow: 0 0 12px 4px rgba(168, 85, 247, 0.7);
  flex-shrink: 0;
  z-index: 3;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.twe-dot:hover {
  transform: scale(1.3);
  box-shadow: 0 0 20px 8px rgba(168, 85, 247, 0.9);
}
.twe-dot .twe-dot-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #fff;
  line-height: 1;
  pointer-events: none;
  overflow: hidden;
  width: 100%;
  height: 100%;
}
.twe-dot .twe-dot-icon svg,
.twe-dot .twe-dot-icon i {
  width: 12px !important;
  height: 12px !important;
  font-size: 12px !important;
  display: block;
  flex-shrink: 0;
}

/* ============================================================
   CARD
   ============================================================ */
.twe-timeline-card {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  border-radius: 16px;
  padding: 24px;
  color: #fff;
  position: relative;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
  box-shadow:
    0 0 30px rgba(124, 58, 237, 0.5),
    0 8px 32px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}
.twe-timeline-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.12) 0%,
    transparent 60%
  );
  pointer-events: none;
  border-radius: inherit;
  z-index: 1;
}
.twe-timeline-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow:
    0 0 45px rgba(124, 58, 237, 0.75),
    0 16px 48px rgba(0, 0, 0, 0.4);
}
.twe-card-overlay {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: 1;
  pointer-events: none;
}
.twe-card-date,
.twe-card-title,
.twe-card-desc {
  position: relative;
  z-index: 2;
}
.twe-card-date {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.12);
  padding: 3px 10px;
  border-radius: 20px;
}
.twe-card-title {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}
.twe-card-desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.85);
}

/* ============================================================
   HORIZONTAL LAYOUT
   ============================================================ */
.twe-layout-horizontal .twe-h-scroll-wrapper {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(168, 85, 247, 0.5) transparent;
  padding: 60px 0 60px 0 !important;
}
.twe-layout-horizontal .twe-h-scroll-wrapper::-webkit-scrollbar {
  height: 4px;
}
.twe-layout-horizontal .twe-h-scroll-wrapper::-webkit-scrollbar-track {
  background: transparent;
}
.twe-layout-horizontal .twe-h-scroll-wrapper::-webkit-scrollbar-thumb {
  background: rgba(168, 85, 247, 0.5);
  border-radius: 4px;
}
.twe-layout-horizontal .twe-h-track {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  position: relative;
  min-width: max-content;
  padding: 0 40px;
}
.twe-layout-horizontal .twe-line-h {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 3px;
  background: #111;
  transform: translateY(-50%);
  z-index: 1;
  pointer-events: none;
}
.twe-layout-horizontal .twe-h-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 2;
  margin-right: 60px;
}
.twe-layout-horizontal .twe-h-item:last-child {
  margin-right: 0;
}
.twe-layout-horizontal .twe-card-slot-top,
.twe-layout-horizontal .twe-card-slot-bottom {
  flex: 1;
  display: flex;
  justify-content: center;
  min-height: 160px;
}
.twe-layout-horizontal .twe-card-slot-top {
  align-items: flex-end;
}
.twe-layout-horizontal .twe-card-slot-bottom {
  align-items: flex-start;
}
.twe-layout-horizontal .twe-dot-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  z-index: 3;
}
.twe-layout-horizontal .twe-connector-line {
  width: 3px;
  height: 30px;
  background: #111;
  flex-shrink: 0;
}
.twe-layout-horizontal .twe-pos-top .twe-card-slot-top {
  order: 1;
}
.twe-layout-horizontal .twe-pos-top .twe-dot-connector {
  order: 2;
}
.twe-layout-horizontal .twe-pos-top .twe-dot-connector .twe-connector-line {
  order: 1;
}
.twe-layout-horizontal .twe-pos-top .twe-dot-connector .twe-dot {
  order: 2;
  margin-top: -20px;
}
.twe-layout-horizontal .twe-pos-top .twe-card-slot-bottom {
  order: 3;
  visibility: hidden;
  pointer-events: none;
}
.twe-layout-horizontal .twe-pos-bottom .twe-card-slot-top {
  order: 1;
  visibility: hidden;
  pointer-events: none;
}
.twe-layout-horizontal .twe-pos-bottom .twe-dot-connector {
  order: 2;
}
.twe-layout-horizontal .twe-pos-bottom .twe-dot-connector .twe-dot {
  order: 1;
  margin-bottom: -20px;
}
.twe-layout-horizontal .twe-pos-bottom .twe-dot-connector .twe-connector-line {
  order: 2;
}
.twe-layout-horizontal .twe-pos-bottom .twe-card-slot-bottom {
  order: 3;
}
.twe-layout-horizontal .twe-timeline-card {
  min-width: 220px;
  max-width: 280px;
}

/* ============================================================
   VERTICAL SHARED
   ============================================================ */
.twe-v-wrapper {
  position: relative;
  padding: 20px 0;
}

/* ============================================================
   VERTICAL ALTERNATING
   ============================================================
   Structure per item:
   [LEFT HALF: card or empty] [DOT] [CONNECTOR] [RIGHT HALF: card or empty]

   We use a pure flexbox row approach:
   - .twe-v-spacer fills the empty half
   - dot and connector are inline in the row
   - card takes the other half
   This guarantees dot is always on the center line and
   connector always touches both dot and card.
   ============================================================ */
.twe-layout-vertical .twe-line-v {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #111;
  transform: translateX(-50%);
  z-index: 1;
}

.twe-layout-vertical .twe-v-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  position: relative;
  margin-bottom: 60px;
  z-index: 2;
  width: 100%;
}
.twe-layout-vertical .twe-v-item:last-child {
  margin-bottom: 0;
}

/* Spacer fills exactly half the row width */
.twe-v-spacer {
  flex: 0 0 calc(50% - 14px - 26px); /* 50% minus half-dot minus connector */
  min-width: 0;
}

/* Connector: inline flex item, fixed width, sits between dot and card */
.twe-layout-vertical .twe-v-item .twe-v-connector {
  flex: 0 0 26px;
  width: 26px;
  height: 3px;
  background: #111;
  flex-shrink: 0;
  align-self: center;
  position: relative;
  z-index: 3;
}

/* Dot: inline flex item */
.twe-layout-vertical .twe-v-item .twe-dot {
  flex-shrink: 0;
  position: relative;
  z-index: 4;
  align-self: center;
  vertical-align: middle;
  margin-top: 0;
}

/* Card fills remaining space */
.twe-layout-vertical .twe-v-item .twe-timeline-card {
  flex: 1;
  min-width: 0;
  align-self: center;
}

/*
 * RIGHT item (even): card LEFT, spacer RIGHT
 * Order: [card] [connector] [dot] [spacer]
 */
.twe-layout-vertical .twe-v-right .twe-timeline-card {
  order: 1;
}
.twe-layout-vertical .twe-v-right .twe-v-connector {
  order: 2;
}
.twe-layout-vertical .twe-v-right .twe-dot {
  order: 3;
  margin-right: 24px;
}
.twe-layout-vertical .twe-v-right .twe-v-spacer {
  order: 4;
}

/*
 * LEFT item (odd): spacer LEFT, card RIGHT
 * Order: [spacer] [dot] [connector] [card]
 */
.twe-layout-vertical .twe-v-left .twe-v-spacer {
  order: 1;
}
.twe-layout-vertical .twe-v-left .twe-dot {
  order: 2;
  margin-left: 24px;
}
.twe-layout-vertical .twe-v-left .twe-v-connector {
  order: 3;
}
.twe-layout-vertical .twe-v-left .twe-timeline-card {
  order: 4;
}

/* ============================================================
   VERTICAL SINGLE SIDE
   ============================================================
   Pure flexbox row: [dot] [connector] [card]
   No absolute positioning needed — everything is in flow.
   ============================================================ */
.twe-layout-vertical-single .twe-line-v {
  position: absolute;
  left: 14px; /* dot center = 14px from left edge */
  top: 0;
  bottom: 0;
  width: 3px;
  background: #111;
  transform: translateX(-50%);
  z-index: 1;
}

.twe-layout-vertical-single .twe-v-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  position: relative;
  margin-bottom: 50px;
  padding-left: 0;
  z-index: 2;
  gap: 0;
}
.twe-layout-vertical-single .twe-v-item:last-child {
  margin-bottom: 0;
}

/* Dot: first in flow, its center aligns with the line */
.twe-layout-vertical-single .twe-v-item .twe-dot {
  flex-shrink: 0;
  position: relative;
  z-index: 4;
  align-self: center;
}

/* Connector: immediately after dot, touches dot's right edge */
.twe-layout-vertical-single .twe-v-item .twe-v-connector {
  flex: 0 0 26px;
  width: 26px;
  height: 3px;
  background: #111;
  flex-shrink: 0;
  align-self: center;
  position: relative;
  z-index: 3;
}

/* Card: fills rest of row, touches connector's right edge */
.twe-layout-vertical-single .twe-v-item .twe-timeline-card {
  flex: 1;
  min-width: 0;
  align-self: center;
}

/* Card side = left */
.twe-layout-vertical-single.twe-side-left .twe-line-v {
  left: auto;
  right: 14px;
  transform: translateX(50%);
}
.twe-layout-vertical-single.twe-side-left .twe-v-item {
  flex-direction: row-reverse;
}

/* ============================================================
   RESPONSIVE LAYOUT SWITCHING
   ============================================================ */
.twe-timeline .twe-horizontal-only {
  display: block;
}
.twe-timeline .twe-vertical-only {
  display: none;
}
.twe-timeline.twe-layout-vertical .twe-horizontal-only,
.twe-timeline.twe-layout-vertical-single .twe-horizontal-only {
  display: none;
}
.twe-timeline.twe-layout-vertical .twe-vertical-only,
.twe-timeline.twe-layout-vertical-single .twe-vertical-only {
  display: block;
}

/* ============================================================
   ANIMATION STATES
   ============================================================ */
[data-twe-anim] .twe-timeline-card,
[data-twe-anim] .twe-dot {
  opacity: 0;
  transition-property: opacity, transform;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}
[data-twe-anim="fade-up"] .twe-timeline-card {
  transform: translateY(40px);
}
[data-twe-anim="fade-in"] .twe-timeline-card {
  transform: none;
}
[data-twe-anim="zoom-in"] .twe-timeline-card {
  transform: scale(0.85);
}
[data-twe-anim="slide-left"] .twe-timeline-card {
  transform: translateX(-40px);
}
[data-twe-anim="slide-right"].twe-timeline-card {
  transform: translateX(40px);
}
[data-twe-anim] .twe-timeline-card.twe-animated,
[data-twe-anim] .twe-dot.twe-animated {
  opacity: 1;
  transform: none;
}

/* ============================================================
   BREAKPOINTS
   ============================================================ */
@media (max-width: 767px) {
  .twe-layout-horizontal .twe-timeline-card {
    min-width: 180px;
    max-width: 220px;
  }
  .twe-card-title {
    font-size: 15px;
  }
  .twe-card-desc {
    font-size: 13px;
  }
}

/* ============================================================
   VERTICAL-SINGLE OVERRIDES FOR ALTERNATING HTML
   ============================================================
   When JS switches layout to vertical-single, the HTML still
   has twe-v-right / twe-v-left / twe-v-spacer from the
   alternating render. These overrides reset all of that so
   every item looks like: [dot] [connector] [card]
   ============================================================ */
.twe-layout-vertical-single .twe-v-right,
.twe-layout-vertical-single .twe-v-left {
  /* Reset alternating padding */
  padding-left: 0 !important;
  padding-right: 0 !important;
  /* Re-apply single-side layout */
  flex-direction: row !important;
}

/* Hide the spacer — not needed in single-side */
.twe-layout-vertical-single .twe-v-spacer {
  display: none !important;
}

/* Reset all flex orders set by alternating layout */
.twe-layout-vertical-single .twe-v-right .twe-timeline-card,
.twe-layout-vertical-single .twe-v-left .twe-timeline-card {
  order: 3 !important;
  flex: 1 !important;
  min-width: 0 !important;
}
.twe-layout-vertical-single .twe-v-right .twe-v-connector,
.twe-layout-vertical-single .twe-v-left .twe-v-connector {
  order: 2 !important;
  flex: 0 0 26px !important;
  width: 26px !important;
  height: 3px !important;
}
.twe-layout-vertical-single .twe-v-right .twe-dot,
.twe-layout-vertical-single .twe-v-left .twe-dot {
  order: 1 !important;
}

/* Re-apply single-side line position */
.twe-layout-vertical-single .twe-line-v {
  left: 14px !important;
  right: auto !important;
  transform: translateX(-50%) !important;
}
