@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,200..800;1,200..800&display=swap');

/* ── CSS Variables ─────────────────────────────────── */
:root {
  --primary:       #4F46E5;
  --primary-dark:  #4338CA;
  --primary-light: #EEF2FF;
  --sidebar-bg:    #0F172A;
  --sidebar-width: 220px;
  --body-bg:       #F1F5F9;
  --card-bg:       #FFFFFF;
  --text:          #1E293B;
  --text-muted:    #64748B;
  --border:        #E2E8F0;
  --success:       #10B981;
  --warning:       #F59E0B;
  --danger:        #EF4444;
  --radius:        12px;
  --shadow:        0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:     0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
}

/* ── Reset ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0;   font-family: "Plus Jakarta Sans", sans-serif !important;
 background: var(--body-bg); color: var(--text); font-size: 14px; }
a { color: var(--primary); text-decoration: none; }

/* ── Layout ────────────────────────────────────────── */
.layout-wrapper { display: flex; min-height: 100vh; }
.sidebar-col    { width: var(--sidebar-width); flex-shrink: 0; transition: width .25s ease; }
.main-col       { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#mainWrap       { flex: 1; padding: 24px; }

/* ── Sidebar ────────────────────────────────────────── */
#sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  z-index: 1000; transition: width .25s ease; overflow: hidden;
}
#sidebar .sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 16px; border-bottom: 1px solid rgba(255,255,255,.06);
}
#sidebar .brand-icon {
  width: 34px; height: 34px; background: var(--primary); border-radius: 8px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
#sidebar .brand-icon i { color: #fff; font-size: 16px; }
#sidebar .brand-text { color: #fff; font-weight: 700; font-size: 15px; white-space: nowrap; }
#sidebar .brand-sub  { color: rgba(255,255,255,.4); font-size: 10px; }
#sidebar .sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 8px; }
#sidebar .nav-section-label {
  color: rgba(255,255,255,.3); font-size: 10px; font-weight: 600;
  letter-spacing: .08em; padding: 8px 8px 4px; text-transform: uppercase;
}
#sidebar .nav-item { list-style: none; }
#sidebar .nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px; color: rgba(255,255,255,.6);
  font-size: 13.5px; font-weight: 500; transition: all .15s; white-space: nowrap;
}
#sidebar .nav-link:hover  { background: rgba(255,255,255,.07); color: #fff; }
#sidebar .nav-link.active { background: var(--primary); color: #fff; }
#sidebar .nav-link i      { font-size: 16px; flex-shrink: 0; width: 18px; text-align: center; }
#sidebar .sidebar-user {
  padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; gap: 10px; white-space: nowrap;
}
#sidebar .user-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 13px; flex-shrink: 0;
}
#sidebar .user-name { color: #fff; font-size: 13px; font-weight: 600; }
#sidebar .user-role { color: rgba(255,255,255,.4); font-size: 11px; }

/* Collapsed sidebar */
#sidebar.collapsed { width: 56px; }
#sidebar.collapsed .brand-text,
#sidebar.collapsed .brand-sub,
#sidebar.collapsed .nav-section-label,
#sidebar.collapsed .nav-link span,
#sidebar.collapsed .user-name,
#sidebar.collapsed .user-role { display: none; }
#sidebar.collapsed .nav-link { justify-content: center; padding: 9px; }
#sidebar.collapsed .sidebar-brand { justify-content: center; padding: 20px 0; }
#sidebar.collapsed .sidebar-user  { justify-content: center; padding: 12px 0; }

/* ── Topbar ─────────────────────────────────────────── */
#topbar {
  height: 56px; background: var(--card-bg); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 100;
}
#topbar .topbar-title { font-weight: 700; font-size: 16px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
#sidebarToggle {
  background: none; border: none; cursor: pointer; padding: 6px;
  border-radius: 6px; color: var(--text-muted); font-size: 18px;
}
#sidebarToggle:hover { background: var(--body-bg); }

/* ── Auth ─────────────────────────────────────────── */
.auth-wrapper {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--sidebar-bg);
}
.auth-card {
  background: #fff; border-radius: var(--radius); padding: 40px;
  width: 100%; max-width: 420px; box-shadow: var(--shadow-md);
}
.auth-logo     { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; font-weight: 700; font-size: 15px; }
.auth-title    { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.auth-subtitle { color: var(--text-muted); margin-bottom: 24px; }
.auth-link     { font-size: 13px; color: var(--primary); }
.form-control  { border-radius: 8px; border: 1px solid var(--border); padding: 9px 12px; font-size: 14px; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); outline: none; }
.form-label    { font-size: 13px; font-weight: 500; }
.btn-primary   { background: var(--primary); color: #fff; border: none; border-radius: 8px; padding: 10px 20px; font-weight: 600; font-size: 14px; cursor: pointer; width: 100%; transition: background .15s; }
.btn-primary:hover { background: var(--primary-dark); }

/* ── Table card ─────────────────────────────────────── */
.table-card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.table-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border); gap: 12px; flex-wrap: wrap;
}
.table-title   { font-weight: 700; font-size: 15px; }
.toolbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search-box {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 12px; background: var(--body-bg);
}
.search-box svg   { width: 15px; height: 15px; color: var(--text-muted); flex-shrink: 0; }
.search-box input { border: none; background: none; outline: none; font-size: 13px; width: 180px; }
.filter-select    { border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font-size: 13px; background: var(--body-bg); cursor: pointer; outline: none; }

/* ── Inventory table ─────────────────────────────────── */
#tableWrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.inv-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.inv-table thead th {
  background: #F8FAFC; color: var(--text-muted); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
  padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.inv-table tbody td { padding: 10px 12px; border-bottom: 1px solid #F1F5F9; vertical-align: middle; white-space: nowrap; }
.inv-table tbody td:first-child { white-space: normal; min-width: 140px; }
.inv-table tbody tr:last-child td { border-bottom: none; }
.inv-table tbody tr:hover td      { background: #FAFBFF; }

/* Badges */
.badge-instock { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; background: #DCFCE7; color: #16A34A; }
.badge-reorder { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; background: #FEF3C7; color: #D97706; }

.threshold-input, .defective-input {
  border: 1px solid var(--border); border-radius: 6px;
  padding: 4px 8px; font-size: 12px; text-align: center; transition: border-color .2s;
}
.threshold-input:focus, .defective-input:focus { outline: none; border-color: var(--primary); }

/* ── DataTables pagination — sidebar color ──────────── */
div.dataTables_wrapper div.dataTables_info { padding: 12px 20px; font-size: 12px; color: var(--text-muted); }
div.dataTables_wrapper div.dataTables_paginate { padding: 12px 20px; }
div.dataTables_wrapper div.dataTables_paginate .pagination { gap: 4px; flex-wrap: wrap; margin: 0; }

div.dataTables_wrapper .page-item .page-link {
  border-radius: 8px !important;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  background: var(--card-bg);
  transition: all .15s;
  box-shadow: none;
}
div.dataTables_wrapper .page-item .page-link:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}
div.dataTables_wrapper .page-item.active .page-link,
div.dataTables_wrapper .page-item.active .page-link:hover,
div.dataTables_wrapper .page-item.active .page-link:focus {
  background-color: #0F172A !important;
  border-color: #0F172A !important;
  color: #ffffff !important;
  box-shadow: none !important;
}
div.dataTables_wrapper .page-item.disabled .page-link { opacity: .4; pointer-events: none; }

/* ── DataTables Responsive + button ─────────────────── */
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control {
  cursor: pointer;
  position: relative;
  padding-left: 32px !important;
}
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:before,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control:before {
  content: '+';
  position: absolute;
  top: 50%;
  left: 8px;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  font-size: 12px;
  font-weight: bold;
  color: #fff;
  background-color: #0F172A;
  border-radius: 50%;
  display: block;
  box-shadow: none;
  border: none;
}
table.dataTable.dtr-inline.collapsed > tbody > tr.parent > td.dtr-control:before,
table.dataTable.dtr-inline.collapsed > tbody > tr.parent > th.dtr-control:before {
  content: '-';
  background-color: #EF4444;
}

/* ── Skeleton loader ─────────────────────────────────── */
.table-loader { padding: 16px 20px; }
.loader-row   { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); align-items: center; }
.skeleton-line { height: 12px; border-radius: 6px; background: linear-gradient(90deg,#f0f0f0 25%,#e0e0e0 50%,#f0f0f0 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ── Overview cards ─────────────────────────────────── */
.overview-label { font-weight: 700; font-size: 15px; margin-bottom: 12px; }
.overview-card  { background: var(--card-bg); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); border: 1px solid var(--border); min-height:160px !important}
.overview-card.ov-warning { border-color: #FDE68A; background: #FFFBEB; }
.ov-top   { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.ov-title { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.ov-icon  { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.ov-icon i { font-size: 17px; }
.ov-icon.amber  { background: #FEF3C7; color: #D97706; }
.ov-icon.teal   { background: #CCFBF1; color: #0D9488; }
.ov-icon.orange { background: #FEE2E2; color: #DC2626; }
.ov-value { font-size: 28px; font-weight: 800; letter-spacing: -.5px; margin-bottom: 2px; }
.ov-sub   { font-size: 12px; color: var(--text-muted); }

/* ── Preloader ──────────────────────────────────────── */
#preloader { position: fixed; inset: 0; background: #fff; z-index: 9999; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 12px; }
.preloader-spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
.preloader-text { color: var(--text-muted); font-size: 13px; }
@keyframes spin { to { transform: rotate(360deg); } }
#refreshBtn.spinning i { animation: spin .7s linear infinite; display: inline-block; }
#cacheInfo { font-size: 12px; color: var(--text-muted); padding: 8px 20px; }

/* ── Settings pages ─────────────────────────────────── */
.settings-card { background: var(--card-bg); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); margin-bottom: 20px; }
.settings-card h5 { font-weight: 700; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.badge-admin    { background: var(--primary-light); color: var(--primary); padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-producer { background: #F1F5F9; color: var(--text-muted); padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar-col { width: 0; }
  #sidebar { width: var(--sidebar-width); transform: translateX(-100%); transition: transform .25s; }
  #sidebar.show { transform: translateX(0); }
  #mainWrap { padding: 16px; }
}
/* DataTables 2.x responsive button */
table.dataTable.dtr-column > tbody > tr > td.dtr-control,
table.dataTable.dtr-column > tbody > tr > th.dtr-control {
  cursor: pointer;
  position: relative;
  padding-left: 32px !important;
}
table.dataTable.dtr-column > tbody > tr > td.dtr-control:before,
table.dataTable.dtr-column > tbody > tr > th.dtr-control:before {
  content: '+';
  position: absolute;
  top: 50%;
  left: 8px;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  font-size: 12px;
  font-weight: bold;
  color: #fff;
  background-color: #0F172A;
  border-radius: 50%;
  display: block;
}
table.dataTable.dtr-column > tbody > tr.parent > td.dtr-control:before,
table.dataTable.dtr-column > tbody > tr.parent > th.dtr-control:before {
  content: '-';
  background-color: #EF4444;
}


.active>.page-link, .page-link.active{
background:#0f172a !important;
border-color:#0f172a !important;
color:#fff !important
}
.page-link{
color:#0f172a !important;
}
.table-card{
padding:15px !important
}
/* One row, no wrap, horizontal scroll */
#tableWrap { overflow-x: auto !important; }
#invTable { min-width: 1400px; }
#invTable tbody td, #invTable thead th { white-space: nowrap !important; }
#invTable tbody td:first-child,
#invTable thead th:first-child { min-width: 400px; white-space: nowrap !important; }
