/* =========================================================
   APLIKASI POIN PELANGGARAN
   GAYA FORMAL / INSTITUSIONAL
   ========================================================= */

:root {
  --primary: #1559a6;
  --primary-dark: #0d3f78;
  --primary-light: #eaf3ff;

  --secondary: #2f6fab;
  --accent: #198754;

  --success: #198754;
  --success-light: #eaf7ef;

  --warning: #d99a00;
  --warning-light: #fff7df;

  --danger: #c43d3d;
  --danger-light: #fdeeee;

  --bg: #f3f6fa;
  --surface: #ffffff;

  --text: #1f2937;
  --text-secondary: #5f6b7a;
  --text-light: #8a96a6;

  --border: #d9e0e8;

  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow: 0 3px 12px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 8px 24px rgba(16, 24, 40, 0.10);

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
}


/* =========================================================
   RESET
   ========================================================= */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family:
    "Segoe UI",
    Roboto,
    Arial,
    sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  overflow-x: hidden;

  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}


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

header {
  position: sticky;
  top: 0;
  z-index: 100;

  min-height: 68px;
  padding: 10px clamp(16px, 4vw, 32px);

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

  color: #fff;
  background: var(--primary-dark);

  border-bottom: 3px solid var(--primary);
  box-shadow: 0 2px 8px rgba(16, 24, 40, 0.12);
}

header h1,
header h2 {
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: 0;
}

header h2::before {
  content: "▌";
  margin-right: 8px;
  color: #9fc7ef;
}


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

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

#user-info {
  display: inline-flex;
  align-items: center;

  padding: 6px 10px;

  border: 1px solid rgba(255,255,255,.22);
  border-radius: 6px;

  background: rgba(255,255,255,.08);
  color: #fff;

  font-size: .82rem;
  font-weight: 600;
}


/* =========================================================
   LOGOUT
   ========================================================= */

#btn-logout,
.btn-logout {
  background: #fff;
  color: var(--primary-dark);

  border: 1px solid rgba(255,255,255,.8);
  border-radius: 6px;

  padding: 8px 13px;

  font-size: .82rem;
  font-weight: 700;

  cursor: pointer;
  transition: .2s ease;
  box-shadow: none;
}

#btn-logout:hover,
.btn-logout:hover {
  background: #eef5fd;
  color: var(--primary-dark);
  transform: none;
  box-shadow: none;
}


/* =========================================================
   NAVIGATION
   ========================================================= */

.nav-tabs {
  position: sticky;
  top: 68px;
  z-index: 90;

  display: flex;
  gap: 4px;

  padding: 8px clamp(10px, 4vw, 32px);

  background: #fff;
  border-bottom: 1px solid var(--border);

  overflow-x: auto;
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  flex-shrink: 0;

  padding: 10px 15px;

  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 5px 5px 0 0;

  background: transparent;
  color: var(--text-secondary);

  font-size: .86rem;
  font-weight: 600;

  cursor: pointer;
  transition: .2s ease;
  box-shadow: none;
}

.tab-btn:hover {
  color: var(--primary);
  background: #f5f8fc;
  transform: none;
  box-shadow: none;
}

.tab-btn.active {
  color: var(--primary-dark);
  background: #f7faff;
  border-bottom-color: var(--primary);
  box-shadow: none;
}


/* =========================================================
   CONTAINER
   ========================================================= */

.container {
  width: 100%;
  max-width: 1150px;
  min-width: 0;

  margin: 24px auto;
  padding: 0 18px;

  overflow-x: hidden;
}

.tab-content {
  width: 100%;
  max-width: 100%;
  min-width: 0;

  animation: fadeIn .22s ease;
}

.tab-content h3 {
  margin-bottom: 16px;

  color: var(--text);
  font-size: 1.12rem;
  font-weight: 700;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}


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

form {
  width: 100%;
  max-width: 680px;

  margin: 0 auto;
  padding: 24px;

  background: var(--surface);

  border: 1px solid var(--border);
  border-radius: var(--radius-lg);

  box-shadow: var(--shadow);
}

form::before {
  content: "";

  display: block;

  height: 4px;

  margin: -24px -24px 22px;

  border-radius: 12px 12px 0 0;

  background: var(--primary);
}

form div {
  margin-bottom: 17px;
}

label {
  display: block;

  margin-bottom: 6px;

  color: #334155;

  font-size: .85rem;
  font-weight: 650;
}


/* =========================================================
   INPUTS
   ========================================================= */

input,
select,
textarea {
  width: 100%;
  min-height: 44px;

  padding: 10px 12px;

  border: 1px solid var(--border);
  border-radius: var(--radius-sm);

  background: #fff;
  color: var(--text);

  font-size: .92rem;
  outline: none;

  transition: border-color .2s, box-shadow .2s;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #b9c8d9;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21, 89, 166, .10);
}

select:disabled {
  background: #f4f6f8;
  color: var(--text-light);
  cursor: not-allowed;
}


/* =========================================================
   FILE
   ========================================================= */

input[type="file"] {
  padding: 7px;
  background: #fafbfd;
}

input[type="file"]::file-selector-button {
  border: 1px solid #cbd5e1;
  padding: 7px 11px;
  margin-right: 8px;

  border-radius: 5px;

  background: #f1f5f9;
  color: #334155;

  font-weight: 600;
  cursor: pointer;
}


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

button {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);

  background: var(--primary);
  color: #fff;

  padding: 10px 16px;

  font-size: .86rem;
  font-weight: 650;

  cursor: pointer;

  transition:
    background-color .2s,
    border-color .2s,
    transform .2s,
    box-shadow .2s;

  box-shadow: none;
}

button:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(21, 89, 166, .18);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  opacity: .65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}


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

.table-responsive,
#user-list-container,
#siswa-list-container,
#pelanggaran-list-container,
.siswa-kelas-wrapper-admin,
.pelanggaran-kategori-wrapper-admin,
#tab-verifikasi {
  width: 100%;
  max-width: 100%;
  min-width: 0;

  overflow-x: auto;
  overflow-y: hidden;

  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;

  border-radius: var(--radius-lg);
}

.table-responsive {
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

table {
  width: max-content;
  min-width: 100%;
  max-width: none;

  border-collapse: collapse;
}

th,
td {
  padding: 11px 13px;

  border-bottom: 1px solid #e8edf3;

  text-align: left;
  vertical-align: top;

  font-size: .84rem;
}

th {
  background: #edf3f9;

  color: #24415f;

  font-weight: 700;

  white-space: nowrap;
}

td {
  color: #334155;
  overflow-wrap: anywhere;
}

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

tbody tr:hover {
  background: #f8fafc;
}

tr:last-child td {
  border-bottom: none;
}

table a {
  color: var(--primary);
  text-decoration: none;
}

table a:hover {
  text-decoration: underline;
}

table button {
  white-space: nowrap;
  padding: 6px 10px;
  font-size: .74rem;
}


/* =========================================================
   TABLE WIDTH RULES
   ========================================================= */

#tab-verifikasi table {
  min-width: 760px;
}

.siswa-kelas-wrapper-admin table {
  min-width: 900px;
}

#user-list-container table {
  min-width: 620px;
}

.pelanggaran-kategori-wrapper-admin table {
  min-width: 560px;
}


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

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 4px 9px;

  border-radius: 12px;

  font-size: .7rem;
  font-weight: 700;

  white-space: nowrap;
}

.badge.green {
  color: #146c43;
  background: var(--success-light);
}

.badge.yellow {
  color: #8a6400;
  background: var(--warning-light);
}

.badge.orange {
  color: #9a5000;
  background: #fff1df;
}

.badge.red {
  color: #a72d2d;
  background: var(--danger-light);
}


/* =========================================================
   TOKEN VERIFIKASI
   ========================================================= */

.status-token {
  display: inline-flex;
  align-items: center;
  gap: 5px;

  padding: 4px 8px;

  border-radius: 12px;

  font-size: .72rem;
  font-weight: 650;
}


/* =========================================================
   ADMIN - KATEGORI
   ========================================================= */

.kategori-list-admin {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kategori-wrapper-admin {
  overflow: hidden;

  background: #fff;

  border: 1px solid var(--border);
  border-radius: var(--radius);

  box-shadow: var(--shadow-sm);
}

.kategori-button-admin {
  width: 100%;

  display: flex;
  align-items: center;
  gap: 9px;

  padding: 12px 14px;

  border: none;
  border-radius: 0;

  background: #edf3f9;
  color: #24415f;

  text-align: left;
  box-shadow: none;
}

.kategori-button-admin:hover {
  background: #e4edf6;
  transform: none;
  box-shadow: none;
}

.kategori-arrow {
  width: 20px;
  font-size: .72rem;
}

.kategori-nama {
  flex: 1;
  font-weight: 700;
}

.kategori-jumlah {
  padding: 3px 8px;

  border-radius: 12px;

  background: #fff;
  color: var(--primary);

  font-size: .68rem;
  font-weight: 700;
}


/* =========================================================
   ADMIN - TABEL PELANGGARAN
   ========================================================= */

.pelanggaran-kategori-wrapper-admin {
  padding: 10px;

  background: #fbfcfe;
}

.pelanggaran-kategori-wrapper-admin table {
  border-radius: 8px;
  overflow: hidden;
}

.pelanggaran-kategori-wrapper-admin th {
  background: #f1f5f9;
}

.btn-edit-pelanggaran {
  background: #c88a00;
  box-shadow: none;

  padding: 6px 10px;
  font-size: .72rem;
}

.btn-delete-pelanggaran {
  background: #b53b3b;
  box-shadow: none;

  padding: 6px 10px;
  font-size: .72rem;
}

.btn-edit-pelanggaran:hover,
.btn-delete-pelanggaran:hover {
  transform: translateY(-1px);
}


/* =========================================================
   ADMIN - BUTTON UMUM
   ========================================================= */

.btn-edit-user,
.btn-edit-siswa {
  background: #e7eef7;
  color: #24415f;
  border-color: #c9d7e6;
  box-shadow: none;
  padding: 6px 10px;
  font-size: .72rem;
}

.btn-edit-user:hover,
.btn-edit-siswa:hover {
  background: #dbe7f3;
  color: var(--primary-dark);
  box-shadow: none;
}

.btn-delete-user,
.btn-delete-siswa {
  background: #b53b3b;
  color: #fff;
  box-shadow: none;
  padding: 6px 10px;
  font-size: .72rem;
}

.btn-delete-user:hover,
.btn-delete-siswa:hover {
  background: #982f2f;
  box-shadow: none;
}


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

.login-container {
  width: min(92%, 420px);

  margin: 8vh auto;
  padding: 28px;

  background: #fff;

  border: 1px solid var(--border);
  border-radius: var(--radius-xl);

  box-shadow: var(--shadow-lg);
}

.login-container::before {
  content: "APLIKASI POIN PELANGGARAN";

  display: block;

  margin-bottom: 18px;

  text-align: center;

  color: var(--primary-dark);

  font-size: 1.15rem;
  font-weight: 800;
}


/* =========================================================
   FILTER
   ========================================================= */

.filter-box {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.filter-box > * {
  flex: 1;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 768px) {

  header {
    min-height: auto;

    padding: 10px 14px;

    align-items: flex-start;
    gap: 9px;
  }

  header h1,
  header h2 {
    font-size: 1rem;
  }

  .user-profile {
    width: 100%;
    justify-content: space-between;
    gap: 7px;
  }

  #user-info {
    max-width: 70%;

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

    font-size: .72rem;
    padding: 5px 8px;
  }

  #btn-logout,
  .btn-logout {
    padding: 7px 10px;
    font-size: .72rem;
  }

  .nav-tabs {
    top: 61px;
    padding: 6px 9px;
  }

  .tab-btn {
    padding: 8px 11px;
    font-size: .75rem;
  }

  .container {
    margin: 16px auto;
    padding: 0 10px;
  }

  .tab-content h3 {
    font-size: 1.02rem;
  }

  form {
    padding: 19px;
  }

  form::before {
    margin: -19px -19px 19px;
  }

  button {
    min-height: 42px;
  }

  .filter-box {
    flex-direction: column;
  }

  /* Tabel tetap utuh, tetapi hanya area tabel yang scroll */
  .table-responsive,
  #user-list-container,
  #siswa-list-container,
  #pelanggaran-list-container,
  .siswa-kelas-wrapper-admin,
  .pelanggaran-kategori-wrapper-admin,
  #tab-verifikasi {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
  }

  #tab-verifikasi table {
    min-width: 760px;
  }

  .siswa-kelas-wrapper-admin table {
    min-width: 900px;
  }

  #user-list-container table {
    min-width: 620px;
  }

  .pelanggaran-kategori-wrapper-admin table {
    min-width: 560px;
  }

  th,
  td {
    padding: 8px 9px;
    font-size: .74rem;
  }

  .kategori-button-admin {
    padding: 11px 12px;
  }

  .kategori-nama {
    font-size: .84rem;
  }

  .kategori-jumlah {
    font-size: .62rem;
  }

  .pelanggaran-kategori-wrapper-admin {
    padding: 6px;
  }

}


/* =========================================================
   EXTRA SMALL MOBILE
   ========================================================= */

@media (max-width: 480px) {

  header {
    padding: 9px 11px;
  }

  header h1,
  header h2 {
    font-size: .92rem;
  }

  .tab-btn {
    padding: 7px 9px;
    font-size: .7rem;
  }

  .container {
    padding: 0 8px;
  }

  form {
    padding: 16px;
  }

  form::before {
    margin: -16px -16px 17px;
  }

  input,
  select,
  textarea {
    font-size: .86rem;
  }

  th,
  td {
    padding: 7px 8px;
    font-size: .7rem;
  }

  .kategori-jumlah {
    display: none;
  }
}


/* =========================================================
   SCROLLBAR
   ========================================================= */

::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

::-webkit-scrollbar-track {
  background: #edf1f5;
}

::-webkit-scrollbar-thumb {
  background: #b9c7d6;
  border-radius: 20px;
}

::-webkit-scrollbar-thumb:hover {
  background: #9eafc1;
}
