/* Timeline CSS */

.brxe-mitoterapia-timeline-wrapper {
    position: relative;
    padding: 40px 0;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    counter-reset: timeline-counter;
}

/* Central Line */
.timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: var(--primary-dark-trans-20, #e5e5e5);
    transform: translateX(-50%);
    border-radius: 4px;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to bottom, black calc(100% - 150px), transparent 100%);
    mask-image: linear-gradient(to bottom, black calc(100% - 150px), transparent 100%);
}

/* Progress Line */
.timeline-line-progress {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 0;
    background-color: var(--primary);
    transition: height 0.1s linear;
    z-index: 1;
}

/* Item Wrapper */
.brxe-mitoterapia-timeline-item {
    position: relative;
    width: 50%;
    padding-bottom: var(--space-m, 20px);
    box-sizing: border-box;
    counter-increment: timeline-counter;
    transition: opacity 0.3s ease;
}

/* =========================================
   Layout: Center (Alternating)
   ========================================= */

/* Use specific selector for Center or Default */
.brxe-mitoterapia-timeline-wrapper.timeline-layout-center .brxe-mitoterapia-timeline-item:nth-child(even),
.brxe-mitoterapia-timeline-wrapper:not([class*="timeline-layout-"]) .brxe-mitoterapia-timeline-item:nth-child(even) {
    left: 0;
    padding-right: 40px;
    text-align: right;
}

.brxe-mitoterapia-timeline-wrapper.timeline-layout-center .brxe-mitoterapia-timeline-item:nth-child(odd),
.brxe-mitoterapia-timeline-wrapper:not([class*="timeline-layout-"]) .brxe-mitoterapia-timeline-item:nth-child(odd) {
    left: 50%;
    padding-left: 40px;
    text-align: left;
}

/* Dot Position - Center */
.brxe-mitoterapia-timeline-wrapper.timeline-layout-center .brxe-mitoterapia-timeline-item:nth-child(even) .timeline-item-dot,
.brxe-mitoterapia-timeline-wrapper:not([class*="timeline-layout-"]) .brxe-mitoterapia-timeline-item:nth-child(even) .timeline-item-dot {
    right: -20px;
    left: auto;
}

.brxe-mitoterapia-timeline-wrapper.timeline-layout-center .brxe-mitoterapia-timeline-item:nth-child(odd) .timeline-item-dot,
.brxe-mitoterapia-timeline-wrapper:not([class*="timeline-layout-"]) .brxe-mitoterapia-timeline-item:nth-child(odd) .timeline-item-dot {
    left: -20px;
    right: auto;
}

/* Arrow - Center */
.brxe-mitoterapia-timeline-wrapper.timeline-layout-center .brxe-mitoterapia-timeline-item:nth-child(even) .timeline-item-content::before,
.brxe-mitoterapia-timeline-wrapper:not([class*="timeline-layout-"]) .brxe-mitoterapia-timeline-item:nth-child(even) .timeline-item-content::before {
    right: -10px;
    left: auto;
    border-width: 10px 0 10px 10px;
    border-color: transparent transparent transparent #fff;
}

.brxe-mitoterapia-timeline-wrapper.timeline-layout-center .brxe-mitoterapia-timeline-item:nth-child(odd) .timeline-item-content::before,
.brxe-mitoterapia-timeline-wrapper:not([class*="timeline-layout-"]) .brxe-mitoterapia-timeline-item:nth-child(odd) .timeline-item-content::before {
    left: -10px;
    right: auto;
    border-width: 10px 10px 10px 0;
    border-color: transparent #fff transparent transparent;
}


/* =========================================
   Layout: Left
   ========================================= */

.brxe-mitoterapia-timeline-wrapper.timeline-layout-left .timeline-line {
    left: 20px;
    transform: none;
}

/* Important to override Center styles if specificity is tricky */
.brxe-mitoterapia-timeline-wrapper.timeline-layout-left .brxe-mitoterapia-timeline-item {
    width: 100%;
    left: 0;
    padding-left: 60px; 
    padding-right: 0;
    text-align: left;
}

.brxe-mitoterapia-timeline-wrapper.timeline-layout-left .brxe-mitoterapia-timeline-item .timeline-item-dot {
    left: 0;
    right: auto;
}

.brxe-mitoterapia-timeline-wrapper.timeline-layout-left .brxe-mitoterapia-timeline-item .timeline-item-content::before {
    left: -10px;
    right: auto;
    border-width: 10px 10px 10px 0;
    border-color: transparent #fff transparent transparent;
}


/* =========================================
   Components
   ========================================= */

/* Dot */
.timeline-item-dot {
    position: absolute; /* Crucial */
    top: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #fff;
    border: 2px solid #e5e5e5;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    z-index: 2;
    box-shadow: 0 0 0 5px #fff;
    transition: all 0.3s ease;
}

.brxe-mitoterapia-timeline-item.active .timeline-item-dot {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #fff;
    transform: scale(1.1);
}

.timeline-item-dot .number:empty::before {
    content: counter(timeline-counter);
}

/* Content */
.timeline-item-content {
    background-color: #fff;
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--box-shadow-1, 0 10px 30px rgba(0,0,0,0.05));
    text-align: left;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: grid;
    grid-template-columns: var(--grid-1-2, 1fr 1fr);
    align-items: center;
    gap: 30px;
}

.brxe-mitoterapia-timeline-item.active .timeline-item-content {
    box-shadow: var(--box-shadow-1, 0 15px 40px rgba(0,0,0,0.1));
    transform: translateY(-2px);
}

.timeline-item-content::before {
    content: '';
    position: absolute;
    top: 15px;
    width: 0;
    height: 0;
    border-style: solid;
}

/* Image */
.timeline-image {
    border-radius: var(--radius-circle, 50%);
    overflow: hidden;
    aspect-ratio: 1;
    height: 200px;
    width: 200px;
    margin-right: auto;
}

.timeline-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Typography */
.timeline-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: #333;
}

.timeline-description {
    font-size: 0.95rem;
    color: #666;
    line-height: 1.6;
}

/* Responsive */
@media (max-width: 767px) {
    .brxe-mitoterapia-timeline-wrapper .timeline-line {
        left: 20px;
        transform: none;
    }

    .brxe-mitoterapia-timeline-wrapper .brxe-mitoterapia-timeline-item {
        width: 100%;
        left: 0 !important;
        padding-left: 60px;
        padding-right: 0;
        text-align: left !important;
    }

    /* Reset Dot to Left for all */
    .brxe-mitoterapia-timeline-wrapper .brxe-mitoterapia-timeline-item .timeline-item-dot {
        left: 0 !important;
        right: auto !important;
    }

    /* Reset Arrow to Left for all */
    .brxe-mitoterapia-timeline-wrapper .brxe-mitoterapia-timeline-item .timeline-item-content::before {
        left: -10px !important;
        right: auto !important;
        border-width: 10px 10px 10px 0;
        border-color: transparent #fff transparent transparent;
    }
    
    .timeline-item-content {
        grid-template-columns: 1fr;
    }
}
