/* Container */
.steps-timeline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 40px 0 60px;
    padding: 0 20px;
    position: relative;
}

/* ================= เส้นสีเทา (ไม่ทับวงกลม) ================= */
.steps-timeline::before {
    content: "";
    position: absolute;
    top: 24px;
    left: calc(20px + 20px);   /* padding + ครึ่งวงกลม */
    right: calc(20px + 20px);  /* padding + ครึ่งวงกลม */
    height: 3px;
    background: #dedede;
    z-index: 1;
}

/* Step */
.steps-timeline .step {
    flex: 1;
    width: 16.66%;
    text-align: center;
    position: relative;
    z-index: 2;
}

/* ================= วงกลมอยู่บนสุด ================= */
.steps-timeline .circle {
    width: 40px;
    height: 40px;
    background: #bbbbbb;
    color: #fff;
    line-height: 40px;
    font-weight: bold;
    border-radius: 50%;
    margin: 0 auto;
    position: relative;
    z-index: 5;   /* สูงกว่าเส้นทุกชนิด */
}
/* ตัวเลข (บนสุด) */
.steps-timeline .step-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    color: #fff;
    z-index: 10; /* สูงสุด */
    pointer-events: none;
}
/* Label */
.steps-timeline .label {
    margin-top: 10px;
    font-size: 14px;
}

/* Active */
.steps-timeline .step.active .circle {
    background: #007bff;
}

/* Completed */
.steps-timeline .step.completed .circle {
    background: #28a745;
}

/* ================= เส้นเขียว Completed (ไม่ทับวงกลม) ================= */
.steps-timeline .step.completed::before {
    content: "";
    position: absolute;
    top: 24px;
    left: -50%;
    width: calc(100% - 20px); /* ตัดปลายเส้นก่อนถึงวงกลม */
    height: 3px;
    background: #28a745;
    z-index: 2;
}

/* ไม่ให้มีเส้นก่อน step แรก */
.steps-timeline .step:first-child.completed::before {
    display: none;
}


/* --------------------------------------------------------- */
/*                     RESPONSIVE                            */
/* --------------------------------------------------------- */

/* Tablet (≤ 992px): ลดขนาดวงกลม + label ชิดกันมากขึ้น */
@media (max-width: 992px) {

    .steps-timeline {
        padding: 0;
    }

    .steps-timeline .step {
        width: 20%;
    }

    .steps-timeline .circle {
        width: 32px;
        height: 32px;
        line-height: 32px;
        font-size: 14px;
    }

    .steps-timeline .label {
        font-size: 13px;
    }

    /* ปรับเส้นแบ็คกราวด์ให้อยู่กลางพอดี */
    .steps-timeline::before {
        top: 18px;
    }

    .steps-timeline .step.completed::before {
        top: 18px;
    }
}

/* Mobile (≤ 576px): ปรับเป็นแนวตั้งทั้งหมด */
@media (max-width: 576px) {

    .steps-timeline {
        flex-direction: column;
        align-items: flex-start;
    }

    /* ไม่ต้องใช้เส้นยาวด้านหลัง */
    .steps-timeline::before {
        display: none;
    }

    .steps-timeline .step {
        width: 100%;
        display: flex;
        align-items: center;
        margin-bottom: 20px;
    }

    .steps-timeline .circle {
        width: 34px;
        height: 34px;
        line-height: 34px;
        margin: 0;
        margin-right: 10px;
        font-size: 14px;
    }

    .steps-timeline .label {
        font-size: 14px;
        text-align: left;
    }

    /* เส้นเขียวใน Mobile — เป็นขีดซ้ายแทน */
    .steps-timeline .step.completed::before {
        content: "";
        position: absolute;
        left: -10px;
        top: 17px;
        width: 8px;
        height: 3px;
        background: #28a745;
        z-index: 2;
    }
}
