/* ==========================================================================
   Kalkulatori (procjena cijene i isplativost): forma lijevo, rezultat desno
   ========================================================================== */
.calc { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); border: 1px solid var(--line2); border-radius: var(--r-xl); overflow: hidden; background: var(--s1); box-shadow: var(--sh-3); }
.est { padding: 32px; min-width: 0; }
.est fieldset { border: 0; margin: 0 0 26px; padding: 0; min-width: 0; transition: opacity var(--d-base) ease; }
.est fieldset:last-of-type { margin-bottom: 0; }
.est legend { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 12px; color: var(--mut); margin-bottom: 12px; padding: 0; }
.est-n { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; color: var(--tx); border: 1px solid var(--line2); background: var(--s3); }
.est-size.is-off { opacity: .38; }
.est-submit { margin-top: 22px; }

/* Segmentirani izbor (radio) s kliznim indikatorom */
.seg { position: relative; display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--s0); }
.seg-2 { --n: 2; } .seg-3 { --n: 3; } .seg-4 { --n: 4; } .seg-5 { --n: 5; }
.seg label { position: relative; z-index: 1; cursor: pointer; min-width: 0; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg label > span { display: grid; gap: 2px; padding: 10px 12px; border-radius: 9px; height: 100%; transition: background-color var(--d-fast) ease, box-shadow var(--d-fast) ease; }
.seg b { font-weight: 500; font-size: 14.5px; line-height: 1.3; }
.seg small { font-family: var(--mono); font-size: 11px; color: var(--dim); transition: color var(--d-fast) ease; }
.seg input:checked + span { background: var(--s3); box-shadow: inset 0 0 0 1px var(--line2), 0 6px 16px -8px rgba(0, 0, 0, .8); }
.seg input:checked + span small { color: var(--a1); }
.seg input:focus-visible + span { outline: 2px solid var(--a1); outline-offset: 1px; }
.seg input:disabled + span { cursor: not-allowed; }
@media (hover: hover) { .seg label:hover input:not(:checked):not(:disabled) + span { background: rgba(255, 255, 255, .035); } }
/* JS: klizni indikator umjesto pozadine pojedinačne opcije */
.seg-ind { position: absolute; z-index: 0; top: 4px; left: 0; height: calc(100% - 8px); border-radius: 9px; background: var(--s3); box-shadow: inset 0 0 0 1px var(--line2), 0 6px 16px -8px rgba(0, 0, 0, .8); transition: transform var(--d-slow) var(--ease-out); pointer-events: none; }
.seg.has-ind input:checked + span { background: transparent; box-shadow: none; }

/* Prekidači dodataka */
.feats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.feat { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); cursor: pointer; min-height: 58px; transition: border-color var(--d-fast) ease, background-color var(--d-fast) ease, opacity var(--d-fast) ease, transform var(--d-fast) var(--ease-out); }
.feat:active { transform: scale(.985); }
.feat input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.tg { flex: none; width: 32px; height: 18px; border-radius: 10px; background: #22262c; position: relative; transition: background-color var(--d-fast) ease; }
.tg::after { content: ""; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: #8b9098; transition: transform var(--d-base) var(--ease-pop), background-color var(--d-fast) ease; }
.feat input:checked ~ .tg { background: var(--a1); }
.feat input:checked ~ .tg::after { transform: translateX(14px); background: var(--ink); }
.feat:has(input:checked) { border-color: var(--a1-line); background: rgba(var(--a1-rgb), .04); }
.feat:has(input:focus-visible) { outline: 2px solid var(--a1); outline-offset: 2px; }
@media (hover: hover) { .feat:not(.off):hover { border-color: var(--line2); } }
.ft { display: grid; gap: 1px; font-size: 14px; line-height: 1.35; min-width: 0; }
.ft small { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.feat.off { opacity: .38; cursor: not-allowed; }
.feat.off input { cursor: not-allowed; }

/* Rezultat */
.est-out { border-left: 1px solid var(--line2); padding: 32px; display: flex; flex-direction: column; background: radial-gradient(90% 60% at 100% 0%, rgba(var(--a2-rgb), .08), transparent 70%), var(--s0); position: relative; min-width: 0; }
.out-range { font-family: var(--mono); font-size: clamp(32px, 3.3vw, 48px); letter-spacing: -.045em; line-height: 1.05; margin: 14px 0 8px; font-variant-numeric: tabular-nums; white-space: nowrap; display: flex; align-items: baseline; flex-wrap: wrap; }
.out-num { display: inline-block; transition: transform var(--d-base) var(--ease-out); }
.out-range.bump .out-num { animation: out-bump 380ms var(--ease-out); }
@keyframes out-bump { 0% { transform: translateY(0); } 35% { transform: translateY(-3px); } 100% { transform: none; } }
.out-range .cur { font-size: .42em; color: var(--mut); letter-spacing: 0; margin-left: 8px; }
.out-range.is-neg .out-num { color: var(--err); }
.out-meta { display: flex; gap: 6px 22px; color: var(--mut); font-size: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.out-meta b { color: var(--tx); font-weight: 500; font-family: var(--mono); font-size: 13px; }
.out-list { list-style: none; margin: 0 0 24px; padding: 0; border-top: 1px solid var(--line); font-size: 14px; }
.out-list li { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); color: var(--tx2); }
.out-list li.is-new { animation: li-in 320ms var(--ease-out); }
@keyframes li-in { from { opacity: 0; transform: translate3d(-6px, 0, 0); } }
.out-list li span:last-child { font-family: var(--mono); font-size: 12.5px; color: var(--mut); white-space: nowrap; font-variant-numeric: tabular-nums; }
.est-out .btn { margin-top: auto; }
.est-out .note { margin-top: 14px; }

/* Isplativost */
.roi-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.roi-f { display: grid; gap: 8px; }
.roi-f label { font-size: 13.5px; color: var(--tx2); }
.roi-in { display: flex; align-items: center; height: 44px; border: 1px solid var(--line2); border-radius: var(--r-md); background: var(--s0); padding: 0 12px; transition: border-color var(--d-fast) ease, box-shadow var(--d-fast) ease; }
.roi-in:focus-within { border-color: rgba(var(--a1-rgb), .6); box-shadow: var(--ring); }
.roi-in input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: none; font-family: var(--mono); font-size: 16px; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.roi-in input::-webkit-inner-spin-button, .roi-in input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.roi-in input { appearance: textfield; }
.roi-in span { font-family: var(--mono); font-size: 12px; color: var(--dim); }
.roi-range { -webkit-appearance: none; appearance: none; width: 100%; height: 18px; background: none; margin: 0; cursor: pointer; }
.roi-range::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--a1) 0 var(--p, 50%), rgba(255, 255, 255, .08) var(--p, 50%)); }
.roi-range::-moz-range-track { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .08); }
.roi-range::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--a1); }
.roi-range::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: var(--tx); border: 3px solid var(--ink); box-shadow: 0 0 0 1px var(--a1); transition: transform var(--d-fast) var(--ease-out); }
.roi-range::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--tx); border: 3px solid var(--ink); box-shadow: 0 0 0 1px var(--a1); }
.roi-range:active::-webkit-slider-thumb { transform: scale(1.15); }
html:not(.js) .roi-range { display: none; }

/* Tabela stavki (server-side, za crawlere i ljude) */
.calc-table { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--s1); }
.calc-table > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 14px 18px; cursor: pointer; font-size: 14.5px; color: var(--tx2); border-radius: var(--r-lg); transition: color var(--d-fast) ease; }
.calc-table > summary::-webkit-details-marker { display: none; }
.calc-table > summary .ic { width: 16px; height: 16px; color: var(--dim); }
.calc-table > summary .ic-c { width: 10px; height: 10px; margin-left: auto; transition: transform var(--d-base) var(--ease-out); }
.calc-table[open] > summary .ic-c { transform: rotate(180deg); }
@media (hover: hover) { .calc-table > summary:hover { color: var(--tx); } }
.calc-table .table-scroll { margin: 0 12px 12px; }
.calc-table table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 13.5px; }
.calc-table caption { text-align: left; padding: 12px 14px 4px; font-family: var(--mono); font-size: 11.5px; color: var(--dim); }
.calc-table th, .calc-table td { padding: 10px 14px; text-align: left; border-top: 1px solid var(--line); vertical-align: top; }
.calc-table thead th { font-weight: 500; color: var(--tx); font-size: 13px; border-top: 0; }
.calc-table tbody th { font-weight: 400; color: var(--tx2); }
.calc-table td { font-family: var(--mono); font-size: 12.5px; color: var(--mut); font-variant-numeric: tabular-nums; white-space: nowrap; }

@media (max-width: 1023px) {
	.calc { grid-template-columns: 1fr; }
	.est-out { border-left: 0; border-top: 1px solid var(--line2); }
}
@media (max-width: 720px) {
	.est, .est-out { padding: 22px; }
	.seg { grid-template-columns: 1fr 1fr; }
	.seg-3 { grid-template-columns: 1fr; }
	.seg-3 label > span { grid-template-columns: 1fr auto; align-items: center; }
	.seg-ind { display: none; }
	.seg.has-ind input:checked + span { background: var(--s3); box-shadow: inset 0 0 0 1px var(--line2); }
	.feats, .roi-fields { grid-template-columns: 1fr; }
	.out-range { font-size: clamp(28px, 8.6vw, 40px); }
}

/* U uskoj koloni (prose) kalkulator ide u jednu kolonu: container query */
.kalk-block { container-type: inline-size; }
@container (max-width: 780px) {
	.kalk-block .calc { grid-template-columns: 1fr; }
	.kalk-block .est-out { border-left: 0; border-top: 1px solid var(--line2); }
}
@container (max-width: 560px) {
	.kalk-block .feats, .kalk-block .roi-fields { grid-template-columns: 1fr; }
	.kalk-block .est, .kalk-block .est-out { padding: 22px; }
}
