/* ==========================================================
   assets/css/style.css
   InvenPro — Inventory System Custom Styles
   ========================================================== */

/* ---------- CSS Variables ---------- */
:root {
  --primary:       #2563eb;
  --primary-dark:  #1d4ed8;
  --primary-light: #eff6ff;
  --primary-soft:  #dbeafe;
  --accent:        #0ea5e9;

  --success:       #16a34a;
  --success-light: #dcfce7;
  --warning:       #d97706;
  --warning-light: #fef3c7;
  --danger:        #dc2626;
  --danger-light:  #fee2e2;
  --info:          #0891b2;
  --info-light:    #cffafe;

  --sidebar-w:     260px;
  --topbar-h:      64px;

  --gray-50:       #f8fafc;
  --gray-100:      #f1f5f9;
  --gray-200:      #e2e8f0;
  --gray-300:      #cbd5e1;
  --gray-500:      #64748b;
  --gray-700:      #334155;
  --gray-900:      #0f172a;

  --text-primary:  #0f172a;
  --bg-base:       #f8fafc;
  --card-bg:       #ffffff;
  --table-head:    #f1f5f9;

  --font:          'Plus Jakarta Sans', system-ui, sans-serif;
  --radius:        12px;
  --radius-sm:     8px;
  --shadow:        0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.04);
  --shadow-md:     0 4px 24px rgba(37,99,235,.12);
}

.dark-mode {
  --bg-base:       #0f172a;
  --card-bg:       #131e39;
  --table-head:    #1e293b;
  --text-primary:  #f8fafc;
  --gray-50:       #121827;
  --gray-100:      #1e293b;
  --gray-200:      #334155;
  --gray-300:      #475569;
  --gray-500:      #94a3b8;
  --gray-700:      #cbd5e1;
  --gray-900:      #f8fafc;

  --primary-light: rgba(96, 165, 250, .18);
  --primary-soft:  rgba(59, 130, 246, .18);
  --shadow:        0 1px 3px rgba(0,0,0,.18), 0 4px 16px rgba(0,0,0,.1);
}

.dark-mode .sidebar {
  background: var(--gray-100);
  border-color: var(--gray-300);
}

.dark-mode .sidebar-brand,
.dark-mode .sidebar-footer,
.dark-mode .topbar,
.dark-mode .card,
.dark-mode .card-header,
.dark-mode .stat-card,
.dark-mode .dropdown-menu,
.dark-mode .table {
  background: var(--card-bg);
}

.dark-mode .sidebar-menu,
.dark-mode .sidebar-footer,
.dark-mode .topbar-title,
.dark-mode .topbar-date,
.dark-mode .btn-user-menu,
.dark-mode .card,
.dark-mode .card-header,
.dark-mode .stat-card,
.dark-mode .dropdown-item,
.dark-mode .table thead th,
.dark-mode .table tbody td,
.dark-mode .form-control,
.dark-mode .form-select {
  color: var(--text-primary);
}

.dark-mode .table {
  border-color: var(--gray-300);
}

.dark-mode .table thead th {
  background: var(--table-head);
  color: var(--text-primary);
  border-color: var(--gray-300);
}

.dark-mode .table tbody td {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--gray-300);
}

.dark-mode .table tbody tr:hover td {
  background: rgba(255,255,255,.08);
}

.dark-mode .topbar {
  border-bottom-color: var(--gray-300);
}

.dark-mode .btn-toggle-sidebar {
  background: var(--gray-200);
  color: var(--gray-900);
}

.dark-mode .btn-toggle-sidebar:hover,
.dark-mode .btn-user-menu:hover,
.dark-mode .dropdown-item:hover {
  background: rgba(255,255,255,.08);
}

.dark-mode .card {
  border-color: var(--gray-300);
}

.dark-mode .card-header {
  border-bottom-color: var(--gray-300);
}

.dark-mode .table thead th {
  background: var(--gray-200);
}

.dark-mode .table tbody tr:hover td {
  background: var(--gray-200);
}

.dark-mode .form-control,
.dark-mode .form-select {
  background: var(--gray-200);
  border-color: var(--gray-300);
  color: var(--gray-900);
}

.dark-mode .btn-outline-secondary {
  color: var(--gray-900);
  border-color: var(--gray-300);
}

.dark-mode .btn-outline-secondary:hover {
  background: rgba(255,255,255,.08);
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
}

/* ---------- Layout Shell ---------- */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ---------- SIDEBAR ---------- */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--gray-100);
}

.brand-icon {
  width: 40px; height: 40px;
  background: var(--primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 18px;
  flex-shrink: 0;
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
  display: block;
  line-height: 1.2;
}

.brand-sub {
  font-size: 11px;
  color: var(--gray-500);
  display: block;
}

/* Menu */
.sidebar-menu {
  padding: 16px 12px;
  flex: 1;
  overflow-y: auto;
}

.menu-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--gray-300);
  padding: 4px 8px 8px;
  margin-bottom: 2px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--gray-700);
  text-decoration: none;
  font-weight: 500;
  font-size: 13.5px;
  transition: all .18s;
  margin-bottom: 2px;
}

.menu-item i { font-size: 16px; flex-shrink: 0; }

.menu-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.menu-item.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37,99,235,.3);
}

.menu-item.text-danger-soft { color: var(--danger); }
.menu-item.text-danger-soft:hover { background: var(--danger-light); color: var(--danger); }

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--gray-100);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
}

.user-avatar {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.user-name { font-size: 13px; font-weight: 600; display: block; }
.user-role { font-size: 11px; color: var(--gray-500); display: block; }

/* Overlay mobile */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 999;
}

/* ---------- MAIN CONTENT ---------- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left .3s;
}

/* ---------- TOPBAR ---------- */
.topbar {
  position: sticky; top: 0;
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  z-index: 100;
}

.btn-toggle-sidebar {
  width: 36px; height: 36px;
  border: none;
  background: var(--gray-100);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  color: var(--gray-700);
  cursor: pointer;
  transition: all .18s;
  flex-shrink: 0;
}

.btn-toggle-sidebar:hover { background: var(--primary-soft); color: var(--primary); }

.topbar-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--gray-900);
  flex: 1;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-date {
  font-size: 13px;
  color: var(--gray-500);
  display: flex; align-items: center; gap: 4px;
}

.btn-user-menu {
  display: flex; align-items: center; gap: 8px;
  background: none; border: none;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--gray-700);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background .18s;
}

.btn-user-menu:hover { background: var(--gray-100); }
.btn-user-menu::after { margin-left: 2px; }

.topbar-avatar {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}

/* ---------- PAGE CONTENT ---------- */
.page-content {
  padding: 28px 28px 40px;
  flex: 1;
}

/* Page Header */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 2px;
}

.page-header p {
  font-size: 13.5px;
  color: var(--gray-500);
  margin: 0;
}

/* ---------- CARDS ---------- */
.card {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--card-bg);
}

.card-header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--gray-100);
  padding: 16px 20px;
  border-radius: var(--radius) var(--radius) 0 0 !important;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-header i { color: var(--primary); }

.card-body { padding: 20px; }

/* Stat Cards (Dashboard) */
.stat-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
  text-decoration: none;
  color: inherit;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.stat-icon.blue   { background: var(--primary-soft); color: var(--primary); }
.stat-icon.green  { background: var(--success-light); color: var(--success); }
.stat-icon.orange { background: var(--warning-light); color: var(--warning); }
.stat-icon.cyan   { background: var(--info-light);    color: var(--info); }

.stat-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--gray-500);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1;
}

.stat-sub {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 4px;
}

/* ---------- TABLE ---------- */
.table {
  font-size: 13.5px;
  margin: 0;
}

.table thead th {
  background: var(--gray-50);
  color: var(--gray-500);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

.table tbody td {
  padding: 13px 16px;
  vertical-align: middle;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--gray-50); }

/* ---------- BADGES ---------- */
.badge-kategori {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
}

.badge-elektronik { background: var(--primary-soft); color: var(--primary); }
.badge-furnitur   { background: var(--warning-light); color: var(--warning); }
.badge-atk        { background: var(--success-light); color: var(--success); }
.badge-default    { background: var(--gray-100); color: var(--gray-500); }

/* ---------- BUTTONS ---------- */
.btn {
  font-family: var(--font);
  font-weight: 600;
  font-size: 13.5px;
  border-radius: 8px;
  transition: all .18s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37,99,235,.3);
}

.btn-sm { font-size: 12px; padding: 5px 10px; }

/* Action button group in table */
.btn-action {
  width: 30px; height: 30px;
  border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none;
  font-size: 13px;
  cursor: pointer;
  transition: all .18s;
  text-decoration: none;
}

.btn-view   { background: var(--info-light);    color: var(--info); }
.btn-edit   { background: var(--warning-light); color: var(--warning); }
.btn-delete { background: var(--danger-light);  color: var(--danger); }

.btn-view:hover   { background: var(--info);    color: #fff; }
.btn-edit:hover   { background: var(--warning); color: #fff; }
.btn-delete:hover { background: var(--danger);  color: #fff; }

/* ---------- FORMS ---------- */
.form-label {
  font-weight: 600;
  font-size: 13px;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-control, .form-select {
  font-family: var(--font);
  font-size: 13.5px;
  border-radius: 8px;
  border: 1.5px solid var(--gray-200);
  padding: 9px 14px;
  color: var(--gray-900);
  transition: border-color .18s, box-shadow .18s;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.form-text { font-size: 12px; color: var(--gray-500); }

.invalid-feedback { font-size: 12px; }

/* ---------- ALERTS ---------- */
.alert {
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  border: none;
  padding: 13px 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert i { font-size: 16px; flex-shrink: 0; margin-top: 1px; }

/* ---------- LOGIN PAGE ---------- */
.login-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary) 0%, #1e40af 50%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.login-wrapper::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  background: rgba(255,255,255,.04);
  border-radius: 50%;
  top: -200px; right: -100px;
}

.login-wrapper::after {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  background: rgba(255,255,255,.03);
  border-radius: 50%;
  bottom: -100px; left: -80px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 20px;
  padding: 44px 40px;
  box-shadow: 0 24px 80px rgba(0,0,0,.3);
  position: relative;
  z-index: 1;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo-icon {
  width: 60px; height: 60px;
  background: var(--primary);
  border-radius: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 28px;
  color: #fff;
  margin-bottom: 12px;
}

.login-logo h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 4px;
}

.login-logo p {
  font-size: 13px;
  color: var(--gray-500);
  margin: 0;
}

/* ---------- KODE BARANG ---------- */
.kode-badge {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  font-weight: 700;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 3px 8px;
  border-radius: 6px;
}

/* ---------- STOCK INDICATOR ---------- */
.stok-value { font-weight: 700; }
.stok-low   { color: var(--danger); }
.stok-ok    { color: var(--success); }

/* ---------- DETAIL ITEM ---------- */
.detail-row {
  display: flex;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
  gap: 12px;
}

.detail-row:last-child { border-bottom: none; }

.detail-label {
  width: 140px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gray-500);
  flex-shrink: 0;
}

.detail-value {
  font-size: 13.5px;
  color: var(--gray-900);
  font-weight: 500;
}

/* ---------- DATATABLE OVERRIDES ---------- */
div.dataTables_wrapper {
  padding: .75rem 1rem 1rem;
}

div.dataTables_wrapper div.dataTables_length,
div.dataTables_wrapper div.dataTables_filter {
  padding-bottom: .75rem;
}

div.dataTables_wrapper div.dataTables_length label,
div.dataTables_wrapper div.dataTables_filter label {
  font-size: 13px;
  font-weight: 500;
  margin-right: .5rem;
}

div.dataTables_wrapper div.dataTables_filter {
  text-align: right;
}

div.dataTables_wrapper div.dataTables_filter input {
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  min-width: 180px;
}

@media (max-width: 767.98px) {
  div.dataTables_wrapper div.dataTables_filter,
  div.dataTables_wrapper div.dataTables_length {
    text-align: left;
  }
}

div.dataTables_wrapper div.dataTables_info {
  font-size: 12.5px;
  color: var(--gray-500);
}

/* ---------- DROPDOWN ---------- */
.dropdown-menu {
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  min-width: 180px;
  padding: 6px;
}

.dropdown-item {
  border-radius: 6px;
  padding: 8px 12px;
  display: flex; align-items: center;
  font-weight: 500;
}

.dropdown-item:hover { background: var(--gray-50); }
.dropdown-item.text-danger:hover { background: var(--danger-light); }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,.12);
  }

  .sidebar-overlay.show { display: block; }

  .main-content { margin-left: 0; }

  .page-content { padding: 20px 16px 32px; }
}

@media (max-width: 575.98px) {
  .login-card { padding: 32px 24px; }
  .stat-value { font-size: 22px; }
}

/* ---------- UTILITIES ---------- */
.text-money {
  font-family: 'Courier New', monospace;
  font-weight: 700;
  color: var(--gray-900);
}

.divider {
  height: 1px;
  background: var(--gray-100);
  margin: 20px 0;
}

.empty-state {
  text-align: center;
  padding: 60px 24px;
}

.empty-state i {
  font-size: 48px;
  color: var(--gray-300);
  display: block;
  margin-bottom: 12px;
}

.empty-state p {
  color: var(--gray-500);
  font-size: 14px;
}