/* ==========================================================================
   STYLE CSS UTAMA - SISTEM ABSENSI BEST BINJAI
   ========================================================================== */

/* ==========================================================================
   1. STYLE UMUM
   ========================================================================== */
body {
  margin: 0;
  background-color: #f4f6f9;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #333333;
}

/* ==========================================================================
   2. HALAMAN LOGIN
   ========================================================================== */
body.auth-body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0;
  padding: 20px;
  position: relative;
  background-color: #780000;
}

.btn-login {
  background-color: #003049;
  color: #ffffff;
  border: none;
  padding: 10px;
  font-weight: 600;
  border-radius: 8px;
}

.btn-login:hover {
  background-color: #8b0000;
  color: #ffffff;
}

.auth-theme-toggle {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 50%;
  color: #555555;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.auth-theme-toggle:hover {
  background-color: #e9ecef;
  color: #0d47a1;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 35px 30px;
  background-color: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 25px;
  color: #003049;
  font-size: 1.4rem;
  text-decoration: none;
}

.auth-brand .brand-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  background-color: #003049;
  color: #ffffff;
  border-radius: 10px;
  font-size: 1.2rem;
}

/* ==========================================================================
   3. LAYOUT DASHBOARD
   ========================================================================== */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ==========================================================================
   4. SIDEBAR
   ========================================================================== */
.sidebar {
  width: 260px;
  min-width: 260px;

  /* KUNCI UTAMA AGAR SIDEBAR DIAM DI DALAM FLEXBOX */
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh; 
  overflow-y: auto;

  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 25px 15px;
  background-color: #f8f9fa;
  border-right: 1px solid #e0e0e0;
}

.sidebar::-webkit-scrollbar {
  width: 5px;
}
.sidebar::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 10px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
  padding-left: 10px;
}

.sidebar-brand .brand-icon {
  padding: 10px 12px;
  background-color: #003049;
  color: #ffffff;
  border-radius: 12px;
  font-size: 1.3rem;
}

.sidebar-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-menu li {
  margin-bottom: 8px;
}

.sidebar-menu li:last-child {
  margin-bottom: 0;
}

.sidebar-menu a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: #555555;
  font-weight: 500;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s;
}

.sidebar-menu a:hover {
  background-color: #e9ecef;
  color: #003049;
}

.sidebar-menu a.active {
  background-color: #003049;
  color: #ffffff !important;
}

/* ==========================================================================
   5. KONTEN UTAMA
   ========================================================================== */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 30px;
}

/* ==========================================================================
   6. FORM DAN BUTTON
   ========================================================================== */
.form-label {
  margin-bottom: 6px;
  color: #444444;
  font-weight: 500;
}

.form-control {
  padding: 10px 14px;
  border: 1px solid #ced4da;
  border-radius: 8px;
}

.form-control:focus {
  border-color: #0d47a1;
  box-shadow: 0 0 0 0.2rem rgba(13, 71, 161, 0.15);
}

.btn-primary {
  padding: 10px;
  background-color: #0d47a1;
  border-color: #0d47a1;
  border-radius: 8px;
  font-weight: 600;
}

.btn-primary:hover {
  background-color: #083378;
  border-color: #083378;
}

/* ==========================================================================
   7. HALAMAN REKAP ABSENSI
   ========================================================================== */
.judul-cetak {
  display: none;
}

.table-scroll {
  max-height: 420px;
  overflow-x: auto;
  overflow-y: auto;
}

.table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background-color: #f8f9fa;
}

/* ==========================================================================
   8. RESPONSIVE
   ========================================================================== */
@media screen and (max-width: 768px) {
  .app-wrapper {
    display: block;
  }
  
  .sidebar {
    width: 100%;
    min-width: 100%;
    height: auto;
    position: static; /* Mematikan sticky di HP agar tidak menutupi layar */
  }

  .main-content {
    padding: 20px;
  }
}

/* ==========================================================================
   9. CETAK / SIMPAN SEBAGAI PDF
   ========================================================================== */
@page {
  size: A4 portrait;
  margin: 12mm;
}

@media print {
  html,
  body {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background-color: #ffffff !important;
  }

  aside.sidebar,
  .sidebar,
  .no-print,
  .modal,
  .modal-backdrop {
    display: none !important;
    visibility: hidden !important;
  }

  .app-wrapper {
    display: block !important;
    width: 100% !important;
    min-height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .main-content {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .judul-halaman {
    display: none !important;
    visibility: hidden !important;
  }

  .judul-cetak {
    display: block !important;
    visibility: visible !important;
    text-align: center;
    margin-bottom: 20px;
  }

  .table-responsive,
  .table-scroll {
    display: block !important;
    width: 100% !important;
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
  }

  .table-scroll thead th {
    position: static !important;
  }

  .card {
    box-shadow: none !important;
    border: 1px solid #dddddd !important;
  }

  table {
    width: 100% !important;
    border-collapse: collapse !important;
  }

  thead {
    display: table-header-group;
  }

  tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  th,
  td {
    font-size: 10px !important;
  }
}