/* Mayak payment calculator — premium redesign in the mayak.dev family.
   Brand: #005056, Albert Sans, amber accent; glass + editorial patterns. */
:root {
  --teal: #005056;
  --teal-deep: #04353a;
  --teal-dark: #063e43;
  --teal-soft: #4d8a8e;
  --mist: #b8cdce;
  --paper: #f6f5f2;
  --ink: #10312f;
  --ink-muted: #5a7473;
  --line: #e3e6e0;
  --amber: #ffc850;
  --font: "Albert Sans", "Segoe UI", sans-serif;
  --r-md: 14px; --r-lg: 24px; --r-xl: 32px;
  --shadow-1: 0 2px 10px rgba(4,53,58,.10);
  --shadow-2: 0 20px 50px rgba(4,53,58,.25);
  --ease: cubic-bezier(.2,.8,.25,1);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { min-height: 100%; }
body { font-family: var(--font); background: var(--paper); color: var(--ink); line-height: 1.5; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; border-radius: 4px; }
.hero :focus-visible, .result :focus-visible { outline-color: var(--amber); }

/* ============ HERO BAND ============ */
.hero {
  position: relative; overflow: hidden;
  border-radius: 0 0 var(--r-xl) var(--r-xl);
  padding: 20px 20px 88px;
}
.hero > img.bg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center 62%;
}
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(4,53,58,.72) 0%, rgba(4,53,58,.45) 55%, rgba(4,53,58,.72) 100%);
}
.topbar {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  max-width: 980px; margin: 0 auto;
}
.topbar img { height: 24px; display: block; }
.topbar a {
  display: inline-flex; align-items: center; gap: 6px;
  color: #fff; text-decoration: none; font-size: 13px; font-weight: 700;
  padding: 9px 16px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.3);
  background: rgba(255,255,255,.1);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: background .2s;
}
.topbar a:hover { background: rgba(255,255,255,.22); }
.hero-title {
  position: relative; z-index: 2; text-align: center;
  max-width: 980px; margin: 44px auto 0; color: #fff;
}
.hero-title .k {
  font-size: 11px; font-weight: 800; letter-spacing: .22em; text-transform: uppercase;
  color: var(--amber); margin-bottom: 10px;
}
.hero-title h1 {
  font-size: clamp(30px, 5.5vw, 52px); font-weight: 800;
  letter-spacing: -.03em; line-height: 1.05;
  text-shadow: 0 4px 30px rgba(4,53,58,.5);
}
.hero-title p { margin-top: 12px; font-size: 14.5px; color: rgba(255,255,255,.8); }

/* ============ LAYOUT ============ */
.wrap {
  position: relative; z-index: 3;
  max-width: 980px; margin: -64px auto 56px; padding: 0 16px;
  display: grid; grid-template-columns: 1fr 360px; gap: 20px; align-items: start;
}
@media (max-width: 820px) { .wrap { grid-template-columns: 1fr; } }

.card {
  background: #fff; border-radius: var(--r-lg);
  box-shadow: var(--shadow-1); border: 1px solid var(--line);
  padding: 28px;
}
@media (max-width: 480px) {
  .card { padding: 20px; }
  .topbar img { height: 19px; }
  .topbar a { font-size: 11.5px; padding: 8px 12px; }
}

/* ============ FIELDS ============ */
.field { margin-bottom: 26px; }
.field:last-child { margin-bottom: 0; }
.flabel {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-muted); margin-bottom: 12px;
}
.numwrap { display: flex; align-items: baseline; gap: 6px; }
.numwrap input {
  width: 104px; font-size: 20px; font-weight: 800; color: var(--teal);
  text-align: right; border: none; border-bottom: 2px solid var(--line);
  outline: none; background: transparent; font-variant-numeric: tabular-nums;
  border-radius: 0; transition: border-color .2s;
}
.numwrap input:focus { border-bottom-color: var(--amber); }
.numwrap .unit { font-size: 13px; font-weight: 800; color: var(--teal-soft); text-transform: none; letter-spacing: 0; }

input[type="range"] {
  width: 100%; height: 8px; -webkit-appearance: none; appearance: none;
  background: linear-gradient(to right, var(--teal) var(--fill, 50%), var(--line) var(--fill, 50%));
  border-radius: 999px; outline: none; cursor: pointer;
  touch-action: manipulation;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 28px; height: 28px; border-radius: 50%;
  background: #fff; border: 3px solid var(--teal);
  box-shadow: 0 3px 10px rgba(0,80,86,.35);
  transition: transform .15s var(--ease);
}
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.15); border-color: var(--amber); }
input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 3px solid var(--teal);
}
.range-limits {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--ink-muted); margin-top: 8px;
  font-variant-numeric: tabular-nums;
}

/* ============ SEGMENTS ============ */
.seg { display: grid; gap: 8px; }
.seg.c5 { grid-template-columns: repeat(5, 1fr); }
.seg.c6 { grid-template-columns: repeat(6, 1fr); }
.seg.c2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 480px) {
  .seg.c5 { grid-template-columns: repeat(3, 1fr); }
  .seg.c6 { grid-template-columns: repeat(3, 1fr); }
}
.seg button, .rate-custom {
  font-size: 14px; font-weight: 700; padding: 11px 0; min-height: 44px;
  border: 1.5px solid var(--line); border-radius: var(--r-md);
  background: var(--paper); color: var(--ink-muted);
  transition: all .18s var(--ease);
}
.seg button:hover { border-color: var(--teal-soft); color: var(--teal); background: #fff; }
.seg button:active { transform: scale(.96); }
.seg button.active {
  background: var(--teal); border-color: var(--teal); color: #fff;
  box-shadow: 0 6px 16px rgba(0,80,86,.28);
}
.seg#mode button.active { background: var(--teal-deep); border-color: var(--teal-deep); }

.rate-custom { display: flex; align-items: center; gap: 4px; padding: 0 10px; background: #fff; }
.rate-custom.active { border-color: var(--teal); background: var(--teal); box-shadow: 0 6px 16px rgba(0,80,86,.28); }
.rate-custom input {
  width: 100%; font-size: 14px; font-weight: 700;
  border: none; outline: none; background: transparent;
  text-align: center; color: var(--ink-muted);
}
.rate-custom.active input { color: #fff; }
.rate-custom .pc { font-size: 13px; font-weight: 800; color: var(--ink-muted); }
.rate-custom.active .pc { color: #fff; }

#ipotekaFields { display: none; }
body.ipoteka #ipotekaFields { display: block; }
body.ipoteka #creditFields { display: none; }

/* ============ RESULT (premium dark card) ============ */
.result {
  position: sticky; top: 16px;
  background: linear-gradient(165deg, var(--teal-dark) 0%, var(--teal-deep) 100%);
  color: #fff; border: none;
  box-shadow: var(--shadow-2);
  overflow: hidden;
}
.result::before {
  content: ""; position: absolute; top: -70px; right: -70px;
  width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,200,80,.22), transparent 65%);
  pointer-events: none;
}
.total { text-align: center; padding: 6px 0 20px; border-bottom: 1px dashed rgba(255,255,255,.25); margin-bottom: 18px; }
.total .lbl { font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--mist); }
.total .val {
  font-size: 38px; font-weight: 800; color: #fff;
  font-variant-numeric: tabular-nums; line-height: 1.2; letter-spacing: -.02em;
}
.rows { display: grid; gap: 11px; }
.row { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; }
.row .k { color: var(--mist); }
.row .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.row.hl {
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--r-md); padding: 14px 16px;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.row.hl .k { color: #fff; font-weight: 700; }
.row.hl .v { color: var(--amber); font-size: 24px; font-weight: 800; }
.row[hidden] { display: none; }
.row.sub .k, .row.sub .v { font-size: 12.5px; }
.row.sub .v { color: var(--mist); font-weight: 600; }

.cta {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  text-align: center; margin-top: 18px; padding: 14px; min-height: 48px;
  background: var(--amber); color: var(--teal-deep);
  font-weight: 800; font-size: 15px; text-decoration: none;
  border-radius: 999px; border: none;
  transition: transform .2s var(--ease), background .2s;
}
.cta:hover { background: #ffd670; transform: translateY(-2px); }
.cta svg { width: 17px; height: 17px; flex: none; }
.cta.ghost {
  background: transparent; color: #fff;
  border: 1.5px solid rgba(255,255,255,.35); margin-top: 10px;
}
.cta.ghost:hover { background: rgba(255,255,255,.1); transform: none; }
.print-btn { width: 100%; }
.note { margin-top: 16px; font-size: 11.5px; line-height: 1.55; color: var(--mist); text-align: center; }

footer { text-align: center; font-size: 12px; color: var(--ink-muted); padding-bottom: 34px; }
footer a { color: var(--teal); font-weight: 700; text-decoration: none; }

/* number change flash */
@keyframes tick { 0% { opacity: .35; } 100% { opacity: 1; } }
.tick { animation: tick .3s var(--ease); }

@media print {
  body { background: #fff; }
  .hero { border-radius: 0; padding-bottom: 24px; }
  .hero > img.bg, .topbar a { display: none; }
  .hero::after { background: var(--teal-deep); }
  .wrap { grid-template-columns: 1fr 1fr; margin-top: 16px; }
  .card { box-shadow: none; border: 1px solid var(--line); }
  .result { background: #fff; color: var(--ink); }
  .result .lbl, .row .k, .note { color: var(--ink-muted); }
  .total .val { color: var(--teal); }
  .row.hl { background: var(--paper); border-color: var(--line); }
  .row.hl .k { color: var(--ink); }
  .row.hl .v { color: var(--teal); }
  .cta, footer { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
