/* Story demo pieces for: Robotic Process Automation service page */

.sfp-legacy,
.sfp-dlg,
.sfp-sched,
.sfp-gain {
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.06),
        0 8px 16px -6px rgba(15, 23, 42, 0.12),
        0 30px 60px -18px rgba(15, 23, 42, 0.28);
}

.sfp-btn {
    display: inline-grid;
    place-items: center;
    min-width: 64px;
    height: 24px;
    padding: 0 12px;
    border-radius: 3px;
    background: linear-gradient(#ffffff, #e5e7eb);
    border: 1px solid #9ca3af;
    font-size: 11px;
    font-weight: 500;
    color: #1f2937;
}

/* ---------- Legacy desktop program (the screen the bot operates) ---------- */
.sfp-legacy {
    position: absolute;
    background: #eceae6;
    border: 1px solid #94a3b8;
    border-radius: 6px;
    overflow: hidden;
    transform: translateZ(var(--z, 0));
    font-size: 11.5px;
}

.sfp-legacy-title {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 26px;
    padding: 0 4px 0 10px;
    background: linear-gradient(#3b5998, #2c4377);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.sfp-legacy-title span { flex: 1; overflow: hidden; text-overflow: ellipsis; }

.sfp-legacy-title i {
    display: grid;
    place-items: center;
    width: 18px;
    height: 16px;
    border-radius: 2px;
    background: #e5e7eb;
    color: #1f2937;
    font-style: normal;
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
}

.sfp-legacy-title i:last-child { background: #dc2626; color: #fff; }

.sfp-legacy-menu {
    display: flex;
    gap: 14px;
    height: 22px;
    align-items: center;
    padding: 0 10px;
    background: #f5f4f1;
    border-bottom: 1px solid #d6d3cd;
    font-size: 10.5px;
    color: #374151;
}

.sfp-legacy-body { padding: 10px 12px 12px; }

.sfp-field {
    display: grid;
    grid-template-columns: 84px 1fr;
    align-items: center;
    height: 26px;
    margin-bottom: 6px;
    color: #374151;
}

.sfp-field label { font-size: 11px; }

.sfp-field span {
    display: flex;
    align-items: center;
    height: 24px;
    padding: 0 8px;
    background: #fff;
    border: 1px solid #9ca3af;
    border-top-color: #6b7280;
    border-left-color: #6b7280;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
}

.sfp-field-err span { border: 2px solid #ef4444; background: #fef2f2; color: #b91c1c; }

.sfp-field u {
    display: inline-block;
    text-decoration: none;
    overflow: hidden;
    white-space: nowrap;
    width: calc(var(--n) * 1ch + 3px);
    border-right: 2px solid transparent;
}

.sfp-legacy-btns { display: flex; gap: 8px; margin: 10px 0 0 84px; }

.sfp-legacy-status {
    position: relative;
    height: 22px;
    border-top: 1px solid #d6d3cd;
    background: #f5f4f1;
    font-size: 10.5px;
}

.sfp-legacy-status em,
.sfp-legacy-status b {
    position: absolute;
    left: 10px;
    top: 0;
    line-height: 22px;
    font-style: normal;
    white-space: nowrap;
}

.sfp-legacy-status em { color: #6b7280; }
.sfp-legacy-status b { color: #15803d; font-weight: 700; opacity: 0; }

/* Error dialog */
.sfp-dlg {
    position: absolute;
    width: 200px;
    background: #f5f4f1;
    border: 1px solid #94a3b8;
    border-radius: 6px;
    overflow: hidden;
    transform: rotate(2deg);
    z-index: 3;
}

.sfp-dlg-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 22px;
    padding: 0 4px 0 9px;
    background: linear-gradient(#3b5998, #2c4377);
    color: #fff;
    font-size: 10.5px;
    font-weight: 600;
}

.sfp-dlg-title i {
    display: grid;
    place-items: center;
    width: 16px;
    height: 14px;
    border-radius: 2px;
    background: #dc2626;
    font-style: normal;
    font-size: 8px;
}

.sfp-dlg-body { display: flex; align-items: center; gap: 9px; padding: 12px 12px 6px; font-size: 12px; }
.sfp-dlg-body b { color: #111827; font-weight: 600; }

.sfp-dlg-ico {
    display: grid;
    place-items: center;
    flex: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #fde68a;
    color: #92400e;
    font-weight: 800;
    border: 1px solid #f59e0b;
}

.sfp-dlg-foot { padding: 6px 12px 10px; text-align: right; }

/* Copy & paste key caps */
.sfp-keys {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 8px 7px 12px;
    border-radius: 14px;
    background: #fff;
    font-size: 12px;
    color: #64748b;
    box-shadow: 0 10px 24px -10px rgba(15, 23, 42, 0.4);
    white-space: nowrap;
}

.sfp-keys kbd {
    display: inline-grid;
    place-items: center;
    min-width: 26px;
    height: 24px;
    padding: 0 6px;
    border-radius: 6px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    box-shadow: 0 2px 0 #cbd5e1;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    color: #334155;
}

.sfp-keys em { font-style: normal; margin: 0 4px; color: #94a3b8; }

.sfp-keys b {
    margin-left: 6px;
    padding: 3px 9px;
    border-radius: 999px;
    background: #fee2e2;
    color: #dc2626;
    font-size: 11.5px;
}

.sfx-sheet td.sfp-copy { outline: 2px dashed #22c55e; outline-offset: -3px; background: #f0fdf4; }

/* ---------- Scene 2: bot studio + schedule ---------- */
.sfp-steps { padding: 12px 14px 14px; }

.sfp-step {
    display: grid;
    grid-template-columns: 26px auto 1fr;
    align-items: center;
    gap: 9px;
    height: 36px;
    padding: 0 10px 0 6px;
    margin-bottom: 6px;
    border-radius: 9px;
    background: #fff;
    border: 1px solid #e2e8f0;
    font-size: 12px;
    white-space: nowrap;
}

.sfp-step b { color: #0f172a; font-weight: 600; }

.sfp-step em {
    justify-self: end;
    padding: 2px 8px;
    border-radius: 6px;
    background: #f1f5f9;
    color: #475569;
    font-style: normal;
    font-size: 10.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.sfp-step-ico {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 700;
}

.sfp-loop {
    margin: 0 0 6px;
    padding: 6px 8px 2px;
    border-radius: 11px;
    border: 1.5px dashed #93c5fd;
    background: #f5f9ff;
}

.sfp-loop-head {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 2px 6px;
    font-size: 11.5px;
    font-weight: 700;
    color: #1d4ed8;
}

.sfp-loop-head span {
    margin-left: auto;
    padding: 1px 8px;
    border-radius: 999px;
    background: #dbeafe;
    font-size: 10.5px;
}

.sfp-sched {
    position: absolute;
    width: 254px;
    padding: 14px 14px 16px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.07);
}

.sfp-sched-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; }
.sfp-sched-head em { margin-left: auto; font-style: normal; font-size: 10.5px; font-weight: 600; color: #64748b; background: #f1f5f9; padding: 2px 8px; border-radius: 999px; }

.sfp-clock {
    position: relative;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2.5px solid #2563eb;
    background: #eff6ff;
}

.sfp-clock::before,
.sfp-clock::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 50%;
    width: 2px;
    margin-left: -1px;
    border-radius: 2px;
    background: #0f172a;
    transform-origin: 50% 100%;
}

.sfp-clock::before { height: 5px; transform: rotate(-60deg); }
.sfp-clock::after { height: 7px; transform: rotate(90deg); }

.sfp-sched-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 8px;
    font-size: 12px;
    color: #475569;
    white-space: nowrap;
}

.sfp-sched-row span { font-weight: 700; color: #94a3b8; font-variant-numeric: tabular-nums; }
.sfp-sched-row.is-now { background: #eff6ff; color: #0f172a; font-weight: 600; }
.sfp-sched-row.is-now span { color: #2563eb; }

.sfp-sched-cur { left: 124px; top: 198px; }

/* ---------- Scene 3: the bot at work ---------- */
.sfp-tilt-work { transform: rotateX(12deg) rotateY(8deg); }

.sfp-sheet-st td:last-child { width: 86px; text-align: left; }
.sfp-sheet-st .sfx-st { display: block; }
.sfp-cur-row td { background: #eff6ff; }

.sfp-wait {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 600;
}
.sfp-cur-row th { background: #dbeafe; color: #1d4ed8; }

.sfp-bot {
    position: absolute;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    transform: translate(486px, 240px) translateZ(60px);
    z-index: 5;
}

.sfp-bot svg { width: 26px; height: 26px; filter: drop-shadow(0 4px 6px rgba(15, 23, 42, 0.35)); }

.sfp-bot span {
    margin: -2px 0 0 16px;
    padding: 2px 6px;
    border-radius: 5px;
    background: #2563eb;
    color: #fff;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.sfp-botchip {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px 6px 10px;
    border-radius: 999px;
    background: #fff;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    box-shadow: 0 8px 20px -10px rgba(15, 23, 42, 0.4);
    white-space: nowrap;
}

.sfp-botchip i { width: 8px; height: 8px; border-radius: 50%; background: #2563eb; }
.sfp-botchip b { color: #2563eb; }

/* ---------- Scene 4: run history + time saved ---------- */
.sfp-runs { padding: 8px 14px 12px; }

.sfp-run {
    display: grid;
    grid-template-columns: 52px 1.2fr 1.1fr 92px;
    align-items: center;
    padding: 9px 4px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 12px;
    color: #334155;
    white-space: nowrap;
}

.sfp-run span:first-child { font-variant-numeric: tabular-nums; color: #64748b; }
.sfp-run.head { font-size: 10.5px; font-weight: 600; color: #94a3b8; letter-spacing: 0.04em; padding-top: 4px; }
.sfp-run.head span:first-child { color: #94a3b8; }

.sfp-run b {
    justify-self: start;
    padding: 2px 9px;
    border-radius: 999px;
    background: #dcfce7;
    color: #15803d;
    font-size: 11px;
    font-weight: 700;
}

.sfp-runs-foot {
    display: flex;
    justify-content: space-between;
    padding: 10px 4px 0;
    font-size: 11px;
    color: #64748b;
}

.sfp-runs-foot b { color: #15803d; }

.sfp-gain {
    position: absolute;
    width: 240px;
    padding: 14px 16px 14px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.07);
}

.sfp-gain p { font-size: 11px; font-weight: 600; color: #94a3b8; letter-spacing: 0.04em; margin-bottom: 6px; }

.sfp-gain-row {
    display: grid;
    grid-template-columns: 44px 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    font-size: 11.5px;
    color: #475569;
}

.sfp-gain-row i { display: block; height: 10px; border-radius: 999px; background: #f1f5f9; overflow: hidden; }
.sfp-gain-row em { display: block; height: 100%; width: var(--w); border-radius: inherit; transform-origin: left; }
.sfp-gain-old { background: linear-gradient(90deg, #fda4af, #ef4444); }
.sfp-gain-new { background: linear-gradient(90deg, #34d399, #059669); }
.sfp-gain-row b { font-size: 12px; color: #0f172a; white-space: nowrap; }

.sfp-gain-big {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
}

.sfp-gain-big div {
    padding: 8px 10px;
    border-radius: 10px;
    background: #f0fdf4;
    border: 1px solid #dcfce7;
    line-height: 1.15;
}

.sfp-gain-big b { display: block; font-size: 24px; color: #15803d; }
.sfp-gain-big small { font-size: 10.5px; color: #64748b; }

/* ---------- Motion ---------- */
.is-active .sfp-dlg { animation: sfp-dlg 0.5s cubic-bezier(.2, 1.4, .4, 1) both 0.8s; }
.is-active .sfp-field-err span { animation: sfp-shake 0.5s ease both 0.8s; }

.is-active .sfp-step,
.is-active .sfp-loop { animation: sfp-deal 0.45s cubic-bezier(.2, 1.3, .4, 1) both; animation-delay: var(--d); }

.is-active .sfp-field u { animation: sfp-type 0.4s steps(var(--n)) both, sfp-caret 0.4s step-end both; animation-delay: var(--d); }
.is-active .sfp-btn-save { animation: sfp-click 0.3s ease both 2.15s; }
.is-active .sfp-legacy-status em { animation: sfx-out 0.2s ease forwards 2.35s; }
.is-active .sfp-legacy-status b { animation: sfp-pop 0.35s cubic-bezier(.2, 1.5, .4, 1) forwards 2.4s; }
.is-active .sfp-bot { animation: sfp-bot 2.4s ease-in-out both; }
.is-active .sfp-botchip i { animation: sfx-pulse 1.2s ease-in-out infinite; }
.is-active .sfp-cur-row td { animation: sfp-row-done 0.4s ease forwards 2.4s; }

.is-active .sfp-run:not(.head) { animation: sfp-row-in 0.4s ease both; animation-delay: var(--d); }
.is-active .sfp-run b { animation: sfp-pop 0.35s cubic-bezier(.2, 1.5, .4, 1) both; animation-delay: calc(var(--d) + 0.25s); }
.is-active .sfp-gain-row em { animation: sfp-grow-x 0.9s ease both 0.6s; }
.is-active .sfp-gain-big div { animation: sfp-pop 0.4s cubic-bezier(.2, 1.5, .4, 1) both 1.4s; }

@keyframes sfp-dlg {
    from { opacity: 0; transform: rotate(2deg) scale(0.8); }
    to { opacity: 1; transform: rotate(2deg); }
}

@keyframes sfp-shake {
    0%, 100% { transform: none; }
    20%, 60% { transform: translateX(-3px); }
    40%, 80% { transform: translateX(3px); }
}

@keyframes sfp-deal {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

@keyframes sfp-type { from { width: 0; } to { width: calc(var(--n) * 1ch + 3px); } }

@keyframes sfp-caret {
    0% { border-right-color: #111827; }
    100% { border-right-color: transparent; }
}

@keyframes sfp-click {
    0%, 100% { transform: none; }
    50% { transform: translateY(1px); background: linear-gradient(#dbeafe, #bfdbfe); border-color: #2563eb; }
}

@keyframes sfp-pop {
    from { opacity: 0; transform: scale(0.6); }
    to { opacity: 1; transform: none; }
}

@keyframes sfp-row-in {
    from { opacity: 0; transform: translateX(-8px); }
    to { opacity: 1; transform: none; }
}

@keyframes sfp-row-done { to { background: #f0fdf4; } }

@keyframes sfp-grow-x {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

/* Bot pointer: Excel row → each field → Save (plane coordinates) */
@keyframes sfp-bot {
    0% { opacity: 0; transform: translate(150px, 236px) translateZ(60px); }
    6% { opacity: 1; transform: translate(150px, 236px) translateZ(60px); }
    18% { transform: translate(520px, 104px) translateZ(60px); }
    37% { transform: translate(520px, 136px) translateZ(60px); }
    56% { transform: translate(520px, 168px) translateZ(60px); }
    75% { transform: translate(520px, 200px) translateZ(60px); }
    88% { transform: translate(486px, 236px) translateZ(60px) scale(1); }
    92% { transform: translate(486px, 237px) translateZ(60px) scale(0.88); }
    100% { opacity: 1; transform: translate(486px, 240px) translateZ(60px) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .sfp-bot, .sfp-sched-cur { display: none; }
    .sfp-field u { border-right-color: transparent !important; }
}
