/* Bartels Conjar – Brzi upit, 1.4.0.
 * Namjerno izolirano unutar #bcq-widget: ne mijenja stil teme ili druge CF7 forme.
 */
#bcq-widget,
#bcq-widget *,
#bcq-widget *::before,
#bcq-widget *::after { box-sizing: border-box; }

#bcq-widget {
  --bcq-navy: #19253f;
  --bcq-red: #d53931;
  --bcq-text: #26334b;
  --bcq-border: #d9e0e9;
  font-family: inherit;
  color: var(--bcq-text);
}
#bcq-widget button,
#bcq-widget input,
#bcq-widget textarea { font-family: inherit; }

/* Plutajući CTA ostaje potpuno neovisan o izgledu popupa. */
#bcq-widget .bcq-fab {
  appearance: none;
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 99991;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  max-width: calc(100vw - 32px);
  min-height: 50px;
  padding: 12px 19px;
  border: 0;
  border-radius: 999px;
  background: var(--bcq-red);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0;
  cursor: pointer;
  box-shadow: 0 8px 23px rgba(19, 30, 49, .2);
  transition: transform .18s ease, background .18s ease, box-shadow .18s ease;
}
#bcq-widget .bcq-fab svg { flex: none; }
#bcq-widget .bcq-fab:hover { background: #bb3029; transform: translateY(-2px); box-shadow: 0 11px 27px rgba(19, 30, 49, .23); }
#bcq-widget button:focus-visible,
#bcq-widget a:focus-visible,
#bcq-widget input:focus-visible,
#bcq-widget textarea:focus-visible { outline: 2px solid #6685ae; outline-offset: 3px; }

/* Kompaktniji prozor; na nizim ekranima scrolla se samo popup. */
#bcq-widget .bcq-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999999;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#bcq-widget.bcq-is-open .bcq-modal { display: flex; }
#bcq-widget.bcq-is-open .bcq-fab { visibility: hidden; }
#bcq-widget .bcq-backdrop { position: absolute; inset: 0; background: rgba(15, 25, 42, .65); }
#bcq-widget .bcq-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100%, 490px);
  max-height: min(94vh, 750px);
  max-height: min(94dvh, 750px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #fff;
  border: 1px solid #e4e8ef;
  border-radius: 14px;
  box-shadow: 0 24px 65px rgba(8, 19, 37, .28);
  color: var(--bcq-text);
}
/* Kad je mobitel nizak, djeca flex prozora se NE smiju stisnuti
 * i preklopiti tekst ili formu; umjesto toga scrolla cijeli dialog. */
#bcq-widget .bcq-head,
#bcq-widget .bcq-product-context,
#bcq-widget .bcq-form,
#bcq-widget .bcq-foot { flex-shrink: 0; }
#bcq-widget .bcq-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px 7px;
  background: #fff;
  height: auto !important; /* tema zna postaviti fiksnu visinu na header */
  min-height: 0 !important;
  max-height: none;
}
#bcq-widget .bcq-head-text { min-width: 0; flex: 1 1 auto; }
#bcq-widget .bcq-eyebrow {
  display: inline-block;
  color: var(--bcq-red);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}
#bcq-widget h2#bcq-heading {
  margin: 4px 0 5px !important;
  padding: 0;
  color: var(--bcq-navy);
  font-family: inherit;
  font-size: clamp(21px, 4.3vw, 24px);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -.55px;
  text-transform: none;
}
#bcq-widget #bcq-description {
  margin: 0 !important;
  padding: 0;
  color: #647187;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.48;
}
#bcq-widget .bcq-close {
  appearance: none;
  flex: 0 0 32px;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 1px solid #e1e7ee;
  border-radius: 50%;
  background: #fff;
  color: #46536c;
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
}
#bcq-widget .bcq-close:hover { background: #f5f7fa; }

/* Dodatne kontrole pojavljuju se samo dok korisnik tipka na mobitelu. */
#bcq-widget .bcq-title-compact,
#bcq-widget .bcq-done { display: none; }

/* Naziv proizvoda je kontekst upita, a ne zasebna velika kartica. */
#bcq-widget .bcq-product-context {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 9px;
  row-gap: 2px;
  margin: 10px 24px 15px;
  padding: 9px 12px;
  border: 1px solid #e9edf2;
  border-left: 3px solid var(--bcq-red);
  border-radius: 6px;
  background: #f8f9fb;
}
#bcq-widget .bcq-product-context span {
  flex: none;
  color: #707f93;
  font-size: 10px;
  font-weight: 650;
  line-height: 1.4;
  letter-spacing: .5px;
  text-transform: uppercase;
}
#bcq-widget .bcq-product-context strong {
  color: var(--bcq-navy);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

/* Izolacija od globalnih Crystalo i Contact Form 7 razmaka. */
#bcq-widget .bcq-form { padding: 0 24px 7px; }
#bcq-widget .bcq-form form,
#bcq-widget .bcq-form .wpcf7,
#bcq-widget .bcq-form .wpcf7-form { margin: 0; padding: 0; }
#bcq-widget .bcq-form p,
#bcq-widget .bcq-form .wpcf7-form p { margin: 0 !important; padding: 0 !important; }
#bcq-widget .bcq-fields br { display: none !important; }
#bcq-widget .bcq-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 12px 12px;
  margin: 0;
  padding: 0;
}
#bcq-widget .bcq-field { grid-column: 1 / -1; min-width: 0; width: auto; margin: 0; padding: 0; }
#bcq-widget .bcq-field-half { grid-column: auto; }
#bcq-widget .bcq-field label {
  display: block;
  margin: 0 0 5px !important;
  padding: 0 !important;
  color: var(--bcq-navy);
  font-size: 11.5px;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: 0;
  text-transform: none;
}
#bcq-widget .bcq-optional {
  color: #7b8799;
  font-size: 10px;
  font-weight: 400;
  white-space: nowrap;
}
#bcq-widget .bcq-field .wpcf7-form-control-wrap { display: block; width: 100%; margin: 0 !important; padding: 0 !important; }
#bcq-widget .bcq-field input:not([type="checkbox"]),
#bcq-widget .bcq-field textarea {
  appearance: none;
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 42px;
  min-height: 42px;
  margin: 0 !important;
  padding: 9px 12px;
  border: 1px solid var(--bcq-border);
  border-radius: 7px;
  background: #fff;
  color: var(--bcq-text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: 0;
  box-shadow: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}
#bcq-widget .bcq-field textarea {
  height: 94px;
  min-height: 94px;
  max-height: 190px;
  resize: vertical;
}
#bcq-widget .bcq-field input::placeholder,
#bcq-widget .bcq-field textarea::placeholder { color: #929eaf; opacity: 1; }
#bcq-widget .bcq-field input:focus,
#bcq-widget .bcq-field textarea:focus {
  outline: none;
  border-color: #7d93b6;
  box-shadow: 0 0 0 3px rgba(77, 115, 173, .12);
}
#bcq-widget .bcq-field input.wpcf7-not-valid,
#bcq-widget .bcq-field textarea.wpcf7-not-valid { border-color: #c8433b; }

#bcq-widget .bcq-privacy {
  grid-column: 1 / -1;
  margin: 1px 0 0;
  padding: 0;
  color: #697589;
  font-size: 11px;
  line-height: 1.5;
}
#bcq-widget .bcq-privacy .wpcf7-form-control-wrap { display: inline; }
#bcq-widget .bcq-privacy .wpcf7-list-item { margin: 0; padding: 0; }
#bcq-widget .bcq-privacy .wpcf7-list-item-label { color: inherit; font-size: inherit; }
#bcq-widget .bcq-privacy label { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: inherit; font-weight: 400; line-height: 1.5; }
#bcq-widget .bcq-privacy input[type="checkbox"] {
  appearance: auto;
  flex: 0 0 auto;
  width: 15px !important;
  min-width: 15px !important;
  max-width: 15px !important;
  height: 15px !important;
  min-height: 15px !important;
  max-height: 15px !important;
  margin: 0 !important;
  padding: 0 !important;
  accent-color: var(--bcq-red);
  vertical-align: middle;
}
#bcq-widget .bcq-privacy a,
#bcq-widget .bcq-foot a { color: #213e70; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
#bcq-widget .bcq-actions { position: relative; grid-column: 1 / -1; width: 100%; margin: 0; padding: 0; }
#bcq-widget .bcq-actions .wpcf7-submit {
  appearance: none;
  display: block;
  width: 100%;
  min-height: 43px;
  margin: 0;
  padding: 10px 15px;
  border: 0;
  border-radius: 7px;
  background: var(--bcq-red);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: .1px;
  text-align: center;
  cursor: pointer;
  transition: background .15s ease;
}
#bcq-widget .bcq-actions .wpcf7-submit:hover { background: #ba3029; }
#bcq-widget .bcq-actions .wpcf7-submit:disabled { opacity: .7; cursor: wait; }
#bcq-widget .bcq-actions .wpcf7-spinner { position: absolute; top: 9px; right: 11px; margin: 0; }
#bcq-widget .wpcf7-not-valid-tip { display: block; margin: 4px 0 0; color: #b02d28; font-size: 11px; line-height: 1.25; }
#bcq-widget .wpcf7 form .wpcf7-response-output { margin: 9px 0 0; padding: 9px 10px; border-radius: 6px; font-size: 11.5px; line-height: 1.45; }
#bcq-widget .bcq-foot {
  margin: 7px 0 0;
  padding: 11px 24px 14px;
  border-top: 1px solid #eef1f5;
  color: #788398;
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
}

/* Mobilni CTA se centrira po SREDINI viewporta, ne po desnom rubu.
 * !important sprjecava Crystalo/WordPress globalna pravila za button da ga pomaknu.
 * Na desktopu ostaje postojeći plutajući gumb dolje desno.
 */
/* V4: mobilni popup je centrirana kartica s vidljivim razmakom oko sva 4 ruba,
   a NE fullscreen / bottom-sheet. Dugačak sadržaj scrolla samo u kartici. */
@media (max-width: 600px) {
  #bcq-widget .bcq-fab,
  #bcq-widget .bcq-fab:hover,
  #bcq-widget .bcq-fab:focus-visible {
    position: fixed !important;
    left: 50% !important;
    right: auto !important;
    bottom: 14px !important;
    bottom: max(14px, env(safe-area-inset-bottom, 0px)) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: max-content !important;
    max-width: calc(100vw - 36px) !important;
    min-height: 48px;
    margin: 0 !important;
    padding: 11px 18px !important;
    transform: translateX(-50%) !important;
    white-space: nowrap;
    text-align: center;
  }
  #bcq-widget .bcq-fab svg { flex-shrink: 0; }
  #bcq-widget .bcq-modal {
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
    padding-top: max(20px, env(safe-area-inset-top, 0px)) !important;
    padding-bottom: max(20px, env(safe-area-inset-bottom, 0px)) !important;
    overflow: hidden;
  }
  #bcq-widget .bcq-dialog {
    width: 100% !important;
    max-width: 400px !important;
    min-width: 0;
    max-height: calc(100vh - 44px);
    max-height: calc(100dvh - 44px);
    margin: auto !important;
    padding-bottom: 0;
    border-radius: 17px !important;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  #bcq-widget .bcq-head {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 15px 16px 9px;
    border-bottom: 1px solid #f0f2f5;
  }
  #bcq-widget h2#bcq-heading { font-size: 20px; line-height: 1.18; }
  #bcq-widget #bcq-description { font-size: 11.5px; }
  #bcq-widget .bcq-close { flex-basis: 36px; width: 36px; height: 36px; }
  #bcq-widget .bcq-product-context { margin: 10px 16px 12px; padding: 8px 10px; }
  #bcq-widget .bcq-form { padding: 0 16px 5px; min-width: 0; }
  #bcq-widget .bcq-fields { gap: 10px 10px; }
  #bcq-widget .bcq-field label { margin-bottom: 4px !important; }
  #bcq-widget .bcq-field input:not([type="checkbox"]) { min-height: 40px; height: 40px; padding: 7px 11px; }
  #bcq-widget .bcq-field textarea { min-height: 78px; height: 78px; padding: 8px 11px; }
  #bcq-widget .bcq-actions .wpcf7-submit { min-height: 42px; }
  #bcq-widget .bcq-foot { padding: 10px 15px 12px; overflow-wrap: anywhere; }
  /* iPhone ne zumira cijelu stranicu pri fokusiranju polja. */
  #bcq-widget .bcq-field input:not([type="checkbox"]),
  #bcq-widget .bcq-field textarea { font-size: 16px; }
}
@media (max-width: 440px) {
  /* Jedno polje po retku radi čitljivosti i dovoljno velikih touch-targeta. */
  #bcq-widget .bcq-fields { grid-template-columns: minmax(0, 1fr); }
  #bcq-widget .bcq-field-half { grid-column: 1 / -1; }
  #bcq-widget .bcq-optional { font-size: 10px; }
}
@media (max-width: 350px) {
  #bcq-widget .bcq-modal { padding: 16px !important; }
  #bcq-widget .bcq-dialog { max-height: calc(100dvh - 36px); border-radius: 15px !important; }
  #bcq-widget .bcq-head { padding: 13px 13px 8px; }
  #bcq-widget h2#bcq-heading { font-size: 18px; }
  #bcq-widget .bcq-product-context { margin: 8px 13px 10px; }
  #bcq-widget .bcq-form { padding: 0 13px 5px; }
  #bcq-widget .bcq-optional { white-space: normal; }
  #bcq-widget .bcq-fab { gap: 7px; padding-inline: 13px !important; font-size: 12.5px; }
}
/* iOS Safari i Android: modal pratimo prema stvarno vidljivom viewportu,
 * tj. dijelu koji nije pokriven softverskom tipkovnicom. JS ažurira varijable.
 * Pozicija se ne temelji na visini layout viewporta (100vh), jer ona može
 * ostati ista i kada tipkovnica pokrije donji dio ekrana.
 */
@media (max-width: 600px) {
  #bcq-widget .bcq-modal {
    inset: auto !important;
    top: var(--bcq-vtop, 0px) !important;
    left: var(--bcq-vleft, 0px) !important;
    right: auto !important;
    bottom: auto !important;
    width: var(--bcq-vwidth, 100vw) !important;
    height: var(--bcq-vheight, 100dvh) !important;
    max-height: none !important;
    padding: 14px !important;
    padding-top: max(12px, env(safe-area-inset-top, 0px)) !important;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px)) !important;
    overflow: hidden !important;
  }
  #bcq-widget .bcq-dialog {
    max-height: 100% !important;
    min-height: 0 !important;
    margin: auto !important;
    overscroll-behavior: contain;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  /* Dok tipka, kraće zaglavlje oslobađa prostor stvarnom polju za unos;
   * kartica se NE skalira niti se smanjuje veličina tipografije. */
  #bcq-widget.bcq-is-typing .bcq-modal {
    padding: 8px 12px !important;
  }
  #bcq-widget.bcq-is-typing .bcq-dialog {
    max-height: 100% !important;
    border-radius: 13px !important;
  }
  #bcq-widget.bcq-is-typing .bcq-head {
    padding: 7px 12px !important;
    gap: 8px;
    align-items: center;
  }
  #bcq-widget.bcq-is-typing .bcq-eyebrow,
  #bcq-widget.bcq-is-typing #bcq-description,
  #bcq-widget.bcq-is-typing .bcq-title-full,
  #bcq-widget.bcq-is-typing .bcq-product-context,
  #bcq-widget.bcq-is-typing .bcq-foot { display: none !important; }
  #bcq-widget.bcq-is-typing .bcq-title-compact { display: block; }
  #bcq-widget.bcq-is-typing h2#bcq-heading {
    margin: 0 !important;
    padding: 0;
    font-size: 16px !important;
    line-height: 1.35;
    letter-spacing: 0;
  }
  #bcq-widget.bcq-is-typing .bcq-close {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    font-size: 22px;
    margin-left: 0;
  }
  #bcq-widget.bcq-is-typing .bcq-done {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 6px;
    padding: 6px 8px;
    width: auto;
    min-height: 32px;
    margin: 0;
    background: #edf2f7;
    color: var(--bcq-navy);
    font-size: 12px;
    font-weight: 650;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
  }
  #bcq-widget.bcq-is-typing .bcq-form {
    padding-top: 10px !important;
  }
  /* 16px sprječava automatski zoom fokusa na iOS-u. */
  #bcq-widget .bcq-field input:not([type="checkbox"]),
  #bcq-widget .bcq-field textarea { font-size: 16px !important; }
}
@media (max-width: 350px) {
  #bcq-widget.bcq-is-typing .bcq-modal { padding: 6px 8px !important; }
}
@media (prefers-reduced-motion: reduce) {
  #bcq-widget .bcq-fab,
  #bcq-widget .bcq-field input,
  #bcq-widget .bcq-field textarea,
  #bcq-widget .bcq-actions .wpcf7-submit { transition: none; }
}
