/* ============================================================
   PRAVILA — docs layout (topbar + sidebar + sadržaj)
   Oslanja se na tokene iz styles.css (:root varijable, .nav-brand, .noise)
   ============================================================ */

.docs-body { background: rgba(11, 26, 23, 0.35); }

/* ---------- TOPBAR ---------- */
.docs-topbar {
  position: sticky;
  top: 0;
  z-index: 600;
  overflow: visible;
  background: rgba(11, 26, 23, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.docs-topbar-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: visible;
}
.docs-topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 20px;
  position: relative;
  z-index: 30;
  overflow: visible;
}
.docs-home-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.15s;
  white-space: nowrap;
}
.docs-home-link:hover { color: var(--text); }

/* ---------- PRETRAGA ---------- */
.docs-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,0.30);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 7px 10px;
  width: 290px;
  z-index: 40;
  overflow: visible;
  transition: border-color 0.15s;
}
.docs-search:focus-within { border-color: var(--orange); }
.docs-search-icon { width: 15px; height: 15px; color: var(--muted); flex-shrink: 0; }
.docs-search input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
.docs-search input:focus { outline: none; }
.docs-search input::placeholder { color: var(--muted); }
.docs-search input::-webkit-search-cancel-button { display: none; }
.docs-search-clear {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  background: none;
  border: none;
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.docs-search-clear svg { width: 13px; height: 13px; }
.docs-search-clear:hover { color: var(--text); background: rgba(255,255,255,0.08); }
.docs-search-clear[hidden] { display: none; }

/* ---------- PADAJUĆA LISTA REZULTATA ---------- */
.docs-results {
  position: fixed;
  top: 0;
  left: 0;
  width: 420px;
  max-width: min(420px, calc(100vw - 32px));
  max-height: min(60vh, 520px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #0b1715;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0,0,0,0.78);
  padding: 6px;
  z-index: 2147483647;
  isolation: isolate;
  scrollbar-width: thin;
  scrollbar-color: var(--card-border) transparent;
  animation: docs-results-in 0.16s ease-out;
}

.docs-results[hidden] { display: none; }
@keyframes docs-results-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}
.docs-result {
  display: block;
  width: 100%;
  text-align: left;
  background: #0e1b19;
  border: none;
  border-radius: 7px;
  padding: 11px 12px;
  cursor: pointer;
  font-family: inherit;
  position: relative;
  z-index: 1;
  transition: background 0.12s;
}
.docs-result + .docs-result { border-top: 1px solid rgba(255,255,255,0.05); }
.docs-result:hover,
.docs-result.is-active {
  background: rgba(255,122,61,0.10);
  border-top-color: transparent;
}
.docs-result-cat {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 3px;
}
.docs-result-title {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  margin-bottom: 3px;
}
.docs-result-snippet {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}
.docs-result mark {
  background: rgba(255,194,75,0.22);
  color: var(--gold);
  border-radius: 2px;
  padding: 0 1px;
}
.docs-results-empty {
  padding: 18px 12px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 940px) {
  .docs-search { width: 100%; }
  .docs-results { right: auto; left: 0; width: 100%; }
}

/* ---------- ŠKOLJKA: SIDEBAR + SADRŽAJ ---------- */
.docs-shell {
  max-width: 1360px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 48px;
  padding: 0 24px;
}

/* ---------- SIDEBAR ---------- */
.docs-sidebar {
  position: sticky;
  top: 61px; /* visina topbara */
  align-self: start;
  height: calc(100vh - 61px);
  overflow-y: auto;
  padding: 32px 16px 40px 0;
  border-right: 1px solid rgba(255,255,255,0.06);
  scrollbar-width: thin;
  scrollbar-color: var(--card-border) transparent;
}
.docs-group { margin-bottom: 28px; }
.docs-group-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 10px;
  padding-left: 12px;
}
.docs-group-label svg { width: 14px; height: 14px; opacity: 0.9; }
.docs-link {
  display: block;
  padding: 7px 12px;
  border-left: 2px solid transparent;
  border-radius: 0 6px 6px 0;
  font-size: 15px;
  color: var(--muted);
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.docs-link:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.docs-link.active {
  color: var(--orange);
  border-left-color: var(--orange);
  background: rgba(255,122,61,0.08);
  font-weight: 600;
}
.docs-link[hidden] { display: none; }
.docs-group[hidden] { display: none; }

.docs-sidebar-backdrop { display: none; }

/* ---------- SADRŽAJ ---------- */
.docs-content {
  padding: 48px 0 100px;
  max-width: 900px;
  min-height: calc(100vh - 61px);
  position: relative;
  z-index: 1;
}
.docs-section { display: none; }
.docs-section.visible {
  display: block;
  animation: docs-fade 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes docs-fade {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.docs-section h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(34px, 5vw, 48px);
  letter-spacing: 0.01em;
  margin: 0 0 10px;
}
.docs-lead {
  color: var(--muted);
  font-size: 19px;
  margin: 0 0 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.docs-section h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  margin: 40px 0 14px;
}
.docs-section p { color: var(--text); font-size: 17px; line-height: 1.65; margin: 0 0 18px; }
.docs-section p strong { color: var(--gold); font-weight: 600; }
.docs-section a { color: var(--orange); font-weight: 600; }
.docs-section a:hover { text-decoration: underline; }
.docs-section code {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--gold);
  background: rgba(0,0,0,0.3);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ---------- LISTE PRAVILA ---------- */
.docs-list { margin: 0 0 16px; }
.docs-list li {
  position: relative;
  padding: 9px 0 9px 28px;
  color: var(--text);
  font-size: 17px;
  line-height: 1.65;
}
.docs-list li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 18px;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--orange);
  opacity: 0.85;
}

/* ---------- CALLOUT (upozorenje/napomena) ---------- */
.docs-callout {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: rgba(255,194,75,0.06);
  border: 1px solid rgba(255,194,75,0.28);
  border-radius: 10px;
  padding: 16px 18px;
  margin: 24px 0;
}
.docs-callout svg {
  width: 20px;
  height: 20px;
  color: var(--gold);
  flex-shrink: 0;
  margin-top: 1px;
}
.docs-callout p { margin: 0; font-size: 16px; color: var(--text); }

/* ---------- POJMOVNIK ---------- */
.docs-glossary { margin: 0; display: flex; flex-direction: column; }
.docs-glossary > div {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 16px;
  padding: 12px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.docs-glossary > div:last-child { border-bottom: none; }
.docs-glossary dt {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--orange);
}
.docs-glossary dd { margin: 0; font-size: 16px; color: var(--muted); }
@media (max-width: 560px) {
  .docs-glossary > div { grid-template-columns: 1fr; gap: 4px; }
}

/* ---------- PAGER (prethodno / sljedeće) ---------- */
.docs-pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.docs-pager-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 18px;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  background: var(--card);
  max-width: 48%;
  transition: border-color 0.15s, transform 0.15s;
}
.docs-pager-link:hover { border-color: var(--orange); transform: translateY(-1px); text-decoration: none !important; }
.docs-pager-next { margin-left: auto; text-align: right; }
.docs-pager-dir {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.docs-pager-title { font-weight: 600; font-size: 15px; color: var(--text); }
.docs-pager-link:hover .docs-pager-title { color: var(--orange); }

.docs-empty { color: var(--muted); font-size: 15px; padding: 40px 0; }

/* ---------- MOBILNI DRAWER ---------- */
.docs-menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: var(--text);
  width: 38px;
  height: 38px;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}
.docs-menu-btn svg { width: 18px; height: 18px; display: block; margin: 0 auto; }
.docs-menu-btn:hover { border-color: var(--orange); color: var(--orange); }

@media (max-width: 940px) {
  .docs-shell {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .docs-menu-btn { display: grid; place-items: center; }

  .docs-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 300;
    height: 100vh;
    height: 100dvh;
    width: min(300px, 84vw);
    background: var(--bg-alt);
    border-right: 1px solid var(--card-border);
    padding: 24px 16px 40px 16px;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .docs-sidebar.open { transform: translateX(0); }

  .docs-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 250;
    background: rgba(0,0,0,0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
  }
  .docs-sidebar-backdrop.open { opacity: 1; pointer-events: auto; }

  .docs-content { padding-top: 32px; }
  .docs-home-link { display: none; }
  .docs-search { width: min(200px, 46vw); }
}


/* ---------- FAVELA DOCS FIXES ---------- */
.docs-body,
.legal-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top center, rgba(255,107,53,.10), transparent 28%),
    linear-gradient(180deg, #0b1514 0%, #07100f 100%);
  color: var(--text);
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.6'/%3E%3C/svg%3E");
}

.docs-topbar,
.docs-shell,
.legal-wrap { position: relative; z-index: 1; }

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.nav-logo {
  width: 46px;
  height: 46px;
  object-fit: contain;
  flex: 0 0 auto;
}
.brand-mark {
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1;
  letter-spacing: .03em;
  color: var(--text);
}
.brand-mark.accent { color: var(--orange); }

.docs-shell {
  gap: 32px;
  padding-top: 24px;
  padding-bottom: 36px;
}
.docs-sidebar {
  top: 84px;
  height: calc(100vh - 108px);
  padding: 24px 16px 28px;
  border-right: none;
  border: 1px solid var(--card-border);
  border-radius: 20px;
  background: rgba(10,20,19,.80);
  box-shadow: 0 24px 60px rgba(0,0,0,.24);
}
.docs-content {
  padding: 42px 38px 72px;
  max-width: 940px;
  border: 1px solid var(--card-border);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(13,24,22,.92), rgba(10,19,18,.88));
  box-shadow: 0 28px 80px rgba(0,0,0,.26);
}
.docs-section h1,
.docs-section h2,
.legal-wrap h1,
.legal-wrap h2 { color: var(--text); }
.docs-lead,
.docs-section p,
.docs-glossary dd,
.legal-wrap p,
.legal-wrap li,
.legal-updated,
.legal-back { color: #d5ddd7; }
.docs-section code,
.docs-result-cat,
.docs-result mark,
.legal-note svg,
.docs-callout svg { color: var(--gold); }
.docs-callout p,
.legal-note p { color: #edf1ed; }
.docs-search {
  background: rgba(255,255,255,.05);
  border-color: var(--card-border);
}
.docs-search input { color: var(--text); }
.docs-home-link { color: #d8dfd9; }
.docs-home-link:hover { color: #fff; }

@media (max-width: 940px) {
  .docs-shell { padding-top: 14px; }
  .docs-sidebar {
    top: 0;
    height: 100vh;
    width: min(320px, 86vw);
    border-radius: 0 20px 20px 0;
  }
  .docs-content {
    padding: 28px 20px 52px;
    border-radius: 20px;
  }
  .brand-mark { font-size: 20px; }
}


/* Search dropdown final fix */
.docs-topbar,
.docs-topbar-inner,
.docs-topbar-right,
.docs-search { overflow: visible; }
.docs-results::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: #0b1715;
  z-index: 0;
}
.docs-results > * { position: relative; z-index: 1; }


/* Absolute top-layer search dropdown fix */
body.search-open {
  overflow-x: hidden;
}
.docs-search { z-index: 1000; }
.docs-results[hidden] { display: none !important; }


/* ---------- DOCS LUXURY UPGRADE ---------- */
.docs-topbar {
  background: linear-gradient(180deg, rgba(8,19,18,.94), rgba(8,19,18,.78));
  border-bottom-color: rgba(255,255,255,.08);
}
.docs-topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,107,53,.55), transparent);
}
.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.docs-sidebar {
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(9,19,18,.90), rgba(8,16,15,.82));
}
.docs-sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at top right, rgba(255,107,53,.08), transparent 28%);
  pointer-events: none;
}
.docs-group-label {
  color: #f5d89b;
  letter-spacing: .24em;
}
.docs-link {
  border-radius: 12px;
  transition: transform .22s ease, background .22s ease, border-color .22s ease, color .22s ease;
  border: 1px solid transparent;
}
.docs-link:hover {
  transform: translateX(4px);
  border-color: rgba(255,255,255,.06);
}
.docs-link.active {
  background: linear-gradient(90deg, rgba(255,107,53,.18), rgba(255,107,53,.05));
  border-color: rgba(255,107,53,.18);
  box-shadow: inset 2px 0 0 var(--orange);
}
.docs-content {
  border-radius: 28px;
  overflow: hidden;
}
.docs-spotlight {
  margin-bottom: 30px;
  padding: 30px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 26px;
  background:
    radial-gradient(circle at 88% 16%, rgba(255,107,53,.08), transparent 18%),
    linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.015));
}
.docs-spotlight-kicker {
  display: inline-block;
  margin-bottom: 10px;
  font: 800 11px var(--font-mono);
  letter-spacing: .18em;
  color: var(--orange);
}
.docs-spotlight h1 {
  margin: 0;
  font-size: clamp(34px, 4vw, 58px);
  line-height: .98;
  max-width: 720px;
}
.docs-spotlight h1 em { color: var(--orange); font-style: normal; }
.docs-spotlight p {
  max-width: 700px;
  margin: 16px 0 0;
  color: #d4dbd6;
  font-size: 16px;
  line-height: 1.7;
}
.docs-spotlight-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 24px;
}
.docs-spotlight-grid article {
  padding: 18px 18px 16px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 18px;
  background: rgba(255,255,255,.025);
}
.docs-spotlight-grid strong {
  display: inline-flex;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  align-items: center;
  justify-content: center;
  background: rgba(255,107,53,.14);
  color: var(--orange);
  font: 800 12px var(--font-mono);
}
.docs-spotlight-grid h3 {
  margin: 14px 0 8px;
  font-size: 20px;
  color: var(--text);
}
.docs-spotlight-grid p {
  margin: 0;
  font-size: 14px;
  line-height: 1.65;
  color: #c9d1cb;
}
.docs-section.visible {
  padding: 34px 34px 42px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255,255,255,.018), rgba(255,255,255,.012));
  box-shadow: 0 20px 55px rgba(0,0,0,.14);
}
.docs-section h1 {
  position: relative;
  padding-bottom: 18px;
}
.docs-section h1::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 110px;
  height: 2px;
  background: linear-gradient(90deg, var(--orange), rgba(255,107,53,0));
}
.docs-lead {
  color: #e8ece8 !important;
  font-size: 18px !important;
}
.docs-list li {
  padding: 18px 20px 18px 22px;
  border: 1px solid rgba(255,255,255,.05);
  border-radius: 16px;
  background: rgba(255,255,255,.02);
}
.docs-list li::before {
  top: 1.05em;
  width: 8px;
  height: 8px;
  box-shadow: 0 0 10px rgba(255,107,53,.55);
}
.docs-callout {
  border-radius: 18px;
  background: linear-gradient(90deg, rgba(255,210,103,.07), rgba(255,255,255,.015));
  box-shadow: inset 0 0 0 1px rgba(255,210,103,.12);
}
.docs-callout p { font-size: 16px; line-height: 1.7; }
.docs-pager {
  margin-top: 28px;
  gap: 14px;
}
.docs-pager-link {
  border-radius: 18px;
  background: rgba(255,255,255,.02);
}
.docs-pager-link:hover {
  box-shadow: 0 16px 36px rgba(0,0,0,.16);
}

@media (max-width: 980px) {
  .docs-spotlight { padding: 22px 18px; border-radius: 22px; }
  .docs-spotlight-grid { grid-template-columns: 1fr; }
  .docs-section.visible { padding: 26px 18px 32px; border-radius: 20px; }
}


/* ---------- RULES TOPBAR BRAND MATCH ---------- */
.rules-brand {
  padding: 12px 18px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.015));
  box-shadow: 0 12px 30px rgba(0,0,0,.18);
}
.rules-brand img {
  width: 36px;
  height: 36px;
}
.rules-brand .brand-copy strong {
  font-size: 16px;
  color: var(--text);
}
.rules-brand .brand-copy small {
  font-size: 7px;
  letter-spacing: .28em;
}
.docs-topbar-inner {
  padding-top: 14px;
  padding-bottom: 14px;
}
@media (max-width: 760px) {
  .rules-brand {
    padding: 10px 12px;
    border-radius: 16px;
  }
  .rules-brand img {
    width: 30px;
    height: 30px;
  }
  .rules-brand .brand-copy strong { font-size: 14px; }
}


/* ---------- COMPACT CUSTOM SCROLLBARS ---------- */
html {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 107, 53, .72) #06100e;
}
html::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
html::-webkit-scrollbar-track {
  background: #06100e;
}
html::-webkit-scrollbar-thumb {
  min-height: 52px;
  border: 2px solid #06100e;
  border-radius: 999px;
  background: rgba(255, 107, 53, .72);
}
html::-webkit-scrollbar-thumb:hover {
  background: #ff7a43;
}
html::-webkit-scrollbar-corner {
  background: #06100e;
}

.docs-sidebar,
.docs-results {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 107, 53, .55) transparent;
}
.docs-sidebar::-webkit-scrollbar,
.docs-results::-webkit-scrollbar {
  width: 6px;
}
.docs-sidebar::-webkit-scrollbar-track,
.docs-results::-webkit-scrollbar-track {
  background: transparent;
}
.docs-sidebar::-webkit-scrollbar-thumb,
.docs-results::-webkit-scrollbar-thumb {
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(255, 107, 53, .55);
  background-clip: padding-box;
}

.docs-section {
  scroll-margin-top: 110px;
}
