:root {
  --primary: #269dd8;
  --primary-dark: #1a7ba8;
  --primary-light: rgba(38,157,216,.12);
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --dark: #111827;
  --gray: #6b7280;
  --gray-light: #f3f4f6;
  --border: #e5e7eb;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
  background: #f0f4f8;
  color: var(--dark);
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ===== FLASH MESSAGE ===== */
.flash {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideDown .3s ease;
}
.flash-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.flash-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.flash-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; color: #fff; }
.btn-info { background: var(--info); color: #fff; }
.btn-info:hover { background: #2563eb; color: #fff; }
.btn-outline {
  background: #fff;
  color: var(--gray);
  border-color: var(--border);
}
.btn-outline:hover { background: var(--gray-light); color: var(--dark); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn-block { width: 100%; }

/* ===== AUTH PAGE ===== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, #3b82f6 100%);
  padding: 20px;
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: #fff;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
  animation: slideUp .4s ease;
}
.auth-card.wide { max-width: 560px; }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.auth-logo {
  text-align: center;
  margin-bottom: 24px;
}
.auth-logo .logo-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--primary), #3b82f6);
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 28px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-md);
}
.auth-logo h1 { font-size: 22px; margin-bottom: 4px; }
.auth-logo p { color: var(--gray); font-size: 14px; }

/* ===== FORM ===== */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #374151;
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  background: #fff;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.15);
}
.form-text { font-size: 12px; color: var(--gray); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

/* ===== LAYOUT APP ===== */
.app-layout {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 260px;
  background: linear-gradient(180deg, #1a7ba8, #146180);
  color: #d1d5db;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 50;
  transition: transform .3s ease;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-header .logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--primary), #3b82f6);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px;
}
.sidebar-header .sidebar-title { font-size: 15px; font-weight: 700; color: #fff; }
.sidebar-header .sidebar-subtitle { font-size: 11px; color: #9ca3af; }
.sidebar-user {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.04);
}
.sidebar-user .name { font-weight: 600; color: #fff; font-size: 14px; }
.sidebar-user .role {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #60a5fa;
  background: rgba(59,130,246,.15);
  padding: 2px 8px;
  border-radius: 999px;
  display: inline-block;
  margin-top: 4px;
}
.sidebar-nav { padding: 14px 12px; flex: 1; }
.sidebar-nav .nav-section-label {
  font-size: 11px;
  text-transform: uppercase;
  color: #6b7280;
  letter-spacing: .8px;
  padding: 8px 10px 6px;
}
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: #d1d5db;
  font-size: 14px;
  margin-bottom: 2px;
  transition: all .2s;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav a.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}
.sidebar-nav a .nav-icon { width: 20px; text-align: center; font-size: 16px; }
.sidebar-footer { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-footer a {
  display: flex; align-items: center; gap: 10px;
  color: #f87171; font-size: 14px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  transition: all .2s;
}
.sidebar-footer a:hover { background: rgba(248,113,113,.1); color: #ef4444; }

.main-content {
  flex: 1;
  margin-left: 260px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left .3s ease;
}
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar .page-title { font-size: 18px; font-weight: 700; }
.topbar .page-subtitle { font-size: 12px; color: var(--gray); }
.hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--dark);
  padding: 4px;
}
.content-wrapper { padding: 28px; flex: 1; }

/* ===== TOGGLE SIDEBAR ===== */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 45;
}

@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.show { display: block; }
  .main-content { margin-left: 0; }
  .hamburger { display: block; }
}

/* ===== CARDS ===== */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 24px;
}
.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.card-header h3 { font-size: 16px; font-weight: 700; }
.card-body { padding: 24px; }
.card-footer { padding: 16px 24px; border-top: 1px solid var(--border); background: #fafafa; border-radius: 0 0 var(--radius) var(--radius); }

/* ===== STAT CARDS ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: #d1fae5; color: #059669; }
.stat-icon.yellow { background: #fef3c7; color: #d97706; }
.stat-icon.red { background: #fee2e2; color: #dc2626; }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.stat-icon.cyan { background: #cffafe; color: #0891b2; }
.stat-info .stat-value { font-size: 26px; font-weight: 800; line-height: 1.2; }
.stat-info .stat-label { font-size: 13px; color: var(--gray); }

/* ===== DASHBOARD MODERN ===== */
.dashboard-hero { background:linear-gradient(135deg,#1a7ba8,#269dd8); color:#fff; border-radius:20px; padding:25px 28px; margin-bottom:24px; display:flex; align-items:center; justify-content:space-between; gap:20px; box-shadow:0 10px 25px rgba(26,123,168,.2); overflow:hidden; position:relative; }
.dashboard-hero::after { content:''; width:180px; height:180px; position:absolute; right:-60px; top:-80px; border:30px solid rgba(255,255,255,.12); border-radius:50%; }
.dashboard-hero-content { position:relative; z-index:1; }.dashboard-hero .eyebrow { display:flex; align-items:center; gap:7px; opacity:.85; text-transform:uppercase; letter-spacing:.7px; font-weight:700; font-size:11px; margin-bottom:7px; }.dashboard-hero h2 { margin:0 0 6px; font-size:22px; }.dashboard-hero p { margin:0; font-size:13px; opacity:.9; }.dashboard-hero-icon { z-index:1; width:58px; height:58px; border-radius:17px; display:grid; place-items:center; font-size:25px; background:rgba(255,255,255,.16); border:1px solid rgba(255,255,255,.25); }
.dashboard-stat { border-radius:18px; padding:20px; border:1px solid #e5e7eb; box-shadow:0 2px 10px rgba(0,0,0,.04); }.dashboard-stat .stat-icon { border-radius:14px; }.dashboard-stat .stat-value { color:#1f2a37; }.dashboard-card { border-radius:18px; overflow:hidden; }.dashboard-card .card-header { background:linear-gradient(90deg,rgba(38,157,216,.055),#fff); }.card-header-title { display:flex; align-items:center; gap:9px; }.card-header-title i { color:var(--primary); }
@media (max-width:640px) { .dashboard-hero { padding:22px; }.dashboard-hero h2 { font-size:18px; }.dashboard-hero-icon { display:none; } }

/* ===== TABLE ===== */
.table-responsive { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 650px;
}
.table thead th {
  background: #f9fafb;
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--gray);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:hover { background: #f9fafb; }
.table tbody tr:last-child td { border-bottom: none; }
.table .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.table .actions .btn { padding: 5px 10px; font-size: 12px; }

/* ===== BADGE ===== */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-secondary { background: #e5e7eb; color: #374151; }

/* ===== PAGINATION ===== */
.pagination { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 13px;
  background: #fff;
  color: var(--dark);
  transition: all .2s;
}
.pagination a:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { color: var(--dark); font-size: 17px; margin-bottom: 6px; }

/* ===== ALERT ===== */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* ===== GRID ===== */
.row { display: grid; gap: 20px; }
.row-2 { grid-template-columns: repeat(2, 1fr); }
.row-3 { grid-template-columns: repeat(3, 1fr); }
.row-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 992px) { .row-3, .row-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .row-2, .row-3, .row-4 { grid-template-columns: 1fr; } }

/* ===== PENDAFTARAN KEGIATAN ===== */
.registration-page { min-width: 0; }
.registration-page .card-body { min-width: 0; }
.registration-form { max-width: 760px; }

@media (max-width: 640px) {
  .content-wrapper { padding: 16px; }
  .topbar { padding: 12px 16px; gap: 10px; }
  .topbar .page-title { font-size: 16px; }
  .topbar .page-subtitle { display: none; }
  .card { margin-bottom: 16px; }
  .card-header, .card-body { padding: 16px; }
  .registration-form > .btn { width: 100%; min-height: 44px; }
  .registration-page .table-responsive { margin: 0 -16px; }
  .registration-page .table-responsive > .table:not(.registration-history-table) { min-width: 560px; }

  /* Riwayat peserta dibuat menjadi kartu agar tidak perlu menggeser tabel. */
  .registration-history-table,
  .registration-history-table tbody,
  .registration-history-table tr,
  .registration-history-table td,
  .kegiatan-public-table,
  .kegiatan-public-table tbody,
  .kegiatan-public-table tr,
  .kegiatan-public-table td { display: block; width: 100%; }
  .registration-history-table, .kegiatan-public-table { min-width: 0; }
  .registration-history-table thead, .kegiatan-public-table thead { display: none; }
  .registration-history-table tbody, .kegiatan-public-table tbody { padding: 0 16px; }
  .registration-history-table tr, .kegiatan-public-table tr {
    margin: 12px 0;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
  }
  .registration-history-table tbody td, .kegiatan-public-table tbody td {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 8px;
    padding: 6px 0;
    border: 0;
    overflow-wrap: anywhere;
  }
  .registration-history-table tbody td::before, .kegiatan-public-table tbody td::before {
    content: attr(data-label);
    color: var(--gray);
    font-size: 12px;
    font-weight: 700;
  }
}

/* ===== UTILITY ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-primary { color: var(--primary); }
.text-bold { font-weight: 700; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; align-items: center; gap: 10px; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.ml-auto { margin-left: auto; }
.w-100 { width: 100%; }

/* ===== PROFILE AVATAR ===== */
.avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #3b82f6);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}
.avatar-sm { width: 32px; height: 32px; font-size: 13px; }

/* ===== MODAL ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal {
  background: #fff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp .3s ease;
}
.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h4 { font-size: 16px; }
.modal-close {
  background: none; border: none;
  font-size: 22px; cursor: pointer;
  color: var(--gray);
  line-height: 1;
}
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: #fafafa;
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ===== FILTER BAR ===== */
.filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 20px;
  background: #fff;
  padding: 16px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.filter-bar .form-group { margin-bottom: 0; flex: 1; min-width: 180px; }

/* ===== CERTIFICATE PREVIEW ===== */
.cert-preview {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}
.cert-preview img { width: 100%; display: block; }

/* ===== NOTES ===== */
.note-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 14px;
  color: #92400e;
  margin-top: 10px;
}

/* ===== LOGIN DEMO ===== */
.demo-info {
  margin-top: 20px;
  padding: 14px 16px;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: #1e40af;
  border: 1px dashed var(--primary);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }
