/* =========================================================
   e-Asset Perguruan Tinggi — Design System
   ========================================================= */
:root {
  --brand-primary: #1F4E79;
  --brand-primary-dark: #163a5c;
  --brand-primary-light: #2f6ea3;
  --brand-light: #EAF1F8;

  --sidebar-bg: #16273e;
  --sidebar-text: #b9c6d8;
  --sidebar-text-muted: #7c8ca3;
  --sidebar-active: #ffffff;

  --surface: #ffffff;
  --page-bg: #f4f6fa;
  --border-color: #e7eaf0;
  --text-dark: #1d2939;
  --text-muted: #667085;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 28px rgba(16, 24, 40, .12);

  --topbar-height: 64px;
}

* { box-sizing: border-box; }

body {
  background-color: var(--page-bg);
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-dark);
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; }

/* ---------- Topbar ---------- */
.app-navbar {
  background-color: var(--surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0;
  height: var(--topbar-height);
  position: sticky;
  top: 0;
  z-index: 1040;
  box-shadow: var(--shadow-xs);
}
.app-navbar .container-fluid {
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
}

.sidebar-toggle-btn {
  border: 1px solid var(--border-color);
  background: var(--surface);
  color: var(--text-dark);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  margin-right: .75rem;
  transition: background-color .15s ease;
}
.sidebar-toggle-btn:hover { background-color: var(--page-bg); }

.navbar-brand-mobile {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-weight: 700;
  color: var(--brand-primary);
  font-size: 1.02rem;
}
.navbar-brand-mobile img { width: 22px; height: 22px; object-fit: contain; flex-shrink: 0; }

.user-menu { display: flex; align-items: center; }
.user-menu-btn {
  display: flex;
  align-items: center;
  gap: .6rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: .3rem .6rem .3rem .3rem;
  transition: background-color .15s ease, border-color .15s ease;
}
.user-menu-btn:hover { background-color: var(--page-bg); border-color: var(--border-color); }
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-light));
  color: #fff;
  font-weight: 700;
  font-size: .95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.user-menu-text { flex-direction: column; align-items: flex-start; line-height: 1.2; }
.user-menu-name { font-size: .86rem; font-weight: 600; color: var(--text-dark); }
.user-menu-role { font-size: .74rem; color: var(--text-muted); }
.user-menu-caret { font-size: .7rem; color: var(--text-muted); margin-left: .1rem; }

/* ---------- Layout wrapper ---------- */
.app-wrapper {
  display: flex;
  min-height: calc(100vh - var(--topbar-height));
}

.app-sidebar {
  width: 264px;
  flex-shrink: 0;
  background-color: var(--sidebar-bg);
  min-height: calc(100vh - var(--topbar-height));
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: 1.1rem 1.1rem .9rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
  margin-bottom: .5rem;
}
.sidebar-brand-link { display: flex; align-items: center; gap: .65rem; color: #fff; }
.sidebar-brand-icon {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-brand-icon img { width: 100%; height: 100%; object-fit: contain; border-radius: var(--radius-sm); }
.sidebar-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.sidebar-brand-title { font-weight: 700; font-size: .98rem; color: #fff; }
.sidebar-brand-subtitle { font-size: .72rem; color: var(--sidebar-text-muted); }
.sidebar-close-btn {
  background: transparent; border: none; color: var(--sidebar-text-muted);
  width: 30px; height: 30px; border-radius: var(--radius-sm);
}
.sidebar-close-btn:hover { background: rgba(255,255,255,.08); color: #fff; }

.sidebar-nav { padding: 0 .75rem 1.5rem; flex: 1; }

.sidebar-heading {
  font-size: .68rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--sidebar-text-muted);
  padding: 1.1rem .6rem .4rem;
  letter-spacing: .06em;
}

.sidebar-link {
  display: flex;
  align-items: center;
  color: var(--sidebar-text);
  border-radius: var(--radius-sm);
  padding: .55rem .65rem;
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: 2px;
  position: relative;
  transition: background-color .15s ease, color .15s ease;
}
.sidebar-link-icon {
  width: 20px;
  text-align: center;
  margin-right: .65rem;
  font-size: 1rem;
  color: var(--sidebar-text-muted);
  transition: color .15s ease;
}
.sidebar-link:hover { background-color: rgba(255,255,255,.06); color: #fff; }
.sidebar-link:hover .sidebar-link-icon { color: #fff; }
.sidebar-link.active {
  background-color: rgba(255,255,255,.1);
  color: var(--sidebar-active);
  font-weight: 600;
}
.sidebar-link.active .sidebar-link-icon { color: #fff; }
.sidebar-link.active::before {
  content: "";
  position: absolute;
  left: -.75rem;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--brand-primary-light);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .5);
  z-index: 1025;
}

.app-content {
  flex: 1;
  padding: 1.75rem;
  min-width: 0;
}

.app-footer {
  padding: 1.25rem 1.75rem 1rem;
  border-top: 1px solid var(--border-color);
  margin-top: 1rem;
}

/* ---------- Guest (login) shell ---------- */
.guest-body {
  background: linear-gradient(160deg, var(--brand-primary-dark) 0%, var(--brand-primary) 45%, #2f7ab0 100%);
  min-height: 100vh;
}
.guest-main { padding-top: 0; }

/* ---------- Page header ---------- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: .5rem;
}
.page-header h1 {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
  letter-spacing: -.01em;
}

/* ---------- Cards ---------- */
.card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
}

.table-card {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.card-stat {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: box-shadow .15s ease, transform .15s ease;
}
.card-stat:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.card-stat::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.card-stat .card-body { padding: 1.25rem 1.35rem; }
.card-stat .stat-value { font-size: 1.7rem; font-weight: 800; color: var(--text-dark); line-height: 1.2; }
.card-stat .small { color: var(--text-muted); font-weight: 500; }
.card-stat .stat-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  opacity: 1;
  flex-shrink: 0;
}

.bg-stat-1::before { background: var(--brand-primary); }
.bg-stat-1 .stat-icon { background: rgba(31,78,121,.1); color: var(--brand-primary); }
.bg-stat-2::before { background: #0f9d58; }
.bg-stat-2 .stat-icon { background: rgba(15,157,88,.1); color: #0f9d58; }
.bg-stat-3::before { background: #e08e0b; }
.bg-stat-3 .stat-icon { background: rgba(224,142,11,.1); color: #e08e0b; }
.bg-stat-4::before { background: #c62828; }
.bg-stat-4 .stat-icon { background: rgba(198,40,40,.1); color: #c62828; }

/* ---------- Tables ---------- */
.table { margin-bottom: 0; color: var(--text-dark); }
.table thead th {
  background-color: #f8f9fc;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: .7rem;
  letter-spacing: .04em;
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
  padding: .75rem .9rem;
  white-space: nowrap;
}
.table tbody td { padding: .7rem .9rem; vertical-align: middle; border-bottom: 1px solid var(--border-color); font-size: .875rem; }
.table tbody tr:last-child td { border-bottom: none; }
.table-hover tbody tr:hover { background-color: var(--page-bg); }
.table code { background: var(--brand-light); color: var(--brand-primary-dark); padding: .15rem .4rem; border-radius: 6px; font-size: .8rem; }

/* ---------- Buttons ---------- */
.btn { border-radius: var(--radius-sm); font-weight: 600; font-size: .875rem; }
.btn-sm { border-radius: 7px; }
.btn-primary { background-color: var(--brand-primary); border-color: var(--brand-primary); }
.btn-primary:hover, .btn-primary:focus { background-color: var(--brand-primary-dark); border-color: var(--brand-primary-dark); }
.btn-outline-primary { color: var(--brand-primary); border-color: var(--brand-primary); }
.btn-outline-primary:hover { background-color: var(--brand-primary); border-color: var(--brand-primary); }

/* ---------- Forms ---------- */
.form-label { font-weight: 600; font-size: .85rem; color: var(--text-dark); margin-bottom: .35rem; }
.form-control, .form-select {
  border-radius: var(--radius-sm);
  border-color: var(--border-color);
  font-size: .9rem;
  padding: .5rem .75rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand-primary-light);
  box-shadow: 0 0 0 .2rem rgba(31,78,121,.12);
}
.required::after { content: " *"; color: #c62828; }

/* ---------- Badges ---------- */
.badge { font-weight: 600; padding: .4em .65em; border-radius: 6px; font-size: .72rem; letter-spacing: .01em; }

/* ---------- Alerts ---------- */
.alert { border: 1px solid transparent; border-left-width: 4px; border-radius: var(--radius-sm); font-size: .9rem; }

/* ---------- Pagination ---------- */
.pagination .page-link { border-radius: var(--radius-sm); margin: 0 .15rem; border-color: var(--border-color); color: var(--text-dark); font-size: .85rem; }
.pagination .page-item.active .page-link { background-color: var(--brand-primary); border-color: var(--brand-primary); }

/* ---------- Misc ---------- */
.step-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--brand-primary);
  color: #fff; font-size: .75rem; font-weight: 700; margin-right: .5rem;
}

.settings-logo-preview {
  width: 72px;
  height: 72px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--page-bg);
  overflow: hidden;
  flex-shrink: 0;
}
.settings-logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ---------- DataTables (entries/search/export) ---------- */
.dt-buttons { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .5rem; }
.dt-buttons .btn { border-radius: var(--radius-sm); }
.dataTables_wrapper .dataTables_filter { text-align: left; margin-bottom: .5rem; }
.dataTables_wrapper .dataTables_filter label { display: flex; align-items: center; gap: .5rem; font-size: .85rem; color: var(--text-muted); font-weight: 500; margin: 0; }
.dataTables_wrapper .dataTables_filter input { width: auto; flex: 1; max-width: 260px; }
.dataTables_wrapper .dataTables_length { margin-bottom: .5rem; }
.dataTables_wrapper .dataTables_length label { display: flex; align-items: center; gap: .5rem; font-size: .85rem; color: var(--text-muted); font-weight: 500; margin: 0; }
.dataTables_wrapper .dataTables_length select { width: auto; }
.dataTables_wrapper .dataTables_info { font-size: .8rem; color: var(--text-muted); padding-top: .5rem; }
.dataTables_wrapper .dataTables_paginate { margin-top: .5rem; }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
  .app-sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    z-index: 1030;
    height: 100vh;
    transition: left .22s ease-in-out;
    box-shadow: var(--shadow-lg);
  }
  .app-sidebar.show { left: 0; }
  .sidebar-backdrop.show { display: block; }
  .app-content { padding: 1.1rem; }
}

@media (min-width: 992px) {
  .sidebar-close-btn { display: none; }
}
