@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --bg: #1e2130;
  --bg-panel: #262b3d;
  --bg-card: #2d3349;
  --bg-input: #2a2f42;
  --bg-hover: #323858;
  --bg-selected: #2a3f6b;
  --border: rgba(255,255,255,0.12);
  --border-focus: rgba(82,153,255,0.7);
  --accent: #5299ff;
  --accent-soft: rgba(82,153,255,0.15);
  --accent-glow: rgba(82,153,255,0.3);
  --text-primary: #f0f3f8;
  --text-secondary: #b0bac8;
  --text-muted: #6e7a8a;
  --success: #4ec97b;
  --warning: #e0aa3e;
  --danger: #f87171;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --font: 'IBM Plex Sans', -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
  --shadow-panel: 0 4px 24px rgba(0,0,0,0.3);
  --transition: 0.15s ease;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ─── HEADER / NAV ─── */
header {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

nav.navtop {
  height: 56px !important;
  background: var(--bg-panel) !important;
  border-bottom: 1px solid var(--border) !important;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex !important;
  align-items: center;
  padding: 0 24px;
}

nav.navtop > div {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 0;
}

/* Logo */
nav.navtop h1 {
  font-size: 0;
  margin: 0;
  padding: 0;
  line-height: 1;
  margin-right: auto;
}

nav.navtop h1 a {
  display: flex;
  align-items: center;
  text-decoration: none;
}

nav.navtop h1 img {
  height: 32px;
  width: auto;
  display: block;
}

/* Nav links */
nav.navtop a {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 400;
  padding: 0 14px;
  height: 56px;
  border-left: 1px solid var(--border);
  transition: color var(--transition), background var(--transition);
  white-space: nowrap;
}

nav.navtop a:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* FontAwesome icons in nav */
nav.navtop a .fas,
nav.navtop a .far,
nav.navtop a .fa {
  font-size: 14px;
  opacity: 0.6;
}

/* User link — no left border for first nav link after logo */
nav.navtop a:first-of-type {
  border-left: 1px solid var(--border);
}

/* Logout link gets a subtle danger tint on hover */
nav.navtop a[href="logout.php"]:hover {
  color: var(--danger);
  background: rgba(248,81,73,0.06);
}

/* ─── LAYOUT ─── */
.mainbody {
  padding: 24px;
  max-width: 1600px;
  margin: 0 auto;
  padding-bottom: 60px;
}

.mainbody .row { margin: 0; }
.clearfix::after { content: ''; display: table; clear: both; }

/* ─── PANELS ─── */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-panel);
  margin-bottom: 20px;
}

.panel-primary { border-top: 2px solid var(--accent); }

.panel-heading {
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-heading::before {
  content: '';
  display: block;
  width: 3px;
  height: 18px;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}

.panel-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 0;
}

.panel-body {
  padding: 20px;
}

/* ─── SEARCH CONTROLS ─── */
.search-bar {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 380px;
}

.search-input-wrap::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' fill='none' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='8' stroke='%238b949e' stroke-width='2'/%3E%3Cpath d='M21 21l-4.35-4.35' stroke='%238b949e' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center;
  pointer-events: none;
}

#keyword_input {
  width: 100%;
  height: 36px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  padding: 0 12px 0 36px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

#keyword_input::placeholder { color: var(--text-muted); }
#keyword_input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

select.form-control {
  height: 36px !important;
  width: 180px !important;
  max-width: 180px !important;
  background: var(--bg-input) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-md) !important;
  color: var(--text-primary) !important;
  font-family: var(--font);
  font-size: 13px;
  padding: 0 10px;
  cursor: pointer;
  min-width: 0 !important;
  flex-shrink: 0;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23b0bac8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  padding-right: 28px !important;
  transition: border-color var(--transition);
}

select.form-control:focus { border-color: var(--border-focus) !important; box-shadow: 0 0 0 3px var(--accent-glow) !important; }

/* ─── GLOBAL INPUT/SELECT DARK OVERRIDE (beats Bootstrap) ─── */
input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]),
textarea,
select {
  background-color: var(--bg-input) !important;
  color: var(--text-primary) !important;
  border-color: var(--border) !important;
}

input:not([type="checkbox"]):not([type="radio"])::placeholder {
  color: var(--text-muted) !important;
}

.btn-info, .btn.btn-sm.btn-info {
  height: 36px;
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background var(--transition), transform var(--transition);
  white-space: nowrap;
}

.btn-info:hover { background: #4a9eff; }
.btn-info:active { transform: scale(0.97); }

/* ─── FILTER TABLE ─── */
.filter {
  margin: 0;
  width: auto;
}

.filter td {
  padding: 4px 12px 4px 0;
  color: var(--text-secondary);
  font-size: 12px;
  white-space: nowrap;
  vertical-align: middle;
}

.filter input[type="number"] {
  width: 68px;
  height: 28px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 0 8px;
  outline: none;
  transition: border-color var(--transition);
}

.filter input[type="number"]:focus { border-color: var(--border-focus); }

.filter input[type="checkbox"] {
  appearance: none;
  width: 14px;
  height: 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  vertical-align: middle;
  position: relative;
  transition: background var(--transition), border-color var(--transition);
  margin-right: 4px;
}

.filter input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.filter input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 2px;
  top: 0px;
  width: 8px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg);
}

/* ─── SEARCH ROW ─── */
.col-lg-6.pull-left {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 !important;
}

.iskalnik {
  margin-top: 0 !important;
}

/* ─── TABLE ─── */
.table-responsive {
  overflow-y: auto;
  max-height: 520px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-top: 12px;
}

.table-responsive::-webkit-scrollbar { width: 6px; height: 6px; }
.table-responsive::-webkit-scrollbar-track { background: transparent; }
.table-responsive::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.table-responsive::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

#table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

#table thead tr th {
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 2;
  white-space: nowrap;
  transform: none !important; /* override old translateY hack */
}

#table thead tr th:first-child { border-radius: var(--radius-md) 0 0 0; }
#table thead tr th:last-child { border-radius: 0 var(--radius-md) 0 0; }

#table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  cursor: pointer;
  height: auto;
  background: var(--bg-panel) !important;
}

#table tbody tr:nth-child(odd) { background: var(--bg-panel) !important; }
#table tbody tr:nth-child(even) { background: var(--bg-card) !important; }

#table tbody tr:last-child { border-bottom: none; }

#table tbody tr:hover,
#table tbody tr:hover td,
.table-striped > tbody > tr:hover > td,
.table-hover > tbody > tr:hover > td {
  background: var(--bg-hover) !important;
}

#table tbody tr.selected td,
.table-striped > tbody > tr.selected > td,
.table-striped > tbody > tr.selected > th {
  background: var(--bg-selected) !important;
}

#table tbody tr td {
  padding: 9px 14px;
  color: var(--text-primary);
  vertical-align: middle;
  border: none !important;
  line-height: 1.4;
  background: inherit !important;
}

#table tbody tr td:nth-child(7),
#table tbody tr td:nth-child(8) {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--success);
  text-align: right;
  white-space: nowrap;
  min-width: 110px;
}

/* Kill Bootstrap table-bordered outer border */
#table.table-bordered,
.table-bordered {
  border: none !important;
}

/* Price column styling — no cell borders */
.table-bordered > thead > tr > th,
.table-bordered > tbody > tr > th,
.table-bordered > tfoot > tr > th,
.table-bordered > thead > tr > td,
.table-bordered > tbody > tr > td,
.table-bordered > tfoot > tr > td {
  border: none !important;
  text-align: left;
}


/* Stock */
#table tbody tr td:nth-child(5) {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}

/* ─── NO RESULTS ─── */
.well.well-lg {
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  letter-spacing: 0.03em;
  margin-top: 12px;
}

/* ─── RESULT COUNTER ─── */
.result-count {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 8px 0 0;
  font-family: var(--font-mono);
}

.result-count span {
  color: var(--accent);
  font-weight: 500;
}

/* ─── ARTICLE DETAIL PANEL ─── */

/* Three-column grid rows */
.detail-thirds {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px 20px;
}

.detail-thirds--bottom {
  align-items: start;
  margin-top: 4px;
}

/* Single column within a grid cell */
.detail-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Full-width row */
.detail-full {
  display: flex !important;
  grid-column: 1 / -1;
}

/* Individual label+input pair */
.detail-field {
  display: flex;
  align-items: center;
  gap: 0;
}

.detail-field label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  width: 110px;
  text-align: right;
  padding-right: 10px;
}

.detail-field input {
  flex: 1;
  min-width: 0;
  background: var(--bg-input) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--text-secondary) !important;
  font-family: var(--font);
  font-size: 12.5px;
  padding: 5px 10px;
  outline: none;
  box-shadow: none !important;
  transition: border-color var(--transition);
}

.detail-field input[readonly] { cursor: default; }
.detail-field input:focus { border-color: var(--border-focus) !important; }

/* Wide inputs (naziv, url) */
.detail-full .detail-field,
.detail-full input {
  width: 100%;
  flex: 1;
}

/* Wide label for naziv/url matches other fields */
.detail-full label {
  width: 110px;
}


/* ─── IMAGE AREA ─── */
#slika {
  max-width: 100%;
  max-height: 220px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  display: none;
  margin-top: 8px;
}

.img-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  min-height: 260px;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
}

/* ─── TEXTAREA (OPIS) ─── */
#opis {
  flex: 1;
  width: 100%;
  min-height: 260px;
  background: var(--bg-input) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-md);
  color: var(--text-secondary) !important;
  font-family: var(--font);
  font-size: 12px;
  padding: 10px 12px;
  resize: vertical;
  outline: none;
  box-shadow: none !important;
  line-height: 1.6;
  transition: border-color var(--transition);
  margin-top: 4px;
}

#opis:focus { border-color: var(--border-focus); }

/* ─── OPIS SECTION LABEL ─── */
.section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}

/* ─── ALERTS ─── */
.alert {
  padding: 10px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 13px;
  border: 1px solid;
}
.alert-danger { background: rgba(248,81,73,0.1); border-color: rgba(248,81,73,0.3); color: #f85149; }
.alert-success { background: rgba(63,185,80,0.1); border-color: rgba(63,185,80,0.3); color: #3fb950; }
.alert-warning { background: rgba(210,153,34,0.1); border-color: rgba(210,153,34,0.3); color: #d29922; }
.alert .close { float: right; background: none; border: none; color: inherit; cursor: pointer; font-size: 16px; line-height: 1; padding: 0; }

/* ─── FOOTER ─── */
.footer {
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  padding: 14px 24px;
  text-align: center;
}

.copyright { color: var(--text-muted); font-size: 12px; }
.copyright a { color: var(--text-secondary); text-decoration: none; }
.copyright a:hover { color: var(--text-primary); }

/* ─── BREADCRUMB ─── */
.breadcrumb {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin: 0 0 16px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.breadcrumb li { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }
.breadcrumb .divider { color: var(--text-muted); }
.breadcrumb .active a { color: var(--text-secondary); text-decoration: none; }

/* ─── PAGE HEADER ─── */
.page-header {
  margin-top: 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.page-header h1 {
  font-size: 20px;
  font-weight: 500;
  color: var(--text-primary);
  margin-top: 0;
}

/* ─── FORM LAYOUT FIXES ─── */
form > .col-lg-6.pull-left {
  padding: 0 !important;
}

.col-lg-12 { padding-left: 0; padding-right: 0; }
.col-lg-6 { padding: 0; }

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  .mainbody { padding: 12px; }
  .detail-thirds { grid-template-columns: 1fr; }
}

/* ─── SCROLLBAR GLOBAL ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ─── LOGIN PAGE ─── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  box-shadow: var(--shadow-panel);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo img {
  /* height: 40px; */
  width: auto;
}

.login-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  margin: 0 0 24px;
  letter-spacing: 0.02em;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-field {
  position: relative;
}

.login-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13px;
  pointer-events: none;
}

.login-field input {
  width: 100% !important;
  height: 42px;
  background: var(--bg-input) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-md) !important;
  color: var(--text-primary) !important;
  font-family: var(--font);
  font-size: 13px;
  padding: 0 14px 0 38px;
  outline: none;
  box-shadow: none !important;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.login-field input::placeholder { color: var(--text-muted) !important; }

.login-field input:focus {
  border-color: var(--border-focus) !important;
  box-shadow: 0 0 0 3px var(--accent-glow) !important;
}

.login-btn {
  width: 100%;
  height: 42px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: background var(--transition), transform var(--transition);
  margin-top: 4px;
}

.login-btn:hover { background: #6aaaff; }
.login-btn:active { transform: scale(0.98); }
