/* ==========================================================================
   Sekcja „Funkcje” – makiety po prawej w wyglądzie wtyczki i jej shortcode'ów,
   z mikroanimacjami (js/stack-vis.js).
   ========================================================================== */

.sv {
    --g-700: #0a7a48;
    --g-600: #0c9256;
    --g-300: #a7dfc1;
    --g-100: #e5f5e9;
    --g-50: #ebf7f0;
    --bg: #f7faf8;
    --line: #e1e9e4;
    --ink: #101c19;
    --muted: #5f6b66;
    --warn: #9a5b00;
    --warn-bg: #fff6e5;
    --bad: #b42318;
    --bad-bg: #fdecea;
    --yellow: #e0a100;
    --red: #d92d20;
    position: relative;
    width: 100%;
    max-width: 420px;
    font-family: 'Inter', 'Inter Fallback', Arial, sans-serif;
    font-size: 12px;
    line-height: 1.4;
    color: var(--ink);
    text-align: left;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 24px 50px rgba(16, 28, 25, .10), 0 2px 6px rgba(16, 28, 25, .04);
}

.sv b { font-weight: 600; }
.sv-muted { display: block; color: var(--muted); font-size: 11px; font-weight: 400; }
.sv-down { color: var(--g-700); font-style: normal; font-weight: 600; }
.sv-up { color: var(--bad); font-style: normal; font-weight: 600; }

.sv-pill { padding: 2px 9px; border-radius: 999px; background: var(--g-100); color: var(--g-700); font-size: 11px; font-weight: 600; white-space: nowrap; transition: background .3s, color .3s; }
.sv-pill-muted { background: #f1f3f2; color: var(--muted); }
.sv-pill.is-busy { background: var(--warn-bg); color: var(--warn); }

.sv-card { padding: 18px; }
.sv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.sv-head > div > b { font-size: 14px; }

.sv-cursor {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 6;
    width: 20px;
    height: 20px;
    opacity: 0;
    transform: translate(var(--x, 300px), var(--y, 260px));
    transition: transform 1s cubic-bezier(.45, 0, .2, 1), opacity .3s;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .25));
    pointer-events: none;
}

.sv-cursor.is-on { opacity: 1; }
.sv-cursor.is-click { animation: sv-click .3s; }
@keyframes sv-click { 50% { scale: .8; } }

@keyframes sv-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------- 1. Strona: shortcode'y ---------- */

.sv-site { overflow: visible; }

.sv-code {
    position: absolute;
    top: -14px;
    left: 18px;
    z-index: 3;
    padding: 5px 10px;
    border-radius: 8px;
    background: var(--ink);
    color: #a8e6c0;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    box-shadow: 0 8px 20px rgba(16, 28, 25, .18);
    transition: opacity .25s;
}

.sv-code.is-swap { opacity: 0; }

.sv-bar { display: flex; align-items: center; gap: 5px; padding: 10px 14px; background: #fafbfa; border-bottom: 1px solid #eef2ef; border-radius: 16px 16px 0 0; }
.sv-bar i { width: 8px; height: 8px; border-radius: 50%; background: #ff5f57; }
.sv-bar i:nth-child(2) { background: #febc2e; }
.sv-bar i:nth-child(3) { background: #28c840; }
.sv-bar span { margin-left: 10px; padding: 2px 10px; border-radius: 6px; background: #f0f3f1; color: var(--muted); font-size: 10.5px; }

.sv-body { padding: 14px 16px 16px; }

.sv-tabs { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); padding: 3px; border-radius: 10px; background: #f1f5f2; }
.sv-tabs span { position: relative; z-index: 1; padding: 6px 4px; text-align: center; font-size: 11px; font-weight: 500; color: var(--muted); transition: color .3s; }
.sv-tabs span.is-on { color: var(--ink); }
.sv-tabs-ind { position: absolute !important; z-index: 0 !important; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px) / 3); padding: 0 !important; border-radius: 8px; background: #ffffff; box-shadow: 0 1px 3px rgba(16, 28, 25, .1); transform: translateX(calc(var(--t, 0) * 100%)); transition: transform .45s cubic-bezier(.22, 1, .36, 1); }

.sv-panes { position: relative; height: 196px; margin-top: 12px; }
.sv-pane { position: absolute; inset: 0; opacity: 0; transform: translateY(8px); transition: opacity .35s, transform .45s cubic-bezier(.22, 1, .36, 1); pointer-events: none; }
.sv-pane.is-on { opacity: 1; transform: none; }

.sv-acc { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto auto; align-items: center; gap: 4px 10px; padding: 9px 10px; margin-bottom: 6px; border: 1px solid var(--line); border-radius: 10px; }
.sv-acc > span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.sv-acc > em { font-style: normal; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sv-st { justify-self: end; padding: 1px 8px; border-radius: 999px; background: var(--g-100); color: var(--g-700); font-size: 10px; font-style: normal; font-weight: 600; white-space: nowrap; transition: background .4s, color .4s; }
.sv-st-r { background: #fff3d6; color: #8a5a00; }
.sv-st-u { background: #fdecea; color: var(--bad); }
.sv-acc.is-open { border-color: var(--g-300); background: #fbfdfb; }
.sv-acc-more { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 4px; padding-top: 8px; border-top: 1px dashed var(--line); }
.sv-acc-more span { display: block; color: var(--muted); font-size: 10px; }
.sv-acc-more b { font-size: 12px; font-variant-numeric: tabular-nums; }
.sv-pane.is-on .sv-acc-more { animation: sv-open .6s .2s cubic-bezier(.22, 1, .36, 1) both; }
@keyframes sv-open { from { opacity: 0; clip-path: inset(0 0 100% 0); } to { opacity: 1; clip-path: inset(0); } }

.sv-table { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; font-variant-numeric: tabular-nums; }
.sv-table th, .sv-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.sv-table th:first-child, .sv-table td:first-child { text-align: left; white-space: normal; }
.sv-table thead th { background: var(--bg); color: var(--muted); font-size: 9.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.sv-table td small { display: block; color: var(--muted); font-size: 10px; }
.sv-table tfoot th, .sv-table tfoot td { border-bottom: 0; background: var(--g-50); font-weight: 700; }
.sv-pane.is-on .sv-table tbody tr { animation: sv-in .45s cubic-bezier(.22, 1, .36, 1) both; }
.sv-pane.is-on .sv-table tbody tr:nth-child(2) { animation-delay: .1s; }
.sv-pane.is-on .sv-table tbody tr:nth-child(3) { animation-delay: .2s; }

.sv-tl { position: relative; margin: 4px 0 0; padding: 0 0 0 20px; list-style: none; }
.sv-tl::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.sv-tl li { position: relative; display: grid; grid-template-columns: 54px 1fr auto; align-items: center; gap: 8px; padding: 9px 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.sv-tl li i { position: absolute; left: -18px; width: 10px; height: 10px; border-radius: 50%; background: #c3cdc8; border: 2px solid #fff; }
.sv-tl li b { color: var(--ink); }
.sv-tl li em { font-size: 11px; }
.sv-tl li.is-now i { background: var(--g-600); box-shadow: 0 0 0 4px var(--g-100); }
.sv-tl li.is-now { color: var(--ink); font-weight: 600; }
.sv-pane.is-on .sv-tl li { animation: sv-in .45s cubic-bezier(.22, 1, .36, 1) both; }
.sv-pane.is-on .sv-tl li:nth-child(2) { animation-delay: .08s; }
.sv-pane.is-on .sv-tl li:nth-child(3) { animation-delay: .16s; }
.sv-pane.is-on .sv-tl li:nth-child(4) { animation-delay: .3s; }
.sv-pane.is-on .sv-tl li.is-now i { animation: sv-ping 1.6s .6s ease-out 2; }
@keyframes sv-ping { 0% { box-shadow: 0 0 0 0 rgba(12, 146, 86, .45); } 100% { box-shadow: 0 0 0 10px rgba(12, 146, 86, 0); } }

/* ---------- 2. Eksport ---------- */

.sv-progress { height: 4px; margin: 14px 0 6px; border-radius: 2px; background: var(--g-50); overflow: hidden; }
.sv-progress span { display: block; height: 100%; width: var(--p, 100%); background: var(--g-600); transition: width .5s ease; }

.sv-files { margin: 0; padding: 0; list-style: none; }
.sv-files li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.sv-files li > div span { display: block; color: var(--muted); font-size: 11px; }
.sv-files li > div span b { font-weight: 600; color: var(--ink); }
.sv-files code { grid-column: 2; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; color: #8a948f; }

.sv-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--g-600); box-shadow: 0 0 0 4px var(--g-50); }
.sv-files li.is-wait .sv-dot { background: transparent; box-shadow: none; border: 2px solid var(--g-300); border-top-color: var(--g-600); animation: sv-spin .7s linear infinite; }
.sv-files li.is-pop .sv-dot { animation: sv-pop .45s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes sv-spin { to { transform: rotate(360deg); } }
@keyframes sv-pop { from { transform: scale(.3); } to { transform: scale(1); } }

.sv-warn {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--warn-bg);
    border: 1px solid #f3dfb8;
    transition: background .4s, border-color .4s;
}

.sv-warn > div span { display: block; color: #6b5a3a; font-size: 11px; }
.sv-ico { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--yellow); color: #ffffff; font-style: normal; font-weight: 700; font-size: 12px; transition: background .4s; }
.sv-btn { padding: 5px 10px; border-radius: 8px; background: #ffffff; border: 1px solid #e8d6b0; font-size: 11px; font-weight: 600; color: var(--warn); transition: transform .15s, opacity .3s; }
.sv-btn.is-press { transform: scale(.93); }
.sv-warn.is-shake { animation: sv-shake .5s; }
@keyframes sv-shake { 20%, 60% { transform: translateX(-3px); } 40%, 80% { transform: translateX(3px); } }
.sv-warn.is-fixed { background: var(--g-50); border-color: #cfe9d9; }
.sv-warn.is-fixed .sv-ico { background: var(--g-600); }
.sv-warn.is-fixed > div span { color: var(--g-700); }
.sv-warn.is-fixed .sv-btn { opacity: 0; }

/* ---------- 3. Historia cen ---------- */

.sv-chart { position: relative; height: 96px; margin: 14px 0 8px; padding: 6px 0 0; }
.sv-chart svg { width: 100%; height: 90px; overflow: visible; }
.sv-step { stroke-dasharray: 400; stroke-dashoffset: 0; }
.sv-step-new { stroke-dasharray: 100; stroke-dashoffset: var(--o, 0); transition: stroke-dashoffset .8s ease; }
.sv-step-dot { transform-box: fill-box; transform-origin: center; transform: scale(var(--k, 1)); transition: transform .35s cubic-bezier(.34, 1.56, .64, 1); }
.sv-flag { position: absolute; right: 0; top: 36px; padding: 3px 8px; border-radius: 999px; background: var(--ink); color: #ffffff; font-size: 10px; white-space: nowrap; opacity: var(--f, 1); transform: translateY(calc((1 - var(--f, 1)) * 6px)); transition: opacity .35s, transform .35s; }
.sv-flag b { font-weight: 600; color: #a8e6c0; }

.sv-hist { margin: 0; padding: 0; list-style: none; }
.sv-hist li { display: grid; grid-template-columns: minmax(0, 1fr) auto 44px 40px; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.sv-hist li > div span { display: block; color: var(--muted); font-size: 10.5px; }
.sv-hist-v { white-space: nowrap; font-weight: 600; }
.sv-hist-v s { margin-right: 4px; color: #a1aaa6; font-weight: 400; }
.sv-hist em { text-align: right; font-size: 11px; }
.sv-hist time { text-align: right; color: var(--muted); font-size: 11px; }
.sv-hist li.is-new { animation: sv-in .55s cubic-bezier(.22, 1, .36, 1); background: linear-gradient(90deg, var(--g-50), transparent 80%); }
.sv-hist li.is-out { animation: sv-out .4s forwards; }
@keyframes sv-out { to { opacity: 0; transform: translateY(6px); } }

/* ---------- 4. Mapa osiedla ---------- */

.sv-map { padding: 12px; }
.sv-map-stage { position: relative; border-radius: 10px; overflow: hidden; }
.sv-scene { display: block; width: 100%; height: auto; }
.sv-photo { aspect-ratio: 16 / 9; background: #cfe3c4; }
.sv-photo .sv-unit { stroke-width: 5; stroke-linejoin: round; }
.sv-photo .sv-unit.is-a, .sv-photo .sv-unit.is-u { fill-opacity: .3; }
.sv-photo .sv-unit.is-r { fill-opacity: .35; }
.sv-photo .sv-unit.is-hover { fill-opacity: .55; }
@keyframes sv-glow-photo { 0% { stroke-width: 5; } 40% { stroke-width: 12; } 100% { stroke-width: 5; } }
.sv-photo .sv-unit.is-changed { animation: sv-glow-photo 1.2s ease-out; }

.sv-unit { stroke-width: 2; transition: fill .5s, stroke .5s, fill-opacity .25s; }
.sv-unit.is-a { fill: #0c9256; stroke: #0c9256; fill-opacity: .22; }
.sv-unit.is-r { fill: #e0a100; stroke: #e0a100; fill-opacity: .25; }
.sv-unit.is-u { fill: #d92d20; stroke: #d92d20; fill-opacity: .22; }
.sv-unit.is-hover { fill-opacity: .5; }
.sv-unit.is-changed { animation: sv-glow 1.2s ease-out; }
@keyframes sv-glow { 0% { stroke-width: 2; } 40% { stroke-width: 5; } 100% { stroke-width: 2; } }

.sv-tip {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 4;
    width: 196px;
    padding: 10px 12px;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 10px 30px rgba(16, 28, 25, .18), 0 1px 3px rgba(16, 28, 25, .1);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    opacity: 0;
    transform: translate(var(--tx, 0), calc(var(--ty, 0px) + 6px));
    transition: opacity .2s, transform .25s;
    pointer-events: none;
}

.sv-tip.is-on { opacity: 1; transform: translate(var(--tx, 0), var(--ty, 0)); }
.sv-tip-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sv-tip-head b { white-space: nowrap; }
.sv-tip-rows { display: flex; gap: 14px; margin-top: 6px; }
.sv-tip-rows span { display: block; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .04em; }
.sv-tip-price { display: flex; align-items: baseline; gap: 6px; margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--line); }
.sv-tip-price b { font-size: 14px; color: var(--g-700); }
.sv-tip-price small { color: var(--muted); font-size: 10px; }
.sv-tip.is-r .sv-tip-price b { color: #8a5a00; }

.sv-toast {
    position: absolute;
    left: 50%;
    bottom: 10px;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 999px;
    background: var(--ink);
    color: #ffffff;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    transform: translate(-50%, 10px);
    transition: opacity .3s, transform .4s cubic-bezier(.22, 1, .36, 1);
}

.sv-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.sv-toast i { width: 9px; height: 9px; border-radius: 50%; background: var(--yellow); }

.sv-legend { display: flex; justify-content: center; gap: 16px; margin: 10px 0 2px; padding: 0; list-style: none; font-size: 11px; color: #2f3d38; }
.sv-legend li { display: flex; align-items: center; gap: 6px; }
.sv-legend span { width: 12px; height: 12px; border-radius: 4px; border: 2px solid; }
.sv-legend .is-a { border-color: #0c9256; background: rgba(12, 146, 86, .25); }
.sv-legend .is-r { border-color: #e0a100; background: rgba(224, 161, 0, .25); }
.sv-legend .is-u { border-color: #d92d20; background: rgba(217, 45, 32, .22); }
.sv-legend b { min-width: 10px; color: var(--muted); font-variant-numeric: tabular-nums; transition: color .3s; }
.sv-legend b.is-flash { color: var(--ink); }

/* ---------- Responsywność ---------- */

@media (max-width: 640px) {
    .sv { font-size: 11px; }
    .sv-card { padding: 14px; }
    .sv-files code { display: none; }
    .sv-hist li { grid-template-columns: minmax(0, 1fr) auto 40px; }
    .sv-hist time { display: none; }
    .sv-acc { grid-template-columns: 30px minmax(0, 1fr) auto; }
    .sv-acc > span { display: none; }
    .sv-code { font-size: 10px; }
    .sv-legend { gap: 10px; font-size: 10.5px; }
    .sv-tip { width: 168px; padding: 8px 10px; font-size: 10px; }
    .sv-tip-price b { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    .sv *, .sv *::before { animation: none !important; transition: none !important; }
    .sv-cursor, .sv-toast { display: none; }
}

/* Mapa na zdjęciu: mniejszy dymek, żeby nie zasłaniał domów */
.sv-map .sv-tip { width: 170px; padding: 8px 10px; font-size: 10.5px; border-radius: 10px; }
.sv-map .sv-tip-rows { margin-top: 4px; }
.sv-map .sv-tip-price { margin-top: 5px; padding-top: 5px; }
.sv-map .sv-tip-price b { font-size: 13px; }
@media (max-width: 640px) {
    .sv-map .sv-tip { width: 136px; padding: 6px 8px; font-size: 9.5px; }
    .sv-map .sv-tip-rows { display: none; }
    .sv-map .sv-tip-price { margin-top: 4px; padding-top: 4px; }
    .sv-map .sv-tip-price b { font-size: 11.5px; }
    .sv-map .sv-tip-price small { display: none; }
    .sv-map .sv-toast { font-size: 9.5px; padding: 5px 10px; }
}

/* Mapa na całą wysokość i szerokość panelu – zdjęcie osiedla z działkami */
.stack-visual-full { padding: 0; min-height: 360px; }
.sv-map-full { position: absolute; inset: 0; max-width: none; padding: 0; border: 0; border-radius: 0; box-shadow: none; background: #cfe3c4; }
.sv-map-full .sv-map-stage { position: absolute; inset: 0; border-radius: 0; }
.sv-map-full .sv-scene { width: 100%; height: 100%; aspect-ratio: auto; }
.sv-map-full .sv-unit { stroke-width: 3.5; }
.sv-map-full .sv-unit.is-a, .sv-map-full .sv-unit.is-u { fill-opacity: .28; }
.sv-map-full .sv-unit.is-r { fill-opacity: .32; }
.sv-map-full .sv-unit.is-hover { fill-opacity: .5; }
@keyframes sv-glow-full { 0% { stroke-width: 3.5; } 40% { stroke-width: 9; } 100% { stroke-width: 3.5; } }
.sv-map-full .sv-unit.is-changed { animation: sv-glow-full 1.2s ease-out; }
.sv-map-full .sv-legend {
    position: absolute;
    left: 16px;
    top: 16px;
    z-index: 3;
    margin: 0;
    padding: 7px 12px;
    gap: 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 6px 20px rgba(16, 28, 25, .14);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}
.sv-map-full .sv-toast { bottom: 16px; }
@media (max-width: 640px) {
    .stack-visual-full { min-height: 300px; }
    .sv-map-full .sv-legend { left: 10px; top: 10px; padding: 5px 9px; gap: 8px; font-size: 9.5px; }
    .sv-map-full .sv-legend span { width: 10px; height: 10px; }
}

/* Bez skakania makiet: stałe wysokości tekstów, które się zmieniają */
.sv-warn > div { min-width: 0; }
.sv-warn > div b, .sv-warn > div span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sv-hist li.is-out { animation: none; opacity: 0; transition: opacity .3s; }
