/* =========================================================
   Sistem Informasi Gudang — Design System
   Modern dashboard style (Tabler/AdminLTE-inspired)
   Catatan: file ini HANYA berisi CSS (tampilan). Tidak ada
   logika bisnis di sini.
   ========================================================= */

:root {
  /* Warna utama */
  --brand-primary: #4f46e5;
  --brand-primary-dark: #4338ca;
  --brand-primary-light: #eef2ff;
  --brand-success: #16a34a;
  --brand-success-light: #dcfce7;
  --brand-warning: #d97706;
  --brand-warning-light: #fef3c7;
  --brand-danger: #dc2626;
  --brand-danger-light: #fee2e2;
  --brand-info: #0891b2;
  --brand-info-light: #cffafe;
  --brand-dark: #1e2129;

  /* Netral */
  --body-bg: #f4f6fb;
  --surface: #ffffff;
  --border-color: #e7e9f0;
  --text-main: #1f2333;
  --text-muted: #6b7280;

  /* Layout */
  --sidebar-width: 260px;
  --sidebar-bg: #1a1d29;
  --sidebar-bg-hover: #262a3b;
  --topbar-height: 64px;

  /* Radius & shadow */
  --radius-sm: 0.5rem;
  --radius-md: 0.85rem;
  --radius-lg: 1.1rem;
  --shadow-soft: 0 2px 10px rgba(20, 20, 43, 0.06);
  --shadow-hover: 0 10px 25px rgba(20, 20, 43, 0.10);
}

* { box-sizing: border-box; }

body {
  background: var(--body-bg);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  letter-spacing: -0.01em;
}

a { text-decoration: none; }

.text-muted { color: var(--text-muted) !important; }

/* =========================================================
   LAYOUT SHELL
   ========================================================= */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: #cbd1e6;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  transition: transform .25s ease;
}

.app-sidebar .sidebar-brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: 1.15rem 1.25rem;
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.app-sidebar .sidebar-brand .brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--brand-primary), #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.app-sidebar .sidebar-section-title {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #6b7290;
  padding: 1rem 1.25rem .35rem;
}

.app-sidebar .nav-link {
  color: #b7bcd6;
  padding: .65rem 1.25rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .9rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  border-radius: 0;
}

.app-sidebar .nav-link i { font-size: 1.05rem; width: 20px; text-align: center; }

.app-sidebar .nav-link:hover {
  background: var(--sidebar-bg-hover);
  color: #fff;
}

.app-sidebar .nav-link.active {
  background: var(--sidebar-bg-hover);
  color: #fff;
  border-left-color: var(--brand-primary);
}

.app-sidebar .sidebar-footer {
  margin-top: auto;
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.07);
  font-size: .78rem;
  color: #6b7290;
}

.app-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 1030;
}

.app-topbar .sidebar-toggle {
  border: none;
  background: var(--body-bg);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
}

.app-topbar .page-heading {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .35rem .5rem .35rem .35rem;
  border-radius: 999px;
  background: var(--body-bg);
}

.user-chip .avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-primary), #7c3aed);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .85rem;
}

.user-chip .user-meta { line-height: 1.15; }
.user-chip .user-name { font-size: .85rem; font-weight: 600; color: var(--text-main); }
.user-chip .user-role { font-size: .72rem; color: var(--text-muted); }

.app-content {
  padding: 1.5rem;
  flex: 1;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 26, .55);
  z-index: 1035;
}

@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-100%); }
  .app-sidebar.show { transform: translateX(0); }
  .app-main { margin-left: 0; }
  .app-topbar .sidebar-toggle { display: inline-flex; }
  body.sidebar-open .sidebar-backdrop { display: block; }
}

/* =========================================================
   PAGE HEADER (judul halaman + breadcrumb ringkas)
   ========================================================= */
.page-header {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-size: 1.4rem;
  margin: 0;
}

.page-header .page-subtitle {
  font-size: .85rem;
  color: var(--text-muted);
  margin-top: .2rem;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: var(--text-muted);
  font-size: .85rem;
  font-weight: 500;
  margin-bottom: .75rem;
}
.btn-back:hover { color: var(--brand-primary); }

/* =========================================================
   CARD
   ========================================================= */
.card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border-color);
  font-weight: 700;
  padding: 1rem 1.25rem;
}

.card-body { padding: 1.25rem; }

.card-hover { transition: transform .2s ease, box-shadow .2s ease; }
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }

/* Stat card di dashboard */
.stat-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform .2s ease, box-shadow .2s ease;
}

.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }

.stat-card .stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-card .stat-label {
  font-size: .78rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.stat-card .stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  margin-top: .15rem;
}

.stat-icon.bg-primary-soft { background: var(--brand-primary-light); color: var(--brand-primary); }
.stat-icon.bg-success-soft { background: var(--brand-success-light); color: var(--brand-success); }
.stat-icon.bg-info-soft    { background: var(--brand-info-light);    color: var(--brand-info); }
.stat-icon.bg-warning-soft { background: var(--brand-warning-light); color: var(--brand-warning); }
.stat-icon.bg-danger-soft  { background: var(--brand-danger-light);  color: var(--brand-danger); }

/* Quick action tile */
.quick-action {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.1rem;
  display: flex;
  align-items: center;
  gap: .9rem;
  height: 100%;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  color: var(--text-main);
}

.quick-action:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: var(--brand-primary);
  color: var(--text-main);
}

.quick-action .qa-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.quick-action .qa-title { font-weight: 700; font-size: .92rem; }
.quick-action .qa-desc { font-size: .78rem; color: var(--text-muted); }

/* =========================================================
   BUTTON
   ========================================================= */
.btn {
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: .875rem;
  padding: .5rem 1rem;
}

.btn-sm { padding: .3rem .65rem; font-size: .8rem; }

.btn-primary {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
}
.btn-primary:hover { background: var(--brand-primary-dark); border-color: var(--brand-primary-dark); }

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

/* =========================================================
   FORM
   ========================================================= */
.form-label { font-weight: 600; font-size: .85rem; margin-bottom: .4rem; }

.form-control, .form-select {
  border-radius: var(--radius-sm);
  border-color: var(--border-color);
  padding: .55rem .8rem;
  font-size: .9rem;
}

.form-control:focus, .form-select:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 .2rem rgba(79, 70, 229, .12);
}

.form-text { font-size: .78rem; }

/* =========================================================
   TABLE
   ========================================================= */
.table-modern {
  margin-bottom: 0;
}

.table-modern thead th {
  background: var(--body-bg);
  border-bottom: none;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  font-weight: 700;
  padding: .85rem 1rem;
  white-space: nowrap;
}

.table-modern tbody td {
  padding: .85rem 1rem;
  vertical-align: middle;
  font-size: .875rem;
  border-bottom: 1px solid var(--border-color);
}

.table-modern tbody tr:last-child td { border-bottom: none; }
.table-modern tbody tr:hover { background: var(--brand-primary-light); }

.table-card { overflow: hidden; }
.table-card .card-body { padding: 0; }

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.empty-state i { font-size: 2.5rem; color: #c7cbe0; margin-bottom: .75rem; display: block; }
.empty-state .empty-title { font-weight: 700; color: var(--text-main); margin-bottom: .25rem; }

/* =========================================================
   BADGE
   ========================================================= */
.badge { font-weight: 600; padding: .4em .7em; border-radius: 999px; font-size: .72rem; }
.badge-soft-primary { background: var(--brand-primary-light); color: var(--brand-primary); }
.badge-soft-success { background: var(--brand-success-light); color: var(--brand-success); }
.badge-soft-warning { background: var(--brand-warning-light); color: var(--brand-warning); }
.badge-soft-danger  { background: var(--brand-danger-light);  color: var(--brand-danger); }
.badge-soft-info    { background: var(--brand-info-light);    color: var(--brand-info); }
.badge-soft-dark    { background: #e5e7eb; color: #374151; }

/* =========================================================
   ALERT
   ========================================================= */
.alert {
  border: none;
  border-radius: var(--radius-md);
  font-size: .875rem;
  display: flex;
  align-items: flex-start;
  gap: .6rem;
}
.alert-danger  { background: var(--brand-danger-light);  color: #991b1b; }
.alert-success { background: var(--brand-success-light); color: #166534; }
.alert-warning { background: var(--brand-warning-light); color: #92400e; }
.alert-info    { background: var(--brand-info-light);    color: #155e75; }

/* =========================================================
   LOGIN PAGE
   ========================================================= */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top left, #4f46e5 0%, #1a1d29 55%, #0f1117 100%);
  padding: 1.5rem;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 60px rgba(0,0,0,.35);
  overflow: hidden;
  max-width: 400px;
  width: 100%;
}

.login-card .login-brand {
  padding: 2rem 2rem 0;
  text-align: center;
}

.login-card .login-brand .brand-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto .75rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--brand-primary), #7c3aed);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
}

.login-card .login-body { padding: 1.5rem 2rem 2rem; }

/* =========================================================
   MISC
   ========================================================= */
.divider-label {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: var(--text-muted);
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin: 1.75rem 0 1rem;
}
.divider-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.fade-in { animation: fadeIn .35s ease both; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media print {
  .app-sidebar, .app-topbar, .btn-back, form, .no-print { display: none !important; }
  .app-main { margin-left: 0 !important; }
}
