/* How It Works - Interactive Question Selector Component */

.how-it-works-section {
    padding: 80px 0;
    background: #F5F5F5;
}

.how-it-works-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.how-it-works-title {
    font-size: 32px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 60px;
    color: #1a1a1a;
    line-height: 1.15;
    letter-spacing: 0.01em;
}

@media (min-width: 1024px) {
    .how-it-works-title {
        font-size: 52px;
        line-height: 1.1;
        letter-spacing: 0.01em;
    }
}

.how-it-works-content {
    display: flex;
    gap: 60px;
    align-items: flex-start;
    min-height: 600px;
}

/* Questions Section - LEFT SIDE */
.how-it-works-questions-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    order: 1;
    align-items: flex-start;
}

/* Image Section - RIGHT SIDE */
.how-it-works-image-section {
    flex: 1;
    position: relative;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    order: 2;
}

.how-it-works-image-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
}

.how-it-works-image {
    width: 100%;
    height: auto;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transform: scale(0.98) translateZ(0);
    will-change: opacity, transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transition: opacity 0.45s cubic-bezier(0.25, 0.1, 0.25, 1), 
                transform 0.45s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.how-it-works-image.active {
    opacity: 1;
    position: relative;
    transform: scale(1) translateZ(0);
}

/* Question Buttons - White Pills */
.how-it-works-question-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: #FFFFFF;
    border: 1px solid #E8E8E8;
    border-radius: 50px;
    padding: 14px 22px;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    width: auto;
    opacity: 1;
    max-height: 100px;
    overflow: hidden;
    transform: translateY(0) translateZ(0) scale(1);
    will-change: opacity, transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    -webkit-transform: translateZ(0);
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                padding 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                margin 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                border 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.25s ease-out;
}

.how-it-works-question-btn:hover {
    background: #FAFAFA;
    border-color: #D0D0D0;
}

.how-it-works-question-btn.active {
    background: #FFFFFF;
    border-color: #D0D0D0;
}

/* Hidden state for active question - smooth collapse */
.how-it-works-question-btn.hidden {
    opacity: 0;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin: 0;
    border-width: 0;
    pointer-events: none;
    transform: translateY(-4px) translateZ(0) scale(0.99);
}

.how-it-works-question-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: transparent;
    border: 1.5px solid #AAAAAA;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #AAAAAA;
    font-size: 14px;
    font-weight: 300;
    flex-shrink: 0;
    line-height: 1;
    transition: all 0.3s ease;
}

.how-it-works-question-btn.active .how-it-works-question-icon {
    background: #00C967;
    border-color: #00C967;
    color: white;
}

.how-it-works-question-title {
    font-size: 16px;
    font-weight: 500;
    color: #707070;
    margin: 0;
    transition: opacity 0.2s ease;
}

/* Separate Answer Box - Green with smooth animation */
.how-it-works-answer-box {
    display: grid;
    grid-template-rows: 0fr;
    background: #D4F1DE;
    border-radius: 20px;
    width: 100%;
    max-width: 440px;
    opacity: 0;
    margin: 0;
    overflow: hidden;
    transform: translateY(-8px) translateZ(0);
    will-change: grid-template-rows, opacity, transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    -webkit-transform: translateZ(0);
    transition: grid-template-rows 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                margin 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.how-it-works-answer-box.visible {
    grid-template-rows: 1fr;
    opacity: 1;
    margin: 4px 0;
    transform: translateY(0) translateZ(0);
}

.how-it-works-answer-content {
    min-height: 0;
    overflow: hidden;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.how-it-works-answer-inner {
    padding: 24px 28px;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1) 0.1s,
                transform 0.35s cubic-bezier(0.4, 0, 0.2, 1) 0.1s;
}

.how-it-works-answer-box:not(.visible) .how-it-works-answer-inner {
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.how-it-works-answer-title {
    font-size: 17px;
    font-weight: 600;
    color: #707070;
    margin: 0 0 12px 0;
}

.how-it-works-answer-text {
    font-size: 14px;
    line-height: 1.6;
    color: #707070;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .how-it-works-section {
        padding: 60px 0;
    }

    .how-it-works-title {
        margin-bottom: 40px;
    }

    .how-it-works-content {
        flex-direction: column;
        gap: 40px;
    }

    .how-it-works-image-section {
        order: 1;
        min-height: 300px;
    }

    .how-it-works-questions-section {
        order: 2;
    }

    .how-it-works-question-title {
        font-size: 15px;
    }

    .how-it-works-question-btn {
        padding: 12px 18px;
        transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                    transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                    max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                    padding 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                    margin 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                    border 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                    background 0.2s ease-out;
    }

    .how-it-works-answer-box {
        max-width: 100%;
        transition: grid-template-rows 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                    opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                    transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                    margin 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .how-it-works-answer-inner {
        padding: 20px 22px;
    }
}

@media (max-width: 480px) {

    .how-it-works-question-btn {
        padding: 12px 16px;
    }

    .how-it-works-question-icon {
        width: 20px;
        height: 20px;
        font-size: 12px;
    }

    .how-it-works-answer-title {
        font-size: 15px;
    }

    .how-it-works-answer-text {
        font-size: 13px;
    }
}

/* Performance optimizations */
@media (prefers-reduced-motion: reduce) {
    .how-it-works-image,
    .how-it-works-question-btn,
    .how-it-works-answer-box {
        transition-duration: 0.01ms;
        animation-duration: 0.01ms;
    }
}
