/**
 * Minh Tri Elements Styles - Updated based on design reference
 * 
 * @package MinhTriCore
 * @subpackage Elements
 * @since 1.0.0
 */

/* ===========================
   VERTICAL TIMELINE STYLES - NEW DESIGN
   =========================== */

.minh-tri-vertical-timeline {
  position: relative;
  margin: 0 auto;
}

/* Timeline Line - Thinner and more subtle */
.minh-tri-vertical-timeline::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 25px;
  bottom: 0;
  width: var(--timeline-line-width, 2px);
  background-color: var(--timeline-line-color, #000000);
  transform: translateX(-50%);
  z-index: 1;
}

/* Timeline Items */
.timeline-item {
  position: relative;
  margin-bottom: 50px;
  width: 100%;
  display: flex;
}

/* Timeline Year/Time - Large and centered like the reference */
.timeline-time {
  font-size: 48px;
  font-weight: 700;
  color: var(--timeline-point-color, #000000);
  text-align: center;
  padding: 0 30px;
  z-index: 3;
  line-height: 1.3;
  font-family: "Roboto", sans-serif;
}

.timeline-time time {
  display: block;
}

/* Timeline Point - Small and subtle */
.timeline-point {
  position: absolute;
  left: 50%;
  top: 25px;
  width: 10px;
  height: 10px;
  background-color: var(--timeline-point-color, #000000);
  border-radius: 50%;
  transform: translateX(-50%);
  z-index: 5;
  box-shadow: 0 0 0 2px var(--timeline-point-color, #000000);
}

.timeline-point i {
  display: none; /* Hide icons for cleaner look */
}

/* Timeline Content Positioning - Alternating left-right */
.timeline-item:nth-child(odd) .timeline-content {
  margin-right: auto;
  text-align: right;
}

.timeline-item:nth-child(even) .timeline-content {
  margin-left: auto;
  text-align: left;
}

/* Timeline Content Styles - Clean and modern */
.timeline-content {
  background: transparent;
  padding: 0 30px;
  border-radius: 0;
  position: relative;
  border: none;
  min-height: 200px;
  width: 50%;
}

/* Remove arrows for cleaner design */
.timeline-content::after {
  display: none;
}

/* Timeline Text Content */
.timeline-text {
  color: #555;
  line-height: 1.8;
  font-size: 16px;
}

.timeline-text h1 {
  font-size: 56px;
}
.timeline-text h2 {
  font-size: 48px;
}
.timeline-text h3 {
  font-size: 40px;
  margin-top: 3px;
}
.timeline-text h4 {
  font-size: 32px;
  margin-top: 9px;
}
.timeline-text h5 {
  font-size: 24px;
  margin-top: 14px;
}
.timeline-text h6 {
  margin-top: 17px;
  font-size: 20px;
}

.timeline-text h1,
.timeline-text h2,
.timeline-text h3,
.timeline-text h4,
.timeline-text h5,
.timeline-text h6 {
  margin-bottom: 15px;
  color: var(--timeline-point-color, #000000);
  font-weight: 600;
  line-height: 1.3;
}

.timeline-text p {
  margin-bottom: 18px;
  color: #666;
}

.timeline-text p:last-child {
  margin-bottom: 0;
}

/* Timeline Image - Better integration like the reference */
.timeline-image-wrapper {
  margin: 10px 0;
  position: relative;
  overflow: hidden;
  border-radius: 8px;
}

.timeline-image {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.3s ease;
}

.timeline-image:hover {
  transform: scale(1.02);
}

/* Multiple images grid (like in the reference design) */
.timeline-text .timeline-images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px;
  margin: 25px 0;
}

.timeline-text .timeline-images-grid img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  transition: transform 0.3s ease;
}

.timeline-text .timeline-images-grid img:hover {
  transform: scale(1.05);
}

/* ===========================
   TABLET STYLES
   =========================== */

@media (max-width: 1024px) {
  .minh-tri-vertical-timeline {
    padding: 0px 20px;
    max-width: 800px;
  }

  .timeline-time {
    font-size: 40px;
    padding: 0 25px;
  }

  .timeline-content {
    padding: 0 30px;
    min-height: 150px;
  }

  .timeline-text {
    font-size: 15px;
  }

  .timeline-text h1 {
    font-size: 48px;
  }
  .timeline-text h2 {
    font-size: 40px;
  }
  .timeline-text h3 {
    font-size: 32px;
  }
  .timeline-text h4 {
    font-size: 28px;
  }
  .timeline-text h5 {
    font-size: 24px;
  }
  .timeline-text h6 {
    font-size: 20px;
  }
}

/* ===========================
   MOBILE STYLES - Following reference design
   =========================== */

@media (max-width: 768px) {
  .minh-tri-vertical-timeline {
    padding: 0px 20px;
    background: #fff;
  }

  /* Move line to left */
  .minh-tri-vertical-timeline::before {
    left: 20px;
    top: 15px;
  }

  /* Timeline items single column */
  .timeline-item {
    margin-bottom: 60px;
    flex-direction: column;
  }

  /* Year/time positioning for mobile */
  .timeline-time {
    font-size: 30px;
    left: 30px;
    transform: translateX(-50%);
    background: #fff;
    padding: 0 15px;
  }

  /* Timeline point positioning */
  .timeline-point {
    left: 0;
    top: 15px;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
  }

  /* Content positioning for mobile */
  .timeline-animate .timeline-item:nth-child(odd) .timeline-time {
    order: 0 !important;
  }

  .timeline-content {
    width: 100%;
    text-align: left !important;
    padding: 0 15px;
  }

  .timeline-text {
    font-size: 14px;
    line-height: 1.6;
  }

  .timeline-text h1 {
    font-size: 36px;
  }
  .timeline-text h2 {
    font-size: 32px;
  }
  .timeline-text h3 {
    font-size: 28px;
  }
  .timeline-text h4 {
    font-size: 24px;
  }
  .timeline-text h5 {
    font-size: 20px;
  }
  .timeline-text h6 {
    font-size: 18px;
  }

  .timeline-text h1,
  .timeline-text h2,
  .timeline-text h3,
  .timeline-text h4,
  .timeline-text h5,
  .timeline-text h6 {
    margin-top: 0;
  }

  .timeline-text .timeline-images-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .timeline-text .timeline-images-grid img {
    height: 60px;
  }
}

/* ===========================
   SMALL MOBILE STYLES
   =========================== */

@media (max-width: 480px) {
  .minh-tri-vertical-timeline {
    padding: 0 15px;
  }

  .minh-tri-vertical-timeline::before {
    left: 15px;
  }

  .timeline-time {
    left: 25px;
    padding: 0 10px;
  }

  .timeline-point {
    width: 6px;
    height: 6px;
  }

  .timeline-content {
    padding: 0 10px;
  }

  .timeline-text {
    font-size: 13px;
  }

  .timeline-item {
    margin-bottom: 50px;
  }
}

/* ===========================
   ANIMATION STYLES - Enhanced
   =========================== */

.timeline-animate .timeline-item {
  opacity: 0;
  transform: translateY(40px);
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.timeline-animate .timeline-item.in-view {
  opacity: 1;
  transform: translateY(0);
}

.timeline-animate .timeline-time {
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.2s;
  width: 50%;
}

.timeline-animate .timeline-item.in-view .timeline-time {
  opacity: 1;
  transform: scale(1);
}

.timeline-animate .timeline-item:nth-child(odd) .timeline-time {
  text-align: left;
  order: 2;
}

.timeline-animate .timeline-item:nth-child(even) .timeline-time {
  text-align: right;
}

.timeline-animate .timeline-content {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.4s;
}

.timeline-animate .timeline-item.in-view .timeline-content {
  opacity: 1;
  transform: translateY(0);
}

/* Mobile animations */
@media (max-width: 768px) {
  .timeline-animate .timeline-time {
    transform: translateY(-10px);
  }

  .timeline-animate .timeline-item.in-view .timeline-time {
    transform: translateY(0);
  }

  .timeline-animate .timeline-item:nth-child(even) .timeline-time {
    text-align: left;
  }
}

/* ===========================
   UX BUILDER PREVIEW STYLES
   =========================== */

.ux-builder-mode .minh-tri-vertical-timeline {
  min-height: 300px;
  background: #f8f9fa;
}

.ux-builder-mode .timeline-item {
  margin-bottom: 20px;
}

.ux-builder-mode .timeline-content {
  border: 2px dashed #ddd;
  background: #f9f9f9;
  min-height: 150px;
}

.ux-builder-mode .timeline-time {
  background: #f8f9fa;
}

/* ===========================
   FRONTEND ENHANCEMENTS
   =========================== */

/* Empty timeline state */
.timeline-empty {
  text-align: center;
  padding: 80px 20px;
  border: 2px dashed #ddd;
  border-radius: 10px;
  background: #f9f9f9;
}

.timeline-empty-message {
  color: #666;
  font-style: italic;
  margin: 0;
  font-size: 16px;
}

/* Error states */
.timeline-box-error {
  background: #ffe6e6;
  border: 1px solid #ffcccc;
  color: #cc0000;
  padding: 15px 20px;
  border-radius: 8px;
  margin: 15px 0;
  font-size: 14px;
}

/* ===========================
   TIMELINE WIDGET STYLES
   =========================== */

.timeline-widget-wrapper {
  position: relative;
  padding: 25px 0;
  background: #fff;
}

.timeline-widget-wrapper .timeline-item {
  margin-bottom: 0;
}

.timeline-widget-wrapper .timeline-point {
  left: 20px;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  top: 15px;
}

.timeline-widget-wrapper .timeline-time {
  position: static;
  transform: none;
  font-size: 18px;
  text-align: left;
  margin-bottom: 15px;
  background: transparent;
  padding: 0;
  color: #000000;
}

.timeline-widget-wrapper .timeline-content {
  margin-left: 45px;
  padding: 0 20px;
  border-left: 3px solid var(--timeline-point-color, #000000);
  box-shadow: none;
  min-height: auto;
  margin-top: 0;
}

.timeline-widget-wrapper .timeline-text {
  font-size: 14px;
}

/* Widget in sidebar */
.widget .timeline-widget-wrapper {
  padding: 15px 0;
}

.widget .timeline-widget-wrapper .timeline-content {
  padding: 0 15px;
  margin-left: 35px;
}

.widget .timeline-widget-wrapper .timeline-time {
  font-size: 16px;
  margin-bottom: 10px;
}

/* ===========================
   ACCESSIBILITY IMPROVEMENTS
   =========================== */

/* High contrast mode */
@media (prefers-contrast: high) {
  .timeline-point {
    border: 3px solid #000;
    background-color: #000;
  }

  .timeline-content {
    border: 2px solid #000;
  }

  .minh-tri-vertical-timeline::before {
    background-color: #000;
  }

  .timeline-time {
    color: #000;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .timeline-animate .timeline-item,
  .timeline-animate .timeline-time,
  .timeline-animate .timeline-content {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .timeline-image,
  .timeline-text .timeline-images-grid img {
    transition: none;
  }
}

/* ===========================
   PRINT STYLES
   =========================== */

@media print {
  .minh-tri-vertical-timeline {
    max-width: none;
    padding: 20px 0;
    background: #fff;
  }

  .timeline-item {
    margin-bottom: 40px;
    page-break-inside: avoid;
  }

  .timeline-content {
    box-shadow: none;
    border: 1px solid #ddd;
    width: calc(100% - 80px);
    margin-left: 70px;
    text-align: left;
    padding: 0 20px;
    margin-top: 40px;
  }

  .timeline-point {
    background: #000 !important;
  }

  .timeline-time {
    color: #000 !important;
    background: #fff;
  }

  .minh-tri-vertical-timeline::before {
    left: 30px;
    transform: none;
  }

  .timeline-point {
    left: 30px;
    transform: translateX(-50%);
  }

  .timeline-time {
    font-size: 24px;
  }
}
