/* ============================================================
   SCANNER PETUGAS PIKET - STYLE MODERN
   ============================================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
}

body {
  min-height: 100vh;
  background: radial-gradient(circle at 20% 30%, #1a1a4e 0%, transparent 50%),
              radial-gradient(circle at 80% 70%, #0d1b3e 0%, transparent 50%),
              radial-gradient(circle at 50% 50%, #0a0a1a 0%, #05050a 100%);
  background-attachment: fixed;
  color: #ffffff;
}

/* ===== UTILITY ===== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: #94a3b8; }
.mt-3 { margin-top: 1rem; }
.mb-3 { margin-bottom: 1rem; }

/* ===== AUTH WRAPPER ===== */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.auth-wrapper.hidden {
  display: none !important;
}

/* ===== CARD ===== */
.card {
  background: rgba(20, 20, 45, 0.7);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 32px;
  padding: 35px 30px;
  width: 100%;
  max-width: 480px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.card .app-header h2 {
  font-size: 26px;
  font-weight: 700;
  background: linear-gradient(135deg, #818cf8, #8b5cf6, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 4px;
  text-align: center;
}

.card .app-header p {
  color: #94a3b8;
  font-size: 14px;
  text-align: center;
}

/* ===== HEADER DASHBOARD (dengan clock) ===== */
.dashboard-header-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.15));
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 18px;
  padding: 16px 18px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.dashboard-header-card .header-info h3 {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 2px;
}

.dashboard-header-card .header-info p {
  font-size: 12px;
  color: #a5b4fc;
}

.dashboard-header-card .live-clock {
  background: rgba(255, 255, 255, 0.08);
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* ===== STATUS ROW ===== */
.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.counter-badge {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  padding: 6px 14px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.network-badge {
  padding: 6px 14px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.net-online {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.net-offline {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ===== CAMERA CARD (dengan border feedback) ===== */
.camera-card {
  background: rgba(20, 20, 45, 0.7);
  border: 2px solid #6366f1;
  border-radius: 20px;
  padding: 14px;
  margin-bottom: 12px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.camera-card.frame-success {
  border-color: #22c55e !important;
  box-shadow: 0 0 25px rgba(34, 197, 94, 0.5) !important;
}

.camera-card.frame-warning {
  border-color: #f59e0b !important;
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.5) !important;
}

.camera-card.frame-danger {
  border-color: #ef4444 !important;
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.6) !important;
}

/* ===== QR READER ===== */
#reader {
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  position: relative;
  min-height: 240px;
}

#reader video {
  border-radius: 14px;
  width: 100%;
  display: block;
  object-fit: cover;
}

#reader.mirror-mode video {
  transform: scaleX(-1);
  -webkit-transform: scaleX(-1);
}

/* ===== STATUS SCAN ===== */
.scan-status-msg {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 700;
  min-height: 20px;
  text-align: center;
  color: #818cf8;
  transition: color 0.3s ease;
}

.scan-status-msg.success { color: #22c55e; }
.scan-status-msg.error { color: #ef4444; }
.scan-status-msg.warning { color: #f59e0b; }

/* ===== CONTROLS ===== */
.controls-row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.btn-camera {
  padding: 8px 14px;
  font-size: 12px;
  width: auto;
  background: rgba(255, 255, 255, 0.06);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
  flex: 1;
  min-width: 100px;
}

.btn-camera:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

/* ===== INFO SISWA TERAKHIR ===== */
.last-scan-card {
  background: rgba(20, 20, 45, 0.7);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 20px;
  padding: 16px 18px;
  margin-bottom: 12px;
  backdrop-filter: blur(20px);
  transition: all 0.3s;
}

.last-scan-card.has-data {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.1));
  border-color: rgba(139, 92, 246, 0.4);
}

.last-scan-title {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.last-scan-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.last-scan-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding-bottom: 6px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}

.last-scan-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.last-scan-label {
  color: #94a3b8;
  font-weight: 600;
}

.last-scan-value {
  color: #ffffff;
  font-weight: 700;
  text-align: right;
}

.status-badge {
  padding: 4px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 800;
  display: inline-block;
}

.badge-hadir {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.badge-terlambat {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

/* ===== RIWAYAT SCAN ===== */
.history-card {
  background: rgba(20, 20, 45, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  padding: 16px 18px;
  margin-bottom: 12px;
}

.history-title {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-title .counter-text {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 600;
}

.history-table-wrap {
  max-height: 380px;
  overflow-y: auto;
  border-radius: 12px;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.history-table th {
  background: rgba(255, 255, 255, 0.04);
  color: #94a3b8;
  padding: 8px 10px;
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: sticky;
  top: 0;
  z-index: 1;
}

.history-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
  font-weight: 600;
}

.history-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.history-table .td-jam { color: #818cf8; font-weight: 700; }
.history-table .td-nama { color: #ffffff; }
.history-table .td-kelas { color: #a5b4fc; }
.history-table .td-status {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 8px;
  font-weight: 700;
}

.empty-history {
  text-align: center;
  color: #64748b;
  font-size: 12px;
  padding: 20px 0;
}

/* ===== PAGINATION ===== */
.pagination-wrapper {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-top: 12px;
  flex-wrap: wrap;
}

.btn-page {
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #94a3b8;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
  font-weight: 600;
}

.btn-page:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.btn-page.active-page {
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  color: white;
  border-color: transparent;
}

.btn-page:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ===== TIMER & LOGOUT ===== */
.footer-timer {
  text-align: center;
  margin-bottom: 10px;
  font-size: 12px;
  color: #94a3b8;
  font-weight: 700;
}

.footer-timer .timer-display {
  color: #ef4444;
  font-variant-numeric: tabular-nums;
}

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ===== BUTTONS ===== */
.btn {
  background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
  color: white !important;
  border: none !important;
  padding: 14px 20px;
  border-radius: 16px !important;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: all 0.3s ease;
  box-shadow: 0 4px 25px rgba(99, 102, 241, 0.3);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 35px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05) !important;
  color: #94a3b8 !important;
  box-shadow: none !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
  transform: translateY(-2px);
  box-shadow: none !important;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #ef4444 !important;
  box-shadow: none !important;
  border: 1px solid rgba(239, 68, 68, 0.15) !important;
  flex: 1;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25) !important;
}

.btn-logout {
  background: linear-gradient(135deg, #ef4444, #b91c1c) !important;
  color: white !important;
  border: none !important;
  padding: 12px 20px;
  border-radius: 14px !important;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  transition: all 0.3s ease;
  box-shadow: 0 4px 25px rgba(239, 68, 68, 0.3);
}

.btn-logout:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 35px rgba(239, 68, 68, 0.4);
}

/* ===== FORM (LOGIN) ===== */
.form-group {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #94a3b8;
  margin-bottom: 6px;
}

.form-group input {
  padding: 14px 18px;
  background: rgba(15, 23, 42, 0.5) !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
  border-radius: 16px !important;
  font-size: 14px;
  color: #ffffff !important;
  outline: none;
  transition: all 0.3s ease;
}

.form-group input::placeholder {
  color: #64748b;
}

.form-group input:focus {
  border-color: rgba(139, 92, 246, 0.4) !important;
  box-shadow: 0 0 30px rgba(139, 92, 246, 0.1) !important;
  background: rgba(15, 23, 42, 0.7) !important;
}

.alert-error {
  color: #ef4444;
  font-size: 13px;
  text-align: center;
  margin-top: 12px;
  font-weight: 500;
}

/* ===== MODAL KONFIRMASI ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal-overlay.show { display: flex; }

.modal-box {
  background: rgba(20, 20, 45, 0.95);
  backdrop-filter: blur(24px);
  border-radius: 28px;
  padding: 32px 28px;
  width: 90%;
  max-width: 450px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-header h3 {
  font-size: 20px;
  color: #ffffff;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #94a3b8;
}

.modal-close:hover { color: #ffffff; }

.modal-body {
  color: #e2e8f0;
  font-size: 14px;
  line-height: 1.6;
}

.modal-body .student-info {
  background: rgba(255, 255, 255, 0.03);
  padding: 14px 16px;
  border-radius: 12px;
  margin: 12px 0;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.modal-body .student-info div {
  padding: 4px 0;
  display: flex;
  justify-content: space-between;
}

.modal-body .student-info .label { color: #94a3b8; }
.modal-body .student-info .value { color: #ffffff; font-weight: 600; }

.modal-footer {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.modal-footer .btn {
  flex: 1;
  padding: 12px;
  font-size: 14px;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.02); }
::-webkit-scrollbar-thumb { background: rgba(139, 92, 246, 0.3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(139, 92, 246, 0.5); }

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
  .auth-wrapper { padding: 10px; }
  .card { padding: 20px 16px; }
  .dashboard-header-card { padding: 14px; }
  .dashboard-header-card .header-info h3 { font-size: 14px; }
  .modal-box { padding: 24px 16px; }
  .modal-footer { flex-direction: column; }
  .controls-row { flex-direction: column; }
  .btn-camera { width: 100%; }
  .btn-row { flex-direction: column; }
  .btn-row .btn { flex: none; width: 100%; }
}