/* --- Basic Reset & Wrapper --- */
.ssf-flowchart-wrapper {
    margin: 0;
    font-family: sans-serif;
    overflow: hidden; /* Clear floats if needed, or use for flex/grid context */
    border: 1px solid #eee;
    padding: 15px;
    border-radius: 5px;
    background-color: #f9f9f9;
}

.ssf-flowchart-title {
    text-align: center;
    margin-bottom: 1.5em;
    margin-top: 1.5em;
    color: #333;
}

.ssf-flowchart-description {
    margin-bottom: 2em;
    color: #555;
    line-height: 1.6;
}

/* --- Steps List (Ordered List) --- */
.ssf-flowchart-steps {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex; /* Use Flexbox for horizontal layout on larger screens */
    /* --- 修改這裡 --- */
    flex-direction: column; /* 改為 column，預設垂直排列 */
    /* overflow-x: auto; */ /* 移除或註解掉，垂直不需要水平捲動 */
    /* flex-wrap: nowrap; */ /* 移除或註解掉，垂直不需要這個 */
    gap: 35px;      /* 使用原本 RWD 的垂直間距，或調整成你想要的 */
    /* --- 修改結束 --- */
    counter-reset: step-counter; /* Initialize step counter */
}

/* --- Single Step Item --- */
.ssf-step-item {
    /* flex: 1 1 200px; */ /* 移除或註解掉，這是水平 flex 佈局用的 */
    /* min-width: 180px; */ /* 移除或註解掉 */
    width: 100%; /* 或者設定一個適合垂直排列的最大寬度 max-width: 600px; margin: 0 auto; 等 */
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 15px;
    position: relative; /* Needed for pseudo-elements (arrows/counter) */
    counter-increment: step-counter; /* Increment counter for each step */
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.2s ease-in-out;
    margin-top: 20px; /* 你之前加的 margin-top */
    /* 可以考慮只保留一個方向的 margin 來控制間距，例如只用 margin-bottom */
    /* margin-bottom: 20px; */ /* 確保有垂直間距 */
}

.ssf-step-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}


/* --- Step Numbering --- */
.ssf-step-item::before {
    content: counter(step-counter);
    position: absolute;
    top: -15px;
    left: -15px;
    width: 30px;
    height: 30px;
    background-color: #0073aa; /* WordPress blue */
    color: #fff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    z-index: 1; /* 確保數字在堆疊時可能在上方 */
}

/* --- Connecting Arrows (for horizontal layout) 連接箭頭 --- */
/* Hide arrow on the last item */
.ssf-flowchart-steps .ssf-step-item:not(:last-child)::after {
    content: ''; /* 清空 content */
    position: absolute;
    bottom: -25px; /* 調整箭頭尖端與元素的距離 */
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;  /* 箭頭寬度的一半 */
    border-right: 8px solid transparent; /* 箭頭寬度的一半 */
    border-top: 10px solid #888;        /* 箭頭的高度和顏色 */
                                        /* 將顏色改為你想要的粗箭頭顏色 */

    /* --- 原有的定位屬性可以保留或微調 --- */
    /* top: auto; */ /* 可能不再需要 */
    /* right: auto; */ /* 可能不再需要 */
    /* font-size: 20px; */ /* 不再需要 */
    /* font-weight: bold; */ /* 不再需要 */
    /* color: #aaa; */ /* 由 border-top 控制顏色 */
    /* line-height: 1; */ /* 不再需要 */
}


/* --- Step Content --- */
.ssf-step-content {
    margin-top: 15px; /* Space below the number */
}

.ssf-step-title {
    font-size: 1.1em;
    font-weight: bold;
    margin: 0 0 0.5em 0;
    color: #222;
}

.ssf-step-description {
    font-size: 1.1em;
    color: #666;
    line-height: 1.5;
}

.ssf-step-description p {
    margin: 0 0 0.5em 0; /* Adjust paragraph spacing inside description */
}
.ssf-step-description p:last-child {
    margin-bottom: 0;
}


/* --- RWD: Responsive Design for Smaller Screens --- */
@media (max-width: 768px) {
    .ssf-flowchart-steps {
        flex-direction: column; /* Stack steps vertically */
        overflow-x: visible; /* Disable horizontal scroll */
        gap: 35px; /* Increase gap for vertical layout */
    }

    .ssf-step-item {
        flex-basis: auto; /* Reset flex-basis */
        width: 100%; /* Take full width */
        margin-bottom: 20px; /* Add bottom margin */
        min-width: unset; /* Reset min-width */
    }

    /* Adjust step number position for vertical layout */
    .ssf-step-item::before {
        top: -15px;
        left: -15px; /* Keep it slightly offset */
        font-size: 20px;
    }

    .ssf-step-content {
         margin-left: 25px; /* Add left margin to avoid overlap with number */
         margin-top: 0;
    }


    /* Adjust arrow for vertical layout */
    .ssf-flowchart-steps .ssf-step-item:not(:last-child)::after {
        content: ''; /* 清空 content */
        position: absolute;
        bottom: -25px; /* 調整箭頭尖端與元素的距離 */
        left: 50%;
        transform: translateX(-50%);
        width: 0;
        height: 0;
        border-left: 8px solid transparent;  /* 箭頭寬度的一半 */
        border-right: 8px solid transparent; /* 箭頭寬度的一半 */
        border-top: 10px solid #888;        /* 箭頭的高度和顏色 */
                                        /* 將顏色改為你想要的粗箭頭顏色 */
    
        /* --- 原有的定位屬性可以保留或微調 --- */
        /* top: auto; */ /* 可能不再需要 */
        /* right: auto; */ /* 可能不再需要 */
        /* font-size: 20px; */ /* 不再需要 */
        /* font-weight: bold; */ /* 不再需要 */
        /* color: #aaa; */ /* 由 border-top 控制顏色 */
        /* line-height: 1; */ /* 不再需要 */
    }
}

@media (max-width: 480px) {
     .ssf-flowchart-title {
        font-size: 1.5em;
     }
    .ssf-step-title {
        font-size: 1.8em;
    }
    .ssf-step-description {
        font-size: 1.4em;
    }
     /* Further adjustments for very small screens if needed */
    .ssf-step-item::before {
        width: 30px;
        height: 30px;
        font-size: 20px;
        top: -15px;
        left: -15px;
    }
    .ssf-step-content {
         margin-left: 20px; /* Adjust margin */
    }
}