/* ==========================================================================
   EnginxProjectFlow — animated hero visual for the Enginx platform
   --------------------------------------------------------------------------
   - Fully scoped under `.epf-scope` (no global leakage).
   - All colors / speeds are CSS custom properties, overridable at runtime
     from the CONFIG object in `core/static/core/js/project-flow.js`.
   - Responsive via CSS container queries (adapts to whatever column it is
     placed in, independent of the viewport).
   - RTL + LTR via CSS logical properties; follows the page `dir`.
   - Honors `prefers-reduced-motion: reduce` (static, readable, no loops).
   ========================================================================== */

.epf-scope {
    container: epf / inline-size;
    display: flex;
    justify-content: center;
    width: 100%;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.epf-root {
    /* ---- palette aligned with the Enginx site theme
       (darkBg #090d16 · darkCard #0f172a · cyanTech #22d3ee · orangeTech #fb923c)
       — override via config.colors */
    --epf-page-background: #0D1322;
    --epf-panel-blue: #1D2E52;
    --epf-panel-blue-dark: #142138;
    --epf-soft-blue: #38BDF8;
    --epf-cyan: #22D3EE;
    --epf-green: #34D399;
    --epf-yellow: #FBBF24;
    --epf-purple: #A78BFA;
    --epf-orange: #FB923C;
    --epf-white: #FFFFFF;
    --epf-text-dark: #E7EEF8;
    --epf-text-muted: #8B98AD;

    /* ---- motion (override via config.speed) */
    --epf-pulse-dur: 2.4s;
    --epf-check-dur: 0.55s;

    position: relative;
    width: 100%;
    max-width: 680px;
    padding: 6px 4px 2px;
    font-family: inherit;
    perspective: 1400px;
}

/* Soft ambient halo behind the light stage so it blends into the dark hero */
.epf-root::before {
    content: "";
    position: absolute;
    inset: -8% -6%;
    background:
        radial-gradient(42% 38% at 72% 16%, rgba(34, 211, 238, 0.13), transparent 70%),
        radial-gradient(50% 44% at 22% 78%, rgba(249, 115, 22, 0.11), transparent 72%),
        radial-gradient(30% 26% at 50% 50%, rgba(56, 130, 246, 0.10), transparent 70%);
    filter: blur(28px);
    pointer-events: none;
    z-index: 0;
}

/* ==========================================================================
   Stage — the bright dotted-grid canvas that hosts the dashboard
   ========================================================================== */

.epf-stage {
    position: relative;
    z-index: 1;
    border-radius: 30px;
    padding: 18px 22px 8px;
    background-image:
        radial-gradient(rgba(148, 163, 184, 0.13) 1.1px, transparent 1.1px),
        linear-gradient(160deg, #141D31 0%, var(--epf-page-background) 52%, #0A0F1D 100%);
    background-size: 22px 22px, 100% 100%;
    background-position: 0 0, 0 0;
    border: 1px solid rgba(148, 163, 184, 0.16);
    box-shadow:
        0 34px 80px -28px rgba(2, 6, 14, 0.85),
        0 0 0 1px rgba(148, 163, 184, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    animation: epfRise 0.9s cubic-bezier(0.22, 0.8, 0.3, 1) both;
}


/* ==========================================================================
   Dashboard — the rounded blue panel
   ========================================================================== */

.epf-dashboard {
    position: relative;
    border-radius: 24px;
    padding: 18px 16px 12px;
    background:
        linear-gradient(150deg, rgba(148, 197, 255, 0.08) 0%, rgba(255, 255, 255, 0) 36%),
        linear-gradient(140deg, #23375F 0%, var(--epf-panel-blue) 46%, var(--epf-panel-blue-dark) 100%);
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow:
        0 24px 50px -18px rgba(2, 8, 20, 0.75),
        0 4px 14px rgba(2, 8, 20, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.09);
    overflow: hidden;
    will-change: transform;
}

/* glassy top-light sweep */
.epf-dashboard::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(58% 34% at 78% -6%, rgba(148, 197, 255, 0.09), transparent 62%);
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.epf-head {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-inline: 6px 4px;
    margin-bottom: 10px;
}

.epf-brand {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    direction: ltr;
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 0.22em;
    color: rgba(148, 163, 184, 0.9);
    margin-bottom: 7px;
}

.epf-brand svg {
    width: 13px;
    height: 13px;
    display: block;
}

.epf-title {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    color: var(--epf-white);
    letter-spacing: -0.01em;
}

.epf-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
    margin-top: 8px;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    color: #7DD3FC;
    background: rgba(34, 211, 238, 0.10);
    border: 1px solid rgba(34, 211, 238, 0.32);
    transition: background-color 0.8s ease, color 0.8s ease, border-color 0.8s ease;
}

.epf-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--epf-cyan);
    box-shadow: 0 0 8px rgba(34, 211, 238, 0.9);
    animation: epfBlink 2.2s ease-in-out infinite;
}

.epf-status-pill.is-delivered {
    color: #86EFAC;
    background: rgba(52, 211, 153, 0.12);
    border-color: rgba(52, 211, 153, 0.40);
}

.epf-status-pill.is-delivered .epf-status-dot {
    background: var(--epf-green);
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.9);
    animation: none;
}

/* --------------------------------------------------------------------------
   Stages — glass rows + node icons + status badges
   -------------------------------------------------------------------------- */

.epf-stages {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

/* vertical connection path (measured + positioned by JS) */
.epf-timeline {
    position: absolute;
    z-index: 0;
    width: 2px;
    border-radius: 2px;
    pointer-events: none;
}

.epf-timeline-line {
    position: absolute;
    inset: 0;
    border-radius: 2px;
    background: linear-gradient(180deg,
            rgba(56, 130, 246, 0.10) 0%,
            rgba(34, 211, 238, 0.85) 50%,
            rgba(56, 130, 246, 0.08) 100%);
    opacity: 0.65;
}

/* the glowing dot lives directly under `.epf-stages` (NOT inside the
   z-index-0 timeline) so it travels ABOVE the glass rows */
.epf-timeline-dot {
    position: absolute;
    z-index: 3;
    top: 0;
    left: 0;
    width: 9px;
    height: 9px;
    margin: 0;
    border-radius: 50%;
    background: var(--epf-cyan);
    box-shadow:
        0 0 12px 2px rgba(34, 211, 238, 0.7),
        0 0 0 3px rgba(34, 211, 238, 0.2);
    will-change: transform;
    pointer-events: none;
}

.epf-stage-row {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 6px 12px 6px 10px;
    border-radius: 13px;
    background: rgba(148, 163, 184, 0.06);
    border: 1px solid rgba(148, 163, 184, 0.15);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: background-color 0.9s ease, border-color 0.9s ease, box-shadow 0.9s ease;
}

.epf-stage-row.is-active {
    background: linear-gradient(120deg, rgba(34, 211, 238, 0.13), rgba(34, 211, 238, 0.04) 65%, rgba(148, 163, 184, 0.06));
    border-color: rgba(34, 211, 238, 0.40);
    box-shadow:
        0 0 0 1px rgba(34, 211, 238, 0.16),
        0 10px 26px -10px rgba(34, 211, 238, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.epf-stage-row.is-done {
    border-color: rgba(52, 211, 153, 0.25);
}

/* node icon */
.epf-node {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 10.5px;
    transition: background-color 0.9s ease, border-color 0.9s ease, box-shadow 0.9s ease, color 0.9s ease;
}

/* done */
.epf-node.is-done {
    background: linear-gradient(140deg, #34D399, #10B981);
    color: #022C22;
    box-shadow: 0 6px 14px -4px rgba(16, 185, 129, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.epf-node.is-done svg {
    width: 13px;
    height: 13px;
    stroke: #022C22;
    stroke-width: 3;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.epf-node.is-done svg path {
    stroke-dasharray: 24;
    stroke-dashoffset: 24;
}

.epf-stage-row.epf-just-done .epf-node svg path {
    animation: epfCheckDraw var(--epf-check-dur) cubic-bezier(0.3, 0.9, 0.4, 1.2) forwards;
}

/* active — soft cyan glow + pulse */
.epf-node.is-active {
    background: rgba(34, 211, 238, 0.12);
    border: 1.5px solid rgba(34, 211, 238, 0.7);
    color: var(--epf-cyan);
    box-shadow: 0 0 18px rgba(34, 211, 238, 0.3);
}

.epf-node.is-active::before,
.epf-node.is-active::after {
    content: "";
    position: absolute;
    inset: -1.5px;
    border-radius: 50%;
    border: 1.5px solid rgba(34, 211, 238, 0.6);
    animation: epfPulse var(--epf-pulse-dur) cubic-bezier(0.2, 0.6, 0.35, 1) infinite;
    pointer-events: none;
}

.epf-node.is-active::after {
    animation-delay: calc(var(--epf-pulse-dur) / -2);
}

.epf-node-core {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--epf-cyan);
    box-shadow: 0 0 10px rgba(34, 211, 238, 0.9);
}

/* review */
.epf-node.is-review {
    background: rgba(251, 191, 36, 0.10);
    border: 1.5px solid rgba(251, 191, 36, 0.55);
    color: #FCD34D;
}

/* pending */
.epf-node.is-pending {
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px dashed rgba(148, 163, 184, 0.4);
}

.epf-node-ring {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1.6px solid rgba(148, 163, 184, 0.5);
}

/* status badge — sits at the inline-start of the row, next to the node */
.epf-badge {
    flex-shrink: 0;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 700;
    white-space: nowrap;
    transition: background-color 0.8s ease, color 0.8s ease, border-color 0.8s ease;
}

.epf-badge.is-done {
    color: #6EE7B7;
    background: rgba(52, 211, 153, 0.12);
    border: 1px solid rgba(52, 211, 153, 0.32);
}

.epf-badge.is-active {
    color: #67E8F9;
    background: rgba(34, 211, 238, 0.12);
    border: 1px solid rgba(34, 211, 238, 0.38);
}

.epf-badge.is-review {
    color: #FCD34D;
    background: rgba(251, 191, 36, 0.10);
    border: 1px solid rgba(251, 191, 36, 0.32);
}

.epf-badge.is-pending {
    color: #94A3B8;
    background: rgba(148, 163, 184, 0.10);
    border: 1px solid rgba(148, 163, 184, 0.25);
}

/* stage text */
.epf-stage-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    margin-inline-start: 2px;
}

.epf-stage-title {
    font-size: 12.5px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.95);
    transition: color 0.8s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.epf-stage-row.is-pending .epf-stage-title {
    color: rgba(203, 213, 225, 0.5);
}

.epf-stage-sub {
    font-size: 9.5px;
    line-height: 1.35;
    color: rgba(148, 163, 184, 0.8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --------------------------------------------------------------------------
   Progress
   -------------------------------------------------------------------------- */

.epf-progress {
    margin-top: 10px;
    padding-inline: 6px 2px;
}

.epf-progress-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 6px;
}

.epf-progress-label {
    font-size: 11.5px;
    font-weight: 600;
    color: rgba(203, 213, 225, 0.85);
}

.epf-progress-value {
    font-size: 15px;
    font-weight: 800;
    color: var(--epf-white);
    font-variant-numeric: tabular-nums;
}

.epf-progress-track {
    position: relative;
    height: 11px;
    border-radius: 999px;
    background: rgba(2, 6, 16, 0.55);
    box-shadow: inset 0 1.5px 4px rgba(0, 0, 0, 0.5), inset 0 -1px 0 rgba(255, 255, 255, 0.05);
}

.epf-progress-fill {
    position: absolute;
    /* RTL: anchored to the RIGHT edge of the track (inline-start in RTL) and
       grows leftward — matches Persian reading direction & the step nodes.
       transform-origin mirrors the same guarantee for any transform use. */
    inset-inline-start: 0;
    transform-origin: right center;
    top: 0;
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--epf-cyan) 0%, #38BDF8 58%, #818CF8 100%);
    box-shadow: 0 0 14px rgba(34, 211, 238, 0.4);
    transition: width 1.6s cubic-bezier(0.25, 0.8, 0.3, 1);
}

.epf-progress-tip {
    position: absolute;
    inset-inline-end: -4px;
    top: 50%;
    width: 9px;
    height: 9px;
    margin-top: -4.5px;
    border-radius: 50%;
    background: #FDBA74;
    box-shadow: 0 0 10px 2px rgba(251, 146, 60, 0.7);
}


/* ==========================================================================
   Keyframes
   ========================================================================== */

@keyframes epfRise {
    from { opacity: 0; transform: translateY(20px) scale(0.985); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes epfPulse {
    0%   { transform: scale(1); opacity: 0.75; }
    70%  { transform: scale(1.65); opacity: 0; }
    100% { transform: scale(1.65); opacity: 0; }
}

@keyframes epfBlink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.35; }
}

@keyframes epfCheckDraw {
    to { stroke-dashoffset: 0; }
}


/* ==========================================================================
   Responsive — container queries (component adapts to its column width)
   ========================================================================== */

/* Tablet-ish: shrink the panel */
@container epf (max-width: 619px) {
    .epf-stage { padding: 16px 18px 6px; border-radius: 26px; }
}

/* Mobile: compact dashboard, zero overflow risk */
@container epf (max-width: 449px) {
    .epf-stage { padding: 12px 12px 5px; border-radius: 22px; }
    .epf-dashboard { padding: 16px 12px 12px; border-radius: 19px; }
    .epf-title { font-size: 14px; }
    .epf-status-pill { margin-top: 6px; padding: 4px 9px; font-size: 9px; }
    .epf-stage-row { min-height: 40px; padding: 5px 9px 5px 8px; border-radius: 11px; }
    .epf-node { width: 25px; height: 25px; }
    .epf-stage-title { font-size: 11px; }
    .epf-stage-sub { font-size: 9px; }
    .epf-badge { font-size: 8.5px; padding: 2.5px 7px; }
    .epf-progress-value { font-size: 13.5px; }
}


/* ==========================================================================
   Reduced motion — static, readable, no loops
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .epf-root *,
    .epf-root *::before,
    .epf-root *::after {
        animation: none !important;
        transition: none !important;
    }
    .epf-timeline-dot { display: none !important; }
    .epf-stage { opacity: 1 !important; transform: none !important; }
    .epf-progress-fill { transition: none !important; }
}





