/* ============================================================
   Project Timeline Manager – Frontend CSS (v1.1.1)
   Defaults are provided via var(... , fallback) so the inline
   <style id="ptm-vars"> in <head> always wins, even when this
   file is loaded later in the document.
   ============================================================ */

.ptm-wrap {
    direction: rtl;
    color: var(--ptm-text, #17356a);
    font-family: "Assistant", "Heebo", "Noto Sans Hebrew", -apple-system, BlinkMacSystemFont, Arial, sans-serif;
    max-width: var(--ptm-max-width, 1280px);
    margin: 0 auto 40px auto;
    padding: 0 var(--ptm-padding-x, 24px);
    box-sizing: border-box;
    width: 100%;
}

.ptm-wrap *,
.ptm-wrap *::before,
.ptm-wrap *::after {
    box-sizing: border-box;
}

/* ---------- Header ---------- */
.ptm-header {
    position: relative;
    background: var(--ptm-header-bg, #17356a);
    background-size: cover;
    background-position: center;
    color: var(--ptm-header-text, #ffffff);
    border-radius: 14px 14px 0 0;
    overflow: hidden;
    padding: 28px 24px 22px;
}
.ptm-header-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(23,53,106,.85) 0%, rgba(23,53,106,.65) 100%);
}
.ptm-header-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ptm-title {
    margin: 0;
    font-size: var(--ptm-fs-title, 30px);
    font-weight: 800;
    line-height: 1.1;
    color: var(--ptm-title-color, #ffffff);
}
.ptm-address {
    font-size: var(--ptm-fs-address, 16px);
    color: var(--ptm-address-color, #ffffff);
    opacity: .95;
}
.ptm-progress-bar {
    position: relative;
    height: var(--ptm-progress-h, 22px);
    border-radius: 999px;
    background: rgba(255,255,255,.25);
    overflow: hidden;
    margin-top: 14px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,.12);
}
.ptm-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--ptm-color-in-progress, #f07c2b), var(--ptm-color-done, #21a65b));
    border-radius: 999px;
    transition: width .8s cubic-bezier(.2,.8,.2,1);
}
.ptm-progress-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--ptm-fs-progress, 11px);
    font-weight: 700;
    letter-spacing: .2px;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,.35);
    pointer-events: none;
}

/* ---------- Legend ---------- */
.ptm-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    justify-content: center;
    padding: 14px 16px;
    background: var(--ptm-legend-bg, #f7f9fc);
    border: 1px solid var(--ptm-card-border, #e6ebf2);
    border-top: none;
    border-radius: 0 0 14px 14px;
    margin-bottom: 30px;
    font-size: var(--ptm-fs-legend, 14px);
    font-weight: 600;
}
.ptm-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.ptm-legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(0,0,0,.08);
}

/* ---------- Timeline core ---------- */
.ptm-timeline {
    position: relative;
    padding: 20px 0 40px;
}

.ptm-line {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 50%;
    transform: translateX(50%);
    width: var(--ptm-line-width, 3px);
    background: var(--ptm-line, #d7dde4);
    border-radius: 999px;
    z-index: 0;
}
.ptm-line-fill {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 0%;
    background: linear-gradient(180deg, var(--ptm-color-done, #21a65b) 0%, var(--ptm-color-in-progress, #f07c2b) 100%);
    border-radius: 999px;
    transition: height 1s cubic-bezier(.2,.8,.2,1);
    box-shadow: 0 0 14px rgba(240,124,43,.35);
}

/* ---------- Step row ---------- */
.ptm-step {
    position: relative;
    display: grid;
    /* Side columns are symmetric and capped at card-max-width so the
       whole row (card | dot | meta) feels visually balanced around the
       central line, instead of a wide card dominating one side. */
    grid-template-columns:
        minmax(0, var(--ptm-card-max-width, 560px))
        auto
        minmax(0, var(--ptm-card-max-width, 560px));
    justify-content: center;
    align-items: center;
    gap: var(--ptm-gap, 28px);
    min-height: 86px;
    margin-bottom: var(--ptm-step-gap, 10px);
    z-index: 1;
}

.ptm-step-side {
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 0;
}
/* Default (non-alternate): both sides hug the central dot so there is
   no empty gap between the meta/card and the line. */
.ptm-wrap:not(.ptm-alternate) .ptm-step-side-start { justify-content: flex-end; }
.ptm-wrap:not(.ptm-alternate) .ptm-step-side-end   { justify-content: flex-start; }

/* ---------- Step dot / icon ---------- */
.ptm-step-mid {
    position: relative;
    width: var(--ptm-ring-size, 64px);
    height: var(--ptm-ring-size, 64px);
    display: flex;
    align-items: center;
    justify-content: center;
}
.ptm-step-dot {
    position: relative;
    width: var(--ptm-dot-size, 56px);
    height: var(--ptm-dot-size, 56px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ptm-card-bg, #ffffff);
    border: 3px solid var(--ptm-line, #d7dde4);
    color: #9aa5b1;
    font-size: var(--ptm-fs-icon, 20px);
    transition: transform .3s ease, background .3s ease, border-color .3s ease, color .3s ease, box-shadow .3s ease;
    z-index: 2;
}
.ptm-step-dot .ptm-icon-svg {
    width: 60%;
    height: 60%;
    object-fit: contain;
}

.ptm-step-done .ptm-step-dot {
    background: var(--ptm-color-done, #21a65b);
    border-color: var(--ptm-color-done, #21a65b);
    color: #fff;
    box-shadow: 0 6px 14px rgba(33,166,91,.25);
}
.ptm-step-in_progress .ptm-step-dot {
    background: var(--ptm-color-in-progress, #f07c2b);
    border-color: var(--ptm-color-in-progress, #f07c2b);
    color: #fff;
    box-shadow: 0 6px 18px rgba(240,124,43,.45);
}
.ptm-step-pending .ptm-step-dot {
    background: var(--ptm-color-pending, #ffffff);
    border-color: #b8c0cc;
    color: #2b3446;
    box-shadow: none;
}
.ptm-step-pending .ptm-step-dot i,
.ptm-step-pending .ptm-step-dot .ptm-icon-svg {
    opacity: .85;
    filter: none;
}

.ptm-step-current .ptm-step-dot {
    transform: scale(1.12);
}
.ptm-step-pulse {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 3px solid var(--ptm-color-in-progress, #f07c2b);
    animation: ptm-pulse 1.6s ease-out infinite;
    pointer-events: none;
    z-index: 1;
}
@keyframes ptm-pulse {
    0%   { transform: scale(.85); opacity: .75; }
    70%  { transform: scale(1.35); opacity: 0;   }
    100% { transform: scale(1.35); opacity: 0;   }
}

/* ---------- Step card ---------- */
.ptm-step-card {
    background: var(--ptm-card-bg, #ffffff);
    padding: var(--ptm-card-py, 14px) var(--ptm-card-px, 18px);
    border-radius: var(--ptm-card-radius, 12px);
    box-shadow: 0 6px 18px rgba(23,53,106,.08);
    border: 1px solid var(--ptm-card-border, #e6ebf2);
    /* Fill the side column so each row has a symmetric visual block on
       either side of the central dot. */
    width: 100%;
    max-width: 100%;
    position: relative;
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.ptm-step-title {
    font-weight: var(--ptm-step-title-weight, 700);
    font-size: var(--ptm-fs-step-title, 16px);
    line-height: var(--ptm-step-title-lh, 1.4);
    color: var(--ptm-step-title-color, #17356a);
}
.ptm-step-done .ptm-step-card {
    border-color: rgba(33,166,91,.45);
    background: linear-gradient(180deg, #f4fbf6, var(--ptm-card-bg, #ffffff));
}
.ptm-step-in_progress .ptm-step-card {
    border-color: var(--ptm-color-in-progress, #f07c2b);
    background: linear-gradient(180deg, #fff7ef, var(--ptm-card-bg, #ffffff));
    box-shadow: 0 8px 22px rgba(240,124,43,.18);
    transform: translateY(-1px);
}
.ptm-step-pending .ptm-step-card {
    background: #fafbfd;
    color: #6b7685;
    border-color: var(--ptm-card-border, #e6ebf2);
}
.ptm-step-pending .ptm-step-title { color: #6b7685; font-weight: 600; }

/* "אנחנו כאן עכשיו" badge */
.ptm-step-current-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 4px 10px;
    font-size: var(--ptm-fs-step-status, 12px);
    font-weight: 700;
    color: #fff;
    background: var(--ptm-color-in-progress, #f07c2b);
    border-radius: 999px;
    animation: ptm-tag-pop .6s ease-out;
}
@keyframes ptm-tag-pop {
    from { transform: translateY(4px); opacity: 0; }
    to   { transform: translateY(0);   opacity: 1; }
}

/* ---------- Meta (step number + status) ---------- */
.ptm-step-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 16px;
    background: var(--ptm-meta-bg, #ffffff);
    border-radius: 10px;
    border: 1px solid var(--ptm-card-border, #e6ebf2);
    box-shadow: 0 2px 8px rgba(23,53,106,.06);
    /* Match the card visually so the row is balanced around the dot. */
    width: 100%;
    max-width: 100%;
    text-align: center;
    align-items: center;
    justify-content: center;
    min-height: calc(var(--ptm-ring-size, 64px) - 8px);
}
.ptm-step-num {
    font-size: var(--ptm-fs-step-meta, 13px);
    font-weight: 700;
    color: var(--ptm-meta-text, #17356a);
}
.ptm-step-status {
    font-size: var(--ptm-fs-step-status, 12px);
    font-weight: 700;
}

/* ---------- Alternating left/right layout ---------- */
/* When "alternate" is ON: odd steps go left, even steps go right. */
.ptm-alternate .ptm-step-right .ptm-step-side-start { justify-content: flex-start; }
.ptm-alternate .ptm-step-right .ptm-step-side-end   { justify-content: flex-end; }
.ptm-alternate .ptm-step-left  .ptm-step-side-start { justify-content: flex-end; }
.ptm-alternate .ptm-step-left  .ptm-step-side-end   { justify-content: flex-start; }

/* ---------- Reveal animation on scroll ---------- */
.ptm-step .ptm-step-card,
.ptm-step .ptm-step-meta {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .5s ease, transform .5s ease;
}
.ptm-step.ptm-visible .ptm-step-card,
.ptm-step.ptm-visible .ptm-step-meta {
    opacity: 1;
    transform: translateY(0);
}
.ptm-wrap:not([data-animate="1"]) .ptm-step .ptm-step-card,
.ptm-wrap:not([data-animate="1"]) .ptm-step .ptm-step-meta {
    opacity: 1;
    transform: none;
}

/* ---------- Error state ---------- */
.ptm-error {
    padding: 16px;
    background: #fdecec;
    color: #a1291a;
    border: 1px solid #f5c1c1;
    border-radius: 8px;
    text-align: center;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .ptm-wrap {
        --ptm-ring-size: 52px;
        --ptm-dot-size: 44px;
        --ptm-gap: 12px;
        padding: 0 var(--ptm-padding-x-mobile, 14px);
        margin-bottom: 24px;
    }

    /* Header scales down */
    .ptm-title {
        font-size: clamp(18px, 5.2vw, 24px);
    }
    .ptm-address {
        font-size: clamp(13px, 3.6vw, 15px);
    }
    .ptm-header {
        padding: 22px 18px 18px;
        border-radius: 12px 12px 0 0;
    }
    .ptm-progress-bar {
        height: 18px;
        margin-top: 12px;
    }
    .ptm-progress-label {
        font-size: 10px;
    }

    /* Legend becomes more compact */
    .ptm-legend {
        gap: 10px 14px;
        padding: 10px 12px;
        font-size: 12px;
        border-radius: 0 0 12px 12px;
        margin-bottom: 20px;
    }
    .ptm-legend-dot {
        width: 11px;
        height: 11px;
    }

    /* Timeline switches to a single-column layout with the line on the
       right edge (RTL). Each step stacks: meta on top, card below, and
       the dot icon floats on the right next to the card. */
    .ptm-timeline {
        padding: 10px 0 24px;
    }
    .ptm-line {
        right: 26px;
        transform: none;
        width: 2px;
    }

    .ptm-step {
        grid-template-columns: 1fr;
        grid-template-areas:
            "dot"
            "meta"
            "card";
        gap: 6px;
        padding-right: 60px;
        padding-left: 0;
        min-height: 0;
        margin-bottom: 18px;
        align-items: stretch;
        justify-content: stretch;
    }
    .ptm-step-side {
        width: 100%;
        justify-content: flex-start !important;
    }
    .ptm-step-side-start { grid-area: meta; }
    .ptm-step-side-end   { grid-area: card; }

    /* The dot gets positioned absolutely so it sits on the vertical line,
       aligned with the top of the card area. */
    .ptm-step-mid {
        grid-area: dot;
        position: absolute;
        right: 0;
        top: 6px;
        width: var(--ptm-ring-size, 52px);
        height: var(--ptm-ring-size, 52px);
    }
    .ptm-step-dot {
        width: var(--ptm-dot-size, 44px);
        height: var(--ptm-dot-size, 44px);
        border-width: 2px;
        font-size: 16px;
    }

    .ptm-step-meta {
        padding: 6px 12px;
        min-height: 0;
        font-size: 12px;
        width: auto;
        max-width: max-content;
        flex-direction: row;
        gap: 8px;
        align-self: flex-start;
        box-shadow: 0 1px 4px rgba(23,53,106,.05);
    }
    .ptm-step-num {
        font-size: 12px;
    }
    .ptm-step-status {
        font-size: 11px;
    }

    .ptm-step-card {
        text-align: right;
        max-width: 100%;
        padding: 12px 14px;
        box-shadow: 0 4px 12px rgba(23,53,106,.06);
    }
    .ptm-step-title {
        font-size: 15px;
        line-height: 1.4;
    }
    .ptm-step-current-tag {
        margin-top: 6px;
        padding: 3px 9px;
        font-size: 11px;
    }

    /* Alternating layout doesn't apply on mobile — always single column. */
    .ptm-alternate .ptm-step-right .ptm-step-side-start,
    .ptm-alternate .ptm-step-right .ptm-step-side-end,
    .ptm-alternate .ptm-step-left  .ptm-step-side-start,
    .ptm-alternate .ptm-step-left  .ptm-step-side-end {
        justify-content: flex-start !important;
    }
}

@media (max-width: 480px) {
    .ptm-wrap {
        --ptm-ring-size: 46px;
        --ptm-dot-size: 38px;
        padding: 0 10px;
    }
    .ptm-header {
        padding: 18px 14px 14px;
        border-radius: 10px 10px 0 0;
    }
    .ptm-title {
        font-size: clamp(17px, 5vw, 20px);
    }
    .ptm-address {
        font-size: 12px;
    }
    .ptm-progress-bar {
        height: 16px;
        margin-top: 10px;
    }
    .ptm-legend {
        gap: 8px 12px;
        padding: 8px 10px;
        font-size: 11px;
        border-radius: 0 0 10px 10px;
    }
    .ptm-legend-dot {
        width: 10px;
        height: 10px;
    }

    .ptm-line {
        right: 22px;
    }
    .ptm-step {
        padding-right: 52px;
        margin-bottom: 14px;
    }
    .ptm-step-mid {
        top: 4px;
    }
    .ptm-step-dot {
        font-size: 14px;
        border-width: 2px;
    }
    .ptm-step-card {
        padding: 10px 12px;
        border-radius: 10px;
    }
    .ptm-step-title {
        font-size: 14px;
    }
    .ptm-step-meta {
        padding: 4px 10px;
    }
    .ptm-step-num,
    .ptm-step-status {
        font-size: 11px;
    }
}
