/* ══════════════════════════════════════════════════════
   POLYCORE MANAGER — Design System
   Baziran na Polycore admin stilu (#0a0a0a, #e8ff4d)
══════════════════════════════════════════════════════ */

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

/* ── TOKENS ─────────────────────────────────────────── */
:root {
  --bg:       #0a0a0a;
  --bg2:      #111111;
  --bg3:      #1a1a1a;
  --bg4:      #222222;
  --border:   #2a2a2a;
  --border2:  #333333;
  --text:     #f0f0f0;
  --text2:    #cccccc;
  --muted:    #888888;
  --muted2:   #555555;
  --accent:   #e8ff4d;
  --accent-d: #c8df2d;
  --red:      #ef4444;
  --green:    #22c55e;
  --yellow:   #eab308;
  --blue:     #3b82f6;
  --r:        10px;
  --sb-w:     220px;
  --tr:       0.15s ease;
}

/* ── BASE ────────────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
  font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-d); }

/* ══════════════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════════════ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sb-w);
  height: 100vh;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform var(--tr);
}

/* Logo */
.sb-logo {
  padding: 1.2rem 1.35rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text);
  user-select: none;
}

.sb-logo-mark {
  width: 28px; height: 28px;
  background: var(--accent);
  color: #000;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900;
  font-size: 0.82rem;
  flex-shrink: 0;
  letter-spacing: -0.03em;
}

.sb-logo-text b {
  font-size: 0.88rem;
  font-weight: 800;
  display: block;
  letter-spacing: -0.02em;
  color: var(--text);
}

.sb-logo-text small {
  font-size: 0.62rem;
  color: var(--muted2);
  display: block;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: -1px;
}

/* Nav scroll area */
.sb-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
  scrollbar-width: none;
}
.sb-nav::-webkit-scrollbar { display: none; }

/* Section label */
.sb-section {
  padding: 0.65rem 1.35rem 0.2rem;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted2);
}

/* Nav item */
.sb-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.62rem 1.35rem;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: color var(--tr), background var(--tr);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  position: relative;
}

.sb-item:hover {
  color: var(--text);
  background: var(--bg3);
}

.sb-item.active {
  color: var(--accent);
  background: rgba(232, 255, 77, 0.07);
}

.sb-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 60%;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.sb-item i {
  font-size: 15px;
  flex-shrink: 0;
  opacity: 0.55;
  width: 16px;
  text-align: center;
}
.sb-item.active i { opacity: 1; }
.sb-item:hover i  { opacity: 0.8; }

/* Badge na nav itemu (npr. broj upozorenja) */
.sb-badge {
  margin-left: auto;
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 12px;
  padding: 0.05rem 0.45rem;
  font-size: 0.65rem;
  font-weight: 700;
}

/* Footer */
.sb-foot {
  padding: 0.9rem 1.35rem;
  border-top: 1px solid var(--border);
}

.sb-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--muted2);
  font-size: 0.72rem;
}

.sb-user-avatar {
  width: 24px; height: 24px;
  background: var(--bg3);
  border-radius: 50%;
  border: 1px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
  text-transform: uppercase;
}

.sb-user-name {
  font-weight: 500;
  color: var(--muted);
  font-size: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ══════════════════════════════════════════════════════
   TOPBAR (mobile only)
══════════════════════════════════════════════════════ */
.topbar {
  display: none;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-logo-mark {
  width: 24px; height: 24px;
  background: var(--accent);
  color: #000;
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900;
  font-size: 0.72rem;
  flex-shrink: 0;
}

.topbar-title {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  flex: 1;
}

.burger {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.3rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-left: auto;
}

.burger span {
  display: block;
  width: 18px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform var(--tr), opacity var(--tr);
}

/* ══════════════════════════════════════════════════════
   MAIN WRAPPER
══════════════════════════════════════════════════════ */
.main-wrap {
  margin-left: var(--sb-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-wrap {
  flex: 1;
  padding: 2rem 2.25rem;
}

/* Mobile backdrop */
.mob-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 150;
  backdrop-filter: blur(3px);
  cursor: pointer;
}
.mob-backdrop.show { display: block; }

/* ══════════════════════════════════════════════════════
   FLASH MESSAGES
══════════════════════════════════════════════════════ */
.flash-wrap {
  padding: 1rem 2.25rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.flash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  animation: flashIn 0.2s ease;
}

@keyframes flashIn {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

.flash-success { background: #052e16; border: 1px solid #166534; color: #86efac; }
.flash-danger  { background: #450a0a; border: 1px solid #991b1b; color: #fca5a5; }
.flash-warning { background: #422006; border: 1px solid #92400e; color: #fcd34d; }
.flash-info    { background: #0c1a4b; border: 1px solid #1e40af; color: #93c5fd; }

.flash-close {
  background: none; border: none;
  cursor: pointer; color: inherit;
  opacity: 0.6; font-size: 1.1rem;
  line-height: 1; padding: 0; margin-left: 0.75rem;
}
.flash-close:hover { opacity: 1; }

/* ══════════════════════════════════════════════════════
   PAGE HEADER
══════════════════════════════════════════════════════ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  margin: 0;
}

.page-subtitle {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.page-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}

/* ══════════════════════════════════════════════════════
   STATS GRID
══════════════════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.15rem 1.25rem;
  transition: border-color var(--tr);
}
.stat-card:hover { border-color: var(--border2); }

.stat-icon {
  width: 30px; height: 30px;
  background: var(--bg3);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 0.85rem;
  font-size: 0.88rem;
  color: var(--accent);
}

.stat-value {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text);
  margin-bottom: 0.15rem;
  line-height: 1;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ══════════════════════════════════════════════════════
   CARDS
══════════════════════════════════════════════════════ */
.pc-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  transition: border-color var(--tr);
}
.pc-card:hover { border-color: var(--border2); }

.pc-card-header {
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.pc-card-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.pc-card-body { padding: 1.25rem; }

.pc-card-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
}

/* ══════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════ */
.btn-pc {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.52rem 1rem;
  border-radius: 7px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--tr);
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
  font-family: inherit;
}

.btn-pc-primary {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}
.btn-pc-primary:hover {
  background: var(--accent-d);
  border-color: var(--accent-d);
  color: #000;
}

.btn-pc-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border2);
}
.btn-pc-ghost:hover {
  background: var(--bg3);
  color: var(--text);
  border-color: var(--border2);
}

.btn-pc-danger {
  background: rgba(239,68,68,0.12);
  color: var(--red);
  border-color: rgba(239,68,68,0.25);
}
.btn-pc-danger:hover {
  background: rgba(239,68,68,0.22);
}

.btn-pc-success {
  background: rgba(34,197,94,0.12);
  color: var(--green);
  border-color: rgba(34,197,94,0.25);
}
.btn-pc-success:hover {
  background: rgba(34,197,94,0.22);
}

.btn-pc-sm {
  padding: 0.32rem 0.7rem;
  font-size: 0.75rem;
  border-radius: 6px;
}

.btn-pc-lg {
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
  border-radius: 8px;
}

/* ══════════════════════════════════════════════════════
   TABLES
══════════════════════════════════════════════════════ */
.pc-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r);
}

.pc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}

.pc-table thead th {
  background: var(--bg3);
  padding: 0.7rem 1rem;
  text-align: left;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  border-bottom: 1px solid var(--border2);
  white-space: nowrap;
}

.pc-table tbody td {
  padding: 0.78rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text2);
  vertical-align: middle;
}

.pc-table tbody tr:last-child td { border-bottom: none; }
.pc-table tbody tr:hover td { background: rgba(255,255,255,0.018); }

/* ══════════════════════════════════════════════════════
   BADGES
══════════════════════════════════════════════════════ */
.badge-pc {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.55rem;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success { background: rgba(34,197,94,0.12); color: var(--green); border: 1px solid rgba(34,197,94,0.2); }
.badge-danger  { background: rgba(239,68,68,0.12);  color: var(--red);   border: 1px solid rgba(239,68,68,0.2); }
.badge-warning { background: rgba(234,179,8,0.12);  color: var(--yellow);border: 1px solid rgba(234,179,8,0.2); }
.badge-info    { background: rgba(59,130,246,0.12); color: var(--blue);  border: 1px solid rgba(59,130,246,0.2); }
.badge-neutral { background: var(--bg3); color: var(--muted); border: 1px solid var(--border2); }

/* Dot indicator */
.dot-indicator {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-success { background: var(--green); }
.dot-danger  { background: var(--red); }
.dot-warning { background: var(--yellow); }
.dot-neutral { background: var(--muted2); }

/* ══════════════════════════════════════════════════════
   FORMS (Bootstrap dark override)
══════════════════════════════════════════════════════ */
.form-control,
.form-select,
textarea.form-control {
  background: var(--bg3) !important;
  border: 1px solid var(--border2) !important;
  color: var(--text) !important;
  border-radius: 7px !important;
  font-size: 0.85rem !important;
  padding: 0.55rem 0.85rem !important;
  transition: border-color var(--tr), box-shadow var(--tr) !important;
  font-family: inherit !important;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(232,255,77,0.1) !important;
  outline: none !important;
  background: var(--bg4) !important;
}

.form-control::placeholder { color: var(--muted2) !important; }
.form-select option { background: var(--bg3); color: var(--text); }

.form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.35rem;
  display: block;
}

.form-text {
  color: var(--muted2) !important;
  font-size: 0.73rem !important;
}

.invalid-feedback { font-size: 0.75rem !important; }

/* Input group */
.input-group-text {
  background: var(--bg3) !important;
  border: 1px solid var(--border2) !important;
  color: var(--muted) !important;
  font-size: 0.85rem !important;
}

/* Checkbox / Radio */
.form-check-input {
  background-color: var(--bg3) !important;
  border-color: var(--border2) !important;
}
.form-check-input:checked {
  background-color: var(--accent) !important;
  border-color: var(--accent) !important;
}
.form-check-label {
  font-size: 0.83rem;
  color: var(--muted);
}

/* ══════════════════════════════════════════════════════
   SEARCH INPUT
══════════════════════════════════════════════════════ */
.search-wrap {
  position: relative;
}
.search-wrap .search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.85rem;
  pointer-events: none;
}
.search-input {
  padding-left: 2.2rem !important;
}

/* ══════════════════════════════════════════════════════
   ALERTS (Bootstrap override)
══════════════════════════════════════════════════════ */
.alert {
  border-radius: 8px !important;
  font-size: 0.82rem !important;
  padding: 0.7rem 1rem !important;
  border-width: 1px !important;
}
.alert-success { background: #052e16 !important; border-color: #166534 !important; color: #86efac !important; }
.alert-danger  { background: #450a0a !important; border-color: #991b1b !important; color: #fca5a5 !important; }
.alert-warning { background: #422006 !important; border-color: #92400e !important; color: #fcd34d !important; }
.alert-info    { background: #0c1a4b !important; border-color: #1e40af !important; color: #93c5fd !important; }

.alert .btn-close { filter: invert(1) grayscale(1) brightness(2) !important; opacity: 0.5 !important; }
.alert .btn-close:hover { opacity: 1 !important; }

/* ══════════════════════════════════════════════════════
   MODALS (Bootstrap override)
══════════════════════════════════════════════════════ */
.modal-content {
  background: var(--bg2) !important;
  border: 1px solid var(--border2) !important;
  border-radius: 12px !important;
  color: var(--text) !important;
}
.modal-header {
  border-bottom: 1px solid var(--border) !important;
  padding: 1.1rem 1.35rem !important;
}
.modal-footer {
  border-top: 1px solid var(--border) !important;
  padding: 0.85rem 1.35rem !important;
}
.modal-title {
  font-size: 0.95rem !important;
  font-weight: 700 !important;
  letter-spacing: -0.02em !important;
}
.btn-close {
  filter: invert(1) grayscale(1) brightness(2) !important;
  opacity: 0.45 !important;
}
.btn-close:hover { opacity: 1 !important; }

/* ══════════════════════════════════════════════════════
   DROPDOWNS (Bootstrap override)
══════════════════════════════════════════════════════ */
.dropdown-menu {
  background: var(--bg2) !important;
  border: 1px solid var(--border2) !important;
  border-radius: 8px !important;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5) !important;
  padding: 0.35rem !important;
  font-size: 0.82rem !important;
  min-width: 160px;
}
.dropdown-item {
  color: var(--muted) !important;
  border-radius: 5px !important;
  padding: 0.52rem 0.75rem !important;
  font-size: 0.82rem !important;
}
.dropdown-item:hover {
  background: var(--bg3) !important;
  color: var(--text) !important;
}
.dropdown-divider { border-color: var(--border) !important; margin: 0.3rem !important; }

/* ══════════════════════════════════════════════════════
   PAGINATION (Bootstrap override)
══════════════════════════════════════════════════════ */
.page-link {
  background: var(--bg2) !important;
  border-color: var(--border2) !important;
  color: var(--muted) !important;
  font-size: 0.8rem !important;
}
.page-link:hover {
  background: var(--bg3) !important;
  color: var(--text) !important;
}
.page-item.active .page-link {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #000 !important;
}
.page-item.disabled .page-link { opacity: 0.35 !important; }

/* ══════════════════════════════════════════════════════
   TABS (Bootstrap override)
══════════════════════════════════════════════════════ */
.nav-tabs {
  border-bottom: 1px solid var(--border) !important;
  gap: 0.1rem;
}
.nav-tabs .nav-link {
  color: var(--muted) !important;
  border: none !important;
  border-bottom: 2px solid transparent !important;
  padding: 0.6rem 0.85rem !important;
  font-size: 0.83rem !important;
  font-weight: 500 !important;
  border-radius: 0 !important;
  background: none !important;
  transition: color var(--tr), border-color var(--tr) !important;
}
.nav-tabs .nav-link:hover {
  color: var(--text) !important;
  border-bottom-color: var(--border2) !important;
}
.nav-tabs .nav-link.active {
  color: var(--accent) !important;
  border-bottom-color: var(--accent) !important;
}
.tab-content { padding-top: 1.25rem; }

/* ══════════════════════════════════════════════════════
   EMPTY STATE
══════════════════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--muted);
}
.empty-state i {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  display: block;
  opacity: 0.35;
}
.empty-state p { font-size: 0.85rem; }
.empty-state small { font-size: 0.75rem; color: var(--muted2); }

/* ══════════════════════════════════════════════════════
   DIVIDER
══════════════════════════════════════════════════════ */
.pc-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* ══════════════════════════════════════════════════════
   MISC UTILITIES
══════════════════════════════════════════════════════ */
.text-accent  { color: var(--accent) !important; }
.text-muted-pc{ color: var(--muted) !important; }
.text-success-pc { color: var(--green) !important; }
.text-danger-pc  { color: var(--red) !important; }
.text-warning-pc { color: var(--yellow) !important; }

.bg-pc2 { background: var(--bg2); }
.bg-pc3 { background: var(--bg3); }

/* Avatar initials */
.avatar-sm {
  width: 30px; height: 30px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
  text-transform: uppercase;
}

/* Item image thumb */
.item-thumb {
  width: 36px; height: 36px;
  border-radius: 7px;
  object-fit: cover;
  border: 1px solid var(--border2);
  background: var(--bg3);
  flex-shrink: 0;
}

/* Spinner */
.pc-spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.12);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════
   SCROLLBAR
══════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #444; }

/* ══════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════ */
@media (max-width: 960px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 10px 0 40px rgba(0,0,0,0.6);
  }
  .main-wrap { margin-left: 0; }
  .topbar { display: flex; }
  .page-wrap { padding: 1.5rem 1.25rem; }
  .flash-wrap { padding: 0.75rem 1.25rem 0; }
}

@media (max-width: 540px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-title { font-size: 1.2rem; }
  .page-header { margin-bottom: 1.25rem; }
}
