/* =====================================================================
   Pravna.rs — LAW DOCUMENT (komponentni stil) — JEDINI IZVOR ISTINE
   ---------------------------------------------------------------------
   Stiluje SAMO telo propisa (`.law-document`): strukturne sekcije
   (Deo/Glava/Odeljak…), kartice članova (`.clan-card`/`.law-article-card`),
   in-text reference (`.law-xref`/`.xref`), tabele/liste, „lawyer-note"
   i body tipografiju (chapter/subchapter/micro-heading iz JSON-a).

   KORISNICI (oba renderuju ISTI `_LawSection` markup → moraju izgledati
   IDENTIČNO):
     • /propisi/{slug}  (Laws/Details.cshtml)  — primarni „referentni" izgled
     • reference popup  (_RefModal → _LawDocumentFragment)

   Ranije je telo bilo duplirano u laws-details.css i ovde, pa su dve
   definicije TIHO razišle (npr. .law-article-card radius 12 vs 26,
   .law-deo-title 16/800 vs 20/700). Sada je telo SAMO ovde; laws-details.css
   nosi isključivo page chrome (header/tabs/toolbar/TOC/search/print/xref-popup).

   Highlight set (`.hl.*`) i citirani član (`.clan-card--cited`) su
   CENTRALIZOVANI u modules/law-shell.css (globalno učitan). Modifikator
   `.law-document--embed` = prikaz u popup-u.
   ===================================================================== */

.law-document {
  --law-paper: var(--p-white);
  --law-ink: var(--c-text-primary);
  --law-muted: var(--c-text-secondary);
  --law-line: var(--c-border-subtle);
  --law-blue: var(--c-brand-strong);

  color: var(--law-ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
  font-size: 13.5px;
}

/* === Body tipografija ============================================== */
.law-document p { margin: 0 0 6px; }
.law-document p:last-child { margin-bottom: 0; }
.law-document strong, .law-document b { font-weight: 850; }
.law-document u { text-decoration-thickness: 2px; text-underline-offset: 3px; }
.law-document a {
  color: var(--law-blue); text-decoration: none;
  border-bottom: 1px dotted var(--law-blue); font-weight: 700;
}
.law-document a:hover { color: var(--p-brand-800); border-bottom-style: solid; }

.law-document ul, .law-document ol,
.law-article-body ul, .law-article-body ol { margin: 10px 0 10px 22px; padding: 0; }
.law-document li, .law-article-body li { margin: 6px 0; }

.law-document table, .law-article-body table {
  width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 15px; background: var(--p-white);
}
.law-document th, .law-document td,
.law-article-body th, .law-article-body td {
  border: 1px solid var(--law-line); padding: 10px 12px; vertical-align: top;
}
.law-document th, .law-article-body th { background: var(--p-app-surface-2); color: var(--c-text-primary); font-weight: 900; }

/* Akt root naslov + JSON heading nivoi (chapter/subchapter/micro-heading)
   — telo iz baze; renderuju se i u modalu i na stranici. */
.law-document > h1,
.law-document > .law-act-title {
  font-size: 20px; font-weight: 800; letter-spacing: -.01em; margin: 0 0 8px; color: var(--c-text-primary);
}
.law-document .chapter, .law-chapter {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 3vw, 38px); line-height: 1.15; letter-spacing: -.035em;
  color: var(--c-text-primary); margin: 36px 0 14px; padding-top: 22px; border-top: 1px solid var(--law-line);
}
.law-document .subchapter, .law-subchapter {
  font-size: 20px; line-height: 1.35; color: var(--c-text-primary); margin: 22px 0 10px; font-weight: 800;
}
.law-document .micro-heading, .law-micro-heading {
  display: inline-flex; margin: 12px 0 8px; padding: 7px 11px; border-radius: 999px;
  background: var(--p-app-surface-2); border: 1px solid var(--law-line);
  font-size: 13px; font-weight: 850; color: var(--p-slate-500);
}

/* === Strukturne sekcije (Deo / Glava / Odeljak / …) ================= */
.law-deo { margin-top: 14px; }
.law-deo .law-deo { margin-top: 10px; }
.law-deo-title { font-size: 16px; font-weight: 800; letter-spacing: .02em; margin: 0 0 6px; color: var(--c-text-primary); }
.law-deo-title--deo, .law-deo-title--poddeo {
  font-size: 17px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; color: var(--c-text-primary); margin: 18px 0 8px;
}
.law-deo-title--glava {
  font-size: 15px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--c-brand-deep); margin: 14px 0 6px;
}
.law-deo-title--odeljak, .law-deo-title--pododeljak {
  font-size: 14px; font-weight: 700; color: var(--c-text-primary); margin: 12px 0 6px;
}
.law-deo-title--odsek, .law-deo-title--pododsek, .law-deo-title--grupa {
  font-size: 13.5px; font-weight: 700; color: var(--p-slate-600); margin: 10px 0 4px;
}
.law-deo-title--preambula { font-size: 16px; font-weight: 800; color: var(--c-text-primary); margin: 12px 0 6px; }
/* Ugnježdeni „Deo > Glava" fallback (kad nema --kind sufiksa) */
.law-deo .law-deo .law-deo-title { font-size: 14px; font-weight: 700; margin: 0 0 4px; }
.law-deo .law-deo .law-deo .law-deo-title { font-size: 13.5px; font-weight: 700; color: var(--c-text-primary); margin: 0 0 4px; }
.law-podnaslov, .law-section-subtitle { font-size: 13.5px; font-weight: 700; color: var(--c-text-primary); margin: 8px 0 4px; }

/* === Kartica člana ================================================== */
.clan-card, .law-article-card {
  background: var(--law-paper); border: 1px solid var(--law-line); border-radius: 26px;
  padding: 22px 24px; margin: 16px 0; box-shadow: 0 18px 50px rgba(15, 23, 42, .055);
  scroll-margin-top: 140px;
}
.law-article-card.is-important { border-color: var(--c-danger-line); box-shadow: 0 22px 65px rgba(185, 28, 28, .10); }
.law-article-card.is-match { border-color: var(--c-brand-300); box-shadow: 0 22px 65px rgba(29, 78, 216, .14); }

.clan-card-head, .law-article-top {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 18px;
  margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--law-line);
}
.clan-card-head h3, .law-article-title {
  margin: 0; font-family: inherit; font-size: 14px; font-weight: 700; color: var(--c-text-primary); letter-spacing: 0; line-height: 1.25;
}
.law-article-subtitle { font-size: 13px; font-weight: 600; color: var(--p-slate-500); margin-top: 4px; line-height: 1.35; }
.clan-card-actions { display: flex; gap: 8px; align-items: center; }
.clan-body, .law-article-body { color: var(--c-text-primary); }
.clan-body p, .law-article-body p { margin: 0 0 6px; font-size: 13.5px; line-height: 1.55; }
.clan-body p:last-child, .law-article-body p:last-child { margin-bottom: 0; }
.law-article-body p:first-child { margin-top: 0; }

.clan-footnotes { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--law-line); }
.clan-footnote { font-size: 12px; color: var(--law-muted); line-height: 1.5; margin: 2px 0; }
.law-plaintext-body { white-space: normal; }
.law-document .muted, .muted { color: var(--law-muted); }

/* Scroll target: deep-link / TOC klik treba da uvuče i nadređeni naslov. */
.law-document > h1,
.law-deo,
.law-podnaslov,
.law-section-subtitle,
.law-article-card,
.clan-card,
.law-article-card[id],
[id^="clan-"] { scroll-margin-top: 140px; }

/* Highlight klase (.hl.*) i citirani član (.clan-card--cited) su
   CENTRALIZOVANI u modules/law-shell.css (globalno). Ovde namerno uklonjeno. */

.law-document .lawyer-note, .lawyer-note {
  margin-top: 16px; border-left: 4px solid var(--law-blue); background: var(--p-app-surface-2); border-radius: 14px; padding: 13px 15px; color: var(--p-slate-600); font-size: 14px;
}
.law-document .lawyer-note strong, .lawyer-note strong { color: var(--c-text-primary); font-weight: 900; }

/* In-text „član N" reference: a.law-xref (popup trigger, Details JS) +
   .xref (statički link iz baze). Izgled: tačkasta donja linija (živi /propisi izgled). */
.law-document .law-xref, a.law-xref {
  color: var(--law-blue); text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px; border-bottom: 0; font-weight: 600; cursor: pointer;
}
.law-document .law-xref:hover, a.law-xref:hover { color: var(--p-brand-800); background: var(--c-brand-surface); border-radius: 3px; }
.law-document .xref, .law-article-body .xref {
  color: var(--law-blue); text-decoration: none; border-bottom: 1px dotted var(--law-blue); font-weight: 750;
}
.law-document .xref:hover, .law-article-body .xref:hover { border-bottom-style: solid; }

/* === Prikaz u popup-u (modal) ====================================== */
/* Bez per-član akcija (Kopiraj/Link zavise od Details JS-a) i bez velikog
   sticky offseta — modal ima svoj scroll kontejner. */
.law-document--embed .clan-card-actions { display: none !important; }
.law-document--embed .clan-card,
.law-document--embed .law-article-card,
.law-document--embed [id^="clan-"] { scroll-margin-top: 12px; }
.law-document--embed > .law-deo:first-child,
.law-document--embed > .clan-card:first-child { margin-top: 0; }

/* === Print (telo) ================================================== */
@media print {
  .law-document { color: var(--c-text-primary); background: var(--p-white); font-size: 13px; line-height: 1.5; }
  .clan-card, .law-article-card {
    box-shadow: none; border: 0; border-radius: 0; border-bottom: 1px solid var(--c-text-faint);
    padding: 14px 0; margin: 0; page-break-inside: avoid;
  }
  .clan-card-head, .law-article-top { border-bottom: 1px solid var(--c-text-faint); }
  .law-article-title, .clan-card-head h3 { font-size: 16px; }
  .law-document .hl, .law-article-body .hl { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .clan-card-actions { display: none !important; }
}

/* === Responsive (kanonski ≤720) =================================== */
@media (max-width: 720px) {
  .law-document { font-size: 14.5px; line-height: 1.6; }
  .law-document > h1 { font-size: 20px; }
  .law-document .chapter, .law-chapter { font-size: 27px; }
  .law-document .subchapter, .law-subchapter { font-size: 18px; }
  .law-deo { margin-top: 22px; }
  .law-deo-title { font-size: 17px; }
  .clan-card, .law-article-card { padding: 16px 16px; }
  .clan-card-head, .law-article-top { flex-direction: column; align-items: flex-start; gap: 8px; padding-bottom: 10px; margin-bottom: 10px; }
  .clan-card-head h3, .law-article-title { font-size: 14px; }
  .law-article-subtitle { font-size: 13px; }
  .clan-body p, .law-article-body p { font-size: 14.5px; }
  .law-article-body { font-size: 14.5px; }
  .clan-card-actions { flex-wrap: wrap; width: 100%; gap: 6px; }
}
