/* ============================================================
   Sistem Inventori BBC — Global Stylesheet
   ============================================================ */

/* ---- Custom Properties (Design Tokens) ---- */
:root {
  /* Colors */
  --primary:        #4f46e5;
  --primary-light:  #818cf8;
  --primary-dark:   #3730a3;
  --secondary:      #06b6d4;
  --accent:         #f59e0b;
  --success:        #10b981;
  --danger:         #ef4444;
  --warning:        #f59e0b;
  --info:           #3b82f6;

  /* Neutrals */
  --bg:             #0f172a;
  --bg-card:        #1e293b;
  --bg-card2:       #263348;
  --bg-sidebar:     #0d1526;
  --border:         rgba(255,255,255,0.07);
  --text:           #e2e8f0;
  --text-muted:     #94a3b8;
  --text-light:     #f8fafc;

  /* Sizes */
  --sidebar-w:      250px;
  --topbar-h:       64px;
  --radius:         12px;
  --radius-sm:      8px;
  --shadow:         0 4px 24px rgba(0,0,0,0.35);
  --shadow-sm:      0 2px 8px rgba(0,0,0,0.2);

  /* Font */
  --font:           'Inter', sans-serif;
  --transition:     0.25s ease;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  font-size: 14px;
  line-height: 1.6;
}
a { color: var(--primary-light); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary); }
img { max-width: 100%; height: auto; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-sidebar); }
::-webkit-scrollbar-thumb { background: var(--primary-dark); border-radius: 3px; }

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.sidebar-toggle {
  background: none; border: none; color: var(--text-muted);
  font-size: 22px; cursor: pointer; padding: 6px;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}
.sidebar-toggle:hover { background: var(--bg-card2); color: var(--text); }

.brand { display: flex; align-items: center; gap: 10px; }
.brand-img { width: 34px; height: 34px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.brand-icon { font-size: 26px; color: var(--primary-light); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-size: 15px; font-weight: 700; color: var(--text-light); }
.brand-sub  { font-size: 11px; color: var(--text-muted); letter-spacing: 0.5px; }

.topbar-right { display: flex; align-items: center; gap: 12px; position: relative; }

.user-menu {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; padding: 6px 12px;
  border-radius: var(--radius);
  transition: background var(--transition);
  position: relative;
}
.user-menu:hover { background: var(--bg-card2); }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; color: #fff;
  overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-info { display: flex; flex-direction: column; line-height: 1.2; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text-light); }
.user-role { font-size: 11px; color: var(--text-muted); }

.user-dropdown {
  display: none; position: absolute; top: calc(100% + 8px); right: 0;
  width: 200px; background: var(--bg-card2);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); z-index: 200; overflow: hidden;
  animation: slideDown 0.2s ease;
}
.user-dropdown.open { display: block; }
.user-dropdown a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; color: var(--text); font-size: 13px;
  transition: background var(--transition);
}
.user-dropdown a:hover { background: var(--primary-dark); color: #fff; }
.user-dropdown a.text-danger { color: var(--danger) !important; }
.user-dropdown a.text-danger:hover { background: var(--danger); color: #fff !important; }
.dropdown-divider { border-top: 1px solid var(--border); margin: 4px 0; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed; top: var(--topbar-h); left: 0; bottom: 0; z-index: 900;
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex; flex-direction: column;
  transition: transform var(--transition);
  padding-bottom: 60px;
}
.sidebar-nav { flex: 1; padding: 16px 12px; }
.sidebar-nav ul { list-style: none; }

.nav-label {
  font-size: 10px; font-weight: 700; letter-spacing: 1px;
  color: var(--text-muted); text-transform: uppercase;
  padding: 20px 12px 6px; display: block;
}
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 13.5px; font-weight: 500;
  transition: all var(--transition); margin-bottom: 2px;
}
.nav-link i { font-size: 17px; min-width: 20px; }
.nav-link:hover { background: var(--bg-card2); color: var(--text); }
.nav-link.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 12px rgba(79,70,229,0.4);
}

.sidebar-footer {
  padding: 12px 16px; font-size: 11px; color: var(--text-muted);
  border-top: 1px solid var(--border);
  text-align: center; position: absolute; bottom: 0; left: 0; right: 0;
  background: var(--bg-sidebar);
}

.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); z-index: 850;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  padding: 28px;
  min-height: calc(100vh - var(--topbar-h));
  transition: margin-left var(--transition);
}
.main-content.sidebar-collapsed { margin-left: 0; }

.app-footer {
  text-align: center; padding: 16px;
  font-size: 12px; color: var(--text-muted);
  border-top: 1px solid var(--border);
  margin-left: var(--sidebar-w);
  transition: margin-left var(--transition);
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px; flex-wrap: wrap; gap: 12px;
}
.page-header-left { display: flex; flex-direction: column; }
.page-title {
  font-size: 22px; font-weight: 800; color: var(--text-light);
  display: flex; align-items: center; gap: 10px;
}
.page-title i { color: var(--primary-light); }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-muted); margin-top: 4px;
}
.breadcrumb a { color: var(--primary-light); }
.breadcrumb span { color: var(--text-muted); }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 15px; font-weight: 700; color: var(--text-light); display: flex; align-items: center; gap: 8px; }
.card-title i { color: var(--primary-light); }

/* Stat Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex; align-items: center; gap: 16px;
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0;
  width: 4px; height: 100%; border-radius: 4px 0 0 4px;
}
.stat-card.primary::before  { background: var(--primary); }
.stat-card.success::before  { background: var(--success); }
.stat-card.warning::before  { background: var(--warning); }
.stat-card.danger::before   { background: var(--danger); }
.stat-card.info::before     { background: var(--info); }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

.stat-icon {
  width: 52px; height: 52px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0;
}
.stat-card.primary .stat-icon { background: rgba(79,70,229,0.15); color: var(--primary-light); }
.stat-card.success .stat-icon { background: rgba(16,185,129,0.15); color: var(--success); }
.stat-card.warning .stat-icon { background: rgba(245,158,11,0.15); color: var(--warning); }
.stat-card.danger  .stat-icon { background: rgba(239,68,68,0.15);  color: var(--danger); }
.stat-card.info    .stat-icon { background: rgba(59,130,246,0.15); color: var(--info); }

.stat-info { flex: 1; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--text-light); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-change { font-size: 11px; margin-top: 6px; }
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: none; transition: all var(--transition);
  text-decoration: none; white-space: nowrap;
}
.btn i { font-size: 15px; }
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover   { background: var(--primary-dark); box-shadow: 0 4px 12px rgba(79,70,229,0.4); transform: translateY(-1px); }
.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover   { background: #059669; box-shadow: 0 4px 12px rgba(16,185,129,0.4); transform: translateY(-1px); }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover    { background: #dc2626; box-shadow: 0 4px 12px rgba(239,68,68,0.4); transform: translateY(-1px); }
.btn-warning   { background: var(--warning); color: #000; }
.btn-warning:hover   { background: #d97706; transform: translateY(-1px); }
.btn-secondary { background: var(--bg-card2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); color: var(--text-light); transform: translateY(-1px); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { padding: 8px; width: 34px; height: 34px; justify-content: center; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 7px; }
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%; padding: 10px 14px;
  background: var(--bg-card2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: var(--font); font-size: 13.5px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.2);
}
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 20px; }
.form-actions { display: flex; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }

/* ============================================================
   TABLE
   ============================================================ */
.table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.table-controls {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; gap: 12px;
}
table.inv-table {
  width: 100%; border-collapse: collapse;
}
.inv-table thead th {
  background: var(--bg-card2); padding: 12px 16px;
  text-align: left; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-muted); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.inv-table tbody td {
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  font-size: 13.5px; vertical-align: middle;
}
.inv-table tbody tr:last-child td { border-bottom: none; }
.inv-table tbody tr { transition: background var(--transition); }
.inv-table tbody tr:hover { background: var(--bg-card2); }
.table-actions { display: flex; gap: 6px; }

/* Search box in table */
.table-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-card2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0 12px;
}
.table-search i { color: var(--text-muted); font-size: 15px; }
.table-search input {
  background: none; border: none; padding: 9px 0;
  color: var(--text); font-size: 13px; font-family: var(--font); outline: none; width: 200px;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.3px;
  white-space: nowrap;
}
.badge-success  { background: rgba(16,185,129,0.15); color: var(--success);  border: 1px solid rgba(16,185,129,0.3); }
.badge-warning  { background: rgba(245,158,11,0.15); color: var(--warning);  border: 1px solid rgba(245,158,11,0.3); }
.badge-danger   { background: rgba(239,68,68,0.15);  color: var(--danger);   border: 1px solid rgba(239,68,68,0.3); }
.badge-primary  { background: rgba(79,70,229,0.15);  color: var(--primary-light);  border: 1px solid rgba(79,70,229,0.3); }
.badge-info     { background: rgba(59,130,246,0.15); color: var(--info);     border: 1px solid rgba(59,130,246,0.3); }
.badge-dark     { background: rgba(100,100,100,0.15); color: #aaa;           border: 1px solid rgba(100,100,100,0.3); }
.badge-secondary{ background: var(--bg-card2);        color: var(--text-muted); }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px; border-radius: var(--radius-sm);
  margin-bottom: 20px; font-size: 13.5px;
  border: 1px solid transparent; position: relative;
  animation: slideDown 0.3s ease;
}
.alert-success { background: rgba(16,185,129,0.1);  border-color: rgba(16,185,129,0.3); color: var(--success); }
.alert-danger  { background: rgba(239,68,68,0.1);   border-color: rgba(239,68,68,0.3);  color: var(--danger); }
.alert-info    { background: rgba(59,130,246,0.1);  border-color: rgba(59,130,246,0.3); color: var(--info); }
.alert-close {
  margin-left: auto; background: none; border: none;
  cursor: pointer; color: inherit; font-size: 18px;
  opacity: 0.7; transition: opacity var(--transition);
}
.alert-close:hover { opacity: 1; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-backdrop {
  display: none; position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(3px);
  align-items: center; justify-content: center;
}
.modal-backdrop.open { display: flex; animation: fadeIn 0.2s ease; }
.modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0; width: 90%;
  max-width: 560px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow); animation: slideUp 0.25s ease;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 700; color: var(--text-light); display: flex; align-items: center; gap: 10px; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 22px; cursor: pointer; transition: color var(--transition); }
.modal-close:hover { color: var(--danger); }
.modal-body   { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh; display: flex;
  background: var(--bg);
}
.login-left {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 40px;
  background: linear-gradient(135deg, var(--primary-dark) 0%, #0f172a 60%, var(--bg-sidebar) 100%);
  position: relative; overflow: hidden;
}
.login-left::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 30% 50%, rgba(79,70,229,0.3) 0%, transparent 70%);
}
.login-left-content { position: relative; z-index: 1; max-width: 420px; }
.login-logo { display: flex; align-items: center; gap: 14px; margin-bottom: 40px; }
.login-logo-img { width: 50px; height: 50px; object-fit: cover; border-radius: 12px; border: 2px solid rgba(255,255,255,0.2); box-shadow: 0 4px 16px rgba(0,0,0,0.3); }
.login-logo-icon { font-size: 48px; color: var(--primary-light); }
.login-logo-text { display: flex; flex-direction: column; }
.login-logo-name { font-size: 22px; font-weight: 800; color: #fff; }
.login-logo-sub  { font-size: 13px; color: rgba(255,255,255,0.6); }
.login-tagline { font-size: 30px; font-weight: 800; color: #fff; line-height: 1.3; margin-bottom: 16px; }
.login-tagline span { color: var(--primary-light); }
.login-desc { font-size: 14px; color: rgba(255,255,255,0.6); line-height: 1.7; }

.login-right {
  width: 440px; min-width: 380px; display: flex;
  align-items: center; justify-content: center; padding: 40px;
  background: var(--bg-card);
}
.login-form-box { width: 100%; max-width: 360px; }
.login-form-title { font-size: 24px; font-weight: 800; color: var(--text-light); margin-bottom: 6px; }
.login-form-sub   { font-size: 13px; color: var(--text-muted); margin-bottom: 32px; }
.login-features { margin-top: 40px; display: flex; flex-direction: column; gap: 14px; }
.login-feature { display: flex; align-items: center; gap: 12px; }
.login-feature i { font-size: 20px; color: var(--primary-light); }
.login-feature span { font-size: 13px; color: rgba(255,255,255,0.7); }

/* ============================================================
   QR CODE
   ============================================================ */
.qr-card {
  background: #fff; border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column;
  align-items: center; gap: 8px; max-width: 180px;
  box-shadow: var(--shadow-sm);
}
.qr-card img { width: 140px; height: 140px; }
.qr-code-label { font-size: 11px; color: #333; font-weight: 700; text-align: center; }

/* ============================================================
   CHART WRAPPER
   ============================================================ */
.chart-wrapper { position: relative; min-height: 220px; }

/* ============================================================
   GRID LAYOUTS
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }

/* ============================================================
   UTILITIES
   ============================================================ */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-3 { margin-bottom: 24px; }
.gap-2 { gap: 16px; }
.flex   { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap { display: flex; align-items: center; gap: 10px; }
.text-muted { color: var(--text-muted); }
.text-sm    { font-size: 12px; }
.text-right { text-align: right; }
.text-center{ text-align: center; }
.fw-bold    { font-weight: 700; }
.w-100      { width: 100%; }
.d-none     { display: none; }

/* Image preview in form */
.img-preview {
  width: 100px; height: 100px; border-radius: var(--radius-sm);
  object-fit: cover; border: 2px solid var(--border);
  margin-top: 8px;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main-content { margin-left: 0; }
  .app-footer   { margin-left: 0; }
  .login-left   { display: none; }
  .login-right  { width: 100%; min-width: unset; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .main-content { padding: 16px; }
  .stats-grid   { grid-template-columns: 1fr; }
  .page-header  { flex-direction: column; align-items: flex-start; }
  .table-controls { flex-direction: column; align-items: flex-start; }
}

/* ============================================================
   DATATABLES DARK OVERRIDE
   ============================================================ */
.dataTables_wrapper { color: var(--text); }
.dataTables_filter input,
.dataTables_length select {
  background: var(--bg-card2) !important; border: 1px solid var(--border) !important;
  color: var(--text) !important; border-radius: var(--radius-sm) !important;
  padding: 6px 10px !important; font-family: var(--font) !important;
}
.dataTables_paginate .paginate_button {
  background: var(--bg-card2) !important; color: var(--text) !important;
  border: 1px solid var(--border) !important; border-radius: var(--radius-sm) !important;
  margin: 2px !important;
}
.dataTables_paginate .paginate_button.current {
  background: var(--primary) !important; color: #fff !important;
  border-color: var(--primary) !important;
}
.dataTables_paginate .paginate_button:hover {
  background: var(--primary-dark) !important; color: #fff !important;
}
.dataTables_info { color: var(--text-muted) !important; font-size: 12px; }
