/**
 * PecPlus Timeline - Estilos do Frontend
 * 
 * Estilos para a timeline animada com trator
 */

/* Variáveis CSS (definidas dinamicamente pelo PHP) */
:root {
    --pecplus-primary: #006633;
    --pecplus-secondary: #cccccc;
    --pecplus-tertiary: #30493a;
}

/* Container principal */
.pecplus-timeline-wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 20px;
    overflow: hidden;
}

/* Timeline */
.pecplus-timeline {
    position: relative;
    width: 100%;
    min-height: 500px;
}

/* Linha central */
.pecplus-timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: var(--pecplus-secondary);
    transform: translateX(-50%);
    z-index: 1;
}

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

/* Trator */
.pecplus-timeline-tractor {
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%) translateY(-20px);
    z-index: 10;
    transition: top 0.1s linear;
}

.pecplus-tractor-image {
    width: 80px;
    height: auto;
    display: block;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.2));
}

.pecplus-tractor-emoji {
    font-size: 50px;
    display: block;
    text-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

/* Sulcos de lavragem (furrows) */
.pecplus-tractor-furrows {
    position: absolute;
    top: -70px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 70px;
    pointer-events: none;
}

.pecplus-furrow {
    position: absolute;
    bottom: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(to top, rgba(139, 90, 43, 0.6), rgba(139, 90, 43, 0));
    border-radius: 1px;
}

.pecplus-furrow--left {
    right: calc(50% + calc(var(--furrow-offset) * 8px));
}

.pecplus-furrow--right {
    left: calc(50% + calc(var(--furrow-offset) * 8px));
}

/* Sementes que caem do trator */
.pecplus-tractor-seeds {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
}

.pecplus-falling-seed {
    position: absolute;
    width: 5px;
    height: 5px;
    background-color: var(--pecplus-primary);
    border-radius: 50%;
    opacity: 0.7;
    z-index: 3;
    transition: opacity 0.3s ease;
}

@keyframes pecplus-seed-fall {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    30% {
        transform: scale(1);
        opacity: 0.8;
    }
    100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
}

.pecplus-falling-seed.is-visible {
    animation: pecplus-seed-fall 0.5s ease-out forwards;
}

/* Items da timeline */
.pecplus-timeline-item {
    position: relative;
    width: 45%;
    padding: 20px 0;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.pecplus-timeline-item.pecplus-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Posição esquerda */
.pecplus-timeline-item.pecplus-position-left {
    margin-left: 0;
    margin-right: auto;
    padding-right: 50px;
    text-align: right;
}

/* Posição direita */
.pecplus-timeline-item.pecplus-position-right {
    margin-left: auto;
    margin-right: 0;
    padding-left: 50px;
    text-align: left;
}

/* Semente/Ponto */
.pecplus-timeline-seed {
    position: absolute;
    top: 30px;
    width: 16px;
    height: 16px;
    background-color: var(--pecplus-primary);
    border-radius: 50%;
    z-index: 5;
    opacity: 0;
    transform: scale(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-shadow: 0 0 0 4px rgba(0, 102, 51, 0.2);
}

.pecplus-timeline-item.pecplus-visible .pecplus-timeline-seed {
    opacity: 1;
    transform: scale(1);
}

.pecplus-timeline-item.pecplus-position-left .pecplus-timeline-seed {
    right: -8px;
    transform-origin: center;
}

.pecplus-timeline-item.pecplus-position-right .pecplus-timeline-seed {
    left: -8px;
    transform-origin: center;
}

.pecplus-timeline-item.pecplus-visible.pecplus-position-left .pecplus-timeline-seed,
.pecplus-timeline-item.pecplus-visible.pecplus-position-right .pecplus-timeline-seed {
    transform: scale(1) translateX(0);
}

/* Ano */
.pecplus-timeline-item-year {
    font-size: 48px;
    font-weight: 300;
    color: var(--pecplus-tertiary);
    opacity: 0.3;
    margin-bottom: 10px;
    line-height: 1;
}

/* Card */
.pecplus-timeline-item-card {
    background: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border-left: 4px solid var(--pecplus-primary);
    text-align: left;
}

.pecplus-timeline-item.pecplus-position-right .pecplus-timeline-item-card {
    border-left: none;
    border-right: 4px solid var(--pecplus-primary);
}

.pecplus-timeline-item-title {
    margin: 0 0 10px;
    font-size: 20px;
    font-weight: 600;
    color: var(--pecplus-tertiary);
}

.pecplus-timeline-item-description {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
    color: #555;
}

/* Animação de pulse nas sementes */
@keyframes pecplus-seed-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 102, 51, 0.4);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(0, 102, 51, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 102, 51, 0);
    }
}

.pecplus-timeline-item.pecplus-visible .pecplus-timeline-seed {
    animation: pecplus-seed-pulse 1s ease-out;
}

/* =====================================================
   MOBILE STYLES (768px e abaixo)
   ===================================================== */
@media screen and (max-width: 768px) {
    .pecplus-timeline-wrapper {
        padding: 40px 15px;
    }

    /* Linha à esquerda no mobile */
    .pecplus-timeline-line {
        left: 20px;
        transform: none;
    }

    /* Trator menor e à esquerda */
    .pecplus-timeline-tractor {
        left: 20px;
        transform: translateX(-50%) translateY(-10px);
    }

    .pecplus-tractor-image {
        width: 50px;
    }

    .pecplus-tractor-emoji {
        font-size: 35px;
    }

    /* Sulcos menores no mobile */
    .pecplus-tractor-furrows {
        width: 80px;
        height: 50px;
        top: -50px;
    }

    .pecplus-furrow {
        width: 1.5px;
    }

    .pecplus-furrow--left {
        right: calc(50% + calc(var(--furrow-offset) * 6px));
    }

    .pecplus-furrow--right {
        left: calc(50% + calc(var(--furrow-offset) * 6px));
    }

    .pecplus-falling-seed {
        width: 4px;
        height: 4px;
    }

    /* Todos os items à direita */
    .pecplus-timeline-item,
    .pecplus-timeline-item.pecplus-position-left,
    .pecplus-timeline-item.pecplus-position-right {
        width: calc(100% - 50px);
        margin-left: 50px;
        margin-right: 0;
        padding-left: 20px;
        padding-right: 0;
        text-align: left;
    }

    /* Sementes à esquerda */
    .pecplus-timeline-seed,
    .pecplus-timeline-item.pecplus-position-left .pecplus-timeline-seed,
    .pecplus-timeline-item.pecplus-position-right .pecplus-timeline-seed {
        left: -28px;
        right: auto;
    }

    /* Ano menor */
    .pecplus-timeline-item-year {
        font-size: 32px;
    }

    /* Card sem borda direita */
    .pecplus-timeline-item-card,
    .pecplus-timeline-item.pecplus-position-right .pecplus-timeline-item-card {
        border-left: 4px solid var(--pecplus-primary);
        border-right: none;
        padding: 20px;
    }

    .pecplus-timeline-item-title {
        font-size: 18px;
    }

    .pecplus-timeline-item-description {
        font-size: 14px;
    }
}

/* =====================================================
   TABLET STYLES (769px - 1024px)
   ===================================================== */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .pecplus-timeline-item {
        width: 46%;
    }

    .pecplus-timeline-item.pecplus-position-left {
        padding-right: 40px;
    }

    .pecplus-timeline-item.pecplus-position-right {
        padding-left: 40px;
    }
}

/* =====================================================
   ANIMAÇÕES EXTRAS
   ===================================================== */

/* Fade in da esquerda */
.pecplus-timeline-item.pecplus-position-left {
    transform: translateX(-30px);
}

.pecplus-timeline-item.pecplus-position-left.pecplus-visible {
    transform: translateX(0);
}

/* Fade in da direita */
.pecplus-timeline-item.pecplus-position-right {
    transform: translateX(30px);
}

.pecplus-timeline-item.pecplus-position-right.pecplus-visible {
    transform: translateX(0);
}

/* Mobile: todos vêm da direita */
@media screen and (max-width: 768px) {
    .pecplus-timeline-item,
    .pecplus-timeline-item.pecplus-position-left,
    .pecplus-timeline-item.pecplus-position-right {
        transform: translateX(30px);
    }

    .pecplus-timeline-item.pecplus-visible,
    .pecplus-timeline-item.pecplus-position-left.pecplus-visible,
    .pecplus-timeline-item.pecplus-position-right.pecplus-visible {
        transform: translateX(0);
    }
}

/* =====================================================
   REDUÇÃO DE MOVIMENTO (Acessibilidade)
   ===================================================== */
@media (prefers-reduced-motion: reduce) {
    .pecplus-timeline-item,
    .pecplus-timeline-line-progress,
    .pecplus-timeline-tractor,
    .pecplus-timeline-seed {
        transition: none;
    }

    .pecplus-timeline-item {
        opacity: 1;
        transform: none;
    }

    .pecplus-timeline-seed {
        animation: none;
    }
}
