/* =========================================================
   Gudang DLH — UI polish layer (dimuat setelah adminlte.css)
   ========================================================= */

:root {
  --app-primary: #0d6efd;
  --app-primary-dark: #0b5ed7;
  --app-success: #198754;
  --app-warning: #f79009;
  --app-danger: #d92d20;
  --app-ink: #101828;
  --app-body: #344054;
  --app-muted: #667085;
  --app-border: #e4e7ec;
  --app-surface: #ffffff;
  --app-canvas: #f5f7fb;
  --app-radius: 14px;
  --app-radius-sm: 10px;
  --app-shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --app-shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 10px 24px -12px rgba(16, 24, 40, .18);
  --app-shadow-lg: 0 18px 40px -18px rgba(16, 24, 40, .28);
  --app-transition: 180ms cubic-bezier(.2, .7, .3, 1);
}

html { scroll-behavior: smooth; }

body {
  font-family: "Source Sans 3", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color: var(--app-body);
  background: var(--app-canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 { color: var(--app-ink); letter-spacing: -.015em; }

a { transition: color var(--app-transition); }

:focus-visible {
  outline: 3px solid rgba(13, 110, 253, .35);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- Layout ---------- */
.app-main { background: transparent; }

.app-content-header {
  padding: 1.35rem 0 .35rem;
}

.app-content-header h3 {
  font-weight: 700;
  font-size: 1.45rem;
  margin: 0;
}

.app-content {
  padding-bottom: 2.5rem;
  animation: app-fade-up .28s ease both;
}

@keyframes app-fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.app-footer {
  background: transparent;
  border-top: 1px solid var(--app-border);
  color: var(--app-muted);
  font-size: .82rem;
}

/* ---------- Navbar & sidebar ---------- */
.app-header.navbar {
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--app-border);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
  position: sticky;
  top: 0;
  z-index: 1030;
  min-height: 56px;
}

.app-sidebar {
  border-right: 1px solid var(--app-border);
  box-shadow: none;
}

.sidebar-brand {
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  padding: 1rem 1rem .9rem;
}

.sidebar-brand .brand-text { font-weight: 600; letter-spacing: -.01em; }

.sidebar-wrapper { scrollbar-width: thin; }

.nav-sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin: 2px 10px;
  padding: .6rem .75rem;
  border-radius: var(--app-radius-sm);
  font-weight: 500;
  transition: background var(--app-transition), color var(--app-transition), transform var(--app-transition);
}

.nav-sidebar .nav-link:hover { background: rgba(255, 255, 255, .08); transform: translateX(2px); }

.nav-sidebar .nav-link.active {
  background: rgba(13, 110, 253, .18);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 3px 0 0 #4dabff;
}

.nav-sidebar .nav-link .nav-icon { font-size: 1.05rem; opacity: .9; }

/* ---------- Cards ---------- */
.card {
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow);
  transition: box-shadow var(--app-transition), transform var(--app-transition);
}

.card:hover { box-shadow: var(--app-shadow-lg); }

.card-header {
  background: var(--app-surface);
  border-bottom: 1px solid var(--app-border);
  font-weight: 600;
  color: var(--app-ink);
  border-radius: var(--app-radius) var(--app-radius) 0 0 !important;
}

.card-body { padding: 1.15rem 1.25rem; }

/* ---------- Tables ---------- */
.table-responsive { border-radius: var(--app-radius-sm); }

.table { margin-bottom: 0; --bs-table-border-color: var(--app-border); }

.table > thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
  color: var(--app-muted);
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--app-border);
  white-space: nowrap;
}

.table > tbody > tr { transition: background var(--app-transition); }
.table-hover > tbody > tr:hover > * { background: #f5f9ff; }

.table td, .table th { vertical-align: middle; }

.table img.img-thumbnail {
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--app-border);
  background: #fff;
}

/* ---------- Buttons ---------- */
.btn {
  border-radius: var(--app-radius-sm);
  font-weight: 600;
  padding: .48rem .9rem;
  transition: transform 120ms ease, box-shadow var(--app-transition), background var(--app-transition), border-color var(--app-transition);
}

.btn:active { transform: translateY(1px) scale(.995); }

.btn-sm { padding: .32rem .65rem; border-radius: 8px; }

.btn-primary { box-shadow: 0 8px 16px -10px rgba(13, 110, 253, .65); }
.btn-primary:hover { box-shadow: 0 10px 20px -10px rgba(13, 110, 253, .75); }

.btn-success { box-shadow: 0 8px 16px -12px rgba(25, 135, 84, .8); }
.btn-danger { box-shadow: 0 8px 16px -12px rgba(217, 45, 32, .8); }

.btn[disabled], .btn.disabled { box-shadow: none; opacity: .65; }

.btn .spinner-border { width: 1rem; height: 1rem; border-width: .16em; }

/* ---------- Forms ---------- */
.form-label { font-weight: 600; color: var(--app-ink); font-size: .88rem; margin-bottom: .35rem; }

.form-control, .form-select {
  border-radius: var(--app-radius-sm);
  border-color: #d0d5dd;
  padding: .55rem .8rem;
  color: var(--app-body);
  transition: border-color var(--app-transition), box-shadow var(--app-transition), background var(--app-transition);
}

.form-control:focus, .form-select:focus {
  border-color: #84b4ff;
  box-shadow: 0 0 0 4px rgba(13, 110, 253, .12);
}

.input-group-text {
  border-radius: var(--app-radius-sm);
  background: #f9fafb;
  border-color: #d0d5dd;
  color: var(--app-muted);
}

textarea.form-control { min-height: 96px; }

.invalid-feedback { font-weight: 500; }

/* ---------- Badges & alerts ---------- */
.badge {
  font-weight: 600;
  letter-spacing: .01em;
  border-radius: 7px;
  padding: .38em .62em;
}

.alert {
  border: 0;
  border-radius: 12px;
  box-shadow: var(--app-shadow-sm);
  animation: app-fade-up .25s ease both;
}

.alert-success { background: #ecfdf3; color: #05603a; border-left: 4px solid #12b76a; }
.alert-danger { background: #fef3f2; color: #912018; border-left: 4px solid #f04438; }
.alert-warning { background: #fffaeb; color: #93370d; border-left: 4px solid #f79009; }
.alert-info { background: #eff8ff; color: #1849a9; border-left: 4px solid #2e90fa; }

/* ---------- Toast ---------- */
.app-toast-stack {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 10800;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  max-width: min(380px, calc(100vw - 2rem));
}

.app-toast {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .75rem .9rem;
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--app-shadow-lg);
  border-left: 4px solid var(--app-primary);
  font-size: .9rem;
  animation: app-toast-in .22s ease both;
}

.app-toast.is-success { border-left-color: #12b76a; }
.app-toast.is-danger { border-left-color: #f04438; }
.app-toast.is-hiding { animation: app-toast-out .2s ease both; }

@keyframes app-toast-in { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes app-toast-out { to { opacity: 0; transform: translateY(-6px) scale(.98); } }

/* ---------- Empty state ---------- */
.app-empty {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--app-muted);
}

.app-empty i { font-size: 2.2rem; opacity: .45; display: block; margin-bottom: .5rem; }

/* ---------- Images / lightbox ---------- */
img { max-width: 100%; }

.app-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--app-border);
  background: #fff;
}

[data-lightbox] { cursor: zoom-in; transition: transform var(--app-transition), box-shadow var(--app-transition); }
[data-lightbox]:hover { transform: scale(1.015); box-shadow: var(--app-shadow); }

.app-lightbox-img { width: 100%; border-radius: 10px; display: block; }

/* ---------- Stat chips ---------- */
.app-stat {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .45rem .7rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--app-border);
  font-size: .82rem;
  font-weight: 600;
  color: var(--app-body);
  box-shadow: var(--app-shadow-sm);
}

a.app-stat {
  text-decoration: none;
  cursor: pointer;
  transition: color var(--app-transition), border-color var(--app-transition),
              background-color var(--app-transition), box-shadow var(--app-transition),
              transform var(--app-transition);
}

a.app-stat:hover,
a.app-stat:focus-visible {
  color: var(--app-primary);
  border-color: rgba(13, 110, 253, .45);
  box-shadow: var(--app-shadow);
  transform: translateY(-1px);
}

.app-stat.is-active {
  color: var(--app-primary);
  border-color: var(--app-primary);
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(13, 110, 253, .08);
}

.app-stat i { opacity: .8; }

.app-stat .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--app-primary); }

/* ---------- Quantity stepper ---------- */
.qty-stepper { display: flex; align-items: stretch; gap: 0; }
.qty-stepper .form-control { text-align: center; border-radius: 0; }
.qty-stepper .btn { border-radius: 0; width: 44px; }
.qty-stepper .btn:first-child { border-radius: 10px 0 0 10px; }
.qty-stepper .btn:last-child { border-radius: 0 10px 10px 0; }

/* ---------- Stepper approval (override inline) ---------- */
.stepper-wrapper { gap: .25rem; }
.stepper-item .step-counter { box-shadow: 0 0 0 4px #fff, var(--app-shadow-sm); transition: background var(--app-transition), transform var(--app-transition); }
.stepper-item.active .step-counter { animation: app-pulse 1.8s infinite; }
@keyframes app-pulse {
  0% { box-shadow: 0 0 0 4px #fff, 0 0 0 0 rgba(13, 110, 253, .35); }
  70% { box-shadow: 0 0 0 4px #fff, 0 0 0 10px rgba(13, 110, 253, 0); }
  100% { box-shadow: 0 0 0 4px #fff, 0 0 0 0 rgba(13, 110, 253, 0); }
}
.stepper-item::before { border-bottom-width: 3px; }

/* ---------- Sticky form panel ---------- */
.app-sticky { position: sticky; top: 1rem; }

/* ---------- Login ---------- */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(1200px 500px at 15% 0%, rgba(13, 110, 253, .16), transparent 60%),
    radial-gradient(900px 400px at 100% 100%, rgba(25, 135, 84, .12), transparent 55%),
    #f4f7fb;
}

.login-box { width: min(430px, 100%); }

.login-card {
  border: 1px solid var(--app-border);
  border-radius: 18px;
  box-shadow: var(--app-shadow-lg);
  overflow: hidden;
}

.login-card .card-body { padding: 1.6rem 1.6rem 1.4rem; }

.login-logo a { color: var(--app-ink); text-decoration: none; font-size: 1.35rem; }

.login-logo .brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #0d6efd, #0b5ed7);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 10px 18px -10px rgba(13, 110, 253, .8);
}

.login-hint { color: var(--app-muted); font-size: .85rem; }

/* ---------- Page header & cards ---------- */
.app-content-header .container-fluid,
.app-content > .container-fluid {
  max-width: 1440px;
  margin-inline: auto;
}

.app-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: .75rem 1rem;
  padding: .35rem 0 .9rem;
}

.app-page-title {
  font-size: 1.5rem;
  font-weight: 750;
  line-height: 1.2;
  margin: 0;
}

.app-page-subtitle {
  margin: .2rem 0 0;
  color: var(--app-muted);
  font-size: .88rem;
}

.app-breadcrumb {
  font-size: .82rem;
}

.app-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
  content: "/";
  color: #cbd5e1;
}

.app-card {
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow-sm);
  overflow: hidden;
}

.app-card > .card-header {
  background: #fff;
  border-bottom: 1px solid var(--app-border);
  padding: .85rem 1.1rem;
  font-weight: 600;
}

.app-card > .card-body { padding: 1.1rem; }

.app-icon-badge {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  background: #eef4ff;
  color: var(--app-primary);
  font-size: 1rem;
}

.app-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: #e8f0ff;
  color: #0b5ed7;
  font-weight: 700;
  font-size: .9rem;
}

.app-avatar-sm { width: 30px; height: 30px; font-size: .78rem; }

.min-w-0 { min-width: 0; }

.app-sticky {
  position: sticky;
  top: 76px;
}

.app-user-menu { min-width: 260px; }

.app-table { --bs-table-bg: transparent; }

.app-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  border-bottom: 1px solid var(--app-border);
  color: var(--app-muted);
  font-size: .72rem;
  font-weight: 650;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .7rem 1rem;
  white-space: nowrap;
}

.app-table tbody td {
  padding: .78rem 1rem;
  border-color: #eef1f5;
  vertical-align: middle;
}

.app-table tbody tr:hover { background: #f9fbff; }

/* Tabel persetujuan: lebar kolom tetap agar tombol aksi (termasuk print) tidak terdorong keluar. */
.app-table-approvals { table-layout: fixed; width: 100%; }
.app-table-approvals tbody td { overflow: hidden; }
.app-table-approvals thead th:last-child,
.app-table-approvals tbody td:last-child {
  overflow: visible;
  white-space: nowrap;
}
.app-table-approvals .app-thumb { flex: 0 0 40px; }
.app-table-approvals .badge { max-width: 100%; vertical-align: middle; }
.app-table-approvals .col-approval-date { white-space: nowrap; }

@media (max-width: 1200px) {
  .app-table-approvals .col-approval-date { display: none; }
  .app-table-approvals thead th:last-child,
  .app-table-approvals tbody td:last-child {
    position: sticky;
    right: 0;
    z-index: 2;
    background: #fff;
    box-shadow: -8px 0 10px -10px rgba(15, 23, 42, .45);
  }
  .app-table-approvals thead th:last-child { background: #f8fafc; z-index: 3; }
  .app-table-approvals tbody tr.app-row-attention td:last-child { background: #fffbeb; }
  .app-table-approvals tbody tr:hover td:last-child { background: #f9fbff; }
}

@media (max-width: 992px) {
  .app-table-approvals .col-approval-qty { display: none; }
}

/* Mobile: ringkas kolom agar nama & tombol aksi tetap terbaca tanpa saling menimpa. */
@media (max-width: 767.98px) {
  .app-table-approvals { table-layout: fixed; }
  .app-table-approvals thead th:first-child,
  .app-table-approvals tbody td:first-child { display: none; }
  .app-table-approvals colgroup col:first-child { display: none; }
  .app-table-approvals colgroup col:nth-child(3) { width: 28% !important; }
  .app-table-approvals colgroup col:nth-child(4) { width: auto !important; }
  .app-table-approvals colgroup col:nth-child(6) { width: 23% !important; }
  .app-table-approvals colgroup col:nth-child(7) { width: 92px !important; }
  .app-table-approvals .app-avatar,
  .app-table-approvals .app-thumb { display: none; }
  .app-table-approvals .badge { white-space: normal; line-height: 1.2; font-size: .65rem; }
  .app-table-approvals thead th:last-child,
  .app-table-approvals tbody td:last-child { width: 92px; }
}

.app-card .pagination { margin-bottom: 0; }
.app-card .page-link { border-radius: 8px; margin: 0 2px; }

.app-row-attention {
  background: #fffbeb;
  box-shadow: inset 3px 0 0 #f79009;
}

.app-detail-list .app-detail-row {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: .75rem;
  padding: .6rem 0;
  border-bottom: 1px dashed #e7ecf2;
}

.app-detail-list .app-detail-row:last-child { border-bottom: 0; }
.app-detail-list dt { color: var(--app-muted); font-weight: 550; font-size: .85rem; margin: 0; }
.app-detail-list dd { margin: 0; }

@media (max-width: 575.98px) {
  .app-detail-list .app-detail-row { grid-template-columns: 1fr; gap: .15rem; }

  .app-header .container-fluid { padding-inline: .85rem; }
  .app-header .navbar-nav { gap: .15rem !important; }
  .app-logout { padding-inline: .55rem; }
  .app-page-title { font-size: 1.3rem; }
}

/* ---------- Utilities ---------- */
.text-muted { color: var(--app-muted) !important; }
.shadow-soft { box-shadow: var(--app-shadow) !important; }
.rounded-app { border-radius: var(--app-radius) !important; }
.w-fit { width: fit-content; }

@media (max-width: 767.98px) {
  .app-content-header h3 { font-size: 1.2rem; }
  .card-body { padding: 1rem; }
  .table-responsive { max-height: 70vh; overflow: auto; }
  .app-toast-stack { left: .75rem; right: .75rem; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
}
