/* ============================================
   SIAKAD MADIN — Desain Hijau Islami Modern
   ============================================ */
:root {
  --primary: #0a8f4d;
  --primary-dark: #077a40;
  --primary-light: #e8f5ee;
  --accent: #f5c518;
  --accent-dark: #d9a800;
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #1a2332;
  --text-muted: #6b7a8c;
  --border: #e2e8f0;
  --danger: #e63946;
  --warning: #f59e0b;
  --info: #3b82f6;
  --success: #10b981;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.05);
  --shadow: 0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.12);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-width: 260px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
h1,h2,h3,h4,h5 { font-family: 'Poppins', sans-serif; font-weight: 700; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #0a8f4d 0%, #077a40 100%);
  color: #fff;
  overflow-y: auto;
  z-index: 100;
  transition: transform .3s ease;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.3); border-radius: 3px; }

.sidebar-header {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.15);
}
.logo {
  width: 42px; height: 42px;
  background: var(--accent);
  color: var(--primary-dark);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}
.brand-name {
  font-family: 'Poppins', sans-serif;
  font-weight: 900; font-size: 1.2rem;
  letter-spacing: -.5px;
}
.brand-sub { font-size: .72rem; opacity: .85; letter-spacing: .5px; }

.sidebar-menu { padding: 12px 10px 30px; }
.menu-group {
  font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  opacity: .6; padding: 14px 12px 6px;
}
.menu-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  color: #fff; border-radius: var(--radius-sm);
  font-size: .88rem; font-weight: 500;
  transition: all .15s;
  margin-bottom: 2px;
}
.menu-item .mdi { font-size: 1.2rem; opacity: .9; }
.menu-item:hover { background: rgba(255,255,255,.12); color: #fff; }
.menu-item.active {
  background: var(--accent); color: var(--primary-dark);
  font-weight: 700;
}
.menu-item.active .mdi { opacity: 1; }
.menu-item.logout {
  background: rgba(230,57,70,.2);
  margin-top: 10px;
}
.menu-item.logout:hover { background: var(--danger); }

/* ============================================
   MAIN WRAPPER
   ============================================ */
.main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex; flex-direction: column;
}
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}
.menu-toggle {
  display: none;
  background: none; border: none; font-size: 1.5rem;
  color: var(--primary); cursor: pointer;
}
.topbar-title {
  font-family: 'Poppins', sans-serif;
  font-weight: 700; font-size: 1.05rem;
  color: var(--primary);
}
.topbar-user {
  margin-left: auto;
  display: flex; align-items: center; gap: 8px;
  font-size: .85rem; color: var(--text-muted);
  font-weight: 500;
}
.topbar-user .mdi { font-size: 1.4rem; color: var(--primary); }

.content { padding: 24px; flex: 1; }

/* ============================================
   FOOTER
   ============================================ */
.footer {
  padding: 18px 24px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: .8rem;
  color: var(--text-muted);
  background: #fff;
}
.footer a { font-weight: 600; color: var(--primary); }
.footer strong { color: var(--text); }

/* ============================================
   CARD
   ============================================ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}
.card-title {
  font-family: 'Poppins', sans-serif;
  font-size: 1rem; font-weight: 700;
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}
.card-title .mdi { color: var(--primary); font-size: 1.3rem; }

/* ============================================
   PAGE TITLE
   ============================================ */
.page-title {
  font-family: 'Poppins', sans-serif;
  font-size: 1.5rem; font-weight: 900;
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 10px;
  color: var(--text);
}
.page-title .mdi { color: var(--primary); font-size: 1.8rem; }

/* ============================================
   GRID
   ============================================ */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }

/* ============================================
   STAT CARD
   ============================================ */
.stat {
  text-align: center;
  padding: 22px 16px;
}
.stat-icon {
  font-size: 2.2rem; color: var(--primary);
  display: block; margin-bottom: 8px;
}
.stat-icon.green { color: var(--success); }
.stat-icon.red { color: var(--danger); }
.stat-icon.yellow { color: var(--accent-dark); }
.stat-num {
  display: block;
  font-family: 'Poppins', sans-serif;
  font-size: 1.8rem; font-weight: 900;
  color: var(--text);
}
.stat-lbl {
  font-size: .78rem; text-transform: uppercase;
  letter-spacing: .8px; color: var(--text-muted);
  font-weight: 600; margin-top: 4px;
}

/* ============================================
   BUTTON
   ============================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: none; cursor: pointer;
  font-family: inherit; font-size: .88rem; font-weight: 600;
  transition: all .15s;
  text-decoration: none;
  line-height: 1;
}
.btn .mdi { font-size: 1.15rem; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-accent { background: var(--accent); color: var(--text); }
.btn-accent:hover { background: var(--accent-dark); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c92a36; color: #fff; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { padding: 6px 12px; font-size: .78rem; }
.btn-sm .mdi { font-size: 1rem; }
.btn-block { width: 100%; }

/* ============================================
   FORM
   ============================================ */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: .78rem; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}
.form-label .mdi { color: var(--primary); margin-right: 4px; }
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  font-family: inherit; font-size: .92rem;
  color: var(--text);
  transition: border-color .15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ============================================
   TABLE
   ============================================ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
table thead {
  background: var(--primary-light);
}
table th {
  padding: 12px 14px;
  text-align: left;
  font-weight: 700;
  color: var(--primary-dark);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 2px solid var(--primary);
  white-space: nowrap;
}
table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table tr:last-child td { border-bottom: none; }
table tr:hover td { background: #f8fafb; }
table .aksi { display: flex; gap: 6px; flex-wrap: wrap; }

/* ============================================
   BADGE
   ============================================ */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-success { background: #d4f4e2; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }

/* ============================================
   ALERT
   ============================================ */
.alert {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-weight: 500;
  animation: slideDown .3s ease-out;
}
.alert .mdi { font-size: 1.3rem; }
.alert-success { background: #d4f4e2; color: #065f46; border-left: 4px solid var(--success); }
.alert-danger  { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--danger); }
.alert-warning { background: #fef3c7; color: #92400e; border-left: 4px solid var(--warning); }
.alert-info    { background: #dbeafe; color: #1e40af; border-left: 4px solid var(--info); }

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #0a8f4d 0%, #077a40 100%);
}
.login-box {
  width: 100%; max-width: 400px;
  background: #fff;
  border-radius: 20px;
  padding: 36px 28px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  width: 72px; height: 72px;
  background: var(--primary);
  color: var(--accent);
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.4rem;
  margin: 0 auto 16px;
}
.login-box h1 {
  text-align: center;
  font-size: 1.7rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -.5px;
  margin-bottom: 4px;
}
.login-box .sub {
  text-align: center;
  color: var(--text-muted);
  font-size: .85rem;
  margin-bottom: 24px;
}

/* ============================================
   TOAST
   ============================================ */
.toast-container {
  position: fixed; top: 20px; right: 20px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
  max-width: 360px;
}
.toast {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: .9rem;
  border-left: 4px solid var(--primary);
  animation: slideInRight .3s ease-out;
}
.toast .mdi { font-size: 1.4rem; flex-shrink: 0; }
.toast.ok      { border-color: var(--success); color: #065f46; }
.toast.ok .mdi { color: var(--success); }
.toast.error   { border-color: var(--danger); color: #991b1b; }
.toast.error .mdi { color: var(--danger); }
.toast.warn    { border-color: var(--warning); color: #92400e; }
.toast.warn .mdi { color: var(--warning); }
.toast.info    { border-color: var(--info); color: #1e40af; }
.toast.info .mdi { color: var(--info); }
.toast.hide { animation: slideOutRight .3s ease-in forwards; }

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideOutRight {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(40px); }
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================
   SCAN SUCCESS OVERLAY
   ============================================ */
.scan-success-overlay {
  position: fixed; inset: 0;
  background: rgba(16,185,129,.95);
  z-index: 9998;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: #fff; text-align: center;
  animation: fadeIn .2s ease-out;
}
.scan-success-overlay .mdi { font-size: 6rem; }
.scan-success-overlay h2 { font-size: 2.2rem; font-weight: 900; margin: 10px 0; }
.scan-success-overlay p { font-size: 1.1rem; font-weight: 600; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ============================================
   QR READER
   ============================================ */
.reader-box {
  max-width: 400px;
  margin: 16px auto;
  border-radius: var(--radius);
  overflow: hidden;
  border: 3px solid var(--primary);
  background: #000;
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
  display: flex; gap: 6px; flex-wrap: wrap;
  justify-content: center;
  margin-top: 16px;
}
.pagination a, .pagination span {
  min-width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-weight: 600; font-size: .85rem;
}
.pagination a:hover { background: var(--primary-light); border-color: var(--primary); }
.pagination .active {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.pagination .disabled { opacity: .4; pointer-events: none; }

/* ============================================
   DETAILS (Accordion)
   ============================================ */
details.card summary {
  cursor: pointer; list-style: none;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0;
}
details.card summary::-webkit-details-marker { display: none; }
details.card summary .mdi { color: var(--primary); font-size: 1.3rem; }

/* ============================================
   DIALOG
   ============================================ */
dialog {
  border: none;
  border-radius: var(--radius);
  padding: 24px;
  max-width: 420px; width: 90%;
  box-shadow: var(--shadow-lg);
  background: #fff;
}
dialog::backdrop { background: rgba(0,0,0,.5); }
dialog h3 {
  margin-bottom: 16px;
  font-family: 'Poppins', sans-serif;
  font-size: 1.1rem;
  display: flex; align-items: center; gap: 8px;
}
dialog h3 .mdi { color: var(--primary); }
dialog button { margin-top: 8px; }

/* ============================================
   FILTER BAR
   ============================================ */
.filter-bar {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 14px;
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.filter-bar .mdi { color: var(--primary); font-size: 1.2rem; }
.filter-bar .form-control { width: auto; min-width: 140px; }

/* ============================================
   PRINT
   ============================================ */
@media print {
  .sidebar, .topbar, .footer, .no-print, .toast-container { display: none !important; }
  .main-wrapper { margin-left: 0; }
  .content { padding: 0; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .menu-toggle { display: block; }
  .content { padding: 16px; }
  .page-title { font-size: 1.25rem; }
  .stat-num { font-size: 1.5rem; }
}

@media (max-width: 600px) {
  .login-box { padding: 26px 20px; }
  .login-box h1 { font-size: 1.4rem; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar .form-control { width: 100%; }
  .toast-container { top: 10px; right: 10px; left: 10px; max-width: none; }
}