@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap");

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Poppins", sans-serif;
  background-color: #f3f4f6;
  margin: 0;
  color: #222;
}

a {
  text-decoration: none;
}

/* =========================================================
TOPBAR
========================================================= */

.topbar {
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);

  padding: 14px 24px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 15px;

  position: sticky;
  top: 0;

  z-index: 100;
}

/* =========================================================
BRAND
========================================================= */

.topbar .brand {
  font-weight: 700;
  font-size: 18px;
  color: #007bff;

  white-space: nowrap;
}

/* =========================================================
DESKTOP NAV
========================================================= */

.main-nav {
  display: flex;
  align-items: center;

  gap: 6px;

  flex: 1;
  justify-content: center;
}

.main-nav a {
  padding: 8px 14px;

  border-radius: 8px;

  color: #444;

  font-size: 14px;
  font-weight: 500;

  transition:
    background 0.2s,
    color 0.2s;
}

.main-nav a:hover,
.main-nav a.active {
  background: #007bff;
  color: #ffffff;
}

/* =========================================================
USER
========================================================= */

.topbar .userbox {
  font-size: 13px;
  color: #666;

  display: flex;
  align-items: center;

  gap: 10px;

  white-space: nowrap;
}

.topbar .userbox .role-badge {
  background: #eef3ff;
  color: #007bff;

  padding: 3px 10px;

  border-radius: 20px;

  font-weight: 600;
  font-size: 11px;

  text-transform: uppercase;
}

.topbar .userbox a {
  color: #dc3545;
  font-weight: 600;
}

/* =========================================================
MOBILE HEADER
========================================================= */

.mobile-header {
  display: none;
}

.mobile-user {
  color: #666;

  font-size: 12px;
  font-weight: 500;

  max-width: 120px;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =========================================================
HAMBURGER
========================================================= */

.hamburger {
  width: 42px;
  height: 42px;

  padding: 0;

  border: 1px solid #e5e7eb;

  border-radius: 9px;

  background: #ffffff;

  display: flex;
  flex-direction: column;

  align-items: center;
  justify-content: center;

  gap: 5px;

  cursor: pointer;

  transition:
    background 0.2s,
    border-color 0.2s;
}

.hamburger:hover {
  background: #f8f9fa;
  border-color: #d1d5db;
}

.hamburger:focus {
  outline: none;
}

.hamburger span {
  width: 20px;
  height: 2px;

  background: #333;

  border-radius: 5px;

  transition:
    transform 0.2s,
    opacity 0.2s;
}

/* ANIMASI GARIS 3 → X */

.hamburger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger.open span:nth-child(2) {
  opacity: 0;
}

.hamburger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* =========================================================
MOBILE NAV
========================================================= */

.mobile-nav {
  display: none;
}

/* =========================================================
LAYOUT
========================================================= */

.wrap {
  max-width: 1400px;

  margin: 0 auto;

  padding: 24px;
}

.page-title {
  font-size: 22px;

  font-weight: 600;

  margin-bottom: 18px;

  color: #333;
}

/* =========================================================
CARD
========================================================= */

.card {
  background: #fff;

  border-radius: 12px;

  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.06);

  padding: 22px;

  margin-bottom: 22px;
}

.card h2 {
  margin-top: 0;

  font-size: 17px;

  color: #333;
}

/* =========================================================
GRID
========================================================= */

.grid {
  display: grid;

  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));

  gap: 18px;
}

/* =========================================================
ROMBEL
========================================================= */

.rombel-block h3 {
  margin: 0 0 10px 0;

  font-size: 15px;

  color: #007bff;

  border-bottom: 2px solid #eef3ff;

  padding-bottom: 8px;
}

.btn-list {
  display: flex;

  flex-direction: column;

  gap: 8px;
}

/* =========================================================
BUTTON
========================================================= */

.btn {
  display: inline-block;

  padding: 9px 14px;

  font-size: 13px;
  font-weight: 500;

  color: #fff;

  background-color: #007bff;

  border: none;

  border-radius: 6px;

  cursor: pointer;

  text-align: center;

  transition:
    transform 0.15s,
    background 0.2s;
}

.btn:hover {
  background-color: #0056b3;

  transform: translateY(-1px);
}

.btn.gray {
  background-color: #6c757d;
}

.btn.gray:hover {
  background-color: #545b62;
}

.btn.red {
  background-color: #dc3545;
}

.btn.red:hover {
  background-color: #b02a37;
}

.btn.green {
  background-color: #28a745;
}

.btn.green:hover {
  background-color: #1e7e34;
}

.btn.empty {
  background-color: #e9ecef;

  color: #999;

  cursor: default;
}

.btn.empty:hover {
  transform: none;
}

.btn.small {
  padding: 6px 10px;

  font-size: 12px;
}

/* =========================================================
FORMS
========================================================= */

label {
  display: block;

  font-size: 13px;

  font-weight: 600;

  margin: 12px 0 6px;

  color: #444;
}

input[type="text"],
input[type="password"],
input[type="file"],
select,
textarea {
  width: 100%;

  padding: 10px 12px;

  font-size: 14px;

  border: 1px solid #ddd;

  border-radius: 6px;

  outline: none;

  font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #007bff;
}

.form-row {
  display: flex;

  gap: 14px;

  flex-wrap: wrap;
}

.form-row > div {
  flex: 1;

  min-width: 200px;
}

/* =========================================================
CHECKBOX
========================================================= */

.checkbox-grid {
  display: grid;

  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));

  gap: 8px;

  margin: 8px 0 16px;
}

.checkbox-grid label {
  display: flex;

  align-items: center;

  gap: 8px;

  font-weight: 400;

  font-size: 13px;

  margin: 0;

  background: #f8f9fa;

  padding: 8px 10px;

  border-radius: 6px;
}

.checkbox-grid input[type="checkbox"] {
  width: auto;
}

.checklist-actions {
  margin: 6px 0 4px;

  display: flex;

  gap: 8px;
}

.checklist-actions button {
  font-size: 12px;

  padding: 5px 10px;
}

/* =========================================================
TABLE
========================================================= */

table {
  width: 100%;

  border-collapse: collapse;

  font-size: 13px;
}

th,
td {
  padding: 10px;

  border-bottom: 1px solid #eee;

  text-align: left;

  vertical-align: middle;
}

th {
  background: #f8f9fa;

  font-weight: 600;

  color: #444;
}

tr:hover td {
  background: #fafcff;
}

.table-wrap {
  overflow-x: auto;
}

/* =========================================================
BADGE
========================================================= */

.badge {
  padding: 3px 10px;

  border-radius: 20px;

  font-size: 11px;

  font-weight: 600;
}

.badge.superadmin {
  background: #ffe9e9;

  color: #dc3545;
}

.badge.admin {
  background: #fff6e0;

  color: #b8860b;
}

.badge.user {
  background: #e6f7ee;

  color: #1e7e34;
}

/* =========================================================
FLASH
========================================================= */

.flash {
  padding: 12px 16px;

  border-radius: 8px;

  margin-bottom: 18px;

  font-size: 14px;
}

.flash.success {
  background: #e6f7ee;

  color: #1e7e34;
}

.flash.error {
  background: #ffe9e9;

  color: #dc3545;
}

/* =========================================================
ACTIONS
========================================================= */

.actions {
  display: flex;

  gap: 6px;

  flex-wrap: wrap;
}

.hint {
  font-size: 12px;

  color: #888;

  margin-top: 4px;
}

/* =========================================================
LOGIN
========================================================= */

.login-container {
  background: #ffffff;

  padding: 34px 30px;

  border-radius: 14px;

  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);

  text-align: center;

  max-width: 380px;

  width: 100%;
}

.login-container h1 {
  font-size: 22px;

  color: #333;

  margin-bottom: 20px;
}

/* =========================================================
AUTH
========================================================= */

.auth-page {
  min-height: 100vh;

  min-height: 100dvh;

  display: flex;

  align-items: center;

  justify-content: center;

  padding: 20px;
}

/* =========================================================
CENTER PAGE
========================================================= */

.center-page {
  display: flex;

  align-items: center;

  justify-content: center;

  min-height: calc(100vh - 160px);

  min-height: calc(100dvh - 160px);
}

.center-page .card {
  width: 100%;
}

/* =========================================================
SEARCH
========================================================= */

.card-search {
  position: relative;

  margin-bottom: 12px;
}

.card-search input {
  width: 100%;

  padding: 8px 12px 8px 30px;

  font-size: 12.5px;

  border: 1px solid #e5e7eb;

  border-radius: 8px;

  background: #f8f9fa
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>")
    no-repeat 9px center;
}

.card-search input:focus {
  background-color: #fff;

  border-color: #007bff;
}

.no-result {
  display: none;

  text-align: center;

  color: #999;

  font-size: 12px;

  padding: 10px 0;
}

.empty-state {
  text-align: center;

  padding: 30px;

  color: #999;

  font-size: 13px;
}

/* =========================================================
TABLET
========================================================= */

@media (max-width: 1100px) {
  .topbar {
    padding: 12px 18px;
  }

  .main-nav a {
    padding: 7px 9px;

    font-size: 12px;
  }

  .topbar .brand {
    font-size: 16px;
  }
}

/* =========================================================
MOBILE / TABLET KECIL
========================================================= */

@media (max-width: 768px) {
  /* HEADER */

  .topbar {
    min-height: 60px;

    padding: 10px 16px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    flex-wrap: nowrap;

    gap: 10px;
  }

  /* BRAND */

  .topbar .brand {
    font-size: 16px;

    max-width: 60%;

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;
  }

  /* HILANGKAN NAV DESKTOP */

  .main-nav {
    display: none;
  }

  /* HILANGKAN USER DESKTOP */

  .topbar .userbox {
    display: none;
  }

  /* TAMPILKAN MOBILE HEADER */

  .mobile-header {
    display: flex;

    align-items: center;

    justify-content: flex-end;

    gap: 10px;
  }

  /* MOBILE NAV */

  .mobile-nav {
    display: flex;

    flex-direction: column;

    position: fixed;

    top: 60px;

    left: 0;

    right: 0;

    background: #ffffff;

    padding: 10px 14px 14px;

    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);

    border-top: 1px solid #f0f0f0;

    z-index: 99;

    opacity: 0;

    visibility: hidden;

    transform: translateY(-10px);

    pointer-events: none;

    transition:
      opacity 0.2s ease,
      transform 0.2s ease,
      visibility 0.2s ease;
  }

  .mobile-nav.show {
    opacity: 1;

    visibility: visible;

    transform: translateY(0);

    pointer-events: auto;
  }

  /* MOBILE LINK */

  .mobile-nav a {
    display: flex;

    align-items: center;

    min-height: 44px;

    padding: 10px 13px;

    margin: 2px 0;

    border-radius: 8px;

    color: #444;

    font-size: 14px;

    font-weight: 500;

    transition:
      background 0.2s,
      color 0.2s;
  }

  .mobile-nav a:hover {
    background: #f3f6ff;

    color: #007bff;
  }

  .mobile-nav a.active {
    background: #007bff;

    color: #ffffff;
  }

  /* LOGOUT MOBILE */

  .mobile-nav .logout-mobile {
    margin-top: 8px;

    padding-top: 13px;

    border-top: 1px solid #eeeeee;

    border-radius: 0;

    color: #dc3545;

    font-weight: 600;
  }

  .mobile-nav .logout-mobile:hover {
    background: #fff1f2;

    color: #dc3545;
  }

  /* CONTENT */

  .wrap {
    padding: 16px;
  }

  .card {
    padding: 16px;

    border-radius: 10px;
  }

  .grid {
    grid-template-columns: 1fr;

    gap: 14px;
  }

  .form-row {
    flex-direction: column;

    gap: 0;
  }

  .form-row > div {
    min-width: 0;
  }

  table,
  thead,
  tbody,
  th,
  td,
  tr {
    font-size: 12.5px;
  }

  .login-container {
    padding: 26px 20px;

    border-radius: 12px;
  }
}

/* =========================================================
HP KECIL
========================================================= */

@media (max-width: 480px) {
  .topbar {
    min-height: 56px;

    padding: 9px 12px;
  }

  .topbar .brand {
    font-size: 15px;

    max-width: 60%;
  }

  .mobile-header {
    gap: 7px;
  }

  .mobile-user {
    max-width: 85px;

    font-size: 11px;
  }

  .hamburger {
    width: 40px;

    height: 40px;

    border-radius: 9px;
  }

  .mobile-nav {
    top: 56px;

    padding: 8px 10px 12px;
  }

  .mobile-nav a {
    min-height: 42px;

    padding: 9px 11px;

    font-size: 13px;
  }

  .wrap {
    padding: 12px;
  }

  .page-title {
    font-size: 19px;
  }

  .card {
    padding: 14px;
  }
}
