/* =========================================================================
   /avtomatizacija/ in /en/automation/: posebnosti na skupnem sistemu
   produktna-stran.css. Osrednji trenutek: obrazec, e-pošta, Excel in CRM se
   zložijo v workflow (--p), nato ob drsenju po njem steče povpraševanje v petih
   korakih (data-screen 0-4 na .ws-stage, nastavlja produktna-stran.js).
   Vozlišča in povezave si delijo koordinate v enotah cqw (graf 72 x 40).
   ========================================================================= */

/* ------------------------------------------------------------- Scena */
.au-stage { height: 540vh; }
.au-scene { width: min(1100px, 94vw, calc((100vh - 320px) * 1.6)); margin: 0; }
.au-scene-caption { display: grid; margin-bottom: 28px; text-align: center; font-size: clamp(1.25rem, 1rem + 1vw, 1.75rem); font-weight: 600; letter-spacing: -0.025em; }
.au-scene-caption > span { grid-area: 1 / 1; }
.au-cap-before { color: var(--ws-muted-dark); opacity: clamp(0, calc(1 - var(--p) * 2.5), 1); }
.au-cap-after { color: #f5f5f7; opacity: 0; transition: opacity 0.45s var(--ws-ease); }
.ws-stage[data-screen="0"] .au-cap-0, .ws-stage[data-screen="1"] .au-cap-1, .ws-stage[data-screen="2"] .au-cap-2,
.ws-stage[data-screen="3"] .au-cap-3, .ws-stage[data-screen="4"] .au-cap-4 { opacity: clamp(0, calc((var(--p) - 0.55) * 2.5), 1); }
.au-scene-note { margin-top: 18px; text-align: center; font-size: 0.8125rem; color: var(--ws-muted-dark); opacity: clamp(0, calc((var(--p) - 0.6) * 2.5), 1); }
.au-steplist { display: none; text-align: left; }

.au-canvas { position: relative; aspect-ratio: 16 / 9.4; container-type: inline-size; text-align: left; }

/* Ločena orodja: začnejo raztresena in se zbližajo v workflow */
.au-frag {
    --x: 0cqw; --y: 0cqw; --r: 0deg;
    position: absolute; left: 50%; top: 50%; z-index: 2; width: 22cqw; padding: 1.6cqw;
    border-radius: 1.2cqw; background: #fff; color: #1d1d1f;
    box-shadow: 0 2cqw 5cqw -1cqw rgba(0, 0, 0, 0.55);
    font: 500 1.15cqw/1.35 var(--ws-font);
    transform: translate(-50%, -50%) translate(calc(var(--x) * (1 - var(--p))), calc(var(--y) * (1 - var(--p)))) rotate(calc(var(--r) * (1 - var(--p)))) scale(calc(1 - 0.55 * var(--p)));
    opacity: clamp(0, calc(1.2 - var(--p) * 2), 1);
    will-change: transform, opacity;
}
.au-frag-0 { --x: -32cqw; --y: -11cqw; --r: -5deg; }
.au-frag-1 { --x: 31cqw; --y: -14cqw; --r: 4deg; }
.au-frag-2 { --x: -24cqw; --y: 15cqw; --r: 3deg; }
.au-frag-3 { --x: 27cqw; --y: 15cqw; --r: -4deg; }
.au-frag-title { display: flex; align-items: center; gap: 0.9cqw; margin: 0 0 1cqw; font-weight: 600; }
.au-frag-title b { padding: 0.3cqw 0.7cqw; border-radius: 0.5cqw; background: var(--ws-blue); color: #fff; font-size: 0.9cqw; }
.au-frag-1 .au-frag-title b { background: #e8443a; }
.au-frag-2 .au-frag-title b { background: #1f8f4e; }
.au-frag-3 .au-frag-title b { background: #8e44ef; }
.au-frag span { display: block; height: 0.5cqw; margin-top: 0.9cqw; border-radius: 1cqw; background: #e3e3e8; }
.au-frag span:nth-child(3) { width: 80%; }
.au-frag span:nth-child(4) { width: 55%; }

/* Okno workflowa */
.au-win {
    position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column;
    border-radius: 1.6cqw; overflow: hidden; background: #fff;
    font: 500 1.15cqw/1.35 var(--ws-font); color: #1d1d1f; letter-spacing: -0.01em;
    transform: scale(calc(0.8 + 0.2 * var(--p)));
    opacity: clamp(0, calc((var(--p) - 0.2) * 2.5), 1);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 3cqw 9cqw -2cqw rgba(79, 134, 247, 0.4);
    will-change: transform, opacity;
}
.au-win-head { display: flex; align-items: center; gap: 1cqw; padding: 1.2cqw 2cqw; border-bottom: 1px solid #ececf0; }
.au-win-icon { width: 2.4cqw; height: 2.4cqw; border-radius: 0.6cqw; background: linear-gradient(135deg, #6b9cff, #1a55d6); }
.au-win-name { font-weight: 600; }
.au-status { display: none; align-items: center; gap: 0.6cqw; margin-left: auto; padding: 0.3cqw 1cqw; border-radius: 2cqw; font-size: 1cqw; font-weight: 600; }
.au-status::before { content: ''; width: 0.8cqw; height: 0.8cqw; border-radius: 50%; background: currentColor; }
.au-status-run { background: #e3edff; color: #1a55d6; }
.au-status-run::before { animation: au-pulse 1.2s infinite ease-in-out; }
.au-status-done { background: #e2f6e7; color: #1f7a3d; }
.ws-stage[data-screen="0"] .au-status-run, .ws-stage[data-screen="1"] .au-status-run,
.ws-stage[data-screen="2"] .au-status-run, .ws-stage[data-screen="3"] .au-status-run,
.ws-stage[data-screen="4"] .au-status-done { display: inline-flex; }
@keyframes au-pulse { 50% { opacity: 0.3; } }

.au-body { flex: 1; display: grid; grid-template-columns: 1fr 24cqw; min-height: 0; }

/* Graf: mreža s pikami kot v orodjih za workflowe */
.au-graph-cell { display: grid; place-items: center; }
.au-graph {
    position: relative; align-self: center; justify-self: center; width: 72cqw; height: 40cqw;
    background-image: radial-gradient(#e5e5ea 0.12cqw, transparent 0.13cqw); background-size: 2cqw 2cqw;
}
.au-wires { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
/* SVG ima merilo 1 enota = 1cqw, zato je debelina v enotah grafa (pathLength in non-scaling-stroke se ne razumeta) */
.au-wire, .au-wire-on { fill: none; stroke-width: 0.2; stroke-linecap: round; }
.au-wire { stroke: #d1d1d6; }
.au-wire-on { stroke: var(--ws-blue); stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 0.9s var(--ws-ease); }
.ws-stage[data-screen="1"] .au-w1, .ws-stage[data-screen="2"] .au-w1, .ws-stage[data-screen="3"] .au-w1, .ws-stage[data-screen="4"] .au-w1,
.ws-stage[data-screen="2"] .au-w2, .ws-stage[data-screen="3"] .au-w2, .ws-stage[data-screen="4"] .au-w2,
.ws-stage[data-screen="3"] .au-w3, .ws-stage[data-screen="4"] .au-w3,
.ws-stage[data-screen="4"] .au-w4 { stroke-dashoffset: 0; }

.au-node {
    position: absolute; left: calc(var(--col) * 14.75cqw); top: calc(var(--row) * 14cqw + 2.25cqw);
    display: flex; align-items: center; gap: 0.9cqw; width: 12cqw; height: 7.5cqw; padding: 0 1cqw;
    border-radius: 1.1cqw; border: 1px solid #e5e5ea; background: #fff;
    box-shadow: 0 0.3cqw 1cqw rgba(0, 0, 0, 0.06);
    opacity: 0.5; transition: opacity 0.4s, border-color 0.4s, box-shadow 0.4s;
}
.au-node-icon { flex: none; display: grid; place-items: center; width: 2.8cqw; height: 2.8cqw; border-radius: 0.7cqw; background: var(--ws-blue); color: #fff; font-size: 1.2cqw; font-weight: 700; }
.au-icon-rules { background: #ff9f0a; }
.au-icon-crm { background: #1f8f4e; }
.au-icon-mail { background: #e8443a; }
.au-icon-notify { background: #5e5ce6; }
.au-icon-task { background: #0a84ff; }
.au-icon-report { background: #1d1d1f; }
.au-node-text { min-width: 0; font-size: 0.9cqw; line-height: 1.25; color: #6e6e73; }
.au-node-text b { display: block; font-size: 1.1cqw; color: #1d1d1f; }
.au-node-state { position: absolute; top: -0.8cqw; right: -0.8cqw; width: 1.8cqw; height: 1.8cqw; border-radius: 50%; opacity: 0; transition: opacity 0.3s; }

/* Trenutni korak: moder okvir in vrtenje; opravljeni: zelena kljukica; prihodnji: zatemnjeni */
.ws-stage[data-screen="0"] .au-n0, .ws-stage[data-screen="1"] .au-n1, .ws-stage[data-screen="2"] .au-n2, .ws-stage[data-screen="3"] .au-n3 {
    opacity: 1; border-color: var(--ws-blue); box-shadow: 0 0 0 0.3cqw rgba(35, 103, 245, 0.16), 0 0.6cqw 2cqw rgba(35, 103, 245, 0.18);
}
.ws-stage[data-screen="0"] .au-n0 .au-node-state, .ws-stage[data-screen="1"] .au-n1 .au-node-state,
.ws-stage[data-screen="2"] .au-n2 .au-node-state, .ws-stage[data-screen="3"] .au-n3 .au-node-state {
    opacity: 1; background: #fff; border: 0.25cqw solid #d6e3ff; border-top-color: var(--ws-blue); animation: au-spin 0.8s linear infinite;
}
.ws-stage[data-screen="1"] .au-n0, .ws-stage[data-screen="2"] .au-n0, .ws-stage[data-screen="3"] .au-n0, .ws-stage[data-screen="4"] .au-n0,
.ws-stage[data-screen="2"] .au-n1, .ws-stage[data-screen="3"] .au-n1, .ws-stage[data-screen="4"] .au-n1,
.ws-stage[data-screen="3"] .au-n2, .ws-stage[data-screen="4"] .au-n2,
.ws-stage[data-screen="4"] .au-n3, .ws-stage[data-screen="4"] .au-n4 { opacity: 1; }
.ws-stage[data-screen="1"] .au-n0 .au-node-state, .ws-stage[data-screen="2"] .au-n0 .au-node-state, .ws-stage[data-screen="3"] .au-n0 .au-node-state, .ws-stage[data-screen="4"] .au-n0 .au-node-state,
.ws-stage[data-screen="2"] .au-n1 .au-node-state, .ws-stage[data-screen="3"] .au-n1 .au-node-state, .ws-stage[data-screen="4"] .au-n1 .au-node-state,
.ws-stage[data-screen="3"] .au-n2 .au-node-state, .ws-stage[data-screen="4"] .au-n2 .au-node-state,
.ws-stage[data-screen="4"] .au-n3 .au-node-state, .ws-stage[data-screen="4"] .au-n4 .au-node-state {
    opacity: 1; background: #34c759 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4L18 8'/%3E%3C/svg%3E") center / 70% no-repeat;
}
.ws-stage[data-screen="4"] .au-n4 { border-color: #34c759; box-shadow: 0 0 0 0.3cqw rgba(52, 199, 89, 0.18); }
@keyframes au-spin { to { transform: rotate(360deg); } }

/* Podatki v tem koraku */
.au-inspect { position: relative; padding: 1.8cqw; border-left: 1px solid #ececf0; background: #f9f9fb; }
.au-inspect-label { margin: 0; font-size: 0.95cqw; font-weight: 700; color: #8e8e93; }
.au-panel {
    position: absolute; inset: 4.4cqw 1.8cqw 1.8cqw;
    opacity: 0; transform: translateY(1.2cqw); visibility: hidden;
    transition: opacity 0.45s var(--ws-ease), transform 0.55s var(--ws-ease), visibility 0s 0.55s;
}
.ws-stage[data-screen="0"] .au-panel-0, .ws-stage[data-screen="1"] .au-panel-1, .ws-stage[data-screen="2"] .au-panel-2,
.ws-stage[data-screen="3"] .au-panel-3, .ws-stage[data-screen="4"] .au-panel-4 { opacity: 1; transform: none; visibility: visible; transition-delay: 0s; }
.au-panel-title { margin: 0 0 1cqw; font-size: 1.4cqw; font-weight: 700; letter-spacing: -0.02em; }
.au-row { display: flex; flex-direction: column; gap: 0.2cqw; margin: 0; padding: 0.8cqw 0; border-top: 1px solid #ececf0; }
.au-row span { font-size: 0.95cqw; color: #8e8e93; }
.au-row b { font-weight: 600; }
.au-row-ok b, .au-row-warn b { display: flex; align-items: center; gap: 0.6cqw; }
.au-row-ok b::before, .au-row-warn b::before { content: ''; flex: none; width: 1.3cqw; height: 1.3cqw; border-radius: 50%; }
.au-row-ok b::before { background: #34c759 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4L18 8'/%3E%3C/svg%3E") center / 70% no-repeat; }
.au-row-warn b { color: #8a6100; }
.au-row-warn b::before { background: #ff9f0a url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.2' stroke-linecap='round'%3E%3Cpath d='M12 7v6M12 17v.5'/%3E%3C/svg%3E") center / 70% no-repeat; }

/* Kartice rešitev so na belem pasu, zato svetlo sive */
.ws-page .au-cards-light .ws-tile:not(.ws-card-ink) { background: var(--ws-mist); }
.ws-page .au-compare-wrap { background: var(--ws-mist); }

/* ---------------------------------------------------------- Odzivno */
/* Na telefonu in brez gibanja je namesto grafa seznam korakov */
@media (max-width: 640px) {
    .au-stage { height: auto; }
    .au-scene { width: calc(100% - 32px); margin-inline: auto; }
    .au-scene-caption, .au-canvas { display: none; }
    .au-scene-note { opacity: 1; }
    .au-steplist { display: block; margin: 0; padding: 0; list-style: none; counter-reset: au; }
    .au-steplist li { position: relative; padding: 18px 0 18px 48px; border-top: 1px solid var(--ws-line-dark); font-size: 1.1875rem; font-weight: 600; letter-spacing: -0.015em; color: #f5f5f7; counter-increment: au; }
    .au-steplist li:first-child { border-top: 0; }
    .au-steplist li::before { content: counter(au); position: absolute; left: 0; top: 50%; display: grid; place-items: center; width: 30px; height: 30px; margin-top: -15px; border-radius: 50%; background: var(--ws-blue); color: #fff; font-size: 0.875rem; }
    .ws-page .au-compare-wrap { background: transparent; }
    .ws-page .au-compare-wrap .ws-compare tr { background: var(--ws-mist); }
}

@media (prefers-reduced-motion: reduce) {
    .au-stage { height: auto; }
    .au-scene { margin-inline: auto; width: min(760px, 100% - 32px); }
    .au-scene-caption, .au-canvas { display: none; }
    .au-scene-note { opacity: 1; }
    .au-steplist { display: block; margin: 0; padding: 0; list-style: none; counter-reset: au; }
    .au-steplist li { position: relative; padding: 18px 0 18px 48px; border-top: 1px solid var(--ws-line-dark); font-size: 1.25rem; font-weight: 600; color: #f5f5f7; counter-increment: au; }
    .au-steplist li:first-child { border-top: 0; }
    .au-steplist li::before { content: counter(au); position: absolute; left: 0; top: 50%; display: grid; place-items: center; width: 30px; height: 30px; margin-top: -15px; border-radius: 50%; background: var(--ws-blue); color: #fff; font-size: 0.875rem; }
}
