/* ============================================
   COMO FUNCIONA - MOBILE PREMIUM REDESIGN
   Layout centralizado com números destacados
   ============================================ */

/* Section Styling */
.how-it-works {
    position: relative;
    background: radial-gradient(circle at 50% 50%, #0A1A3C 0%, #000B1D 100%);
    padding: 5rem 0;
    overflow: hidden;
}

/* Background Effects */
.how-it-works::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 92, 45, 0.06) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
}

/* Steps Container */
.steps-container {
    position: relative;
    max-width: 600px;
    margin: 4rem auto 0;
    padding: 0 1.5rem;
}

/* Desktop Layout */
@media (min-width: 769px) {
    .steps-container {
        max-width: 900px;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 3rem;
        padding: 0 2rem;
    }

    .step-item {
        position: relative;
    }

    /* Remove timeline on desktop */
    .steps-container::before,
    .steps-container::after {
        display: none !important;
    }

    .step-item::after {
        display: none !important;
    }

    .step-item::before {
        position: static !important;
        margin-bottom: 1.5rem;
    }

    .step-icon {
        position: static !important;
        margin-bottom: 1rem;
    }

    .step-content {
        padding-left: 0 !important;
    }
}

/* ============================================
   MOBILE EXPERIENCE (≤768px)
   ============================================ */
@media (max-width: 768px) {
    .how-it-works {
        padding: 4rem 0;
    }

    .steps-container {
        padding: 0 1rem;
    }

    /* Vertical Timeline Line - ATRÁS DE TUDO */
    .steps-container::before {
        content: '';
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        top: 80px;
        bottom: 80px;
        width: 2px;
        background: linear-gradient(to bottom,
                transparent 0%,
                rgba(255, 92, 45, 0.2) 10%,
                rgba(255, 92, 45, 0.4) 50%,
                rgba(255, 92, 45, 0.2) 90%,
                transparent 100%);
        z-index: -1;
        /* Atrás de tudo */
    }

    /* Animated Progress Line - ATRÁS DE TUDO */
    .steps-container::after {
        content: '';
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        top: 80px;
        width: 2px;
        height: 0%;
        background: linear-gradient(to bottom,
                var(--primary-orange),
                rgba(255, 92, 45, 0.6));
        z-index: -1;
        /* Atrás de tudo */
        transition: height 1s ease-out;
        box-shadow: 0 0 20px rgba(255, 92, 45, 0.5);
    }

    .steps-container.progress-active::after {
        height: calc(100% - 160px);
    }

    /* ============================================
       STEP ITEM - Layout Centralizado
       ============================================ */
    .step-item {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        margin-bottom: 4rem;

        /* Initial state */
        opacity: 0;
        transform: translateY(30px);
        transition: all 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }

    .step-item:last-child {
        margin-bottom: 0;
    }

    /* Step visible state */
    .step-item.step-visible {
        opacity: 1;
        transform: translateY(0);
    }

    /* Cascade delays */
    .step-item:nth-child(1).step-visible {
        transition-delay: 0ms;
    }

    .step-item:nth-child(2).step-visible {
        transition-delay: 150ms;
    }

    .step-item:nth-child(3).step-visible {
        transition-delay: 300ms;
    }

    .step-item:nth-child(4).step-visible {
        transition-delay: 450ms;
    }

    /* ============================================
       NÚMERO GRANDE - Centralizado e Destacado
       ============================================ */
    .step-item::before {
        content: attr(data-step);
        position: relative;
        width: 90px;
        height: 90px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 3rem;
        font-weight: 900;
        color: rgba(255, 255, 255, 0.25);
        background: rgba(10, 26, 60, 0.5);
        border: 3px solid rgba(255, 255, 255, 0.08);
        border-radius: 24px;
        z-index: 10;
        /* Acima de tudo */
        transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
        margin-bottom: 1.5rem;
    }

    /* Número ativo - LARANJA VIBRANTE */
    .step-item.step-active::before {
        color: white;
        background: linear-gradient(135deg, #FF5C2D 0%, #ff7a50 100%);
        border-color: rgba(255, 92, 45, 0.5);
        box-shadow:
            0 0 40px rgba(255, 92, 45, 0.6),
            0 15px 40px rgba(0, 0, 0, 0.4),
            inset 0 0 20px rgba(255, 255, 255, 0.1);
        transform: scale(1.1) rotate(5deg);
        animation: numberBounce 2.5s ease-in-out infinite;
    }

    @keyframes numberBounce {

        0%,
        100% {
            transform: scale(1.1) rotate(5deg);
        }

        50% {
            transform: scale(1.15) rotate(-3deg);
        }
    }

    /* ============================================
       CONNECTOR DOT - Ponto na linha
       ============================================ */
    .step-item::after {
        content: '';
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        top: 40px;
        width: 12px;
        height: 12px;
        background: rgba(255, 92, 45, 0.3);
        border: 3px solid rgba(10, 26, 60, 0.9);
        border-radius: 50%;
        z-index: 5;
        transition: all 0.5s ease;
    }

    .step-item.step-active::after {
        background: var(--primary-orange);
        border-color: rgba(255, 92, 45, 0.3);
        box-shadow:
            0 0 20px rgba(255, 92, 45, 0.8),
            0 0 30px rgba(255, 92, 45, 0.4);
        transform: translateX(-50%) scale(1.5);
    }

    /* ============================================
       ÍCONE - Pequeno e discreto no canto
       ============================================ */
    .step-icon {
        position: absolute;
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        background: rgba(10, 26, 60, 0.7);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.1rem;
        color: rgba(255, 92, 45, 0.5);
        transition: all 0.4s ease;
        z-index: 15;
        /* Acima de tudo */
    }

    .step-item.step-active .step-icon {
        background: rgba(255, 92, 45, 0.15);
        border-color: rgba(255, 92, 45, 0.4);
        color: var(--primary-orange);
        box-shadow: 0 0 15px rgba(255, 92, 45, 0.3);
        transform: scale(1.1);
    }

    /* ============================================
       CONTEÚDO - Card limpo e espaçado
       ============================================ */
    .step-content {
        width: 100%;
        max-width: 340px;
        background: linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(10, 26, 60, 0.6));
        backdrop-filter: blur(12px);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 20px;
        padding: 2rem 1.5rem;
        position: relative;
        min-height: 150px;
        transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
        z-index: 8;
        /* Acima da linha */
    }

    /* Content active state */
    .step-item.step-active .step-content {
        background: linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(10, 26, 60, 0.8));
        border-color: rgba(255, 92, 45, 0.4);
        box-shadow:
            0 15px 40px rgba(0, 0, 0, 0.3),
            0 0 30px rgba(255, 92, 45, 0.2),
            inset 0 0 30px rgba(255, 92, 45, 0.05);
        transform: scale(1.03);
    }

    /* Glow effect overlay */
    .step-content::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: radial-gradient(circle at top right, rgba(255, 92, 45, 0.1), transparent 60%);
        border-radius: 20px;
        opacity: 0;
        transition: opacity 0.5s ease;
        pointer-events: none;
    }

    .step-item.step-active .step-content::before {
        opacity: 1;
    }

    /* Typography */
    .step-content h3 {
        font-size: 1.35rem;
        font-weight: 700;
        color: white;
        margin-bottom: 0.8rem;
        padding-right: 50px;
        line-height: 1.3;
        transition: all 0.3s ease;
    }

    .step-item.step-active .step-content h3 {
        color: var(--primary-orange);
        text-shadow: 0 0 20px rgba(255, 92, 45, 0.4);
    }

    .step-content p {
        font-size: 1.05rem;
        line-height: 1.65;
        color: #d0d0d0;
        margin: 0;
        transition: color 0.3s ease;
    }

    .step-item.step-active .step-content p {
        color: #ffffff;
    }

    /* ============================================
       MICROINTERAÇÃO AO TOQUE
       ============================================ */
    .step-item:active .step-content {
        transform: scale(1.00);
        transition: transform 0.1s ease-out;
    }

    .step-item.step-active:active .step-content {
        transform: scale(1.01);
    }

    /* ============================================
       SECTION HEADER
       ============================================ */
    .how-it-works .section-header {
        text-align: center;
        margin-bottom: 2rem;
    }

    .how-it-works .section-tag {
        background: rgba(255, 92, 45, 0.15);
        border: 1px solid rgba(255, 92, 45, 0.3);
        box-shadow: 0 0 15px rgba(255, 92, 45, 0.1);
        padding: 0.5rem 1.2rem;
        border-radius: 30px;
        font-size: 0.9rem;
        font-weight: 600;
        color: var(--primary-orange);
        display: inline-block;
        margin-bottom: 1rem;
    }

    .how-it-works .section-title {
        font-size: 2.2rem;
        font-weight: 800;
        margin-bottom: 0.8rem;
        background: linear-gradient(135deg, #ffffff 0%, #e0e0e0 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }

    .how-it-works .section-header p {
        color: #d0d0d0;
        font-size: 1.1rem;
        margin: 0;
    }
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */
.step-item {
    will-change: transform, opacity;
}

.step-content {
    will-change: transform;
}

.step-item::before {
    will-change: transform;
}