/* =========================================================
   TS Tooltip (desktop + mobile-safe)
   - .ts-tip: element (button/icon) koji prikazuje tooltip
   - content dolazi iz data-ts-tip atributa
   ========================================================= */

/* Reset / base */
.ts-tip,
.ts-tip::before,
.ts-tip::after {
  box-sizing: border-box;
}

/* Okidač — neutralan izgled (možeš promeniti po želji) */
.ts-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  line-height: 1;
}

/* Strelica */
.ts-tip::before {
  content: "";
  position: absolute;
  z-index: 9999;
  bottom: calc(100% + 6px);
  left: 50%;
  width: 10px;
  height: 10px;
  background: #0b1220; /* tamno siva/crna */
  border-radius: 2px;
  transform: translateX(-50%) rotate(45deg);
  opacity: 0;
  visibility: hidden;
  transition: opacity .18s ease, visibility .18s ease, transform .18s ease;
  pointer-events: none;
}

/* Balon */
.ts-tip::after {
  content: attr(data-ts-tip);
  position: absolute;
  z-index: 9999;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  background: #0b1220;
  color: #fff;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 500;
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.28);
  white-space: normal;
  max-width: 360px;            /* desktop clamp */
  width: max-content;
  min-width: 160px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .18s ease, visibility .18s ease, transform .18s ease;

  /* Sigurno lomljenje teksta/URL-ova */
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Prikaz na hover/focus */
.ts-tip:hover::after,
.ts-tip:focus-visible::after,
.ts-tip:hover::before,
.ts-tip:focus-visible::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* **************************************
   MOBILNI FIX
   — Tooltip je FIXED i centriran na dnu;
     ne utiče na layout i ne može da pravi
     horizontalni overflow/pomeranje.
   ************************************** */
@media (max-width: 575.98px) {
  /* okidač ne mora biti relative */
  .ts-tip { position: static !important; }

  /* sakrij strelicu (može i ostati, ali fixed arrow ume da izgleda čudno) */
  .ts-tip::before { display: none !important; }

  /* balon = fixed, centriran na dnu */
  .ts-tip::after {
    position: fixed !important;
    left: 50vw !important;
    right: auto !important;
    top: auto !important;
    bottom: calc(env(safe-area-inset-bottom) + 16px) !important;
    transform: translate(-50%, 0) !important;
    max-width: min(92vw, 480px) !important; /* clamp u viewportu */
    width: auto !important;
    pointer-events: none; /* čisto da ne “hvata” dodire */
  }

  /* Ako imaš varijante sa ručnim poravnanjem, i dalje clamp-uj širinu */
  .ts-tip[data-ts-left="1"]::after,
  .ts-tip[data-ts-right="1"]::after {
    max-width: min(92vw, 480px) !important;
  }
}

/* Dodatni guard protiv horizontalnog “bleeda”
   (moderni browseri); ne utiče na layout */
@supports (overflow: clip) {
  html, body { overflow-x: clip; }
}