@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── VARIJABLE ── */
:root {
  --bg:         #f6f8fc;
  --surface:    #ffffff;
  --surface-2:  #f0f4ff;
  --border:     #e4e9f2;
  --border-2:   #d0d8eb;

  --navy:       #0d1b3e;
  --navy-2:     #1a2f5e;
  --blue:       #2563eb;
  --blue-hover: #1d4ed8;
  --blue-light: #eff6ff;
  --blue-mid:   #bfdbfe;

  --text-1:     #0d1b3e;
  --text-2:     #374151;
  --text-3:     #6b7280;
  --text-4:     #9ca3af;

  --green:      #059669;  --green-bg:  #ecfdf5;  --green-bd: #6ee7b7;
  --red:        #dc2626;  --red-bg:    #fef2f2;  --red-bd:   #fca5a5;
  --amber:      #d97706;  --amber-bg:  #fffbeb;  --amber-bd: #fcd34d;
  --purple:     #7c3aed;  --purple-bg: #f5f3ff;  --purple-bd:#c4b5fd;
  --cyan:       #0891b2;  --cyan-bg:   #ecfeff;

  --sidebar-w:  256px;
  --topbar-h:   64px;
  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  14px;
  --radius-xl:  20px;

  --shadow-sm:  0 1px 2px rgba(0,0,0,.06);
  --shadow:     0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.06);
  --shadow-md:  0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:  0 12px 40px rgba(0,0,0,.14);

  --font:       'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
  --font-mono:  'JetBrains Mono', 'Consolas', monospace;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text-2);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--navy);
  min-height: 100vh;
  position: fixed;
  top: 0; left: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-logo .logo-icon-wrap {
  width: 38px; height: 38px;
  background: var(--blue);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.sidebar-logo .logo-title { font-size: 15px; font-weight: 800; color: #fff; letter-spacing: -.2px; }
.sidebar-logo .logo-sub   { font-size: 11px; color: rgba(255,255,255,.4); margin-top: 1px; }

.sidebar-nav { padding: 16px 12px; flex: 1; overflow-y: auto; }

.nav-section {
  padding: 10px 10px 5px;
  font-size: 10px; font-weight: 700;
  color: rgba(255,255,255,.3);
  letter-spacing: 1.4px; text-transform: uppercase;
  margin-top: 4px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  color: rgba(255,255,255,.6);
  text-decoration: none;
  font-size: 13.5px; font-weight: 500;
  border-radius: var(--radius);
  margin-bottom: 2px;
  transition: all .15s ease;
  white-space: nowrap;
}
.nav-item:hover  { background: rgba(255,255,255,.08); color: rgba(255,255,255,.9); }
.nav-item.active {
  background: rgba(37,99,235,.25);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--blue);
}
.nav-item .nav-icon {
  font-size: 15px; width: 18px; height: 18px; text-align: center;
  flex-shrink: 0; opacity: .9; display: block;
}

.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,.07);
  font-size: 11px; color: rgba(255,255,255,.25); text-align: center;
}

/* ── MAIN ── */
.main {
  margin-left: var(--sidebar-w);
  width: calc(100vw - var(--sidebar-w));
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── TOPBAR ── */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky; top: 0; z-index: 50;
  width: 100%;
}
.topbar-left  { flex: 1; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.topbar-title {
  font-size: 17px; font-weight: 700; color: var(--text-1);
  white-space: nowrap; letter-spacing: -.3px;
}
.topbar-sub { font-size: 12px; color: var(--text-3); line-height: 1.4; }

/* ── CONTENT ── */
.content { padding: 28px; flex: 1; width: 100%; min-width: 0; }

/* ── CARDS ── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  width: 100%; min-width: 0;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.card-title {
  font-size: 14px; font-weight: 700; color: var(--text-1);
  white-space: nowrap; letter-spacing: -.1px;
}
.card-body { padding: 20px; }

/* ── STAT KARTICE ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: var(--accent, var(--blue));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.stat-icon  { font-size: 22px; margin-bottom: 12px; display: block; }
.stat-value {
  font-size: 30px; font-weight: 800; color: var(--text-1);
  line-height: 1; letter-spacing: -1px;
  font-family: var(--font-mono);
}
.stat-label {
  font-size: 11px; font-weight: 600; color: var(--text-3);
  margin-top: 5px; text-transform: uppercase; letter-spacing: .6px;
}

/* ── TABLICE ── */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  background: var(--bg);
  color: var(--text-3);
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px;
  padding: 11px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
tbody td {
  padding: 13px 16px;
  color: var(--text-2);
  vertical-align: middle;
  white-space: nowrap;
  line-height: 1.5;
}
tbody td:first-child { font-weight: 600; color: var(--text-1); }
td.td-wrap { white-space: normal; word-break: break-word; }
td.td-akcije, th.td-akcije { white-space: nowrap; width: 1%; }

/* ── BADGE ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px; font-weight: 600;
  white-space: nowrap; line-height: 1.4;
}
.badge-green  { background: var(--green-bg);  color: var(--green);  border: 1px solid var(--green-bd); }
.badge-red    { background: var(--red-bg);    color: var(--red);    border: 1px solid var(--red-bd); }
.badge-amber  { background: var(--amber-bg);  color: var(--amber);  border: 1px solid var(--amber-bd); }
.badge-slate  { background: var(--bg);        color: var(--text-3); border: 1px solid var(--border); }
.badge-blue   { background: var(--blue-light);color: var(--blue);   border: 1px solid var(--blue-mid); }
.badge-purple { background: var(--purple-bg); color: var(--purple); border: 1px solid var(--purple-bd); }

/* ── GUMBI ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius);
  font-size: 13px; font-weight: 600;
  font-family: var(--font);
  cursor: pointer; border: none; text-decoration: none;
  transition: all .15s ease;
  white-space: nowrap; flex-shrink: 0;
  line-height: 1.4;
}
.btn-primary   { background: var(--blue); color: #fff; box-shadow: 0 1px 2px rgba(37,99,235,.3); }
.btn-primary:hover  { background: var(--blue-hover); box-shadow: 0 4px 12px rgba(37,99,235,.35); }
.btn-secondary {
  background: var(--surface); color: var(--text-2);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { border-color: var(--border-2); background: var(--bg); }
.btn-danger  { background: var(--red-bg);   color: var(--red);   border: 1px solid var(--red-bd); }
.btn-danger:hover  { background: #fee2e2; }
.btn-warning { background: #fffbeb; color: #d97706; border: 1px solid #fcd34d; }
.btn-warning:hover { background: #fef3c7; }
.btn-success { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-bd); }
.btn-success:hover { background: #d1fae5; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-xs { padding: 4px 9px;  font-size: 11.5px; border-radius: var(--radius-sm); }
.akcije-group { display: flex; gap: 4px; align-items: center; }

/* ── FORME ── */
.form-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-full   { grid-column: 1 / -1; }
.form-group  { display: flex; flex-direction: column; gap: 5px; }
.form-label  {
  font-size: 12px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .5px;
}
.form-control {
  padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px; font-family: var(--font);
  color: var(--text-1); background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  width: 100%; line-height: 1.5;
}
.form-control:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-control::placeholder { color: var(--text-4); }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-page          { max-width: 860px; }
.form-section       { margin-bottom: 28px; }
.form-section-title {
  font-size: 11px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 16px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ── FILTER BAR ── */
.filter-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search-wrap { position: relative; }
.search-wrap .form-control { padding-left: 36px; min-width: 200px; }
.search-icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--text-4); font-size: 14px; pointer-events: none;
}
.filter-select {
  padding: 9px 13px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-family: var(--font); font-size: 13.5px;
  color: var(--text-1); background: var(--surface);
  cursor: pointer; max-width: 210px; line-height: 1.5;
}
.filter-select:focus { outline: none; border-color: var(--blue); }

/* ── ALERT ── */
.alert {
  padding: 12px 16px; border-radius: var(--radius);
  font-size: 13.5px; font-weight: 500;
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
  line-height: 1.5;
}
.alert-warning { background: var(--amber-bg); color: #92400e; border: 1px solid var(--amber-bd); }
.alert-danger  { background: var(--red-bg);   color: #991b1b; border: 1px solid var(--red-bd); }
.alert-success { background: var(--green-bg); color: #065f46; border: 1px solid var(--green-bd); }

/* ── DASHBOARD ── */
.dash-grid   { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.dash-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

/* ── IZVJEŠTAJI ── */
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.report-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.report-card:hover { border-color: var(--blue); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.report-card-icon  { font-size: 28px; }
.report-card-title { font-size: 15px; font-weight: 700; color: var(--text-1); }
.report-card-desc  { font-size: 13px; color: var(--text-3); flex: 1; line-height: 1.5; }

/* ── TABOVI ── */
.tabs {
  display: flex; gap: 2px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px; flex-wrap: wrap;
}
.tab-btn {
  padding: 10px 18px; font-size: 13.5px; font-weight: 600;
  color: var(--text-3); background: none; border: none; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  font-family: var(--font); transition: all .15s; white-space: nowrap;
  line-height: 1.5;
}
.tab-btn:hover  { color: var(--text-1); }
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }
.tab-content        { display: none; }
.tab-content.active { display: block; }

/* ── PROGRESS ── */
.progress     { height: 5px; background: var(--border); border-radius: 99px; }
.progress-bar { height: 100%; background: var(--blue); border-radius: 99px; transition: width .4s; }

/* ── UTILITY ── */
.mono            { font-family: var(--font-mono); font-size: 12.5px; }
.text-muted      { color: var(--text-3); font-size: 13px; }
.mt-4            { margin-top: 16px; }
.mt-6            { margin-top: 24px; }
.flex            { display: flex; }
.gap-2           { gap: 8px; }
.items-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full          { width: 100%; }

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
  .dash-grid   { grid-template-columns: 1fr; }
  .dash-grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 500;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 499;
  }
  .sidebar-overlay.active { display: block; }
  .main         { margin-left: 0; width: 100vw; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .dash-grid-3  { grid-template-columns: 1fr; }
  .content      { padding: 16px; }
  .topbar       { padding: 0 12px; }
  .stats-grid   { grid-template-columns: repeat(2, 1fr); }
}

/* ── LUCIDE IKONE ── */
.nav-icon {
  width: 17px !important;
  height: 17px !important;
  flex-shrink: 0;
  stroke-width: 2;
}
[data-lucide] {
  display: inline-block;
  vertical-align: middle;
}
.btn [data-lucide], .btn i {
  width: 15px !important;
  height: 15px !important;
  flex-shrink: 0;
}
.btn-sm [data-lucide], .btn-sm i {
  width: 14px !important;
  height: 14px !important;
}
.btn-xs [data-lucide], .btn-xs i {
  width: 13px !important;
  height: 13px !important;
}

/* ── USER MENU ── */
.user-menu {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--border);
  border-radius: 99px;
  cursor: pointer;
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  user-select: none;
}
.user-menu:hover { border-color: var(--border-2); box-shadow: var(--shadow-sm); }
.user-avatar {
  width: 30px; height: 30px;
  background: var(--blue); color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  flex-shrink: 0;
}
.user-info { line-height: 1.2; }
.user-name  { font-size: 13px; font-weight: 600; color: var(--text-1); }
.user-role  { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.user-role.role-admin     { color: var(--red); }
.user-role.role-moderator { color: var(--blue); }
.user-role.role-user      { color: var(--text-3); }

.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px); right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  z-index: 200;
  overflow: hidden;
}
.user-dropdown.open { display: block; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px;
  font-size: 13.5px; font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  transition: background .1s;
}
.dropdown-item:hover { background: var(--bg); }
.dropdown-item-danger { color: var(--red); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* Stat card hover */
a.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* Nav icon SVG */
.nav-icon {
  width: 17px; height: 17px;
  flex-shrink: 0; stroke-width: 2;
}

/* Klijent lock - disabled stanje za forme */
.form-control:disabled {
  background: #f8fafc !important;
  color: #94a3b8 !important;
  cursor: not-allowed !important;
  opacity: 0.6;
}
select#klijent_sel option[disabled] {
  color: var(--text-3);
  font-style: italic;
}
/* Alert */
.alert-success {
  background: #d1fae5;
  border: 1px solid #6ee7b7;
  color: #065f46;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
}

