/* ─────────────────────────────────────────────
   BLAG.EU – Glavni CSS
   ───────────────────────────────────────────── */

:root {
  --sidebar-w: 260px;
  --topbar-h: 56px;
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --sidebar-bg: #1e1b4b;
  --sidebar-text: rgba(255,255,255,0.8);
  --sidebar-hover: rgba(255,255,255,0.1);
  --sidebar-active: rgba(99,102,241,0.4);
  --border: #e2e8f0;
}

*, *::before, *::after { box-sizing: border-box; }

body.blag-app {
  margin: 0;
  background: var(--bg);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
}

/* ── Sidebar ────────────────────────────────── */
.blag-sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 1000;
  transition: transform 0.3s ease;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.25rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: #fff;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.sidebar-brand i {
  background: var(--primary);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.brand-dot { color: #a5b4fc; }

.sidebar-toggle {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 1.25rem;
  cursor: pointer;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.avatar {
  width: 38px;
  height: 38px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
  flex-shrink: 0;
  text-transform: uppercase;
}

.sidebar-user .fw-semibold { color: #fff; font-size: 0.9rem; }
.sidebar-user .text-muted { color: rgba(255,255,255,0.5) !important; font-size: 0.78rem; }

.sidebar-nav {
  list-style: none;
  padding: 0.75rem 0;
  margin: 0;
  flex: 1;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 1.25rem;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.88rem;
  border-radius: 6px;
  margin: 1px 0.5rem;
  transition: background 0.15s, color 0.15s;
}

.sidebar-nav li a:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.sidebar-nav li a.active {
  background: var(--sidebar-active);
  color: #fff;
  font-weight: 600;
}

.sidebar-nav li a i {
  font-size: 1rem;
  width: 18px;
  flex-shrink: 0;
  opacity: 0.8;
}

.sidebar-nav li a.active i { opacity: 1; }

.nav-label {
  padding: 0.75rem 1.25rem 0.25rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.35);
  margin-top: 0.25rem;
}

/* ── Main Content ────────────────────────────── */
.blag-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.blag-topbar {
  height: var(--topbar-h);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  position: sticky;
  top: 0;
  z-index: 999;
}

.blag-topbar button {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--sidebar-bg);
}

.blag-content {
  padding: 1.5rem;
  flex: 1;
}

/* ── Page Header ────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.page-header h2 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  color: #1e1b4b;
}

/* ── Stat Cards ──────────────────────────────── */
.stat-card {
  border-radius: 14px;
  padding: 1.25rem;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.stat-card .stat-icon {
  font-size: 2rem;
  opacity: 0.25;
  position: absolute;
  right: 1rem;
  top: 1rem;
}

.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat-card .stat-label {
  font-size: 0.82rem;
  opacity: 0.85;
}

.stat-card .stat-sub {
  font-size: 0.78rem;
  opacity: 0.7;
  margin-top: 0.15rem;
}

.stat-card .stat-sub a { color: rgba(255,255,255,0.85); }

.stat-blue   { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.stat-green  { background: linear-gradient(135deg, #10b981, #059669); }
.stat-purple { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.stat-orange { background: linear-gradient(135deg, #f59e0b, #d97706); }

/* ── Cards ──────────────────────────────────── */
.card {
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  background: var(--card-bg);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.875rem 1rem;
}

.hover-card {
  transition: box-shadow 0.2s, transform 0.2s;
}

.hover-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

/* ── Tables ─────────────────────────────────── */
.table thead th {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  border-bottom-width: 1px;
  padding: 0.65rem 1rem;
  background: #f8fafc;
}

.table td {
  padding: 0.7rem 1rem;
  font-size: 0.88rem;
  vertical-align: middle;
}

.table-hover tbody tr:hover { background: #f0f4ff; }

/* ── Status badges ───────────────────────────── */
.badge.status-nacrt       { background-color: #94a3b8; }
.badge.status-izdano      { background-color: #6366f1; }
.badge.status-placeno     { background-color: #10b981; }
.badge.status-stornirano  { background-color: #ef4444; }
.badge.status-knjizeno    { background-color: #10b981; }
.badge.status-otvorena    { background-color: #f59e0b; }
.badge.status-zakljucena  { background-color: #10b981; }

/* ── Login Page ──────────────────────────────── */
body.blag-login-page {
  background: linear-gradient(135deg, #1e1b4b 0%, #4f46e5 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-container {
  width: 100%;
  max-width: 420px;
  padding: 1rem;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 2.5rem 2rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo i {
  font-size: 3rem;
  color: var(--primary);
}

.login-logo h1 {
  font-size: 2.2rem;
  font-weight: 900;
  color: #1e1b4b;
  margin: 0.25rem 0 0;
}

.login-logo h1 span { color: var(--primary); }

.login-logo p {
  color: #94a3b8;
  font-size: 0.9rem;
  margin: 0;
}

/* ── Autocomplete ────────────────────────────── */
.autocomplete-results {
  position: absolute;
  z-index: 1050;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  max-height: 200px;
  overflow-y: auto;
  min-width: 300px;
}

.autocomplete-item {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.88rem;
  transition: background 0.1s;
}

.autocomplete-item:hover { background: #f0f4ff; }

/* ── POS ─────────────────────────────────────── */
.pos-artikl-btn {
  min-height: 64px;
  border-radius: 8px;
  padding: 0.5rem;
}

/* ── Mobile ──────────────────────────────────── */
@media (max-width: 991px) {
  .blag-sidebar {
    transform: translateX(-100%);
  }
  .blag-sidebar.open {
    transform: translateX(0);
  }
  .blag-main {
    margin-left: 0;
  }
}

/* ── Print ───────────────────────────────────── */
@media print {
  .blag-sidebar, .blag-topbar, .page-header .btn, .btn, nav { display: none !important; }
  .blag-main { margin: 0; }
  .blag-content { padding: 0; }
}
