/* =====================================================
   LOLIBO Kalkulator prehrane — plutajući gumb + popup
   (jedina aktivna verzija; stare inačice su uklonjene)
   ===================================================== */

/* ===== plutajući CTA ===== */

.calc-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9000;
  color: #fff;
  background-color: #563887;
  border: 0;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 40px;
  font-family: Rawest Webfont, Arial, sans-serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 120%;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(63, 26, 122, .35);
  transition: background-color .15s, transform .15s;
}

.calc-fab:hover {
  background-color: #3f1a7a;
  transform: translateY(-2px);
}

.calc-fab svg {
  width: 22px;
  height: 22px;
  flex: none;
}

/* shine sweep — svakih ~6 s preleti trak svjetla preko gumba */
.calc-fab {
  overflow: hidden;
}

.calc-fab::after {
  content: "";
  position: absolute;
  top: 0;
  left: -80%;
  width: 60%;
  height: 100%;
  background: linear-gradient(105deg, transparent 20%, rgba(255, 255, 255, .35) 50%, transparent 80%);
  pointer-events: none;
  animation: calc-shine 6s ease-in-out infinite;
}

@keyframes calc-shine {
  0%   { left: -80%; }
  14%  { left: 130%; }
  100% { left: 130%; }
}

/* nakon prvog otvaranja kalkulatora animacija se gasi */
.calc-fab.is-quiet::after {
  animation: none;
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .calc-fab::after {
    animation: none;
    display: none;
  }
}

/* ===== overlay — scrolla se na razini stranice, ne kartice ===== */

.calc-overlay {
  position: fixed;
  inset: 0;
  z-index: 9100;
  background-color: rgba(26, 24, 28, .55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: none;
  justify-content: center;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 16px;
}

.calc-overlay.is-open {
  display: flex;
}

/* ===== modal — raste do prirodne visine ===== */

.calc-modal {
  box-sizing: border-box;
  background-color: #fff;
  border-radius: 24px;
  width: 100%;
  max-width: 520px;
  height: fit-content;
  margin: auto;
  position: relative;
  padding: 28px 32px;
  font-family: Rawest Webfont, Arial, sans-serif;
  animation: calc-modal-in .25s ease;
}

@keyframes calc-modal-in {
  from { opacity: 0; transform: translateY(16px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.calc-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  color: #563887;
  background-color: #f2ebfb;
  border: 0;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
}

.calc-close:hover {
  background-color: #d4bbfc;
}

/* dva pogleda unutar modala (forma / rezultat) */
.calc-view {
  display: none;
}

.calc-view.is-active {
  display: block;
  animation: calc-view-in .2s ease;
}

@keyframes calc-view-in {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ===== forma ===== */

.calc-modal-logo {
  width: 96px;
  margin: 0 auto 10px;
  display: block;
}

.calc-title {
  color: #1a181c;
  text-align: center;
  letter-spacing: -1px;
  font-family: Rawest Webfont, Arial, sans-serif;
  font-size: 26px;
  font-weight: 500;
  line-height: 120%;
}

.calc-subtitle {
  color: #3f1a7a;
  text-align: center;
  font-family: Rawest Webfont, Arial, sans-serif;
  font-size: 15px;
  font-weight: 400;
  line-height: 140%;
}

.calc-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}

.calc-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.calc-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.calc-label {
  color: #1a181c;
  font-size: 13px;
  font-weight: 500;
  line-height: 120%;
}

.calc-input {
  color: #1a181c;
  background-color: #fff;
  border: 1px solid #d4bbfc;
  border-radius: 10px;
  padding: 10px 14px;
  font-family: Rawest Webfont, Arial, sans-serif;
  /* 16px minimum sprječava iOS auto-zoom na fokus */
  font-size: 16px;
  font-weight: 400;
  line-height: 120%;
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
}

.calc-input:focus {
  border-color: #563887;
  outline: 2px solid #d4bbfc;
  outline-offset: 0;
}

.calc-textarea {
  resize: vertical;
  min-height: 44px;
  line-height: 140%;
}

/* razina aktivnosti — tri vidljive kutije */
.calc-activity {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.calc-activity-box {
  background-color: #fff;
  border: 1px solid #d4bbfc;
  border-radius: 10px;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
}

.calc-activity-box:hover {
  background-color: #f2ebfb;
}

.calc-activity-box input {
  position: absolute;
  opacity: 0;
}

.calc-activity-title {
  color: #1a181c;
  font-size: 14px;
  font-weight: 500;
  line-height: 120%;
}

.calc-activity-sub {
  color: #3f1a7a;
  font-size: 11px;
  font-weight: 400;
  line-height: 140%;
}

.calc-activity-box:has(input:checked) {
  background-color: #563887;
  border-color: #563887;
}

.calc-activity-box:has(input:checked) .calc-activity-title {
  color: #fff;
}

.calc-activity-box:has(input:checked) .calc-activity-sub {
  color: #ecdfff;
}

.calc-activity-box:has(input:focus-visible) {
  outline: 2px solid #d4bbfc;
  outline-offset: 2px;
}

/* prekidač za alergije */
.calc-toggle-wrap {
  background-color: #f2ebfb;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
}

.calc-toggle-wrap input {
  position: absolute;
  opacity: 0;
}

.calc-toggle {
  flex: none;
  width: 40px;
  height: 24px;
  background-color: #d4bbfc;
  border-radius: 13px;
  position: relative;
  transition: background-color .2s;
}

.calc-toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
}

.calc-toggle-wrap input:checked + .calc-toggle {
  background-color: #563887;
}

.calc-toggle-wrap input:checked + .calc-toggle::after {
  transform: translateX(16px);
}

.calc-toggle-label {
  color: #1a181c;
  font-size: 13px;
  font-weight: 400;
  line-height: 140%;
}

/* polje za alergije — vidljivo samo kad je prekidač uključen */
.calc-allergy-field {
  display: none;
  animation: calc-slide-in .25s ease;
}

.calc-allergy-field.is-visible {
  display: flex;
}

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

/* validacija po polju */
.calc-field-error {
  display: none;
  color: #a4133c;
  font-size: 12px;
  font-weight: 500;
  line-height: 130%;
}

.calc-field-error.is-visible {
  display: block;
}

.calc-input.has-error {
  border-color: #a4133c;
}

/* gumb Izračunaj — identičan .button stilu stranice */
.calc-buttons {
  display: flex;
  gap: 16px;
  margin-top: 2px;
}

.calc-btn-primary {
  color: #fff;
  background-color: #563887;
  border: 0 solid #563887;
  border-radius: 12px;
  justify-content: center;
  align-items: center;
  flex: 1;
  padding: 20px 40px;
  font-family: Rawest Webfont, Arial, sans-serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 120%;
  display: flex;
  cursor: pointer;
  transition: background-color .15s, transform .15s, box-shadow .15s;
}

.calc-btn-primary:hover {
  background-color: #3f1a7a;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(63, 26, 122, .35);
}

/* taktilni "pritisak" na dodir */
.calc-btn-primary:active,
.calc-fab:active {
  transform: scale(.97);
  box-shadow: 0 4px 12px rgba(63, 26, 122, .3);
}

/* ===== rezultat ===== */

.calc-back {
  color: #563887;
  background: none;
  border: 0;
  padding: 0;
  font-family: Rawest Webfont, Arial, sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

.calc-back:hover {
  color: #3f1a7a;
  text-decoration: underline;
}

.calc-result {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.calc-result.is-visible {
  display: flex;
}

/* ljubičasti hero */
.calc-hero {
  background-color: #3f1a7a;
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
}

.calc-hero-lead {
  color: #ecdfff;
  font-size: 16px;
  font-weight: 400;
  line-height: 150%;
  margin: 0;
}

.calc-hero-lead strong {
  color: #fff;
  font-weight: 700;
}

/* paneli */
.calc-panel {
  background-color: #fff;
  border: 1px solid #ecdfff;
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.calc-panel-tinted {
  background-color: #f2ebfb;
  border-color: #ecdfff;
}

.calc-panel-title {
  color: #1a181c;
  font-size: 16px;
  font-weight: 700;
  line-height: 120%;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}

.calc-icon {
  width: 20px;
  height: 20px;
  flex: none;
  color: #563887;
}

.calc-icon-euro {
  width: auto;
  font-weight: 700;
  font-size: 18px;
}

/* retci label lijevo / vrijednost desno */
.calc-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  color: #6b6473;
  font-size: 14px;
  font-weight: 400;
  line-height: 140%;
}

.calc-line-value {
  color: #3f1a7a;
  font-weight: 700;
  text-align: right;
}

.calc-line-strong {
  color: #1a181c;
  font-weight: 500;
  border-top: 1px solid #ecdfff;
  padding-top: 9px;
}

.calc-panel-tinted .calc-line-strong {
  border-top-color: #d4bbfc;
}

/* velike 30-dnevne pločice */
.calc-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 4px;
}

.calc-tile {
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}

.calc-tile-white {
  background-color: #fff;
  border: 1px solid #ecdfff;
}

.calc-tile-purple {
  background-color: #3f1a7a;
}

.calc-tile-big {
  font-size: 26px;
  font-weight: 700;
  line-height: 110%;
}

.calc-tile-white .calc-tile-big { color: #3f1a7a; }
.calc-tile-white .calc-tile-sub { color: #6b6473; }
.calc-tile-purple .calc-tile-big { color: #fff; }
.calc-tile-purple .calc-tile-sub { color: #ecdfff; }

.calc-tile-sub {
  font-size: 13px;
  font-weight: 400;
}

/* alergije u rezultatu — uvijek jedan red; dulji tekst se reže s "…"
   (cijeli tekst svejedno ide u WhatsApp poruku) */
.calc-allergy-line {
  color: #1a181c;
  font-size: 14px;
  line-height: 150%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calc-allergy-line strong {
  font-weight: 700;
}

.calc-note {
  color: #3f1a7a;
  font-size: 12px;
  font-weight: 400;
  line-height: 150%;
}

.calc-note-italic {
  font-style: italic;
}

/* narudžba */
.calc-order {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.calc-back-bottom {
  margin: 2px 0 0;
  font-size: 13px;
}

.calc-order-btn {
  width: 100%;
  gap: 10px;
  text-decoration: none;
}

.calc-order-btn svg {
  width: 20px;
  height: 20px;
  flex: none;
}

/* ===== mobitel i tablet (≤991px): fullscreen prikaz ===== */

@media screen and (max-width: 991px) {
  .calc-fab {
    right: 16px;
    bottom: 16px;
    padding: 16px 24px;
  }

  .calc-overlay {
    padding: 0;
  }

  .calc-modal {
    max-width: none;
    height: fit-content;
    min-height: 100%;
    margin: 0;
    border-radius: 0;
    padding: 12px 16px 20px;
    animation: calc-sheet-in .25s ease;
  }

  /* manji ✕ stisnut u kut — oslobađa prostor pri vrhu */
  .calc-close {
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    font-size: 16px;
  }

  @keyframes calc-sheet-in {
    from { opacity: 0; transform: translateY(40px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  .calc-title {
    font-size: 24px;
  }

  .calc-modal-logo {
    width: 72px;
    margin-bottom: 6px;
  }

  .calc-form {
    gap: 12px;
  }

  .calc-textarea {
    min-height: 40px;
  }

  /* ime/pasmina i dob/težina ostaju jedno uz drugo i na mobitelu */
  .calc-row {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .calc-activity {
    gap: 8px;
  }

  .calc-activity-sub {
    font-size: 10px;
  }

  .calc-tiles {
    grid-template-columns: 1fr 1fr;
  }

  /* prati .button na mobitelu */
  .calc-btn-primary {
    padding: 16px 24px;
  }
}
