/* ============================================================
   Swed-Trac price calculator
   Single source of truth for every .calc-* rule.
   Loaded by templates/index.html → index.html, sv/index.html, en/index.html
   ============================================================ */

.calc-section {
  padding: 100px 20px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  overflow: hidden;
  position: relative;
}
.calc-section::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255, 221, 0, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(255, 221, 0, 0.06) 0%, transparent 50%);
  pointer-events: none;
}

.calc-inner { max-width: 1240px; margin: 0 auto; position: relative; z-index: 1; }
.calc-header { text-align: center; margin-bottom: 50px; }
.calc-title { font-size: clamp(2rem, 4vw, 3rem); color: white; letter-spacing: -1px; margin-bottom: 12px; }
.calc-sub { color: rgba(255, 255, 255, 0.8); font-size: 1.1rem; max-width: 600px; margin: 0 auto; }
/* .calc-grid išdėstymas — žr. bloką failo apačioje */

/* ─── Form ─── */
.calc-form {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 36px;
  border-radius: 16px;
  backdrop-filter: blur(10px);
}
.calc-form-group { margin-bottom: 28px; }
.calc-form-group:last-child { margin-bottom: 0; }
.calc-form-group label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-weight: 600;
  font-size: 0.95rem;
}
.calc-form-group label .val {
  background: var(--accent);
  color: var(--text);
  padding: 3px 10px;
  border-radius: 4px;
  font-weight: 800;
  font-size: 0.85rem;
}

/* Width is not a slider — we only manufacture 12 m wide hangars. */
.calc-fixed {
  padding: 16px 18px;
  background: rgba(255, 221, 0, 0.14);
  border: 1.5px solid rgba(255, 221, 0, 0.5);
  border-radius: 12px;
}
.calc-fixed label { margin-bottom: 0; }
.calc-fixed .val {
  color: var(--primary-dark);
  padding: 4px 12px;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.5px;
}

.calc-hint { margin-top: 12px; font-size: 0.82rem; color: rgba(255, 255, 255, 0.85); line-height: 1.55; }
.calc-hint a { color: var(--accent); font-weight: 700; text-decoration: underline; }

input[type="range"].calc-range {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  outline: none;
}
input[type="range"].calc-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid var(--primary-dark);
  transition: transform 0.15s;
}
input[type="range"].calc-range::-webkit-slider-thumb:hover { transform: scale(1.2); }
input[type="range"].calc-range::-moz-range-thumb {
  width: 22px;
  height: 22px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid var(--primary-dark);
}
input[type="range"].calc-range:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

/* ─── Result ─── */
.calc-result {
  background: rgba(255, 255, 255, 0.08);
  padding: 40px;
  border-radius: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid rgba(255, 221, 0, 0.3);
  position: relative;
  overflow: hidden;
}
.calc-result::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(from 0deg, transparent 70%, rgba(255, 221, 0, 0.15) 85%, transparent 100%);
  animation: rotateGlow 8s linear infinite;
  pointer-events: none;
}
@keyframes rotateGlow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .calc-result::before { animation: none; }
}
.calc-result-label {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 700;
  margin-bottom: 12px;
  position: relative;
}
.calc-result-price {
  font-size: clamp(2.4rem, 5vw, 3.5rem);
  color: var(--accent);
  font-weight: 900;
  letter-spacing: -2px;
  line-height: 1;
  margin: 8px 0 6px;
  position: relative;
}
.calc-result-range { font-size: 1rem; color: rgba(255, 255, 255, 0.6); margin-bottom: 22px; min-height: 1.5em; position: relative; }
.calc-result hr { border: 0; border-top: 1px solid rgba(255, 255, 255, 0.15); margin: 22px 0; position: relative; }
.calc-details { font-size: 0.92rem; color: rgba(255, 255, 255, 0.75); line-height: 1.7; position: relative; margin-bottom: 22px; }
.calc-details strong { color: white; }

/* Waiting for /api/quote, and the "no price available" state.
   We never show an invented number — see js/calculator.js */
.calc-result.is-loading .calc-result-price { opacity: 0.55; }
.calc-result.is-unavailable .calc-result-price {
  font-size: 1.4rem;
  line-height: 1.45;
  color: white;
  letter-spacing: 0;
  font-weight: 700;
}

.calc-cta {
  display: inline-block;
  background: var(--accent);
  color: var(--text);
  padding: 14px 32px;
  border-radius: 8px;
  font-weight: 800;
  text-decoration: none;
  transition: transform 0.2s;
  position: relative;
}
.calc-cta:hover { transform: translateY(-3px); color: var(--text); }

.calc-disclaimer {
  text-align: center;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.92rem;
  margin: 28px auto 0;
  max-width: 760px;
  line-height: 1.55;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
}

@media (max-width: 768px) {
  .calc-form { padding: 24px; }
  .calc-result { padding: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .calc-result::before { animation: none; }
}

/* ─── 3D hangar viewer (calc section) ─── */
.calc-viewer {
  position: relative;
  height: 420px;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 28px;
  background: #dce8f2;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 18px 50px -18px rgba(0, 0, 0, 0.55);
}
.calc-viewer hangar-viewer { position: absolute; inset: 0; }
.calc-viewer:has(hangar-viewer.hv-failed) { display: none; }
.calc-viewer .hv-badge {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  background: rgba(11, 61, 102, 0.72); color: #fff; font-size: 0.74rem;
  font-weight: 700; padding: 5px 14px; border-radius: 999px;
  white-space: nowrap; pointer-events: none;
}
.calc-viewer .hv-hint {
  position: absolute; top: 12px; right: 14px;
  background: rgba(255, 255, 255, 0.82); color: #475569;
  font-size: 0.7rem; padding: 4px 10px; border-radius: 999px;
  pointer-events: none;
}
/* Kol three.js kraunasi — kad nebūtų tuščias mėlynas stačiakampis */
hangar-viewer.hv-loading::after {
  content: ""; position: absolute; top: 50%; left: 50%;
  width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border: 3px solid rgba(11, 61, 102, 0.18);
  border-top-color: rgba(11, 61, 102, 0.65);
  border-radius: 50%;
  animation: hvSpin 0.9s linear infinite;
}
@keyframes hvSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  hangar-viewer.hv-loading::after { animation: none; }
}
@media (max-width: 720px) { .calc-viewer { height: 280px; } .calc-viewer .hv-hint { display: none; } }

/* ─── Išdėstymas: slankikliai · 3D vaizdas · kaina ─────────────────────────
   Desktop (≥1180 px) — viena horizontali eilė, 3D vaizdas viduryje ir
   platesnis už kraštinius laukus (1 : 1,6 : 1).
   768–1179 px — vaizdas per visą plotį viršuje, po juo slankikliai | kaina.
   <768 px — viskas vienas po kito, vaizdas pirmas. */
.calc-grid { display: grid; grid-template-columns: 1fr; gap: 24px; align-items: stretch; }
.calc-viewer { margin-bottom: 0; }

@media (max-width: 1179px) {
  .calc-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
  .calc-viewer { grid-column: 1 / -1; order: -1; height: 420px; }
}

@media (min-width: 1180px) {
  .calc-grid { grid-template-columns: 1fr 1.6fr 1fr; gap: 22px; }
  .calc-viewer { height: auto; min-height: 0; }
  .calc-form { padding: 26px; }
  .calc-result { padding: 28px 24px; }
  .calc-form-group { margin-bottom: 20px; }
}

@media (max-width: 767px) {
  .calc-grid { grid-template-columns: 1fr; gap: 20px; }
  .calc-viewer { grid-column: auto; height: 280px; }
  .calc-form { padding: 24px; }
  .calc-result { padding: 28px; }
}

/* === Finansavimo juostelė po skaičiuokle === */
.calc-financing {
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: 760px;
  margin: 26px auto 0;
  padding: 20px 24px;
  background: rgba(255, 221, 0, 0.09);
  border: 1px solid rgba(255, 221, 0, 0.32);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  color: white;
  text-align: left;
}
.calc-financing .cf-icon { font-size: 2rem; line-height: 1; flex-shrink: 0; }
.calc-financing strong {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 5px;
  color: var(--accent);
  letter-spacing: 0.2px;
}
.calc-financing p {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.92);
}
@media (max-width: 768px) {
  .calc-financing { gap: 14px; padding: 16px 18px; margin-top: 20px; }
  .calc-financing .cf-icon { font-size: 1.6rem; }
}
.calc-financing .cf-icon svg { display: block; color: var(--accent); }
