/* ============================================================
   assets/css/main.css — Stylesheet Utama
   Buku Catatan Kinerja PTT — Kementerian Agama
   ============================================================ */

/* --- CSS Variables --- */
:root {
  --primary:       #1a4fad;
  --primary-light: #e8efff;
  --primary-dark:  #0d3280;
  --accent:        #e8a020;
  --accent-light:  #fff7e6;
  --success:       #1a8a4a;
  --success-light: #e6f7ee;
  --danger:        #c0392b;
  --danger-light:  #fdf0ee;
  --warning:       #d97706;
  --warning-light: #fffbeb;
  --surface:       #ffffff;
  --bg:            #f0f2f8;
  --text:          #1a1e2e;
  --text-muted:    #6b7280;
  --border:        #e2e6f0;
  --sidebar-w:     260px;
  --header-h:      60px;
  --radius:        10px;
  --shadow:        0 2px 12px rgba(26,79,173,0.08);
  --shadow-md:     0 8px 24px rgba(26,79,173,0.12);
  --transition:    0.2s ease;
}

/* --- Reset --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; }

/* ============================================================
   AUTH PAGES (login.php / register.php)
   ============================================================ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0d3280 0%, #1a4fad 50%, #2c72e0 100%);
  position: relative;
  overflow: hidden;
  padding: 24px;
}
.auth-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
  top: -200px; right: -150px;
  pointer-events: none;
}
.auth-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
  bottom: -150px; left: -100px;
  pointer-events: none;
}
.auth-box {
  background: white;
  border-radius: 16px;
  padding: 40px 44px;
  width: 460px;
  max-width: 100%;
  position: relative;
  z-index: 1;
  box-shadow: 0 24px 64px rgba(0,0,0,0.2);
  animation: fadeUp 0.4s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
.auth-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}
.auth-logo .logo-icon {
  width: 44px; height: 44px;
  background: var(--primary-light);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: var(--primary);
  flex-shrink: 0;
}
.auth-logo h1 { font-size: 15px; font-weight: 700; color: var(--primary); line-height: 1.3; }
.auth-logo p  { font-size: 11px; color: var(--text-muted); }
.auth-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.auth-sub   { font-size: 13px; color: var(--text-muted); margin-bottom: 28px; }
.auth-switch {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}
.auth-switch a { color: var(--primary); font-weight: 600; }
.auth-switch a:hover { text-decoration: underline; }
.auth-demo {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: 8px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ============================================================
   LAYOUT — SIDEBAR + MAIN
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--primary-dark);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition);
}
.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.logo-row { display: flex; align-items: center; gap: 10px; }
.logo-icon {
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 18px; flex-shrink: 0;
}
.sidebar-logo h2 { font-size: 13px; font-weight: 700; color: white; line-height: 1.3; }
.sidebar-logo p  { font-size: 10px; color: rgba(255,255,255,0.55); margin-top: 1px; }

.sidebar-user {
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.user-badge { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: white; flex-shrink: 0;
}
.user-info h4 { font-size: 12px; font-weight: 600; color: white; }
.user-info p  { font-size: 10px; color: rgba(255,255,255,0.5); }
.role-badge {
  font-size: 9px; font-weight: 700;
  padding: 2px 6px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-left: auto; flex-shrink: 0;
}
.role-admin { background: var(--accent); color: white; }
.role-user  { background: rgba(255,255,255,0.2); color: rgba(255,255,255,0.8); }

.sidebar-nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.nav-section { margin-bottom: 18px; }
.nav-section-title {
  font-size: 9px; font-weight: 700;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase; letter-spacing: 1px;
  padding: 0 8px; margin-bottom: 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: rgba(255,255,255,0.65);
  font-size: 13px; font-weight: 500;
  transition: all var(--transition);
  margin-bottom: 2px;
  position: relative;
}
.nav-item i { width: 18px; text-align: center; font-size: 14px; flex-shrink: 0; }
.nav-item:hover  { background: rgba(255,255,255,0.1); color: white; }
.nav-item.active { background: var(--primary); color: white; }
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 10px;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex; flex-direction: column; gap: 4px;
}
.sidebar-btn {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.08);
  border: none;
  color: rgba(255,255,255,0.65);
  padding: 8px 12px; border-radius: 8px;
  cursor: pointer;
  font-family: inherit; font-size: 12px;
  transition: all var(--transition);
}
.sidebar-btn:hover { background: rgba(255,255,255,0.15); color: white; }
.sidebar-btn-logout:hover { background: rgba(192,57,43,0.3); color: #ff8a7a; }

@media screen and (max-width: 768px) {
    .mobile-header {
        display: flex !important; /* Munculkan header mobile */
    }

    .sidebar {
        position: fixed;
        left: -260px; /* Sembunyikan ke kiri luar layar */
        top: 0;
        bottom: 0;
        z-index: 1000;
        transition: 0.3s;
        width: 260px;
    }

    /* Class untuk memunculkan sidebar */
    .sidebar.active {
        left: 0;
    }

    /* Tambahkan overlay (gelap-gelap) saat sidebar aktif */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }

    .sidebar-overlay.active {
        display: block;
    }
}

/* --- Main Content --- */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition);
}

/* --- Topbar --- */
.topbar {
  height: var(--header-h);
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.sidebar-toggle {
  display: none;
  background: none; border: none; cursor: pointer;
  font-size: 18px; color: var(--text-muted);
  padding: 4px;
}
.page-title { font-size: 17px; font-weight: 700; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* --- Page Body --- */
.page-body { padding: 28px; flex: 1; }

/* ============================================================
   COMPONENTS
   ============================================================ */

/* --- Form Elements --- */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 13px; font-weight: 600;
  margin-bottom: 6px; color: var(--text);
}
.form-control {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: inherit; font-size: 14px; color: var(--text);
  background: white;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  appearance: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,79,173,0.08);
}
.form-control::placeholder { color: #adb5bd; }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

/* --- Buttons --- */
.btn {
  padding: 10px 20px;
  border: none; border-radius: 8px;
  font-family: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary  { background: var(--primary); color: white; }
.btn-primary:hover  { background: var(--primary-dark); }
.btn-success  { background: var(--success); color: white; }
.btn-success:hover  { background: #166b3a; }
.btn-danger   { background: var(--danger); color: white; }
.btn-danger:hover   { background: #a93226; }
.btn-accent   { background: var(--accent); color: white; }
.btn-accent:hover   { background: #c7871a; }
.btn-outline  { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover  { border-color: var(--primary); color: var(--primary); }
.btn-ghost    { background: transparent; color: var(--text-muted); border: none; }
.btn-ghost:hover    { background: var(--bg); color: var(--text); }
.btn-block    { width: 100%; justify-content: center; padding: 12px; }
.btn-sm       { padding: 6px 12px; font-size: 12px; }
.btn-lg       { padding: 14px 28px; font-size: 15px; }
.btn-icon     { padding: 8px; min-width: 34px; justify-content: center; }

/* --- Cards --- */
.card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.card-header h3 { font-size: 14px; font-weight: 700; flex: 1; }
.card-header .card-count {
  font-size: 12px; color: var(--text-muted); margin-left: auto;
}
.card-body { padding: 20px; }
.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

/* --- Stat Cards --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
  width: 40px; height: 40px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; margin-bottom: 12px;
}
.stat-num   { font-size: 28px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-blue  .stat-icon { background: var(--primary-light); color: var(--primary); }
.stat-green .stat-icon { background: var(--success-light); color: var(--success); }
.stat-amber .stat-icon { background: var(--accent-light);  color: var(--accent); }
.stat-red   .stat-icon { background: var(--danger-light);  color: var(--danger); }

/* --- Tables --- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; padding: 10px 14px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f7f9ff; }
.col-num  { width: 44px; text-align: center; color: var(--text-muted); }
.col-actions { white-space: nowrap; }
.mono { font-family: 'IBM Plex Mono', monospace; font-size: 12px; }

/* --- Badges --- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
  white-space: nowrap;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--accent-light);  color: #a06800; }
.badge-danger  { background: var(--danger-light);  color: var(--danger); }
.badge-info    { background: var(--primary-light); color: var(--primary); }
.badge-gray    { background: var(--bg);            color: var(--text-muted); }

/* --- Modals --- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 500;
  display: none; align-items: flex-start; justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
}
.modal-overlay.open { display: flex; }
.modal {
  background: white;
  border-radius: 14px;
  width: 620px; max-width: 100%;
  box-shadow: 0 24px 64px rgba(0,0,0,0.18);
  animation: slideUp 0.25s ease;
  margin: auto;
}
.modal-sm { width: 440px; }
.modal-lg { width: 780px; }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.modal-header h3 { font-size: 16px; font-weight: 700; flex: 1; }
.modal-body   { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}

/* --- Alerts --- */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 13px;
}
.alert i { flex-shrink: 0; font-size: 15px; margin-top: 1px; }
.alert-close {
  margin-left: auto; background: none; border: none;
  cursor: pointer; font-size: 18px; line-height: 1;
  color: inherit; opacity: 0.6; padding: 0 4px;
}
.alert-close:hover { opacity: 1; }
.alert-success { background: var(--success-light); color: var(--success); }
.alert-danger  { background: var(--danger-light);  color: var(--danger); }
.alert-warning { background: var(--accent-light);  color: #a06800; }
.alert-info    { background: var(--primary-light); color: var(--primary); }

/* --- Toast Notification --- */
.notif {
  position: fixed; bottom: 24px; right: 24px;
  padding: 12px 20px; border-radius: 10px;
  font-size: 13px; font-weight: 600;
  z-index: 9999; display: flex; align-items: center; gap: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  transform: translateX(140%);
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
  max-width: 320px;
}
.notif.show    { transform: translateX(0); }
.notif-success { background: var(--success); color: white; }
.notif-danger  { background: var(--danger);  color: white; }
.notif-warning { background: var(--accent);  color: white; }
.notif-info    { background: var(--primary); color: white; }

/* --- Filter Row --- */
.filter-row {
  display: flex; gap: 10px; align-items: center;
  flex-wrap: wrap; padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.filter-row .form-control { padding: 8px 12px; width: auto; flex: 1; min-width: 160px; }
.filter-row .btn { flex-shrink: 0; }

/* --- Action Row --- */
.action-row { display: flex; gap: 6px; align-items: center; }

/* --- Empty State --- */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state i    { font-size: 48px; margin-bottom: 16px; color: var(--border); }
.empty-state h4   { font-size: 16px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.empty-state p    { font-size: 13px; }

/* --- Pagination --- */
.pagination {
  display: flex; align-items: center; gap: 6px;
  padding: 16px 20px; border-top: 1px solid var(--border);
  justify-content: center;
}
.page-btn {
  width: 34px; height: 34px; border-radius: 8px;
  border: 1.5px solid var(--border);
  background: white; cursor: pointer;
  font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); transition: all var(--transition);
}
.page-btn:hover  { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: white; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* --- Uraian items --- */
.uraian-list  { display: flex; flex-direction: column; gap: 8px; }
.uraian-item  { display: flex; align-items: flex-start; gap: 8px; }
.uraian-item .form-control { flex: 1; }

/* --- Output tabs --- */
.output-section { border: 1.5px dashed var(--border); border-radius: 8px; padding: 16px; }
.output-tabs    { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.output-tab {
  padding: 6px 14px; border-radius: 6px;
  border: 1.5px solid var(--border);
  background: transparent; cursor: pointer;
  font-size: 12px; font-weight: 600;
  font-family: inherit; color: var(--text-muted);
  transition: all var(--transition);
}
.output-tab.active { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }

/* --- Image thumbnails --- */
.output-thumb {
  width: 48px; height: 36px;
  object-fit: cover; border-radius: 4px;
  border: 1px solid var(--border);
  cursor: pointer; transition: transform var(--transition);
}
.output-thumb:hover { transform: scale(1.1); }

/* --- Image Viewer Lightbox --- */
.img-viewer-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 9000; display: none;
  align-items: center; justify-content: center;
}
.img-viewer-overlay.open { display: flex; }
.img-viewer-overlay img  { max-width: 90vw; max-height: 90vh; border-radius: 8px; }
.img-viewer-close {
  position: absolute; top: 20px; right: 24px;
  background: rgba(255,255,255,0.15); border: none;
  color: white; width: 40px; height: 40px; border-radius: 50%;
  font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.img-viewer-close:hover { background: rgba(255,255,255,0.3); }

/* --- Dashboard Chart Placeholder --- */
.chart-placeholder {
  height: 220px; background: var(--bg);
  border-radius: 8px; display: flex;
  align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 13px;
  border: 1.5px dashed var(--border);
}

/* --- Profile avatar large --- */
.avatar-lg {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; color: white;
}

/* --- Divider --- */
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* --- Code/mono --- */
code {
  background: var(--bg); padding: 2px 7px;
  border-radius: 4px; font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
}

/* --- Pending verification banner --- */
.pending-banner {
  background: var(--accent-light);
  border: 1.5px solid var(--accent);
  border-radius: 10px; padding: 20px 24px;
  display: flex; align-items: flex-start; gap: 14px;
  margin-bottom: 24px;
}
.pending-banner i { font-size: 24px; color: var(--accent); flex-shrink: 0; margin-top: 2px; }
.pending-banner h3 { font-size: 15px; font-weight: 700; color: var(--warning); margin-bottom: 4px; }
.pending-banner p  { font-size: 13px; color: var(--text-muted); }

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .sidebar, .topbar, .action-row, .filter-row,
  .btn, .pagination, .notif { display: none !important; }
  .main-content { margin: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; }
  .page-body { padding: 0 !important; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-260px); }
  .sidebar.open { transform: translateX(0); width: 260px; }
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .page-body { padding: 16px; }
  .topbar { padding: 0 16px; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .auth-box { padding: 28px 24px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .filter-row { flex-direction: column; align-items: stretch; }
}