/* ==========================================================================
   Stanojčić Medical Centar — novi izgled
   Jedan CSS fajl, bez spoljnih fontova (sistemski font = trenutno učitavanje).
   ========================================================================== */

:root {
  --brand: #0b5fa5;
  --brand-600: #094f8a;
  --brand-50: #eaf3fb;
  --brand-100: #d3e6f6;

  --ink: #0f1d2e;
  --text: #24313f;
  --muted: #64748b;
  --line: #e3e8ef;
  --bg: #f3f5f8;
  --surface: #ffffff;

  --green: #15803d;  --green-50: #e8f6ee;
  --amber: #b45309;  --amber-50: #fdf3e2;
  --violet: #6d28d9; --violet-50: #f1ebfd;
  --red: #b91c1c;

  --side-bg: #0c1f33;
  --side-ink: #b9c6d6;
  --side-hover: rgba(255,255,255,.06);
  --side-w: 252px;
  --side-w-mini: 72px;
  --top-h: 60px;

  --radius: 12px;
  --shadow: 0 1px 2px rgba(15,29,46,.04), 0 2px 8px rgba(15,29,46,.04);

  /* Bootstrap u boji ustanove */
  --bs-primary: var(--brand);
  --bs-primary-rgb: 11,95,165;
  --bs-link-color: var(--brand);
  --bs-link-color-rgb: 11,95,165;
  --bs-link-hover-color: var(--brand-600);
  --bs-link-hover-color-rgb: 9,79,138;
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-border-color: var(--line);
  --bs-border-radius: 8px;
  --bs-font-sans-serif: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--text); font-size: .95rem; margin: 0; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { color: var(--ink); letter-spacing: -.01em; }

.btn-primary {
  --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: var(--brand-600);
  --bs-btn-active-bg: var(--brand-600); --bs-btn-active-border-color: var(--brand-600);
  --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand);
}
.btn-outline-primary {
  --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand);
  --bs-btn-active-bg: var(--brand); --bs-btn-active-border-color: var(--brand);
}
.btn { text-decoration: none !important; }
.form-control:focus, .form-select:focus { border-color: #7fb0dc; box-shadow: 0 0 0 .2rem rgba(11,95,165,.15); }
.text-bg-primary-subtle { background: var(--brand-50) !important; color: var(--brand) !important; font-weight: 600; font-size: .7rem; vertical-align: middle; }

.skip-link { position: absolute; left: -999px; top: 8px; z-index: 2000; background: #fff; padding: 8px 12px; border-radius: 6px; }
.skip-link:focus { left: 8px; }

/* ---------- Bočni meni ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 1040;
  background: var(--side-bg); color: var(--side-ink);
  display: flex; flex-direction: column;
  transition: width .18s ease, transform .2s ease;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 18px 18px 16px; color: #fff; text-decoration: none !important; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  display: grid; place-items: center; background: var(--brand); color: #fff;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; white-space: nowrap; }
.brand-text strong { font-size: 1.02rem; letter-spacing: .01em; }
.brand-text small { font-size: .72rem; color: #8fa3ba; text-transform: uppercase; letter-spacing: .08em; }

.nav-groups { flex: 1; overflow-y: auto; padding: 6px 10px 12px; }
.nav-top {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 9px 12px; margin: 1px 0; border: 0; border-radius: 8px;
  background: transparent; color: var(--side-ink); font: inherit; font-size: .92rem;
  text-align: left; text-decoration: none !important; cursor: pointer; white-space: nowrap;
}
.nav-top > .bi:first-child { font-size: 1.1rem; width: 20px; text-align: center; flex-shrink: 0; }
.nav-top:hover { background: var(--side-hover); color: #fff; }
.nav-top.active, .nav-group.active > .nav-top { color: #fff; background: rgba(255,255,255,.08); }
.nav-top.active > .bi:first-child, .nav-group.active > .nav-top > .bi:first-child { color: #7dbbf0; }
.nav-top .caret { margin-left: auto; font-size: .75rem; opacity: .6; transition: transform .15s; }
.nav-group.open > .nav-top .caret { transform: rotate(180deg); }
.nav-sub { display: none; padding: 2px 0 6px 44px; }
.nav-group.open > .nav-sub { display: block; }
.nav-sub a {
  display: block; padding: 6px 10px; border-radius: 6px; color: #94a7bd;
  font-size: .87rem; text-decoration: none !important; position: relative;
}
.nav-sub a:hover { color: #fff; background: var(--side-hover); }
.nav-sub a.current { color: #fff; font-weight: 600; }
.nav-sub a.current::before {
  content: ""; position: absolute; left: -14px; top: 50%; width: 6px; height: 6px;
  margin-top: -3px; border-radius: 50%; background: #7dbbf0;
}

.sidebar-foot { padding: 10px; border-top: 1px solid rgba(255,255,255,.06); }
.sb-collapse {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 12px;
  border: 0; border-radius: 8px; background: transparent; color: #8fa3ba; font: inherit; font-size: .85rem;
}
.sb-collapse:hover { background: var(--side-hover); color: #fff; }
.sb-collapse .bi { font-size: 1.05rem; width: 20px; text-align: center; }

/* Skupljen meni (samo desktop) */
@media (min-width: 992px) {
  .sb-mini .sidebar { width: var(--side-w-mini); }
  .sb-mini .brand-text, .sb-mini .nav-top span, .sb-mini .nav-top .caret,
  .sb-mini .nav-sub, .sb-mini .sb-collapse span { display: none !important; }
  .sb-mini .brand { padding-left: 18px; }
  .sb-mini .nav-top, .sb-mini .sb-collapse { justify-content: center; padding-left: 0; padding-right: 0; }
  .sb-mini .app { margin-left: var(--side-w-mini); }
  .sb-mini .sb-collapse .bi { transform: scaleX(-1); }
  /* u skupljenom meniju podmeni iskače desno na hover */
  .sb-mini .nav-group { position: relative; }
  .sb-mini .nav-group:hover > .nav-sub {
    display: block !important; position: absolute; left: calc(100% + 6px); top: 0;
    min-width: 220px; padding: 8px; background: var(--side-bg); border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.25);
  }
  .sb-mini .nav-group:hover > .nav-sub a.current::before { display: none; }
}

/* ---------- Glavni deo ---------- */
.app { margin-left: var(--side-w); min-height: 100vh; display: flex; flex-direction: column; transition: margin-left .18s ease; }
.topbar {
  position: sticky; top: 0; z-index: 1030; height: var(--top-h);
  display: flex; align-items: center; gap: 14px; padding: 0 24px;
  background: rgba(255,255,255,.92); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.icon-btn { border: 0; background: transparent; font-size: 1.5rem; color: var(--ink); padding: 4px 6px; border-radius: 8px; }
.icon-btn:hover { background: var(--bg); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.global-search { position: relative; flex: 1; max-width: 560px; }
.global-search > .bi { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.global-search input {
  width: 100%; height: 40px; padding: 0 44px 0 38px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
  font-size: 16px; /* bez zumiranja na iPhone-u */ color: var(--ink); outline: none;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
@media (min-width: 768px) { .global-search input { font-size: .92rem; } }
.global-search input:focus { background: #fff; border-color: #7fb0dc; box-shadow: 0 0 0 .2rem rgba(11,95,165,.12); }
.global-search kbd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: #fff; color: var(--muted); border: 1px solid var(--line); box-shadow: none;
  font-size: .72rem; padding: 1px 7px; border-radius: 5px;
}
.global-search input:focus ~ kbd { display: none !important; }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 1050;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15,29,46,.12); padding: 6px; max-height: 70vh; overflow: auto;
}
.search-results a {
  display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 8px;
  color: var(--text); text-decoration: none !important;
}
.search-results a:hover, .search-results a.sel { background: var(--brand-50); }
.search-results .sr-av {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: var(--brand-100); color: var(--brand); font-weight: 700; font-size: .78rem;
}
.search-results .sr-main { display: flex; flex-direction: column; min-width: 0; }
.search-results .sr-main strong { color: var(--ink); font-weight: 600; }
.search-results .sr-main small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-results mark { padding: 0; background: #fff1b8; color: inherit; }
.search-results .sr-empty { padding: 14px 12px; color: var(--muted); }
.search-results .sr-foot { padding: 8px 10px 4px; border-top: 1px solid var(--line); margin-top: 4px; font-size: .78rem; color: var(--muted); }

.user-chip {
  display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px;
  border: 0; border-radius: 999px; background: transparent; color: var(--ink);
}
.user-chip:hover, .user-chip[aria-expanded="true"] { background: var(--bg); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand); color: #fff; font-weight: 700; font-size: .82rem; flex-shrink: 0;
}
.user-chip .who { flex-direction: column; align-items: flex-start; line-height: 1.15; text-align: left; max-width: 230px; }
.user-chip .who strong { font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.user-chip .who small { font-size: .74rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

.app-content { flex: 1; padding: 28px 28px 40px; width: 100%; max-width: 1440px; }
.app-footer { padding: 14px 28px 20px; color: var(--muted); font-size: .8rem; }

/* ---------- Mobilni prikaz ---------- */
.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  .sb-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .sb-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 1035; background: rgba(12,31,51,.45); }
  .sidebar-foot { display: none; }
  .app { margin-left: 0; }
  .topbar { padding: 0 12px; gap: 8px; }
  .app-content { padding: 18px 14px 32px; }
  .app-footer { padding: 10px 14px 18px; }
}

/* ---------- Zaglavlje strane ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 20px; margin-bottom: 22px; }
.page-head h1 { font-size: 1.55rem; font-weight: 700; margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .eyebrow { margin: 0 0 2px; font-size: .82rem; font-weight: 600; color: var(--brand); text-transform: uppercase; letter-spacing: .06em; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.day-nav { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.day-nav .btn { border: 0; border-radius: 7px; padding: 6px 12px; font-size: .88rem; background: transparent; color: var(--text); }
.day-nav .btn:hover { background: var(--bg); }
.day-nav .btn.active { background: var(--brand); color: #fff; }
.date-pick { position: relative; overflow: hidden; margin: 0; cursor: pointer; }
.date-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.date-pick input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }

/* ---------- Statistika ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
@media (max-width: 1100px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  color: inherit; text-decoration: none !important;
}
.stat-link:hover { border-color: var(--brand-100); }
.stat-icon { width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; font-size: 1.25rem; flex-shrink: 0; }
.tone-blue   { background: var(--brand-50);  color: var(--brand); }
.tone-amber  { background: var(--amber-50);  color: var(--amber); }
.tone-green  { background: var(--green-50);  color: var(--green); }
.tone-violet { background: var(--violet-50); color: var(--violet); }
.tone-slate  { background: #eef1f5; color: #475569; }
.stat-num { font-size: 1.55rem; font-weight: 700; color: var(--ink); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-num small { font-size: .75rem; font-weight: 600; color: var(--muted); }
.stat-lbl { font-size: .82rem; color: var(--muted); margin-top: 2px; }
@media (max-width: 575.98px) {
  .stats { gap: 10px; }
  .stat { padding: 12px; gap: 10px; }
  .stat-icon { width: 36px; height: 36px; font-size: 1.05rem; border-radius: 9px; }
  .stat-num { font-size: 1.25rem; }
}

/* ---------- Kartice ---------- */
.card-x { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-x + .card-x { margin-top: 16px; }
.card-x-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-x-head h2 { font-size: .98rem; font-weight: 650; margin: 0; display: flex; align-items: center; gap: 8px; }
.card-x-head h2 .bi { color: var(--brand); }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
@media (max-width: 1199.98px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } }

.empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty .bi { font-size: 2rem; display: block; margin-bottom: 8px; color: #a7b4c4; }
.empty p { margin: 0 0 12px; }
.empty.compact { padding: 24px 16px; }

/* Lista lekara */
.doc-list { list-style: none; margin: 0; padding: 0; }
.doc-list li + li { border-top: 1px solid #eef1f5; }
.doc-list a {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) 150px 110px 16px; align-items: center; gap: 14px;
  padding: 12px 18px; color: inherit; text-decoration: none !important;
}
.doc-list a:hover { background: #f8fafc; }
.doc-list li.is-me a { background: linear-gradient(90deg, var(--brand-50), transparent 60%); }
.doc-avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: #eef1f5; color: #475569; font-weight: 700; font-size: .85rem;
}
.doc-avatar.device { border-radius: 10px; background: #e9eefb; color: #3b5bdb; font-size: 1.1rem; }
.doc-main { display: flex; flex-direction: column; min-width: 0; }
.doc-main strong { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-main small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-progress { display: flex; align-items: center; gap: 8px; }
.doc-progress .bar { flex: 1; height: 6px; border-radius: 99px; background: #edf0f4; overflow: hidden; }
.doc-progress .bar span { display: block; height: 100%; background: var(--green); border-radius: 99px; }
.doc-progress small { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }
.doc-open { text-align: right; }
.chev { color: #a7b4c4; }
@media (max-width: 767.98px) {
  .doc-list a { grid-template-columns: 40px minmax(0, 1fr) auto; row-gap: 6px; padding: 12px 14px; }
  .doc-progress { grid-column: 2 / 4; grid-row: 2; }
  .doc-open { grid-column: 3; grid-row: 1; }
  .chev { display: none; }
}

.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; font-size: .76rem; font-weight: 600; white-space: nowrap; }
.pill-amber { background: var(--amber-50); color: var(--amber); }
.pill-green { background: var(--green-50); color: var(--green); }

/* Sledeći pacijenti */
.next-list { list-style: none; margin: 0; padding: 6px 0; max-height: 440px; overflow: auto; }
.next-list li { display: flex; gap: 14px; padding: 9px 18px; align-items: flex-start; }
.next-list li.is-me { background: var(--brand-50); }
.next-list time {
  font-variant-numeric: tabular-nums; font-weight: 700; color: var(--brand);
  background: var(--brand-50); border-radius: 6px; padding: 2px 8px; font-size: .85rem; flex-shrink: 0;
}
.next-list li.is-me time { background: #fff; }
.next-list li.is-late time { background: var(--amber-50); color: var(--amber); }
.next-list li > div { display: flex; flex-direction: column; min-width: 0; }
.next-list li a { color: var(--ink); }
.next-list small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Brze akcije */
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 14px; }
.quick a {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 10px; color: var(--text);
  font-size: .87rem; font-weight: 500; text-decoration: none !important; line-height: 1.2;
}
.quick a:hover { border-color: var(--brand-100); background: var(--brand-50); color: var(--brand); }
.quick .bi { font-size: 1.1rem; color: var(--brand); }

/* ---------- Prijava ---------- */
.login-page { background: #fff; }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.login-aside {
  position: relative; overflow: hidden; color: #dbe7f3;
  background:
    radial-gradient(1200px 600px at -10% 110%, rgba(125,187,240,.22), transparent 60%),
    radial-gradient(700px 400px at 110% -10%, rgba(11,95,165,.55), transparent 60%),
    var(--side-bg);
  display: flex; align-items: center;
}
.login-aside::after {
  content: ""; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath fill='white' d='M13 4h6v9h9v6h-9v9h-6v-9H4v-6h9z'/%3E%3C/svg%3E") no-repeat center / contain;
  opacity: .04;
}
.login-aside-inner { padding: 56px clamp(32px, 6vw, 88px); max-width: 600px; position: relative; z-index: 1; }
.brand-lg { padding: 0; margin-bottom: 56px; }
.brand-lg .brand-mark { width: 46px; height: 46px; border-radius: 12px; }
.brand-lg .brand-text strong { font-size: 1.25rem; }
.login-aside h2 { color: #fff; font-size: clamp(1.6rem, 2.4vw, 2.2rem); font-weight: 700; line-height: 1.25; margin-bottom: 28px; }
.login-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.login-points li { display: flex; align-items: center; gap: 12px; color: #b9c6d6; }
.login-points .bi { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: rgba(255,255,255,.07); color: #7dbbf0; }

.login-main { display: grid; place-items: center; padding: 32px 20px; background: #fff; }
.login-card { width: 100%; max-width: 380px; }
.login-card h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: 4px; }
.brand-mobile { display: none; padding: 0; margin-bottom: 36px; color: var(--ink); }
.brand-mobile .brand-text small { color: var(--muted); }
.input-icon { position: relative; }
.input-icon > .bi { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon .form-control { padding-left: 42px; font-size: 1rem; border-radius: 10px; }
.input-icon .form-control-lg { height: 50px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted); padding: 6px 10px; border-radius: 8px; }
.pw-toggle:hover { background: var(--bg); color: var(--ink); }
#lozinka { padding-right: 48px; }
.login-card .btn-lg { height: 50px; border-radius: 10px; font-weight: 600; font-size: 1rem; }
.login-foot { margin-top: 40px; color: var(--muted); font-size: .8rem; text-align: center; }
@media (max-width: 899.98px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-aside { display: none; }
  .brand-mobile { display: flex; }
  .login-main { place-items: start center; padding-top: 12vh; }
}

/* ---------- Stare strane unutar novog okvira ---------- */
.is-legacy .app-content .container,
.is-legacy .app-content .page-wrap { margin-left: 0; }
.is-legacy .app-content > .page-wrap,
.is-legacy .app-content > .container { padding-left: 0; padding-right: 0; }
.is-legacy .app-content table:not(.table) { width: 100%; background: #fff; border-collapse: collapse; }
.is-legacy .app-content table:not(.table) th,
.is-legacy .app-content table:not(.table) td { padding: 10px 12px; border: 1px solid var(--line); }
.is-legacy .app-content table:not(.table) th { background: #f6f8fb; color: var(--ink); }
.is-legacy .app-content .navbar { display: none; } /* stari meni, ako ga neka strana sama iscrta */

/* Štampa: samo sadržaj */
@media print {
  .sidebar, .topbar, .app-footer, .sidebar-backdrop { display: none !important; }
  .app { margin: 0 !important; }
  .app-content { padding: 0; max-width: none; }
  body { background: #fff; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar, .app, .nav-top .caret { transition: none; }
}
