/* ================================================================
   STYLE.CSS – Sistem Inventaris Barang di Bengkel
   Design: Dark Navy Premium Theme
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---- Design Tokens ---- */
:root {
  --bg-base:       #0b0f1a;
  --bg-secondary:  #111827;
  --bg-card:       #161d2e;
  --bg-card-hover: #1c2540;
  --bg-input:      #1a2235;
  --bg-table-head: #1e2d4d;
  --bg-row-even:   #141c2e;
  --bg-row-hover:  #1a2540;

  --sidebar-bg:    #0d1220;
  --sidebar-w:     260px;
  --topbar-h:      64px;

  --accent:        #3b82f6;
  --accent-hover:  #2563eb;
  --accent-light:  rgba(59,130,246,0.12);
  --accent-glow:   rgba(59,130,246,0.3);

  --success:       #10b981;
  --success-light: rgba(16,185,129,0.12);
  --warning:       #f59e0b;
  --warning-light: rgba(245,158,11,0.12);
  --danger:        #ef4444;
  --danger-light:  rgba(239,68,68,0.12);
  --info:          #06b6d4;
  --info-light:    rgba(6,182,212,0.12);
  --purple:        #8b5cf6;
  --purple-light:  rgba(139,92,246,0.12);

  --text-primary:  #e2e8f0;
  --text-secondary:#94a3b8;
  --text-muted:    #4a5568;
  --border:        rgba(255,255,255,0.07);
  --border-strong: rgba(255,255,255,0.12);

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.3);
  --shadow:     0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.5);
  --shadow-xl:  0 20px 60px rgba(0,0,0,0.6);

  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  overflow-y: auto;
}

a { text-decoration: none; color: inherit; }

/* ================================================================
   SCROLLBAR
   ================================================================ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ================================================================
   SIDEBAR
   ================================================================ */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform var(--transition), width var(--transition);
  overflow: hidden;
}

.sidebar.collapsed { width: 68px; }
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .sidebar-footer .user-info { display: none; }
.sidebar.collapsed .brand-icon { margin: 0 auto; }
.sidebar.collapsed .sidebar-brand { justify-content: center; padding: 0 16px; }
.sidebar.collapsed .nav-link { justify-content: center; padding: 12px 0; }
.sidebar.collapsed .nav-icon { margin: 0; }
.sidebar.collapsed .user-pill { justify-content: center; }
.sidebar.collapsed .sidebar-footer { padding: 12px 8px; }

/* Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px;
  border-bottom: 1px solid var(--border);
  min-height: var(--topbar-h);
  flex-shrink: 0;
}

.brand-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 20px var(--accent-glow);
  color: #fff;
}

.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-size: 1rem; font-weight: 700; color: var(--text-primary); white-space: nowrap; }
.brand-sub  { font-size: 0.7rem; color: var(--text-secondary); white-space: nowrap; }

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.nav-link::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--accent);
  opacity: 0;
  transition: opacity var(--transition);
}

.nav-link:hover { color: var(--text-primary); background: var(--accent-light); }

.nav-link.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  box-shadow: 0 4px 15px var(--accent-glow);
  font-weight: 600;
}

.nav-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  stroke-width: 1.8;
}

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

/* Footer */
.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.user-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.875rem;
  flex-shrink: 0; color: #fff;
}

.user-info { display: flex; flex-direction: column; min-width: 0; }
.user-name  { font-size: 0.8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role  { font-size: 0.7rem; color: var(--text-secondary); }

/* ================================================================
   MAIN WRAPPER
   ================================================================ */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition);
  overflow-x: hidden;
}

.main-wrapper.sidebar-collapsed { margin-left: 68px; }

/* ================================================================
   TOPBAR
   ================================================================ */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.sidebar-toggle {
  background: none; border: none; cursor: pointer;
  color: var(--text-secondary);
  padding: 8px; border-radius: var(--radius-sm);
  display: flex; align-items: center;
  transition: all var(--transition);
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--accent-light); color: var(--accent); }

.topbar-title { flex: 1; }
.topbar-title h1 { font-size: 1.2rem; font-weight: 700; }

.topbar-right { display: flex; align-items: center; gap: 14px; margin-left: auto; }

.topbar-date { font-size: 0.78rem; color: var(--text-secondary); white-space: nowrap; }

.notif-icon {
  position: relative;
  width: 36px; height: 36px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.notif-icon:hover { background: var(--accent-light); color: var(--accent); border-color: var(--accent); }

.notif-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 0.6rem; font-weight: 700;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* ================================================================
   CONTENT AREA
   ================================================================ */
.content {
  flex: 1;
  padding: 28px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ================================================================
   PAGE HEADER
   ================================================================ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header-left h2 { font-size: 1.4rem; font-weight: 700; }
.page-header-left p  { font-size: 0.82rem; color: var(--text-secondary); margin-top: 2px; }

/* ================================================================
   STAT CARDS
   ================================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
  cursor: default;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--card-accent, var(--accent));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card.blue   { --card-accent: var(--accent); }
.stat-card.green  { --card-accent: var(--success); }
.stat-card.orange { --card-accent: var(--warning); }
.stat-card.red    { --card-accent: var(--danger); }
.stat-card.cyan   { --card-accent: var(--info); }
.stat-card.purple { --card-accent: var(--purple); }

.stat-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  background: var(--icon-bg, var(--accent-light));
  color: var(--icon-color, var(--accent));
}
.stat-card.blue   .stat-icon { background: var(--accent-light);  color: var(--accent); }
.stat-card.green  .stat-icon { background: var(--success-light); color: var(--success); }
.stat-card.orange .stat-icon { background: var(--warning-light); color: var(--warning); }
.stat-card.red    .stat-icon { background: var(--danger-light);  color: var(--danger); }
.stat-card.cyan   .stat-icon { background: var(--info-light);    color: var(--info); }
.stat-card.purple .stat-icon { background: var(--purple-light);  color: var(--purple); }

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}

.stat-label { font-size: 0.78rem; color: var(--text-secondary); font-weight: 500; }
.stat-sub   { font-size: 0.72rem; color: var(--text-muted); margin-top: 6px; }

/* ================================================================
   CARDS / PANELS
   ================================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.card-title { font-size: 0.95rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-title-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

.card-body { padding: 20px 22px; }

/* ================================================================
   SEARCH & TOOLBAR
   ================================================================ */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}

.search-box svg {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  width: 15px; height: 15px;
}

.search-input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: all var(--transition);
}

.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }

/* ================================================================
   BUTTONS
   ================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1;
}

.btn svg { width: 15px; height: 15px; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-glow);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-success {
  background: linear-gradient(135deg, var(--success), #059669);
  color: #fff;
  box-shadow: 0 4px 12px rgba(16,185,129,0.3);
}
.btn-success:hover { transform: translateY(-1px); }

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #b91c1c);
  color: #fff;
  box-shadow: 0 4px 12px rgba(239,68,68,0.3);
}
.btn-danger:hover { transform: translateY(-1px); }

.btn-ghost {
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.btn-sm { padding: 6px 12px; font-size: 0.78rem; }
.btn-icon { padding: 7px; border-radius: var(--radius-sm); }

/* Icon action buttons in table */
.btn-edit {
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid rgba(59,130,246,0.2);
}
.btn-edit:hover { background: var(--accent); color: #fff; }

.btn-delete {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,0.2);
}
.btn-delete:hover { background: var(--danger); color: #fff; }

/* ================================================================
   DATA TABLE
   ================================================================ */
.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table thead th {
  background: var(--bg-table-head);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.data-table tbody tr:nth-child(even) { background: var(--bg-row-even); }
.data-table tbody tr:hover { background: var(--bg-row-hover); }

.data-table tbody td {
  padding: 12px 16px;
  vertical-align: middle;
  color: var(--text-primary);
}

.data-table .actions-cell {
  display: flex;
  gap: 6px;
  align-items: center;
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 0.88rem; }

/* ================================================================
   BADGES / CHIPS
   ================================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-blue   { background: var(--accent-light);  color: var(--accent); }
.badge-green  { background: var(--success-light); color: var(--success); }
.badge-orange { background: var(--warning-light); color: var(--warning); }
.badge-red    { background: var(--danger-light);  color: var(--danger); }
.badge-purple { background: var(--purple-light);  color: var(--purple); }
.badge-cyan   { background: var(--info-light);    color: var(--info); }
.badge-gray   { background: rgba(255,255,255,0.06); color: var(--text-secondary); }

/* ================================================================
   PAGINATION
   ================================================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
  gap: 10px;
}

.pagination-btns { display: flex; gap: 4px; }

.page-btn {
  width: 32px; height: 32px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  font-family: inherit;
}
.page-btn:hover:not(:disabled) { background: var(--accent-light); color: var(--accent); border-color: var(--accent); }
.page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ================================================================
   MODAL
   ================================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.open { display: flex; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)  scale(1); }
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-xl);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title { font-size: 1rem; font-weight: 700; }

.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 6px; border-radius: var(--radius-sm);
  display: flex; align-items: center;
  transition: all var(--transition);
}
.modal-close:hover { color: var(--danger); background: var(--danger-light); }

.modal-body { padding: 24px; overflow-y: auto; }

/* ================================================================
   FORM ELEMENTS
   ================================================================ */
.form-group { margin-bottom: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: all var(--transition);
}

.form-control::placeholder { color: var(--text-muted); }
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }

select.form-control { cursor: pointer; }
select.form-control option { background: var(--bg-card); }

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 0.75rem; color: var(--danger); margin-top: 4px; display: none; }

/* ================================================================
   CONFIRM MODAL
   ================================================================ */
.confirm-modal {
  max-width: 380px;
  text-align: center;
  padding: 32px;
}

.confirm-icon { margin-bottom: 16px; display: flex; justify-content: center; }
.confirm-modal h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; }
.confirm-modal p  { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 24px; }
.confirm-actions  { display: flex; gap: 10px; justify-content: center; }

/* ================================================================
   TOAST
   ================================================================ */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 260px;
  max-width: 360px;
  animation: toastIn 0.3s ease;
  pointer-events: all;
  font-size: 0.85rem;
}

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

@keyframes toastOut {
  to { opacity: 0; transform: translateX(60px); }
}

.toast.removing { animation: toastOut 0.3s ease forwards; }

.toast-icon { width: 18px; height: 18px; flex-shrink: 0; }
.toast.success .toast-icon { color: var(--success); }
.toast.error   .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info    .toast-icon { color: var(--info); }
.toast-msg { flex: 1; color: var(--text-primary); }

/* ================================================================
   DASHBOARD SPECIFICS
   ================================================================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 0;
}

@media (max-width: 900px) { .dashboard-grid { grid-template-columns: 1fr; } }

.recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.recent-item:last-child { border-bottom: none; }

.recent-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.recent-info { flex: 1; min-width: 0; }
.recent-name { font-size: 0.85rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-meta { font-size: 0.75rem; color: var(--text-secondary); }
.recent-qty  { font-size: 0.85rem; font-weight: 700; white-space: nowrap; }

/* Stok rendah indicator */
.stok-bar-wrap { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.stok-bar-wrap:last-child { border-bottom: none; }
.stok-bar-info { flex: 1; min-width: 0; }
.stok-bar-name { font-size: 0.82rem; font-weight: 500; }
.stok-bar-val  { font-size: 0.75rem; color: var(--text-secondary); }
.stok-bar-outer { width: 100px; height: 6px; background: var(--bg-input); border-radius: 99px; flex-shrink: 0; overflow: hidden; }
.stok-bar-inner { height: 100%; border-radius: 99px; background: var(--danger); transition: width 0.5s ease; }

/* ================================================================
   LAPORAN FILTER
   ================================================================ */
.laporan-filter {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.laporan-filter .form-group { margin-bottom: 0; flex: 1; min-width: 160px; }
.laporan-filter .form-label { margin-bottom: 5px; }

/* Stok highlight */
.stok-low  { color: var(--danger); font-weight: 700; }
.stok-ok   { color: var(--success); font-weight: 600; }
.stok-warn { color: var(--warning); font-weight: 600; }

/* Number cell */
.num-cell { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 768px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .content { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-wrapper { margin-left: 0 !important; }
  .topbar { padding: 0 16px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
}

/* ================================================================
   PRINT
   ================================================================ */
@media print {
  .sidebar, .topbar, .no-print, .btn, .toolbar { display: none !important; }
  .main-wrapper { margin: 0 !important; }
  .content { padding: 0; }
  body { background: #fff; color: #000; }
  .card { border: 1px solid #ccc; box-shadow: none; }
  .data-table thead th { background: #1a4a8a; color: #fff; }
  .data-table tbody tr:nth-child(even) { background: #f5f5f5; }
}

/* ================================================================
   UTILITY
   ================================================================ */
.text-right  { text-align: right; }
.text-center { text-align: center; }
.mt-4  { margin-top: 16px; }
.mt-6  { margin-top: 24px; }
.mb-4  { margin-bottom: 16px; }
.fw-600 { font-weight: 600; }
.text-muted { color: var(--text-secondary); }
.text-sm { font-size: 0.8rem; }
.d-flex { display: flex; align-items: center; gap: 8px; }
.ml-auto { margin-left: auto; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ================================================================
   LARAVEL-SPECIFIC ADDITIONS
   ================================================================ */

/* --- Stock Color Classes --- */
.stok-ok   { color: var(--success) !important; font-weight: 600; }
.stok-warn { color: var(--warning) !important; font-weight: 600; }
.stok-low  { color: var(--danger)  !important; font-weight: 600; }
.num-cell  { font-family: 'Courier New', monospace; font-size: 0.88rem; }

/* --- Form Error & Hint --- */
.form-error {
  color: var(--danger);
  font-size: 0.75rem;
  margin-top: 4px;
}
.form-hint {
  font-size: 0.75rem;
  margin-top: 4px;
  color: var(--text-muted);
  transition: color 0.3s;
}

/* --- Alert (Laravel flash messages) --- */
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  font-size: 0.87rem;
  font-weight: 500;
  margin-bottom: 18px;
  border-left: 3px solid;
  transition: opacity 0.4s;
}
.alert-success {
  background: rgba(16,185,129,0.12);
  border-color: var(--success);
  color: var(--success);
}
.alert-danger {
  background: rgba(239,68,68,0.12);
  border-color: var(--danger);
  color: var(--danger);
}

/* --- Badge color variants --- */
.badge-blue   { background: rgba(99,102,241,0.2); color: #818cf8; }
.badge-purple { background: rgba(167,139,250,0.2); color: #c4b5fd; }
.badge-orange { background: rgba(245,158,11,0.2); color: #fbbf24; }
.badge-green  { background: rgba(16,185,129,0.2); color: var(--success); }
.badge-gray   { background: rgba(148,163,184,0.15); color: var(--text-secondary); }

/* --- Stat Cards --- */
.stat-card { border-radius: var(--radius-xl); padding: 24px; border: 1px solid var(--border); position: relative; overflow: hidden; transition: transform 0.2s, box-shadow 0.2s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card::before { content:''; position:absolute; top:0; right:0; width:80px; height:80px; border-radius:50%; opacity:0.12; transform:translate(20px,-20px); }
.stat-card.blue   { background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(99,102,241,0.05)); border-color: rgba(99,102,241,0.3); }
.stat-card.blue::before { background: var(--accent); }
.stat-card.green  { background: linear-gradient(135deg, rgba(16,185,129,0.15), rgba(16,185,129,0.05)); border-color: rgba(16,185,129,0.3); }
.stat-card.green::before { background: var(--success); }
.stat-card.orange { background: linear-gradient(135deg, rgba(245,158,11,0.15), rgba(245,158,11,0.05)); border-color: rgba(245,158,11,0.3); }
.stat-card.orange::before { background: var(--warning); }
.stat-card.red    { background: linear-gradient(135deg, rgba(239,68,68,0.15), rgba(239,68,68,0.05)); border-color: rgba(239,68,68,0.3); }
.stat-card.red::before { background: var(--danger); }
.stat-card.cyan   { background: linear-gradient(135deg, rgba(6,182,212,0.15), rgba(6,182,212,0.05)); border-color: rgba(6,182,212,0.3); }
.stat-card.cyan::before { background: #06b6d4; }
.stat-card.purple { background: linear-gradient(135deg, rgba(167,139,250,0.15), rgba(167,139,250,0.05)); border-color: rgba(167,139,250,0.3); }
.stat-card.purple::before { background: #a78bfa; }
.stat-card-top { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:6px; }
.stat-value { font-size: 2rem; font-weight: 800; line-height:1; }
.stat-label { font-size: 0.82rem; color: var(--text-secondary); font-weight: 500; margin-top: 4px; }
.stat-sub   { font-size: 0.72rem; color: var(--text-muted); }
.stat-icon  { opacity: 0.6; }

/* --- Dashboard Grid --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 768px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
}

/* --- Recent Items --- */
.recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.recent-item:last-child { border-bottom: none; }
.recent-dot  { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.recent-info { flex: 1; min-width: 0; }
.recent-name { font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-meta { font-size: 0.72rem; color: var(--text-muted); }
.recent-qty  { font-weight: 700; font-size: 0.9rem; flex-shrink: 0; }

/* --- Stok Bar Monitor --- */
.stok-bar-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.stok-bar-wrap:last-child { border-bottom: none; }
.stok-bar-info { flex:1; display:flex; align-items:center; gap:10px; min-width:0; }
.stok-bar-name { font-size: 0.85rem; font-weight: 600; flex:1; }
.stok-bar-val  { flex-shrink: 0; }
.stok-bar-outer { background: var(--border); border-radius: 4px; height: 6px; overflow: hidden; }
.stok-bar-inner { height: 100%; border-radius: 4px; transition: width 0.6s ease; }

/* --- Card title dot --- */
.card-title-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.card-title     { display: flex; align-items: center; gap: 8px; font-weight: 600; }

/* --- Action buttons --- */
.actions-cell { display: flex; gap: 6px; align-items: center; }
.btn-edit   { background: rgba(99,102,241,0.15) !important; color: var(--accent) !important; border: 1px solid rgba(99,102,241,0.3) !important; }
.btn-edit:hover { background: rgba(99,102,241,0.3) !important; }
.btn-delete { background: rgba(239,68,68,0.15) !important; color: var(--danger) !important; border: 1px solid rgba(239,68,68,0.3) !important; }
.btn-delete:hover { background: rgba(239,68,68,0.3) !important; }
.btn-success { background: linear-gradient(135deg, var(--success), #059669) !important; color: white !important; border: none; box-shadow: 0 2px 8px rgba(16,185,129,0.35); }

/* --- Pagination buttons --- */
.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.82rem;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
}
.page-btn:hover { background: var(--bg-elevated); border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: white; font-weight: 700; }
.page-btn[disabled] { opacity: 0.35; cursor: not-allowed; }

/* --- Laporan Filter --- */
.laporan-filter {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.laporan-filter .form-group { margin-bottom: 0; min-width: 140px; }
.laporan-filter .btn { align-self: flex-end; }

/* --- Nav badge (Admin label) --- */
.nav-badge {
  margin-left: auto;
  background: rgba(99,102,241,0.25);
  color: var(--accent);
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --- Clean Print styles --- */
@media print {
  body { background: white !important; color: black !important; }
  .sidebar, .topbar, .no-print, .actions-cell, button, .btn { display: none !important; }
  .main-wrapper, .content { margin: 0 !important; padding: 0 !important; width: 100% !important; max-width: 100% !important; left: 0 !important; }
  .card { border: none !important; background: transparent !important; box-shadow: none !important; padding: 0 !important; }
  .table-wrapper { overflow: visible !important; }
  .data-table { width: 100% !important; border-collapse: collapse !important; }
  .data-table th, .data-table td { color: black !important; border: 1px solid #ddd !important; padding: 8px !important; }
}

/* --- Light Mode overrides --- */
html.light-mode {
  --bg-base:       #f3f4f6;
  --bg-secondary:  #ffffff;
  --bg-card:       #ffffff;
  --bg-card-hover: #f9fafb;
  --bg-input:      #f3f4f6;
  --bg-table-head: #e5e7eb;
  --bg-row-even:   #f9fafb;
  --bg-row-hover:  #f3f4f6;

  --sidebar-bg:    #111827;
  --text-primary:  #1f2937;
  --text-secondary:#4b5563;
  --text-muted:    #9ca3af;
  --border:        #e5e7eb;
  --border-strong: #d1d5db;
}

html.light-mode .card,
html.light-mode .topbar,
html.light-mode .sidebar {
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
}

html.light-mode .form-control {
  background: var(--bg-input) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-strong) !important;
}

html.light-mode .form-control::placeholder {
  color: var(--text-muted) !important;
}

html.light-mode .topbar input[name="q"] {
  background: #e5e7eb !important;
  color: #1f2937 !important;
  border-color: #d1d5db !important;
}

html.light-mode .recent-item {
  border-bottom-color: #f3f4f6 !important;
}

html.light-mode .stok-bar-outer {
  background: #e5e7eb !important;
}

html.light-mode .page-title h1 {
  color: #1f2937;
}

/* --- QR Code Modal --- */
.qr-modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0; top: 0; width: 100%; height: 100%;
  background-color: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  align-items: center; justify-content: center;
}
.qr-modal.show { display: flex; }
.qr-modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 30px;
  width: 90%; max-width: 380px;
  text-align: center;
  box-shadow: var(--shadow-xl);
  position: relative;
  animation: modalSlide 0.3s ease;
}
@keyframes modalSlide {
  from { transform: translateY(-30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.qr-modal-close {
  position: absolute; right: 18px; top: 18px;
  cursor: pointer; color: var(--text-secondary);
  background: none; border: none; font-size: 1.4rem;
}
.qr-code-img {
  background: white; padding: 12px; border-radius: var(--radius);
  margin: 20px auto; display: inline-block;
  box-shadow: var(--shadow-sm);
}

/* ================================================================
   FINAL SCROLLING GUARANTEE
   ================================================================ */
html, body {
  height: auto !important;
  min-height: 100% !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}
.main-wrapper, .content {
  overflow: visible !important;
  height: auto !important;
}
