/* =========================================================================
   /umetna-inteligenca/ in /en/ai-solutions/: posebnosti na skupnem sistemu
   produktna-stran.css. Osrednji trenutek: pravilnik, FAQ in CRM priletijo v
   konzolo AI agenta (--p), nato agent ob drsenju opravi delo v petih korakih:
   prejme sporočilo, razume zahtevo, prebere bazo znanja, preveri naročilo in
   ukrepa (data-screen 0-4 na .ws-stage, nastavlja produktna-stran.js).
   ========================================================================= */

/* ------------------------------------------------------------- Scena */
.ai-stage { height: 540vh; }
.ai-scene { width: min(1100px, 94vw, calc((100vh - 320px) * 1.6)); margin: 0; }
.ai-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; }
.ai-scene-caption > span { grid-area: 1 / 1; }
.ai-cap-before { color: var(--ws-muted-dark); opacity: clamp(0, calc(1 - var(--p) * 2.5), 1); }
.ai-cap-after { color: #f5f5f7; opacity: 0; transition: opacity 0.45s var(--ws-ease); }
.ws-stage[data-screen="0"] .ai-cap-0, .ws-stage[data-screen="1"] .ai-cap-1, .ws-stage[data-screen="2"] .ai-cap-2, .ws-stage[data-screen="3"] .ai-cap-3, .ws-stage[data-screen="4"] .ai-cap-4 { opacity: clamp(0, calc((var(--p) - 0.55) * 2.5), 1); }
.ai-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); }

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

/* Viri: začnejo raztreseni in se zbližajo v okno */
.ai-frag {
    --x: 0cqw; --y: 0cqw; --r: 0deg;
    position: absolute; left: 50%; top: 50%; z-index: 2; width: 27cqw; padding: 1.8cqw;
    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;
}
.ai-frag-pdf { --x: -33cqw; --y: -6cqw; --r: -5deg; }
.ai-frag-faq { --x: 32cqw; --y: -13cqw; --r: 4deg; }
.ai-frag-crm { --x: 22cqw; --y: 17cqw; --r: -3deg; width: 22cqw; }
.ai-frag-title { display: flex; align-items: center; gap: 0.9cqw; margin: 0 0 1.2cqw; font-weight: 600; }
.ai-frag-title b { padding: 0.3cqw 0.7cqw; border-radius: 0.5cqw; background: #e8443a; color: #fff; font-size: 0.9cqw; letter-spacing: 0.02em; }
.ai-frag-faq .ai-frag-title b { background: var(--ws-blue); }
.ai-frag-crm .ai-frag-title b { background: #1f8f4e; }
.ai-frag-pdf span { display: block; height: 0.5cqw; margin-top: 1cqw; border-radius: 1cqw; background: #e3e3e8; }
.ai-frag-pdf span:nth-child(3) { width: 85%; }
.ai-frag-pdf span:nth-child(5) { width: 60%; }
.ai-frag-q { margin: 0; padding: 0.8cqw 0; border-top: 1px solid #ececf0; color: #424245; }
.ai-frag-row { display: flex; justify-content: space-between; margin: 0; padding: 0.6cqw 0; border-top: 1px solid #ececf0; }
.ai-frag-row span:first-child { color: #8e8e93; }

/* Konzola agenta */
.ai-win {
    position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column;
    border-radius: 1.6cqw; overflow: hidden; background: #fff;
    font: 500 1.2cqw/1.4 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;
}
.ai-win-head { display: flex; align-items: center; gap: 1cqw; padding: 1.2cqw 2cqw; border-bottom: 1px solid #ececf0; }
.ai-avatar { display: grid; place-items: center; width: 2.6cqw; height: 2.6cqw; border-radius: 50%; background: linear-gradient(135deg, #6b9cff, #1a55d6); color: #fff; font-size: 0.95cqw; font-weight: 700; }
.ai-win-name { font-weight: 600; }
.ag-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; }
.ag-status::before { content: ''; width: 0.8cqw; height: 0.8cqw; border-radius: 50%; background: currentColor; }
.ag-status-run { background: #e3edff; color: #1a55d6; }
.ag-status-run::before { animation: ag-pulse 1.2s infinite ease-in-out; }
.ag-status-done { background: #e2f6e7; color: #1f7a3d; }
.ws-stage[data-screen="0"] .ag-status-run, .ws-stage[data-screen="1"] .ag-status-run, .ws-stage[data-screen="2"] .ag-status-run, .ws-stage[data-screen="3"] .ag-status-run { display: inline-flex; }
.ws-stage[data-screen="4"] .ag-status-done { display: inline-flex; }
@keyframes ag-pulse { 50% { opacity: 0.3; } }

.ag-body { flex: 1; display: grid; grid-template-columns: 25cqw 1fr 21cqw; min-height: 0; }
.ag-col { display: flex; flex-direction: column; gap: 1cqw; min-height: 0; padding: 1.6cqw 1.8cqw; overflow: hidden; }
.ag-col-title { margin: 0; font-size: 0.95cqw; font-weight: 700; color: #8e8e93; letter-spacing: 0; }
.ag-inbox { background: #f9f9fb; border-right: 1px solid #ececf0; }
.ag-side { background: #f9f9fb; border-left: 1px solid #ececf0; }

/* Prejeto */
.ag-mail { padding: 1.3cqw; border-radius: 1.1cqw; background: #fff; border: 1px solid #ececf0; }
.ag-mail p { margin: 0; }
.ag-mail-from { display: flex; align-items: center; gap: 0.8cqw; font-weight: 600; }
.ag-mail-from b { display: grid; place-items: center; width: 2.2cqw; height: 2.2cqw; border-radius: 50%; background: #ffe1d6; color: #b4471f; font-size: 0.95cqw; }
.ag-mail-subject { margin-top: 0.8cqw !important; font-weight: 700; }
.ag-mail-text { margin-top: 0.5cqw !important; color: #424245; font-size: 1.1cqw; }
.ag-attach { display: inline-block; margin-top: 0.9cqw; padding: 0.3cqw 0.9cqw; border-radius: 0.6cqw; background: #f2f2f5; color: #6e6e73; font-size: 0.95cqw; }
.ag-reply { border-color: #b8d0ff; background: #f3f7ff; }
.ag-reply-label { font-size: 0.95cqw; font-weight: 700; color: #1a55d6; }

/* Potek dela: nov korak se pojavi spodaj, starejši se odmaknejo navzgor */
.ag-steps { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 1cqw; min-height: 0; overflow: hidden; }
.ag-idle { align-self: center; margin: auto 0 !important; display: flex; align-items: center; gap: 0.5cqw; color: #8e8e93; }
.ag-idle i { width: 0.7cqw; height: 0.7cqw; border-radius: 50%; background: #aeaeb2; animation: ag-dot 1.2s infinite ease-in-out; }
.ag-idle i:nth-child(2) { animation-delay: 0.15s; }
.ag-idle i:nth-child(3) { animation-delay: 0.3s; margin-right: 0.6cqw; }
@keyframes ag-dot { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-0.35cqw); opacity: 1; } }
.ag-step { flex: none; padding: 1.2cqw 1.4cqw; border-radius: 1.1cqw; border: 1px solid #ececf0; background: #fff; transition: border-color 0.4s, box-shadow 0.4s; }
.ag-step-head { display: flex; align-items: center; gap: 0.8cqw; margin: 0; font-weight: 700; }
.ag-dot { position: relative; flex: none; width: 1.5cqw; height: 1.5cqw; border-radius: 50%; background: #34c759; }
.ag-dot::after { content: ''; position: absolute; left: 32%; top: 22%; width: 30%; height: 45%; border-right: 0.22cqw solid #fff; border-bottom: 0.22cqw solid #fff; transform: rotate(45deg); }
/* Trenutni korak: moder okvir in vrteči se indikator namesto kljukice */
.ws-stage[data-screen="1"] .ag-t1, .ws-stage[data-screen="2"] .ag-t2, .ws-stage[data-screen="3"] .ag-t3 { border-color: var(--ws-blue); box-shadow: 0 0 0 0.25cqw rgba(35, 103, 245, 0.12); }
.ws-stage[data-screen="1"] .ag-t1 .ag-dot, .ws-stage[data-screen="2"] .ag-t2 .ag-dot, .ws-stage[data-screen="3"] .ag-t3 .ag-dot { background: none; border: 0.25cqw solid #d6e3ff; border-top-color: var(--ws-blue); animation: ag-spin 0.8s linear infinite; }
.ws-stage[data-screen="1"] .ag-t1 .ag-dot::after, .ws-stage[data-screen="2"] .ag-t2 .ag-dot::after, .ws-stage[data-screen="3"] .ag-t3 .ag-dot::after { display: none; }
@keyframes ag-spin { to { transform: rotate(360deg); } }
.ag-chips { display: flex; flex-wrap: wrap; gap: 0.6cqw; margin-top: 0.9cqw; }
.ag-chips span { padding: 0.3cqw 0.9cqw; border-radius: 2cqw; background: #f2f2f5; font-size: 1cqw; color: #424245; }
.ag-doc { position: relative; margin-top: 0.9cqw; padding: 1cqw 1.2cqw; border-radius: 0.8cqw; background: #f9f9fb; overflow: hidden; }
.ag-doc-name { display: flex; align-items: center; gap: 0.7cqw; margin: 0 0 0.6cqw; font-size: 1cqw; font-weight: 600; color: #6e6e73; }
.ag-doc-name b { padding: 0.2cqw 0.6cqw; border-radius: 0.4cqw; background: #e8443a; color: #fff; font-size: 0.8cqw; }
.ag-doc-text { margin: 0; font-size: 1.05cqw; color: #424245; }
.ag-doc-text mark { padding: 0 0.2cqw; border-radius: 0.3cqw; background: linear-gradient(#fff1a8, #fff1a8) no-repeat 0 0 / 0% 100%; color: #1d1d1f; font-weight: 600; transition: background-size 1.1s var(--ws-ease) 0.5s; }
.ws-stage[data-screen="2"] .ag-doc-text mark, .ws-stage[data-screen="3"] .ag-doc-text mark, .ws-stage[data-screen="4"] .ag-doc-text mark { background-size: 100% 100%; }
.ag-scan { position: absolute; left: 0; right: 0; top: 0; height: 2.4cqw; background: linear-gradient(180deg, transparent, rgba(35, 103, 245, 0.16), transparent); opacity: 0; }
.ws-stage[data-screen="2"] .ag-scan { animation: ag-scan 1.6s ease-in-out infinite; }
@keyframes ag-scan { 0% { top: -2.4cqw; opacity: 1; } 100% { top: 100%; opacity: 1; } }
.ag-call { display: block; margin-top: 0.9cqw; padding: 0.7cqw 1cqw; border-radius: 0.6cqw; background: #1d1d1f; color: #a8c7ff; font: 500 1cqw/1.3 ui-monospace, 'SF Mono', Menlo, monospace; }
.ag-result { display: flex; gap: 1.6cqw; margin-top: 0.7cqw; }
.ag-result p { margin: 0; display: flex; flex-direction: column; font-size: 1cqw; }
.ag-result span { color: #8e8e93; }
.ag-rule { margin: 0.8cqw 0 0 !important; padding: 0.6cqw 0.9cqw; border-radius: 0.6cqw; background: #fff8e6; color: #8a6100; font-size: 1cqw; font-weight: 600; }
.ag-action { position: relative; margin: 0.7cqw 0 0 !important; padding-left: 2cqw; font-size: 1.1cqw; }
.ag-action::before { content: ''; position: absolute; left: 0.3cqw; top: 0.35cqw; width: 0.6cqw; height: 1cqw; border-right: 0.22cqw solid #1f7a3d; border-bottom: 0.22cqw solid #1f7a3d; transform: rotate(45deg); }

/* Načrt in orodja */
.ag-plan { margin: 0 0 1cqw !important; padding: 0 !important; list-style: none; counter-reset: ag; }
.ag-plan li { position: relative; padding: 0.6cqw 0 0.6cqw 2.4cqw; color: #8e8e93; font-size: 1.1cqw; counter-increment: ag; transition: color 0.3s; }
.ag-plan li::before { content: counter(ag); position: absolute; left: 0; top: 0.55cqw; display: grid; place-items: center; width: 1.6cqw; height: 1.6cqw; border-radius: 50%; border: 0.15cqw solid #d1d1d6; font-size: 0.8cqw; font-weight: 700; transition: background-color 0.3s, border-color 0.3s, color 0.3s; }
.ws-stage[data-screen="1"] .ag-p1, .ws-stage[data-screen="2"] .ag-p2, .ws-stage[data-screen="3"] .ag-p3 { color: #1d1d1f; font-weight: 600; }
.ws-stage[data-screen="1"] .ag-p1::before, .ws-stage[data-screen="2"] .ag-p2::before, .ws-stage[data-screen="3"] .ag-p3::before { border-color: var(--ws-blue); color: var(--ws-blue); }
.ws-stage[data-screen="2"] .ag-p1, .ws-stage[data-screen="3"] .ag-p1, .ws-stage[data-screen="4"] .ag-p1, .ws-stage[data-screen="3"] .ag-p2, .ws-stage[data-screen="4"] .ag-p2, .ws-stage[data-screen="4"] .ag-p3, .ws-stage[data-screen="4"] .ag-p4 { color: #1d1d1f; }
.ws-stage[data-screen="2"] .ag-p1::before, .ws-stage[data-screen="3"] .ag-p1::before, .ws-stage[data-screen="4"] .ag-p1::before, .ws-stage[data-screen="3"] .ag-p2::before, .ws-stage[data-screen="4"] .ag-p2::before, .ws-stage[data-screen="4"] .ag-p3::before, .ws-stage[data-screen="4"] .ag-p4::before { content: '✓'; background: #34c759; border-color: #34c759; color: #fff; }
.ag-tools { display: flex; flex-wrap: wrap; gap: 0.6cqw; margin: 0 !important; padding: 0 !important; list-style: none; }
.ag-tools li { padding: 0.4cqw 1cqw; border-radius: 2cqw; border: 1px solid #e5e5ea; background: #fff; color: #aeaeb2; font-size: 1cqw; font-weight: 600; transition: color 0.4s, border-color 0.4s, background-color 0.4s; }
.ws-stage[data-screen="2"] .ag-tool-kb, .ws-stage[data-screen="3"] .ag-tool-kb, .ws-stage[data-screen="4"] .ag-tool-kb, .ws-stage[data-screen="3"] .ag-tool-crm, .ws-stage[data-screen="4"] .ag-tool-crm, .ws-stage[data-screen="4"] .ag-tool-mail, .ws-stage[data-screen="4"] .ag-tool-task { border-color: #b8d0ff; background: #e3edff; color: #1a55d6; }

/* Kar se je že zgodilo, ostane; novo se pojavi z dvigom */
.ag-from-1, .ag-from-2, .ag-from-3, .ag-from-4, .ag-until-0 { display: none; }
.ws-stage[data-screen="0"] .ag-until-0 { display: flex; }
.ws-stage[data-screen="1"] .ag-from-1, .ws-stage[data-screen="2"] .ag-from-1, .ws-stage[data-screen="3"] .ag-from-1, .ws-stage[data-screen="4"] .ag-from-1, .ws-stage[data-screen="2"] .ag-from-2, .ws-stage[data-screen="3"] .ag-from-2, .ws-stage[data-screen="4"] .ag-from-2, .ws-stage[data-screen="3"] .ag-from-3, .ws-stage[data-screen="4"] .ag-from-3, .ws-stage[data-screen="4"] .ag-from-4 { display: block; }
.ag-step, .ag-reply { animation: ag-in 0.55s var(--ws-ease) both; }
@keyframes ag-in { from { opacity: 0; transform: translateY(1.4cqw); } }

/* Primerjava je na belem pasu, zato je tabela svetlo siva */
.ws-page .ai-compare-wrap { background: var(--ws-mist); }

/* ---------------------------------------------------------- Odzivno */
/* Na telefonu in brez gibanja ni drsne zgodbe: prikazan je končni potek dela */
@media (max-width: 640px) {
    .ai-stage { height: auto; }
    .ai-scene { width: calc(100% - 16px); margin-inline: auto; }
    .ai-frag, .ai-cap-before, .ag-side { display: none; }
    .ws-stage[data-screen] .ai-cap-0 { opacity: 0; }
    .ws-stage[data-screen] .ai-cap-4 { opacity: 1; }
    .ai-scene-note { opacity: 1; }
    .ai-canvas { aspect-ratio: auto; }
    .ai-win { position: relative; font-size: 3.4cqw; border-radius: 3cqw; }
    .ai-win-head { padding: 3cqw 4cqw; gap: 2.4cqw; }
    .ai-avatar { width: 7cqw; height: 7cqw; font-size: 2.6cqw; }
    .ag-status { padding: 0.8cqw 2.4cqw; border-radius: 4cqw; font-size: 2.8cqw; gap: 1.4cqw; }
    .ag-status::before { width: 2cqw; height: 2cqw; }
    .ws-stage[data-screen] .ag-status-run { display: none; }
    .ws-stage[data-screen] .ag-status-done { display: inline-flex; }
    .ag-body { grid-template-columns: 1fr; }
    .ag-col { gap: 2.4cqw; padding: 4cqw; }
    .ag-inbox { border-right: 0; border-bottom: 1px solid #ececf0; }
    .ag-col-title, .ag-attach, .ag-reply-label, .ag-chips span, .ag-doc-name, .ag-call, .ag-result p, .ag-rule { font-size: 2.8cqw; }
    .ag-mail, .ag-step { padding: 3cqw 3.4cqw; border-radius: 3cqw; }
    .ag-mail-text, .ag-doc-text, .ag-action { font-size: 3cqw; }
    .ag-mail-from b { width: 6cqw; height: 6cqw; font-size: 2.6cqw; }
    .ag-doc-name b { padding: 0.5cqw 1.4cqw; border-radius: 1cqw; font-size: 2.2cqw; }
    .ag-dot { width: 4cqw; height: 4cqw; }
    .ag-dot::after { border-width: 0 0.6cqw 0.6cqw 0; }
    .ag-chips, .ag-doc, .ag-call { margin-top: 2cqw; }
    .ag-chips { gap: 1.4cqw; }
    .ag-chips span { padding: 0.8cqw 2cqw; border-radius: 4cqw; }
    .ag-doc, .ag-call, .ag-rule { padding: 2cqw 2.6cqw; border-radius: 2cqw; }
    .ag-result { gap: 4cqw; margin-top: 2cqw; }
    .ag-action { padding-left: 5cqw; margin-top: 1.6cqw !important; }
    .ag-action::before { width: 1.4cqw; height: 2.6cqw; border-width: 0 0.55cqw 0.55cqw 0; left: 1cqw; top: 0.8cqw; }
    .ws-stage[data-screen] .ag-from-1, .ws-stage[data-screen] .ag-from-2, .ws-stage[data-screen] .ag-from-3, .ws-stage[data-screen] .ag-from-4 { display: block; }
    .ws-stage[data-screen] .ag-until-0 { display: none; }
    .ws-stage[data-screen] .ag-doc-text mark { background-size: 100% 100%; }
    .ws-stage[data-screen] .ag-step { border-color: #ececf0; box-shadow: none; }
    .ws-stage[data-screen] .ag-step .ag-dot { background: #34c759; border: 0; animation: none; }
    .ws-stage[data-screen] .ag-step .ag-dot::after { display: block; }
    .ws-page .ai-compare-wrap { background: transparent; }
    .ws-page .ai-compare-wrap .ws-compare tr { background: var(--ws-mist); }
}

@media (prefers-reduced-motion: reduce) {
    .ai-stage { height: auto; }
    .ai-scene { margin-inline: auto; }
    .ai-frag, .ai-cap-before { display: none; }
    .ws-stage[data-screen] .ai-cap-0 { opacity: 0; }
    .ws-stage[data-screen] .ai-cap-4 { opacity: 1; }
    .ai-scene-note { opacity: 1; }
    .ws-stage[data-screen] .ag-status-run { display: none; }
    .ws-stage[data-screen] .ag-status-done { display: inline-flex; }
    .ws-stage[data-screen] .ag-from-1, .ws-stage[data-screen] .ag-from-2, .ws-stage[data-screen] .ag-from-3, .ws-stage[data-screen] .ag-from-4 { display: block; }
    .ws-stage[data-screen] .ag-until-0 { display: none; }
    .ws-stage[data-screen] .ag-doc-text mark { background-size: 100% 100%; transition: none; }
    .ws-stage[data-screen] .ag-plan li { color: #1d1d1f; }
    .ws-stage[data-screen] .ag-plan li::before { content: '✓'; background: #34c759; border-color: #34c759; color: #fff; }
    .ws-stage[data-screen] .ag-tools li { border-color: #b8d0ff; background: #e3edff; color: #1a55d6; }
    .ag-step, .ag-reply, .ag-idle i, .ag-scan, .ag-status-run::before { animation: none; }
}
