:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --secondary: #475569;
  --success: #16a34a;
  --success-light: #dcfce7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --dark: #0f172a;
  --light: #f8fafc;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --radius: 0.75rem;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #f1f5f9;
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 768px) {
  .grid-cols-2, .grid-cols-3, .grid-cols-4 {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.625rem 1.25rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease-in-out;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.btn-secondary { background: #e2e8f0; color: #334155; }
.btn-secondary:hover { background: #cbd5e1; }

.btn-dark { background: var(--dark); color: #fff; }
.btn-dark:hover { background: #1e293b; }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.85rem; border-radius: 0.375rem; }
.btn-lg { padding: 0.85rem 1.75rem; font-size: 1.1rem; border-radius: 0.625rem; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-primary { background: var(--primary-light); color: var(--primary); }

.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.375rem;
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.875rem;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background-color: #fff;
  color: var(--text-main);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.925rem;
}

.table th {
  background: #f8fafc;
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: #475569;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
}

.table tr:hover td {
  background-color: #f8fafc;
}

.alert {
  padding: 1rem 1.25rem;
  border-radius: 0.5rem;
  margin-bottom: 1.25rem;
  font-size: 0.925rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.alert-success { background: var(--success-light); color: #166534; border: 1px solid #bbf7d0; }
.alert-danger { background: var(--danger-light); color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: var(--primary-light); color: #1e40af; border: 1px solid #bfdbfe; }

.candidate-card {
  background: #ffffff;
  border: 2px solid var(--border);
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
}

.candidate-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary);
}

.candidate-card.active-choice {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.25);
}

.candidate-num {
  position: absolute;
  top: 1rem;
  left: 1rem;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #fbbf24;
  color: #78350f;
  font-size: 1.5rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 6px rgba(0,0,0,0.15);
  z-index: 10;
}

.candidate-img-wrap {
  position: relative;
  width: 100%;
  height: 240px;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.candidate-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.candidate-body {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
}

.modal-content {
  background: #fff;
  border-radius: 1rem;
  max-width: 600px;
  width: 100%;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
  overflow: hidden;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.scanner-container {
  position: relative;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  border-radius: 1rem;
  overflow: hidden;
  background: #000;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.3);
}

.scanner-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 260px;
  height: 260px;
  border: 3px solid #22c55e;
  border-radius: 1rem;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  z-index: 20;
}

.scanner-laser {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: #ef4444;
  box-shadow: 0 0 8px 2px #ef4444;
  animation: scanLaser 2s infinite alternate ease-in-out;
}

@keyframes scanLaser {
  0% { top: 5%; }
  100% { top: 95%; }
}

@media print {
  body { background: #fff !important; }
  .no-print { display: none !important; }
  .print-page { margin: 0; padding: 0; }
  
  .kartu-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
    page-break-after: auto;
  }

  main.container {
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
  }

  .kartu-pelajar {
    border: 2px dashed #94a3b8 !important;
    border-radius: 8px !important;
    padding: 12px !important;
    box-shadow: none !important;
    break-inside: avoid;
  }
}

.pagination-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
}

.pagination-info {
  font-size: 0.875rem;
  color: #64748b;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.pagination-item {
  display: inline-flex;
}

.pagination-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.5rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #475569;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  text-decoration: none;
  transition: all 0.15s ease-in-out;
}

.pagination-link:hover:not(.disabled):not(.active) {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #cbd5e1;
}

.pagination-link.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
  cursor: default;
}

.pagination-link.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.pagination-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  height: 2.25rem;
  color: #94a3b8;
  font-weight: 700;
  font-size: 0.875rem;
}

