/* Alpine.js: keep x-cloaked elements hidden until Alpine hydrates so we
   don't show dropdowns / panels in their initial expanded state. */
[x-cloak] { display: none !important; }

:root {
  --ri-red: #d63e45;
  --ri-red-dark: #3b0d0f;
  --ri-red-accent: #ef4a44;
  --ri-red-tertiary: #ba272e;
  --ri-mute: #888888;
  --ri-soft-bg: #fafafa;
  --ri-border: #d9d9d9;
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #1a1a1a;
}

a { color: var(--ri-red); }
a:hover { color: var(--ri-red-tertiary); }

.btn-primary {
  background: var(--ri-red);
  color: #fff;
  border: 1px solid var(--ri-red-tertiary);
}
.btn-primary:hover { background: var(--ri-red-tertiary); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--ri-red);
  border: 1px solid var(--ri-border);
}
.btn-ghost:hover { background: #f6e6e7; }

.cell-mine {
  background: #fff0f1;
  outline: 2px solid var(--ri-red);
  outline-offset: -2px;
}

.flash-ok { background: #ecfdf5; color: #065f46; border: 1px solid #6ee7b7; }
.flash-err { background: #fef2f2; color: #7f1d1d; border: 1px solid #fca5a5; }
.flash-info { background: #eff6ff; color: #1e3a8a; border: 1px solid #93c5fd; }

.status-badge { font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 9999px; }
.status-DRAFT { background: #e5e7eb; color: #374151; }
.status-PUBLISHED { background: #d1fae5; color: #065f46; }
.status-LOCKED { background: #dbeafe; color: #1e3a8a; }

/* =====================================================================
   Moderni sloj (2026-09) — zajednički za raspored, Teren i AI portal.
   Nadograđuje postojeće Tailwind klase, bez diranja predložaka.
   Sve vrijedi samo za ekran: ispis rasporeda (print.ejs) ima svoj stil.
   ===================================================================== */
:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --line: #e7e9ee;
  --line-soft: #f0f2f5;
  --head: #f8f9fb;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6b7280;
  --ring: rgba(214, 62, 69, .18);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, .08);
  --radius: 12px;
}

@media screen {
  html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
  body.bg-slate-50 { background: var(--bg); color: var(--ink); }
  main h1 { letter-spacing: -.015em; }
  main h2 { letter-spacing: .01em; }

  /* ---------- zaglavlje ---------- */
  header.bg-ri-dark {
    background: linear-gradient(180deg, #4a1215 0%, #3b0d0f 100%);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 2px 14px rgba(0, 0, 0, .18);
  }
  header.bg-ri-dark nav a { border-radius: 8px; transition: background-color .15s; }

  /* ---------- kartice ---------- */
  .bg-white.border.rounded-md,
  .bg-white.border.rounded-lg,
  .bg-white.border.rounded-xl {
    border-color: var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
  }
  a.bg-white.border.rounded-md:hover, a.bg-white.border.rounded-lg:hover { box-shadow: var(--shadow-md); border-color: #f1c2c5; }
  .border-2.rounded-md { border-radius: var(--radius); }

  /* ---------- polja ---------- */
  main :is(input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]), select, textarea) {
    border-radius: 9px;
    border-color: #d5d9e0;
    background-color: #fff;
    transition: border-color .15s, box-shadow .15s;
  }
  main :is(input, select, textarea):focus {
    outline: none;
    border-color: var(--ri-red);
    box-shadow: 0 0 0 3px var(--ring);
  }
  input[type=checkbox], input[type=radio] { accent-color: var(--ri-red); }
  main :is(a, button):focus-visible { outline: 2px solid var(--ri-red); outline-offset: 2px; border-radius: 8px; }

  /* ---------- gumbi ---------- */
  main :is(button, a).bg-ri, main :is(button, a).bg-slate-800 {
    border-radius: 9px;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .1);
    transition: background-color .15s, box-shadow .15s, transform .05s;
  }
  main :is(button, a).bg-ri:hover { box-shadow: 0 4px 10px rgba(214, 62, 69, .25); }
  main button:not(:disabled):active { transform: translateY(1px); }

  /* ---------- tablice ---------- */
  .overflow-x-auto.bg-white.border { border-radius: var(--radius); overflow: auto; }
  main table {
    border-collapse: separate !important;
    border-spacing: 0;
    width: 100%;
    font-variant-numeric: tabular-nums;
  }
  main table thead th {
    position: sticky; top: 0; z-index: 2;
    background: var(--head) !important;
    color: #4b5563;
    font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
    text-align: left;
    padding: .65rem .8rem !important;
    border: 0 !important;
    border-bottom: 1px solid var(--line) !important;
    white-space: nowrap;
  }
  main table thead th.text-center { text-align: center; }
  main table td {
    border: 0 !important;
    border-bottom: 1px solid var(--line-soft) !important;
    padding: .6rem .8rem !important;
    vertical-align: top;
    line-height: 1.4;
  }
  /* blage okomite linije — raspored je mreža dana, bez njih se oko gubi */
  main table :is(td, th) + :is(td, th) { border-left: 1px solid var(--line-soft) !important; }
  main table tbody tr:last-child td { border-bottom: 0 !important; }
  main table tbody tr:hover td { background: #fafbfc; }
  main table tbody tr:nth-child(even) td { background-color: #fcfcfd; }
  main table tbody tr:nth-child(even):hover td { background: #f7f8fa; }

  /* prvi stupac (termin, ime) ostaje na mjestu kad se tablica pomiče vodoravno */
  main .overflow-x-auto table :is(td, th):first-child {
    position: sticky; left: 0; z-index: 1;
    background: #fbfbfc;
    box-shadow: 1px 0 0 var(--line);
  }
  main .overflow-x-auto table thead th:first-child { z-index: 3; background: var(--head) !important; }
  main table tbody td:first-child { color: var(--ink-2); font-weight: 500; }

  /* moja smjena: istaknuta i pod mišem */
  main table td.cell-mine, main table tr:hover td.cell-mine, main table tr:nth-child(even) td.cell-mine {
    background: #fff1f2 !important;
    outline: 0;
    box-shadow: inset 0 0 0 2px var(--ri-red);
    border-radius: 6px;
  }

  /* tablice u AI tekstovima (izvještaji, Moj AI) */
  .md table { display: block; overflow-x: auto; border: 1px solid var(--line) !important; border-radius: 10px; margin: .75em 0; }
  .md table :is(td, th) { white-space: normal; }
  .md table th:first-child, .md table td:first-child { position: static; box-shadow: none; }
}

/* ===================================================== Zaglavlje portala (2026-10)
   Isto zaglavlje u Pythonu (ai/app/templates/base.html) i Nodeu
   (views/partials/header.ejs); stavke dolaze iz ai/app/izbornik.json. */
.ri-top {
  --top-bg: #2b0a0c; --top-bg2: #4a1216; --top-tekst: rgba(255,255,255,.84); --top-crvena: #ef4a44;
  position: sticky; top: 0; z-index: 40;
  background: linear-gradient(90deg, var(--top-bg), var(--top-bg2));
  color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,.06), 0 6px 20px -12px rgba(0,0,0,.5);
}
.ri-top-in { max-width: 64rem; margin: 0 auto; padding: 0 1rem; height: 60px; display: flex; align-items: center; gap: 1.25rem; }
.ri-logo { display: flex; align-items: center; gap: .6rem; flex: none; text-decoration: none; }
.ri-logo img { height: 26px; width: auto; max-width: none; display: block; }
.ri-ai { font: 700 11px/1 system-ui, -apple-system, "Segoe UI", sans-serif; letter-spacing: .08em; color: #fff;
  background: var(--top-crvena); padding: 4px 6px 3px; border-radius: 5px; }
.ri-nav { display: none; align-items: center; gap: .15rem; flex: 1; min-width: 0; }
.ri-nav-a { display: inline-flex; align-items: center; gap: .3rem; height: 36px; padding: 0 .75rem; border-radius: 8px;
  font-size: 14.5px; font-weight: 500; color: var(--top-tekst); text-decoration: none; background: none; border: 0;
  cursor: pointer; white-space: nowrap; position: relative; transition: background .12s, color .12s; }
.ri-nav-a:hover, .ri-nav-a[aria-expanded="true"] { background: rgba(255,255,255,.09); color: #fff; }
.ri-nav-a:focus-visible, .ri-pad-a:focus-visible, .ri-gumb:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.ri-nav-a.je-aktivno { color: #fff; }
.ri-nav-a.je-aktivno::after { content: ""; position: absolute; left: .75rem; right: .75rem; bottom: -12px; height: 3px;
  border-radius: 3px 3px 0 0; background: var(--top-crvena); }
.ri-nav-a svg { width: 14px; height: 14px; opacity: .7; transition: transform .15s; }
.ri-nav-a[aria-expanded="true"] svg { transform: rotate(180deg); }
.ri-grupa { position: relative; }
.ri-pad { position: absolute; left: 0; top: calc(100% + 12px); width: 320px; padding: .4rem; background: #fff; color: #1e1b1d;
  border-radius: 14px; box-shadow: 0 18px 40px -12px rgba(30,10,12,.35), 0 0 0 1px rgba(30,10,12,.06); }
.ri-pad-a { display: flex; align-items: flex-start; gap: .75rem; padding: .6rem .65rem; border-radius: 10px; color: inherit; text-decoration: none; }
.ri-pad-a:hover { background: #faf3f3; }
.ri-pad-a b { display: block; font-size: 14px; font-weight: 600; }
.ri-pad-a small { display: block; font-size: 12.5px; color: #6b6266; margin-top: 1px; }
.ri-pad-a.je-aktivno b { color: #ba272e; }
.ri-ik { flex: none; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: #fbe9ea; color: #ba272e; }
.ri-ik svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ri-desno { margin-left: auto; display: flex; align-items: center; gap: .5rem; flex: none; }
.ri-gumb { display: inline-flex; align-items: center; gap: .5rem; height: 38px; padding: 0 .55rem 0 .35rem; border-radius: 999px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); color: #fff; cursor: pointer; font-size: 14px; }
.ri-gumb:hover { background: rgba(255,255,255,.15); }
.ri-avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font: 700 12px/1 system-ui, sans-serif;
  background: var(--top-crvena); color: #fff; letter-spacing: .02em; }
.ri-gumb .ri-ime { display: none; font-weight: 500; }
.ri-gumb svg { width: 16px; height: 16px; opacity: .75; }
.ri-meni-gumb { width: 40px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12); color: #fff; cursor: pointer; }
.ri-meni-gumb svg { width: 22px; height: 22px; }
.ri-profil { position: absolute; right: 0; top: calc(100% + 10px); width: 250px; padding: .35rem; background: #fff; color: #1e1b1d;
  border-radius: 14px; box-shadow: 0 18px 40px -12px rgba(30,10,12,.35), 0 0 0 1px rgba(30,10,12,.06); font-size: 14px; }
.ri-profil-glava { padding: .55rem .7rem .6rem; border-bottom: 1px solid #f0e9ea; margin-bottom: .3rem; }
.ri-profil-glava b { display: block; font-weight: 600; }
.ri-profil-glava small { display: block; color: #6b6266; font-size: 12.5px; }
.ri-profil a, .ri-profil button { display: flex; align-items: center; gap: .55rem; width: 100%; text-align: left; padding: .5rem .7rem;
  border-radius: 8px; color: inherit; text-decoration: none; background: none; border: 0; cursor: pointer; font: inherit; }
.ri-profil a:hover, .ri-profil button:hover { background: #faf3f3; }
.ri-profil svg { width: 17px; height: 17px; fill: none; stroke: #8a7f83; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ri-mob { background: #fff; color: #1e1b1d; border-top: 1px solid rgba(0,0,0,.06); box-shadow: 0 20px 30px -20px rgba(0,0,0,.4);
  max-height: calc(100vh - 60px); overflow-y: auto; }
.ri-mob-in { max-width: 64rem; margin: 0 auto; padding: .75rem 1rem 1.25rem; }
.ri-mob h3 { font: 600 11px/1 system-ui, sans-serif; letter-spacing: .12em; text-transform: uppercase; color: #8a7f83; margin: 1rem .4rem .45rem; }
.ri-mob-mreza { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .25rem; }
.ri-mob .ri-pad-a { padding: .5rem; align-items: center; }
.ri-mob .ri-pad-a small { display: none; }
@media (min-width: 900px) {
  .ri-nav { display: flex; }
  .ri-meni-gumb, .ri-mob { display: none !important; }
}
@media (min-width: 1100px) { .ri-gumb .ri-ime { display: inline; } }
@media (max-width: 380px) { .ri-logo img { height: 22px; } }

/* početna: pločice po grupama */
.ri-plocice { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .75rem; }
.ri-plocica { display: flex; align-items: flex-start; gap: .8rem; padding: .9rem 1rem; border-radius: 14px; background: #fff;
  border: 1px solid #ece4e5; color: #1e1b1d; text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s; }
.ri-plocica:hover { border-color: #e6b9bc; box-shadow: 0 10px 24px -16px rgba(120,20,30,.45); transform: translateY(-1px); }
.ri-plocica b { display: block; font-weight: 600; font-size: 15px; }
.ri-plocica small { display: block; color: #6b6266; font-size: 12.5px; margin-top: 2px; line-height: 1.35; }
.ri-plocica-snimaj { background: linear-gradient(135deg, #d63e45, #ba272e); border-color: transparent; color: #fff; }
.ri-plocica-snimaj small { color: rgba(255,255,255,.85); }
.ri-plocica-snimaj .ri-ik { background: rgba(255,255,255,.18); color: #fff; }
.ri-plocica-snimaj:hover { border-color: transparent; box-shadow: 0 12px 26px -14px rgba(186,39,46,.8); }
.ri-naslov-grupe { font: 600 11.5px/1 system-ui, sans-serif; letter-spacing: .12em; text-transform: uppercase; color: #8a7f83; margin: 1.4rem 0 .6rem; }
@media (max-width: 480px) { .ri-plocice { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; } .ri-plocica { padding: .75rem; gap: .55rem; } .ri-plocica small { display: none; } .ri-plocica .ri-ik { width: 30px; height: 30px; } }
/* Raspored i administracija imaju širi sadržaj (max-w-7xl) — zaglavlje se poravna s njim */
.ri-top.ri-siroko .ri-top-in, .ri-top.ri-siroko .ri-mob-in { max-width: 80rem; }
