/* ============================================================
   SIInventaris SMK - Custom Admin Theme
   ============================================================ */

:root {
  --app-primary: #4f46e5;
  --app-primary-dark: #4338ca;
  --app-primary-light: #eef2ff;
  --app-sidebar-bg: #0f172a;
  --app-sidebar-text: #94a3b8;
  --app-sidebar-active: #ffffff;
  --app-sidebar-hover: #1e293b;
  --app-bg: #f1f5f9;
  --app-card-border: #e2e8f0;
  --app-success: #16a34a;
  --app-warning: #f59e0b;
  --app-danger: #dc2626;
  --app-info: #0ea5e9;
  --sidebar-width: 264px;
}

* {
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", "Inter", system-ui, -apple-system, sans-serif;
  background-color: var(--app-bg);
  color: #1e293b;
  font-size: 0.92rem;
  min-height: 100vh;
}

a {
  text-decoration: none;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #0f172a 0%, #1e1b4b 100%);
  color: var(--app-sidebar-text);
  z-index: 1040;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand .brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--app-primary), #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.sidebar-brand .brand-name {
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.2;
  color: #fff;
}

.sidebar-brand .brand-sub {
  font-size: 0.7rem;
  color: var(--app-sidebar-text);
  letter-spacing: 0.5px;
}

.sidebar-section {
  padding: 18px 20px 6px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #475569;
}

.sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 0 12px 24px;
}

.sidebar-nav .nav-item {
  margin-bottom: 3px;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: var(--app-sidebar-text);
  font-weight: 500;
  transition: all 0.2s ease;
  position: relative;
}

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

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

.sidebar-nav .nav-link.active {
  color: var(--app-sidebar-active);
  background: linear-gradient(135deg, var(--app-primary), #7c3aed);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
}

.sidebar-nav .nav-link.active i {
  color: #fff;
}

.sidebar-badge {
  margin-left: auto;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.75rem;
  color: #64748b;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 1035;
  display: none;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main {
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: calc(100% - var(--sidebar-width));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--app-card-border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.topbar .breadcrumb {
  margin: 0;
  font-size: 0.78rem;
}

/* ============================================================
   GLOBAL SEARCH (Topbar)
   ============================================================ */
.topbar-search {
  position: relative;
  width: 300px;
  margin: 0 12px;
}

.topbar-search form {
  position: relative;
}

.topbar-search form > i {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 0.85rem;
  pointer-events: none;
}

.topbar-search input {
  width: 100%;
  border: 1px solid var(--app-card-border);
  border-radius: 10px;
  padding: 8px 14px 8px 36px;
  font-size: 0.85rem;
  background: #f8fafc;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.topbar-search input:focus {
  outline: none;
  border-color: var(--app-primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.search-results {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 420px;
  overflow-y: auto;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(2, 6, 23, 0.16);
  padding: 6px;
  z-index: 1050;
}

.search-results.show {
  display: block;
}

.search-results-empty {
  padding: 22px 16px;
  text-align: center;
  color: #94a3b8;
  font-size: 0.8rem;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 8px;
  color: #1e293b;
}

.search-result-item:hover {
  background: #f1f5f9;
}

.search-result-item .thumb {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--app-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--app-primary);
  flex-shrink: 0;
}

.search-result-item .sr-name {
  font-weight: 600;
  font-size: 0.83rem;
  line-height: 1.25;
}

.search-result-item .sr-meta {
  font-size: 0.72rem;
  color: #64748b;
}

.search-results-footer a {
  display: block;
  text-align: center;
  padding: 8px;
  font-size: 0.78rem;
  color: var(--app-primary);
  font-weight: 600;
}

@media (max-width: 991.98px) {
  .topbar-search {
    width: auto;
    flex: 1;
    margin: 0 8px;
  }
}

@media (max-width: 575.98px) {
  .topbar-search {
    display: none;
  }
}


.content {
  padding: 24px;
  flex: 1;
}

/* ============================================================
   CARDS & UI
   ============================================================ */
.card {
  border: 1px solid var(--app-card-border);
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.card-header {
  background: #fff;
  border-bottom: 1px solid var(--app-card-border);
  padding: 14px 20px;
  font-weight: 600;
  border-radius: 14px 14px 0 0 !important;
}

.card-body {
  padding: 20px;
}

.stat-card {
  border: none;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  color: #fff;
  min-height: 118px;
}

.stat-card .stat-icon {
  position: absolute;
  right: 16px;
  bottom: 10px;
  font-size: 3.4rem;
  opacity: 0.22;
}

.stat-card .stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  opacity: 0.9;
}

.stat-card .stat-value {
  font-size: 1.7rem;
  font-weight: 700;
  margin-top: 4px;
}

.stat-card .stat-link {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.78rem;
}

.stat-primary  { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.stat-success  { background: linear-gradient(135deg, #16a34a, #22c55e); }
.stat-warning  { background: linear-gradient(135deg, #d97706, #f59e0b); }
.stat-danger   { background: linear-gradient(135deg, #dc2626, #ef4444); }
.stat-info     { background: linear-gradient(135deg, #0284c7, #0ea5e9); }
.stat-secondary{ background: linear-gradient(135deg, #475569, #64748b); }
.stat-indigo   { background: linear-gradient(135deg, #4338ca, #6366f1); }
.stat-pink     { background: linear-gradient(135deg, #db2777, #ec4899); }

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

.btn-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 8px;
}

.badge {
  font-weight: 600;
  padding: 0.42em 0.65em;
}

.form-label {
  font-weight: 600;
  font-size: 0.82rem;
  color: #475569;
  margin-bottom: 6px;
}

.form-control, .form-select {
  border-radius: 9px;
  padding: 9px 12px;
  border-color: #d8dee9;
  font-size: 0.9rem;
}

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

.required::after {
  content: " *";
  color: var(--app-danger);
}

.table thead th {
  background: #f8fafc;
  border-bottom: 2px solid var(--app-card-border);
  color: #475569;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.table td {
  vertical-align: middle;
}

.table-hover tbody tr:hover {
  background-color: #f8faff;
}

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

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
}

.avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #94a3b8;
}

.empty-state i {
  font-size: 3rem;
  opacity: 0.4;
}

.pagination {
  --bs-pagination-active-bg: var(--app-primary);
  --bs-pagination-active-border-color: var(--app-primary);
  --bs-pagination-color: var(--app-primary);
}

/* Alert flash */
.alert {
  border-radius: 10px;
}

/* Login page */
.login-bg {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #312e81 55%, #4f46e5 100%);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.login-bg::before,
.login-bg::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
}

.login-bg::before {
  width: 420px;
  height: 420px;
  top: -140px;
  right: -120px;
}

.login-bg::after {
  width: 320px;
  height: 320px;
  bottom: -110px;
  left: -100px;
}

.login-card {
  width: 100%;
  max-width: 430px;
  border: none;
  border-radius: 20px;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.45);
  position: relative;
  z-index: 2;
}

.login-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--app-primary), #7c3aed);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.8rem;
  box-shadow: 0 10px 24px rgba(79, 70, 229, 0.4);
}

/* Print */
@media print {
  .sidebar, .topbar, .no-print, .content-actions {
    display: none !important;
  }
  .main {
    margin-left: 0 !important;
    width: 100% !important;
  }
  .content {
    padding: 0 !important;
  }
  .card {
    box-shadow: none !important;
    border: none !important;
  }
}

.report-header {
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 3px solid var(--app-primary);
  padding-bottom: 14px;
  margin-bottom: 20px;
}

.report-header .report-logo {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--app-primary), #7c3aed);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
}

.report-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  color: #0f172a;
}

.report-subtitle {
  font-size: 0.8rem;
  color: #64748b;
  margin: 0;
}

.table-report {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.table-report th,
.table-report td {
  border: 1px solid #cbd5e1;
  padding: 7px 9px;
  text-align: left;
}

.table-report thead th {
  background: #f1f5f9;
  color: #334155;
}

.signature-area {
  display: flex;
  justify-content: flex-end;
  margin-top: 50px;
}

/* ============================================================
   TABEL & PAGINATION (DataTables + server pager)
   ============================================================ */

.dataTables_wrapper {
  font-size: 0.88rem;
}

/* Toolbar: search + length */
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_length {
  margin-bottom: 0.85rem;
}

.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--bs-secondary-color);
  font-weight: 500;
}

.dataTables_wrapper .dataTables_filter input {
  position: relative;
  min-width: 220px;
  padding: 0.375rem 0.75rem 0.375rem 2.1rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  font-size: 0.88rem;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0.65rem center;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.dataTables_wrapper .dataTables_filter input:focus {
  border-color: var(--app-primary);
  box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.15);
  outline: 0;
}

.dataTables_wrapper .dataTables_length select {
  padding: 0.375rem 2rem 0.375rem 0.75rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  font-size: 0.88rem;
  background-color: #fff;
  cursor: pointer;
}

.dataTables_wrapper .dataTables_length select:focus {
  border-color: var(--app-primary);
  box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.15);
  outline: 0;
}

/* Info bar */
.dataTables_wrapper .dataTables_info {
  color: var(--bs-secondary-color);
  font-size: 0.82rem;
  padding-top: 0.6rem;
}

/* Pagination (DataTables) */
.dataTables_wrapper .dataTables_paginate .pagination {
  justify-content: flex-end;
  gap: 3px;
}

.dataTables_wrapper .dataTables_paginate .page-link {
  min-width: 34px;
  text-align: center;
  border-radius: 8px !important;
  font-size: 0.82rem;
  padding: 0.3rem 0.55rem;
  color: var(--bs-secondary-color);
  transition: all 0.15s ease;
}

.dataTables_wrapper .dataTables_paginate .page-item:not(.disabled) .page-link:hover {
  background-color: var(--app-primary-light);
  border-color: var(--app-primary-light);
  color: var(--app-primary);
}

.dataTables_wrapper .dataTables_paginate .page-item.active .page-link {
  background-color: var(--app-primary);
  border-color: var(--app-primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.35);
}

/* Pagination (server-side $pager->links) */
.pagination {
  --bs-pagination-active-bg: var(--app-primary);
  --bs-pagination-active-border-color: var(--app-primary);
  --bs-pagination-color: var(--app-primary);
  gap: 3px;
}

.pagination .page-link {
  min-width: 34px;
  text-align: center;
  border-radius: 8px !important;
  font-size: 0.82rem;
  padding: 0.3rem 0.55rem;
  color: var(--bs-secondary-color);
  transition: all 0.15s ease;
}

.pagination .page-item:not(.disabled):not(.active) .page-link:hover {
  background-color: var(--app-primary-light);
  border-color: var(--app-primary-light);
  color: var(--app-primary);
}

.pagination .page-item.active .page-link {
  background-color: var(--app-primary);
  border-color: var(--app-primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.35);
}

.pagination .page-item.disabled .page-link {
  opacity: 0.5;
}

/* Header tabel */
.table thead th {
  background-color: var(--app-primary-light);
  color: var(--app-primary-dark);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
  border-bottom: 1px solid var(--app-card-border);
}

.table tbody tr {
  transition: background-color 0.12s ease;
}

.table tbody tr:hover {
  background-color: rgba(79, 70, 229, 0.04) !important;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.show {
    transform: translateX(0);
  }
  .sidebar-overlay.show {
    display: block;
  }
  .main {
    margin-left: 0;
    width: 100%;
  }
}

@media (max-width: 575.98px) {
  .content {
    padding: 14px;
  }
  .topbar {
    padding: 10px 14px;
  }
  .stat-value {
    font-size: 1.35rem !important;
  }
  .table-responsive {
    border: 0;
  }
}
