/* Zajednički izgled internog dijela (interno.curling.hr) – prati izgled curling.hr */
*, *::before, *::after { box-sizing: border-box; }
:root {
  --red: #CC0000; --red-dark: #990000;
  --bg: #f5f5f5; --surface: #ffffff; --text: #1a1a1a; --muted: #555555; --border: #dddddd;
  --link: #990000; --hover: #fafafa; --th-bg: #ececec;
  --shadow: 0 1px 4px rgba(0,0,0,0.10);
  --ok-bg: #eaf6ec; --ok: #1d6b2f;
  --warn-bg: #fff4d6; --warn: #7a5200;
  --err-bg: #fdecee; --err: #b00020;
  --off-bg: #eeeeee; --off: #666666;
  --shade: rgba(0,0,0,.35);
  --radius: 6px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #121212; --surface: #1e1e1e; --text: #e8e8e8; --muted: #999999; --border: #333333;
  --link: #e06060; --hover: #262626; --th-bg: #2a2a2a;
  --shadow: 0 1px 4px rgba(0,0,0,0.40);
  --ok-bg: #173323; --ok: #9ed8b2;
  --warn-bg: #3a2e10; --warn: #f0cf7a;
  --err-bg: #3a1820; --err: #f2a7b3;
  --off-bg: #2a2a2a; --off: #aaaaaa;
  --shade: rgba(0,0,0,.6);
  color-scheme: dark;
}
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.45;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
.hidden { display: none !important; }

/* ---- Header i izbornik kao na curling.hr ---- */
.site-header { background: var(--red); color: #fff; position: sticky; top: 0; z-index: 1000; box-shadow: 0 2px 8px rgba(0,0,0,0.25); }
.header-inner { max-width: 1100px; margin: 0 auto; padding: 0.75rem 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.header-brand { display: flex; align-items: center; gap: 0.85rem; text-decoration: none; color: #fff; min-width: 0; }
.header-brand:hover, .header-brand:focus { color: #fff; text-decoration: none; }
.header-logo { width: 62px; height: 62px; border-radius: 50%; flex-shrink: 0; }
.header-titles { display: flex; flex-direction: column; min-width: 0; }
.header-title { font-size: 1.2rem; font-weight: 700; letter-spacing: 0.01em; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Puni naziv je zadano vidljiv; skraćenica HCS samo na malim ekranima (kao na curling.hr) */
.header-title-short { display: none; }
.header-subtitle { font-size: 0.78rem; opacity: 0.85; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-controls { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.hdr-btn { width: 2.4rem; height: 2.4rem; padding: 0; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3); color: #fff; border-radius: 6px; cursor: pointer;
  text-decoration: none; transition: background 0.15s; }
.hdr-btn:hover, .hdr-btn:focus { background: rgba(255,255,255,0.25); color: #fff; text-decoration: none; }
.hdr-btn svg { width: 1.2rem; height: 1.2rem; }
.site-header :focus-visible { outline-color: #fff; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 4px; }
.nav-toggle span { display: block; width: 24px; height: 2px; background: #fff; border-radius: 2px; }

.site-nav { background: var(--red-dark); }
.site-nav ul { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; display: flex; flex-wrap: wrap; list-style: none; gap: 0; }
.site-nav ul li a { display: block; color: rgba(255,255,255,0.9); padding: 0.55rem 0.85rem; font-size: 0.88rem; font-weight: 500;
  text-decoration: none; transition: background 0.15s, color 0.15s; border-bottom: 2px solid transparent; }
.site-nav ul li a:hover, .site-nav ul li a.active { color: #fff; background: rgba(255,255,255,0.12); border-bottom-color: rgba(255,255,255,0.6); text-decoration: none; }
.site-nav :focus-visible { outline: 2px solid #fff; outline-offset: -2px; }

@media (max-width: 700px) {
  .header-subtitle { display: none; }
  .header-title { font-size: 1rem; }
  .header-title-full { display: none; }
  .header-title-short { display: inline; }
  .header-logo { width: 46px; height: 46px; }
  .nav-toggle { display: flex; }
  .site-nav { display: none; }
  .site-nav.open { display: block; max-height: calc(100dvh - 4.6rem); overflow-y: auto; overscroll-behavior: contain; }
  .site-nav ul { flex-direction: column; padding: 0.5rem 0; }
  .site-nav ul li a { padding: 0.65rem 1.25rem; border-bottom: none; border-left: 3px solid transparent; }
  .site-nav ul li a:hover, .site-nav ul li a.active { border-left-color: rgba(255,255,255,0.6); background: rgba(255,255,255,0.1); }
}
@media (max-width: 420px) { .header-inner { padding: 0.6rem 1rem; } }

/* ---- Sadržaj ---- */
main { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1.25rem 2rem; }
.status { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; white-space: pre-wrap; }
.status.info { background: var(--surface); border: 1px solid var(--border); color: var(--muted); }
.status.error { background: var(--err-bg); color: var(--err); }


.btn { cursor: pointer; border-radius: var(--radius); padding: 0.45rem 1rem; border: 1px solid var(--border); background: var(--surface); font-weight: 600; }
.btn:hover { background: var(--hover); }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); }
.btn:disabled { opacity: .55; cursor: default; }
.link { background: none; border: 0; color: var(--link); cursor: pointer; padding: 0; font-weight: 600; text-align: left; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar input[type=search] { flex: 1 1 240px; max-width: 340px; }
.toolbar .spacer { flex: 1; }
input[type=search], input[type=text], input[type=date], select, textarea {
  padding: 0.45rem 0.6rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); width: 100%; }
.toolbar select { width: auto; }
textarea { min-height: 90px; resize: vertical; }

.stats { display: flex; gap: 22px; flex-wrap: wrap; margin: 0 0 12px; color: var(--muted); font-size: .95rem; }
.stats b { color: var(--text); font-size: 1.1rem; margin-right: 4px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { padding: 0; white-space: nowrap; background: var(--th-bg); border-bottom: 1px solid var(--border); }
th button { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 4px; width: 100%; padding: 10px 12px; cursor: pointer; font-weight: 600; color: var(--text); }
th button:hover { color: var(--link); }
th button:focus-visible { outline: 3px solid var(--link); outline-offset: -3px; }
th[aria-sort] button { color: var(--link); }
th .arrow { font-size: .75em; opacity: .8; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--hover); }
tbody tr:last-child td { border-bottom: 0; }
tr.inactive td { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.empty { padding: 32px; text-align: center; color: var(--muted); cursor: default; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .82rem; font-weight: 600; white-space: nowrap; }
.b-ok { background: var(--ok-bg); color: var(--ok); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-err { background: var(--err-bg); color: var(--err); }
.b-off { background: var(--off-bg); color: var(--off); }

.notice { padding: 28px; text-align: center; color: var(--muted); }
.notice h2 { color: var(--text); font-size: 1.15rem; margin: 0 0 8px; }
.signin { text-align: center; padding: 48px 20px; }
.signin h2 { margin: 0 0 8px; font-size: 1.3rem; }
.signin p { color: var(--muted); max-width: 46ch; margin: 0 auto 20px; }

/* ---- Modalni prozor (kao na curling.hr: zatamnjena pozadina, prozor na sredini, iznad headera) ---- */
.backdrop { position: fixed; inset: 0; background: rgba(28,43,57,0.7); z-index: 1100; }
.drawer { position: fixed; z-index: 1101; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(640px, calc(100% - 32px)); max-height: calc(100dvh - 80px);
  background: var(--surface); border-radius: 14px; display: flex; flex-direction: column;
  box-shadow: 0 12px 40px rgba(0,0,0,.35); overflow: hidden; }
.drawer-head { position: relative; padding: 24px 64px 14px 28px; border-bottom: 3px solid var(--red); }
.drawer-head h2 { margin: 0; font-size: 1.3rem; }
.drawer-head .sub { color: var(--muted); font-size: .92rem; margin-top: 2px; }
.drawer-head .close { position: absolute; top: 16px; right: 16px; width: 30px; height: 30px; border-radius: 50%; border: none;
  background: var(--th-bg); color: var(--text); font-size: 18px; line-height: 1; padding: 0; cursor: pointer; }
.drawer-head .close:hover { background: var(--border); }
.drawer-body { padding: 18px 28px; overflow-y: auto; flex: 1; }
.drawer-foot { padding: 14px 28px; border-top: 1px solid var(--border); display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 600px) {
  .drawer { width: calc(100% - 16px); max-height: calc(100dvh - 32px); }
  .drawer-head { padding: 20px 56px 12px 16px; }
  .drawer-body, .drawer-foot { padding-left: 16px; padding-right: 16px; }
}
dl.fields { display: grid; grid-template-columns: minmax(150px, 40%) 1fr; gap: 7px 16px; margin: 0 0 18px; }
dl.fields dt { color: var(--muted); }
dl.fields dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.drawer h3 { font-size: 1.02rem; margin: 20px 0 8px; color: var(--link); }
.timeline { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 10px 8px; }
.timeline li::before { content: ""; position: absolute; left: -23px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--red); border: 2px solid var(--surface); }
.timeline li.stop::before { background: var(--muted); }
.timeline li.raw { color: var(--muted); }
.timeline li.raw::before { background: var(--border); }
.timeline time { font-weight: 600; margin-right: 6px; font-variant-numeric: tabular-nums; }
form .row { margin-bottom: 13px; }
form label { display: block; font-weight: 600; margin-bottom: 4px; }
form label .req { color: var(--red); }
.help { color: var(--muted); font-size: .88rem; margin: 4px 0 0; }
details { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; margin-top: 8px; }
details summary { cursor: pointer; font-weight: 600; }
.formerr { background: var(--err-bg); color: var(--err); padding: 10px 12px; border-radius: var(--radius); margin-bottom: 14px; white-space: pre-wrap; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1a1a1a; color: #fff;
  padding: 10px 18px; border-radius: var(--radius); z-index: 300; box-shadow: 0 4px 16px rgba(0,0,0,.3); }

footer { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem 2rem; font-size: .88rem; }
footer a { color: var(--muted); }
.tool { padding: 20px; margin-bottom: 18px; }
.tool h2 { margin: 0 0 8px; font-size: 1.15rem; }
.tool h3 { margin: 16px 0 6px; font-size: 1rem; }
pre.preview { background: var(--bg); padding: 12px; border-radius: var(--radius); white-space: pre-wrap; font-size: .88rem; }
code { font-family: Consolas, 'Courier New', monospace; font-size: .9em; }

@media (max-width: 760px) {
  .col-opt { display: none; }
  dl.fields { grid-template-columns: 1fr; gap: 0; }
  dl.fields dd { margin-bottom: 9px; }
}
@media (prefers-reduced-motion: no-preference) {
  .drawer { animation: popin .16s ease-out; }
  @keyframes popin { from { transform: translate(-50%, -48%); opacity: .4; } to { transform: translate(-50%, -50%); opacity: 1; } }
}

/* ---- Početna stranica internog dijela ---- */
.page-title { font-size: 1.35rem; margin: 0 0 4px; }
.page-lead { color: var(--muted); margin: 0 0 20px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.tile { padding: 18px 20px; border-top: 4px solid var(--red); }
.tile h2 { margin: 0 0 4px; font-size: 1.15rem; }
.tile h2 a { color: var(--text); text-decoration: none; }
.tile h2 a:hover { color: var(--link); }
.tile p { color: var(--muted); margin: 0 0 10px; font-size: .95rem; }
.tile ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 14px; flex-wrap: wrap; }
.tile ul a { color: var(--link); font-weight: 600; text-decoration: none; }
.tile ul a:hover { text-decoration: underline; }

/* Korisnici bez prava uređivanja ne vide gumbe za unos i izmjene */
body.readonly .edit-only { display: none !important; }
