/* =============================================
   Process Flow Widget — Frontend Styles
   ============================================= */

/* ── Wrapper: CSS Grid ─────────────────────────────────────────────
   Every step (in every wrap-row) shares the SAME column tracks, so a
   step in row 2 lands in exactly the same column as the step above it
   in row 1 — no more guessing based on flex fill-order.
   Rows alternate: content-row (auto height) / connector-row (fixed
   height, reserved for the vertical arrow between wrap-rows). */
.pfw-wrapper {
    display: grid;
    grid-template-columns: repeat(var(--pfw-cols, 4), 1fr);
    column-gap: var(--pfw-h-gap, 40px);
    row-gap: 0;
    width: 100%;
    font-family: inherit;
    position: relative;
}

/* ── Step bubble ─────────────────────────────── */
.pfw-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    padding-top: 10px;
    min-width: 0;
}

/* ── Number badge — base ──────────────────────── */
.pfw-step-number {
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #2ecc71;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 24px;
    text-align: center;
    z-index: 2;
}

/* ── Number positions ──────────────────────────── */
/* top-center (default) */
.pfw-number-pos--top-center .pfw-step-number {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
}

/* top-left */
.pfw-number-pos--top-left .pfw-step-number {
    top: 0;
    left: 4px;
    transform: none;
}

/* top-right */
.pfw-number-pos--top-right .pfw-step-number {
    top: 0;
    right: 4px;
    left: auto;
    transform: none;
}

/* bottom-center */
.pfw-number-pos--bottom-center .pfw-step-number {
    bottom: 0;
    top: auto;
    left: 50%;
    transform: translateX(-50%);
}

/* bottom-left */
.pfw-number-pos--bottom-left .pfw-step-number {
    bottom: 0;
    top: auto;
    left: 4px;
    transform: none;
}

/* bottom-right */
.pfw-number-pos--bottom-right .pfw-step-number {
    bottom: 0;
    top: auto;
    right: 4px;
    left: auto;
    transform: none;
}

/* ── Icon / Image container ─────────────────── */
.pfw-icon-wrap {
    margin-top: 22px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    flex-shrink: 0;
    position: relative;
}

.pfw-icon-wrap i {
    font-size: 36px;
    color: #1a2e4a;
}

.pfw-icon-wrap svg {
    width: 36px;
    height: 36px;
    fill: #1a2e4a;
    color: #1a2e4a;
}

.pfw-icon-wrap img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

/* ── Icon Box Style: Filled ─────────────────── */
.pfw-icon-wrap.pfw-style-filled {
    background-color: #e8f8f0;
    border-radius: 50%;
    padding: 10px;
    width: 72px;
    height: 72px;
}

/* ── Icon Box Style: Frame ──────────────────── */
.pfw-icon-wrap.pfw-style-frame {
    border: 2px solid #2ecc71;
    border-radius: 50%;
    padding: 10px;
    width: 72px;
    height: 72px;
    background: transparent;
}

/* ── Title ────────────────────────────────────── */
.pfw-step-title {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.4;
    color: #1a2e4a;
    max-width: 100px;
}

/* Bottom-positioned number needs extra bottom padding on step */
.pfw-number-pos--bottom-center .pfw-step,
.pfw-number-pos--bottom-left   .pfw-step,
.pfw-number-pos--bottom-right  .pfw-step {
    padding-bottom: 28px;
    padding-top: 4px;
}

/* ── Straight (horizontal, within-row) arrows ─────────────────────
   Rendered INSIDE the step that follows them, absolutely positioned
   into the column-gap so they never affect grid column sizing. */
.pfw-h-arrow {
    position: absolute;
    top: 60px;
    width: var(--pfw-h-gap, 40px);
    height: 20px;
    pointer-events: none;
    z-index: 1;
}

.pfw-h-arrow--right { right: 100%; }
.pfw-h-arrow--left  { left: 100%; }

.pfw-h-arrow svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.pfw-h-arrow svg path    { stroke: #1a2e4a; }
.pfw-h-arrow svg polygon { fill: #1a2e4a; }

/* ── Curved (vertical, row-wrap) connector ─────────────────────────
   Sits in the fixed-height connector row-track, in the SAME grid
   column as the step above and below it — guaranteed alignment.
   The svg carries its own width/height attributes (set inline by
   PHP) so the "Curved" style — which needs a wider viewBox for its
   sideways bulge — isn't clipped by a fixed CSS width. */
.pfw-curve-arrow {
    position: relative;
    display: flex;
    align-items: stretch;
    justify-content: center;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.pfw-curve-arrow svg {
    overflow: visible;
}

.pfw-curve-arrow svg path    { stroke: #1a2e4a; fill: none; }
.pfw-curve-arrow svg polygon { fill: #1a2e4a; }

/* ── Responsive: single column stack ──────────── */
@media (max-width: 768px) {
    .pfw-wrapper {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 28px;
    }

    .pfw-step {
        grid-column: unset !important;
        grid-row: unset !important;
        width: 140px;
    }

    .pfw-h-arrow,
    .pfw-curve-arrow {
        display: none;
    }
}
