/* ============================================
   GLOBAL
   ============================================ */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', Tahoma, sans-serif; }

html, body {
  overflow-x: hidden !important;
  width: 100%;
  max-width: 100vw;
  position: relative;
}

body {
  background: linear-gradient(160deg, #e8f7ee 0%, #d3f0dd 40%, #b8e6c8 100%);
  min-height: 100vh;
  color: #1a2e22;
  -webkit-font-smoothing: antialiased;
}

img, video, iframe, canvas { max-width: 100%; }

a { color: #03b845; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================
   LOGIN
   ============================================ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 32px 26px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 10px 30px rgba(0,28,7,0.1);
  border: 1px solid rgba(3,184,69,0.12);
}

.login-card .logo {
  width: 100px;
  height: 100px;
  border-radius: 16px;
  margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #03b845;
  overflow: hidden;
  background: #fff;
  padding: 6px;
}
.login-card .logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
}

.login-card h1 {
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  color: #001c07;
  margin-bottom: 4px;
  line-height: 1.35;
}
.login-card .sub {
  text-align: center;
  font-size: 12.5px;
  color: #5b7d68;
  margin-bottom: 22px;
}

/* ============================================
   FORM
   ============================================ */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #1a2e22;
}
.form-group label .req { color: #e63946; margin-left: 2px; }
.form-group label .opt { color: #8aa895; font-weight: 400; font-size: 12px; }

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: 9px;
  border: 1.5px solid #dbe9e0;
  background: #f7fbf8;
  color: #1a2e22;
  font-size: 14px;
  outline: none;
  transition: all 0.18s;
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: #a3b8ab; }

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: #03b845;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(3,184,69,0.15);
}
.form-group textarea { resize: vertical; min-height: 78px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ============================================
   BUTTON
   ============================================ */
.btn {
  display: inline-block;
  padding: 11px 20px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }

.btn-primary {
  background: linear-gradient(135deg, #001c07, #03b845);
  color: #fff;
  box-shadow: 0 4px 14px rgba(3,184,69,0.3);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(3,184,69,0.4); }
.btn-primary:active { transform: translateY(0); }

.btn-block { width: 100%; display: block; }

.btn-danger { background: #e63946; color: #fff; }
.btn-warning { background: #f4a261; color: #fff; }
.btn-success { background: #03b845; color: #fff; }
.btn-secondary { background: #e6f4eb; color: #001c07; }

.btn-sm { padding: 7px 14px; font-size: 12.5px; border-radius: 8px; }

/* ============================================
   ALERT
   ============================================ */
.alert {
  padding: 12px 14px;
  border-radius: 9px;
  font-size: 13px;
  margin-bottom: 14px;
  line-height: 1.5;
}
.alert-danger  { background: #fde8e8; color: #a4161a; border-left: 4px solid #e63946; }
.alert-success { background: #e6f9ee; color: #0a7c3a; border-left: 4px solid #03b845; }
.alert-info    { background: #e8f4fd; color: #0a5b8c; border-left: 4px solid #2196f3; }
.alert-warning { background: #fef4e6; color: #8a5a00; border-left: 4px solid #f4a261; }

/* ============================================
   SIDEBAR LAYOUT
   ============================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
  max-width: 100vw;
  overflow-x: hidden;
}

.sidebar {
  width: 250px;
  background: linear-gradient(180deg, #001c07 0%, #014d1f 100%);
  color: #fff;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  padding: 20px 0;
  overflow-y: auto;
  transition: transform 0.3s ease;
  z-index: 1000;
}

.sidebar .brand {
  padding: 0 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar .brand img {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #fff;
  object-fit: contain;
  padding: 3px;
  flex-shrink: 0;
}
.sidebar .brand .name {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.3;
}

.sidebar .menu { list-style: none; }
.sidebar .menu li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: rgba(255,255,255,0.85);
  font-size: 13.5px;
  text-decoration: none;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.sidebar .menu li a:hover {
  background: rgba(3,184,69,0.2);
  color: #fff;
  text-decoration: none;
}
.sidebar .menu li a.active {
  background: rgba(3,184,69,0.3);
  border-left-color: #03b845;
  color: #fff;
  font-weight: 600;
}
.sidebar .menu li a .icon { font-size: 16px; }

.main-content {
  flex: 1;
  margin-left: 250px;
  padding: 20px;
  transition: margin 0.3s ease;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

/* ============================================
   TOPBAR
   ============================================ */
.topbar {
  background: #fff;
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 10px rgba(0,28,7,0.05);
  border: 1px solid rgba(3,184,69,0.1);
  gap: 10px;
}
.topbar h2 { font-size: 16px; color: #001c07; }
.topbar .user-info { font-size: 13px; color: #5b7d68; white-space: nowrap; }

.hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #001c07;
  padding: 4px;
  flex-shrink: 0;
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 999;
}
.overlay.active { display: block; }

/* ============================================
   CARD
   ============================================ */
.card {
  background: #fff;
  border-radius: 14px;
  padding: 22px 20px;
  margin-bottom: 14px;
  box-shadow: 0 4px 16px rgba(0,28,7,0.06);
  border: 1px solid rgba(3,184,69,0.12);
  overflow: hidden;
  max-width: 100%;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: #001c07;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1.5px solid #e6f4eb;
}

.section-title {
  font-size: 14.5px;
  font-weight: 700;
  color: #001c07;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1.5px solid #e6f4eb;
  display: flex;
  align-items: center;
  gap: 9px;
}
.section-title .num {
  background: linear-gradient(135deg, #001c07, #03b845);
  color: #fff;
  width: 24px; height: 24px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800;
  flex-shrink: 0;
}

.info-box {
  background: #eafaf0;
  border-left: 4px solid #03b845;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.65;
}

/* ============================================
   STAT GRID (3 kotak sejajar)
   ============================================ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px 8px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0,28,7,0.06);
  border: 1px solid rgba(3,184,69,0.12);
}
.stat-num {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
}
.stat-label {
  font-size: 11.5px;
  color: #5b7d68;
  margin-top: 4px;
  line-height: 1.3;
}

/* ============================================
   TABLE
   ============================================ */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data th, table.data td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #e6f4eb;
}
table.data th {
  background: #f2faf5;
  color: #001c07;
  font-weight: 700;
  font-size: 12.5px;
}
table.data tr:hover td { background: #f9fdfb; }

/* ============================================
   BADGE
   ============================================ */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
}
.badge-baru { background: #fff4e6; color: #8a5a00; }
.badge-verif { background: #e6f9ee; color: #0a7c3a; }

/* ============================================
   FORM HEADER
   ============================================ */
.form-header { text-align: center; margin-bottom: 22px; padding: 10px; }
.form-header .logo {
  width: 100px;
  height: 100px;
  background: #fff;
  border-radius: 16px;
  margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(0,28,7,0.12);
  border: 2px solid #03b845;
  overflow: hidden;
  padding: 6px;
}
.form-header .logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
}
.form-header h1 {
  font-size: 19px; font-weight: 700; color: #001c07;
  line-height: 1.35; margin-bottom: 4px;
}
.form-header p { font-size: 13px; color: #3d6b4d; }

.container-form { max-width: 820px; margin: 0 auto; padding: 0 12px; }

/* ============================================
   SCAN QR (Panitia)
   ============================================ */
.scan-container {
  max-width: 360px;
  margin: 0 auto;
}
.scan-box {
  background: #001c07;
  border-radius: 16px;
  padding: 10px;
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 1;
}
#reader {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
}
#reader video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  border-radius: 12px;
}
#reader__dashboard_section_csr button {
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  background: #03b845;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
}
#reader__dashboard_section_csr button:hover {
  background: #029a39;
}
#reader__scan_region { background: transparent !important; }
#reader__scan_region img { display: none; }
#reader__dashboard { padding: 8px 0; }
#reader__status_span { display: none; }

.scan-frame {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 70%;
  height: 70%;
  pointer-events: none;
  z-index: 10;
}
.scan-frame::before,
.scan-frame::after {
  content: '';
  position: absolute;
  width: 30px; height: 30px;
  border: 3px solid #03b845;
}
.scan-frame::before {
  top: 0; left: 0;
  border-right: none; border-bottom: none;
  border-top-left-radius: 10px;
}
.scan-frame::after {
  bottom: 0; right: 0;
  border-left: none; border-top: none;
  border-bottom-right-radius: 10px;
}
.scan-frame .corner-tr {
  position: absolute;
  top: 0; right: 0;
  width: 30px; height: 30px;
  border: 3px solid #03b845;
  border-left: none; border-bottom: none;
  border-top-right-radius: 10px;
}
.scan-frame .corner-bl {
  position: absolute;
  bottom: 0; left: 0;
  width: 30px; height: 30px;
  border: 3px solid #03b845;
  border-right: none; border-top: none;
  border-bottom-left-radius: 10px;
}

.scan-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 12px 0;
}
.scan-actions .btn {
  flex: 1;
  min-width: 140px;
}

/* ============================================
   POPUP
   ============================================ */
.popup-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.popup-overlay.active { display: flex; }

.popup {
  background: #fff;
  border-radius: 16px;
  padding: 26px 22px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: popIn 0.25s ease;
}
@keyframes popIn {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.popup .popup-icon { font-size: 52px; margin-bottom: 8px; }
.popup h3 { font-size: 18px; color: #001c07; margin-bottom: 8px; }
.popup p {
  font-size: 13.5px;
  color: #3d6b4d;
  line-height: 1.55;
  margin-bottom: 16px;
}
.popup .popup-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================
   RESPONSIVE — TABLET
   ============================================ */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .hamburger { display: block; }
}

/* ============================================
   RESPONSIVE — MOBILE (≤768px)
   ============================================ */
@media (max-width: 768px) {

  .main-content {
    padding: 10px 8px;
    margin-left: 0 !important;
    width: 100%;
    max-width: 100vw;
  }

  .topbar {
    padding: 10px 10px;
    margin-bottom: 10px;
    gap: 8px;
    flex-wrap: nowrap;
  }
  .topbar h2 {
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar .user-info {
    font-size: 10.5px;
    white-space: nowrap;
  }
  .hamburger { font-size: 20px; }

  .card {
    padding: 14px 12px;
    border-radius: 12px;
    width: 100%;
  }
  .card-title {
    font-size: 13.5px;
    margin-bottom: 10px;
    padding-bottom: 8px;
  }

  .section-title {
    font-size: 13px;
    gap: 6px;
    margin-bottom: 12px;
    padding-bottom: 8px;
  }
  .section-title .num {
    width: 20px; height: 20px;
    font-size: 10.5px;
  }

  /* Grid 2 kolom → 1 kolom */
  .grid-2 { grid-template-columns: 1fr; gap: 10px; }

  /* Statistik — tetap 3 kolom, compact */
  .stat-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 10px;
  }
  .stat-card {
    padding: 10px 4px;
    border-radius: 10px;
  }
  .stat-num { font-size: 18px; }
  .stat-label { font-size: 9.5px; margin-top: 2px; }

  /* Form compact */
  .form-group { margin-bottom: 12px; }
  .form-group label { font-size: 12.5px; }
  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 9px 11px;
    font-size: 13px;
  }

  /* Tombol compact */
  .btn { font-size: 12.5px; padding: 9px 14px; }
  .btn-sm { font-size: 11px; padding: 6px 10px; border-radius: 7px; }

  /* Tabel — biar nggak overflow body */
  table.data {
    width: 100%;
    font-size: 11.5px;
    min-width: 0;
  }
  table.data th,
  table.data td {
    padding: 7px 8px;
    word-break: break-word;
  }
  .table-wrap {
    margin: 0;
    padding: 0;
  }

  /* Sidebar */
  .sidebar {
    width: 260px;
    max-width: 80vw;
  }
  .sidebar .menu li a {
    font-size: 13px;
    padding: 10px 16px;
  }
  .sidebar .brand img {
    width: 38px;
    height: 38px;
    border-radius: 8px;
  }

  /* Form header */
  .form-header h1 { font-size: 16px; padding: 0 8px; }
  .form-header p { font-size: 12px; }
  .form-header .logo { width: 85px; height: 85px; border-radius: 14px; padding: 5px; }

  /* Alert & info */
  .alert { font-size: 12px; padding: 10px 12px; }
  .info-box { font-size: 11.5px; padding: 10px 12px; }

  /* Popup */
  .popup { padding: 22px 18px; max-width: 92vw; }
  .popup .popup-icon { font-size: 42px; }
  .popup h3 { font-size: 16px; }
  .popup p { font-size: 12.5px; }

  /* Login */
  .login-card { padding: 26px 20px; border-radius: 14px; }
  .login-card h1 { font-size: 16px; }
  .login-card .sub { font-size: 12px; }
  .login-card .logo { width: 85px; height: 85px; border-radius: 14px; padding: 5px; }

  /* Scan QR */
  .scan-container { max-width: 100%; }
  .scan-box { border-radius: 12px; }
  .scan-actions .btn { min-width: 100%; flex: 1 1 100%; }

  .container-form { padding: 0 4px; }
}

/* ============================================
   RESPONSIVE — HP KECIL (≤380px)
   ============================================ */
@media (max-width: 380px) {
  .main-content { padding: 8px 6px; }
  .card { padding: 12px 10px; }

  .stat-grid { gap: 5px; }
  .stat-card { padding: 9px 3px; }
  .stat-num { font-size: 16px; }
  .stat-label { font-size: 8.5px; }

  .topbar h2 { font-size: 12px; }
  .topbar .user-info { font-size: 10px; }

  .btn { font-size: 12px; padding: 8px 12px; }
  .btn-sm { font-size: 10.5px; padding: 5px 9px; }

  .form-header .logo { width: 75px; height: 75px; border-radius: 12px; padding: 4px; }
  .login-card .logo { width: 75px; height: 75px; border-radius: 12px; padding: 4px; }
}

/* ============================================
   INPUT DISABLED
   ============================================ */
input:disabled {
  cursor: not-allowed;
  color: #666;
}