/* ============================================================
   SENTRA-WEB — Main Stylesheet
   Aesthetic: Government-Grade Modern / Clean Authority
   ============================================================ */

:root {
  /* ── Biru Diskominfo Kabupaten Lingga ── */
  --primary: #1a56db;
  --primary-light: #3b82f6;
  --primary-dark: #1040b0;
  --accent: #f59e0b;
  --accent-light: #fcd34d;
  --success: #1a9e6c;
  --danger: #c0392b;
  --warning: #e67e22;
  --info: #0ea5e9;
  --secondary: #7f8c8d;
  --bg: #f0f4f8;
  --bg-card: #ffffff;
  --text: #1a202c;
  --text-muted: #718096;
  --border: #e2e8f0;
  --sidebar-bg: #0c2d6b;       /* biru tua diskominfo */
  --sidebar-text: rgba(255,255,255,0.88);
  --sidebar-active: rgba(255,255,255,0.15);
  --sidebar-hover: rgba(255,255,255,0.08);
  --sidebar-width: 260px;
  --topbar-height: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --transition: all 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; }

/* ============================================================
   LAYOUT
   ============================================================ */
.app-wrapper { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: transform 0.3s ease;
  box-shadow: 4px 0 20px rgba(0,0,0,0.15);
}

.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand-logo { display: flex; align-items: center; gap: 12px; }
.logo-icon {
  width: 42px; height: 42px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.brand-name {
  display: block;
  font-weight: 800;
  font-size: 1.15rem;
  color: #fff;
  letter-spacing: -0.3px;
}
.brand-sub {
  display: block;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.sidebar-user {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.user-avatar {
  width: 38px; height: 38px;
  background: var(--accent);
  color: var(--primary-dark);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.user-name {
  display: block;
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}
.user-role {
  display: block;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 500;
}

.sidebar-nav { flex: 1; padding: 16px 12px; }
.nav-section-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.35);
  padding: 12px 8px 4px;
  font-weight: 700;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--sidebar-text);
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 2px;
}
.nav-item i { width: 18px; text-align: center; opacity: 0.8; }
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; border-left: 3px solid var(--accent); }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logout {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,0.6);
  font-size: 0.875rem;
  transition: var(--transition);
}
.sidebar-logout:hover { background: rgba(192,57,43,0.2); color: #e74c3c; }

/* MAIN CONTENT */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* TOPBAR */
.topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}
.sidebar-toggle {
  background: none; border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  display: none;
}
.topbar-title {
  flex: 1;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.notif-btn {
  position: relative;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--bg);
  color: var(--text-muted);
  transition: var(--transition);
  font-size: 1rem;
}
.notif-btn:hover { background: var(--primary); color: #fff; }
.notif-badge {
  position: absolute;
  top: -2px; right: -2px;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.topbar-user {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}
.avatar-sm {
  width: 32px; height: 32px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
}

/* PAGE CONTENT */
.page-content { padding: 28px; flex: 1; }

/* ============================================================
   FLASH MESSAGES
   ============================================================ */
.flash-message {
  margin: 0 28px;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; gap: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  animation: slideDown 0.3s ease;
}
.flash-success { background: #d4edda; color: #155724; border-left: 4px solid var(--success); }
.flash-danger { background: #f8d7da; color: #721c24; border-left: 4px solid var(--danger); }
.flash-warning { background: #fff3cd; color: #856404; border-left: 4px solid var(--warning); }
.flash-info { background: #d1ecf1; color: #0c5460; border-left: 4px solid var(--info); }
.flash-close { background: none; border: none; cursor: pointer; margin-left: auto; font-size: 1.2rem; opacity: 0.6; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}
.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.card-title i { color: var(--primary); }
.card-body { padding: 24px; }

/* STAT CARDS */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--stat-color, var(--primary));
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  background: var(--stat-bg, #e8f0fe);
  color: var(--stat-color, var(--primary));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.stat-value { font-size: 1.8rem; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }

/* ============================================================
   TABLES
   ============================================================ */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead th {
  background: #f8fafc;
  padding: 12px 16px;
  text-align: left;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }

/* BADGES */
.badge {
  display: inline-flex; align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}
.badge-secondary { background: #e2e8f0; color: #4a5568; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-primary { background: #ede9fe; color: #5b21b6; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }

/* ============================================================
   FORMS
   ============================================================ */
.form-section { margin-bottom: 32px; }
.form-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--primary);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary);
  display: inline-block;
}
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 6px;
  color: var(--text);
}
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: var(--transition);
  outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,76,129,0.1); }
.form-control::placeholder { color: #a0aec0; }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }
.form-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 768px) { .form-grid { grid-template-columns: 1fr; } }

.file-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: #f8fafc;
  position: relative;
}
.file-upload-area:hover, .file-upload-area.drag-over {
  border-color: var(--primary);
  background: rgba(15,76,129,0.04);
}
.file-upload-area input[type="file"] {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.file-upload-icon { font-size: 2rem; color: var(--primary); margin-bottom: 8px; }
.file-upload-text { font-size: 0.875rem; color: var(--text-muted); }
.file-upload-text strong { color: var(--primary); }
.file-name { margin-top: 8px; font-size: 0.8rem; color: var(--success); font-weight: 600; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-accent { background: var(--accent); color: var(--primary-dark); border-color: var(--accent); }
.btn-accent:hover { background: #d4a43a; }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #a93226; }
.btn-secondary { background: var(--bg); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap; gap: 12px;
}
.page-header-left h1 { font-size: 1.5rem; font-weight: 800; color: var(--text); }
.page-header-left p { color: var(--text-muted); font-size: 0.875rem; margin-top: 2px; }
.breadcrumb { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 4px; }
.breadcrumb a { color: var(--primary); }
.breadcrumb span { margin: 0 4px; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.show { display: flex; }
.modal {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 90%; max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.3s ease;
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-weight: 700; font-size: 1.05rem; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-muted); line-height: 1; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(-20px); } to { opacity: 1; transform: scale(1) translateY(0); } }

/* ============================================================
   DETAIL VIEW
   ============================================================ */
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 640px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-item { }
.detail-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); font-weight: 700; margin-bottom: 4px; }
.detail-value { font-size: 0.9rem; font-weight: 600; color: var(--text); }

/* TIMELINE */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-item::before {
  content: '';
  position: absolute; left: -24px; top: 6px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--primary);
}
.timeline-item.done::before { background: var(--success); box-shadow: 0 0 0 2px var(--success); }
.timeline-item.rejected::before { background: var(--danger); box-shadow: 0 0 0 2px var(--danger); }
.timeline-date { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 2px; }
.timeline-title { font-weight: 700; font-size: 0.9rem; }
.timeline-desc { font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; }

/* ============================================================
   UTILITY
   ============================================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.flex { display: flex; } .flex-center { display: flex; align-items: center; justify-content: center; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.w-full { width: 100%; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 768px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state i { font-size: 3rem; opacity: 0.3; margin-bottom: 16px; display: block; }
.empty-state p { font-size: 0.9rem; }
.action-btns { display: flex; gap: 6px; flex-wrap: wrap; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  background: #0c2d6b;   /* biru tua diskominfo — sama dengan sidebar */
  position: relative;
  overflow: hidden;
}
.login-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 15% 85%, rgba(26,86,219,0.35) 0%, transparent 55%),
    radial-gradient(circle at 85% 15%, rgba(59,130,246,0.25) 0%, transparent 55%),
    radial-gradient(circle at 50% 50%, rgba(12,45,107,0.6) 0%, transparent 80%);
}
.login-left {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 60px;
  position: relative;
}
.login-brand { max-width: 420px; }
.login-logo {
  width: 64px; height: 64px;
  background: rgba(255,255,255,0.12);
  border: 2px solid rgba(255,255,255,0.25);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px;
  margin-bottom: 24px;
}
.login-brand h1 {
  font-size: 2.5rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
  margin-bottom: 12px;
}
.login-brand h1 em { color: var(--accent); font-style: normal; }
.login-brand p { color: rgba(255,255,255,0.6); font-size: 1rem; line-height: 1.6; }
.login-features { margin-top: 32px; display: grid; gap: 12px; }
.login-feature {
  display: flex; align-items: center; gap: 12px;
  color: rgba(255,255,255,0.75);
  font-size: 0.9rem;
}
.login-feature i { color: var(--accent); font-size: 1rem; }

.login-right {
  width: 460px;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  padding: 48px 40px;
  position: relative;
}
.login-form-wrap { width: 100%; }
.login-form-wrap h2 { font-size: 1.6rem; font-weight: 800; margin-bottom: 4px; }
.login-form-wrap p { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 32px; }
.login-footer { margin-top: 20px; text-align: center; font-size: 0.8rem; color: var(--text-muted); }

@media (max-width: 900px) {
  .login-left { display: none; }
  .login-right { width: 100%; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .sidebar-toggle { display: block; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .page-content { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar-user span { display: none; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* Manual Book Styles */
.manual-card {
  border-radius: var(--radius);
  border: 2px solid var(--border);
  padding: 20px;
  cursor: pointer;
  transition: var(--transition);
  background: #fff;
}
.manual-card:hover { border-color: var(--primary); box-shadow: var(--shadow-lg); }
.manual-icon { font-size: 2rem; margin-bottom: 12px; }
.manual-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 6px; }
.manual-card p { font-size: 0.82rem; color: var(--text-muted); }
.manual-content { line-height: 1.8; }
.manual-content h3 { font-size: 1rem; font-weight: 700; margin: 20px 0 8px; color: var(--primary); }
.manual-content h4 { font-size: 0.9rem; font-weight: 700; margin: 16px 0 6px; }
.manual-content p { margin-bottom: 10px; font-size: 0.9rem; }
.manual-content ul, .manual-content ol { padding-left: 20px; margin-bottom: 12px; }
.manual-content li { margin-bottom: 4px; font-size: 0.875rem; }
.manual-content strong { color: var(--primary-dark); }

/* Search Bar */
.search-bar { position: relative; }
.search-bar input { padding-left: 38px; }
.search-bar i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }

/* Pagination */
.pagination { display: flex; gap: 4px; align-items: center; justify-content: flex-end; margin-top: 16px; }
.page-btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 0.82rem;
  cursor: pointer;
  background: #fff;
  transition: var(--transition);
  color: var(--text);
}
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:hover:not(.active) { background: var(--bg); }

/* Report styles */
.report-header { text-align: center; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 2px solid var(--primary); }
.report-header h2 { font-size: 1.2rem; }
.report-header p { font-size: 0.8rem; color: var(--text-muted); }
