/**
 * YS CART v2.27.0 — Shipping Status Timeline component
 *
 * 物流狀態 timeline，5 步（CVS）/ 4 步（宅配）/ 2 步（自取）。
 * 線性進度條 + 圓點 stepper，accessible focus order。
 */

.ys-ec-st-section {
    background: #fff;
    border: 1px solid var(--ys-ec-border, #e5e7eb);
    border-radius: 12px;
    padding: 20px 24px;
    margin: 16px 0;
}

.ys-ec-st-section .ys-ec-ty-section__header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.ys-ec-st-section .ys-ec-ty-section__title {
    flex: 1;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.ys-ec-st-icon {
    color: #3b82f6;
    flex: 0 0 auto;
}

.ys-ec-st-refresh {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.ys-ec-st-refresh:disabled {
    opacity: 0.5;
    cursor: wait;
}

.ys-ec-st-refresh .ys-ec-st-spin {
    animation: ys-ec-st-spin 1s linear infinite;
}

@keyframes ys-ec-st-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.ys-ec-st-current {
    text-align: center;
    color: #1d4ed8;
    font-size: 16px;
    font-weight: 700;
    padding: 12px 0 8px;
}

/* ─── Stepper Progress ─── */

.ys-ec-st-progress {
    display: flex;
    list-style: none;
    margin: 8px 0 16px;
    padding: 0;
    position: relative;
    counter-reset: step;
}

.ys-ec-st-step {
    flex: 1;
    text-align: center;
    position: relative;
    padding-top: 32px;
    color: #9ca3af;
    font-size: 13px;
    line-height: 1.4;
}

.ys-ec-st-step .ys-ec-st-dot {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #e5e7eb;
    border: 3px solid #fff;
    box-shadow: 0 0 0 2px #e5e7eb;
    z-index: 2;
    transition: all 0.2s;
}

/* 連接線 */
.ys-ec-st-step:not(:first-child)::before {
    content: '';
    position: absolute;
    top: 9px;
    right: 50%;
    width: 100%;
    height: 2px;
    background: #e5e7eb;
    z-index: 1;
}

.ys-ec-st-step.is-reached {
    color: #1f2937;
    font-weight: 600;
}

.ys-ec-st-step.is-reached .ys-ec-st-dot {
    background: #3b82f6;
    box-shadow: 0 0 0 2px #3b82f6;
}

.ys-ec-st-step.is-reached:not(:first-child)::before {
    background: #3b82f6;
}

.ys-ec-st-step.is-active .ys-ec-st-dot {
    background: #1d4ed8;
    box-shadow: 0 0 0 2px #1d4ed8, 0 0 0 5px rgba(29, 78, 216, 0.2);
    animation: ys-ec-st-pulse 2s ease-in-out infinite;
}

@keyframes ys-ec-st-pulse {
    0%, 100% { box-shadow: 0 0 0 2px #1d4ed8, 0 0 0 5px rgba(29, 78, 216, 0.2); }
    50%      { box-shadow: 0 0 0 2px #1d4ed8, 0 0 0 8px rgba(29, 78, 216, 0.1); }
}

/* ─── Meta block ─── */

.ys-ec-st-meta {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 8px 16px;
    margin: 12px 0 0;
    padding: 12px 16px;
    background: #f9fafb;
    border-radius: 8px;
    font-size: 14px;
}

.ys-ec-st-meta dt {
    color: #6b7280;
    font-weight: 500;
}

.ys-ec-st-meta dd {
    margin: 0;
    color: #1f2937;
}

/* ─── Mobile ─── */

@media (max-width: 640px) {
    .ys-ec-st-section {
        padding: 16px;
    }
    .ys-ec-st-progress {
        gap: 0;
    }
    .ys-ec-st-step {
        font-size: 12px;
        padding-top: 28px;
    }
    .ys-ec-st-step .ys-ec-st-dot {
        width: 14px;
        height: 14px;
    }
    .ys-ec-st-step:not(:first-child)::before {
        top: 7px;
    }
    .ys-ec-st-meta {
        grid-template-columns: 1fr;
        gap: 4px 0;
    }
    .ys-ec-st-meta dt {
        margin-top: 8px;
    }
}
