/*
 * BPMP Senin Berseri — Design Tokens
 * Di-load setelah tabler.min.css untuk menimpa variabel Tabler.
 * Satu sumber kebenaran warna, font, radius, bayangan untuk semua peran.
 */

/* ======================================================
   1. GOOGLE INTER FONT (Offline-safe via system fallback)
   ====================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  /* ---- Warna Utama Institusional Kemendikdasmen ---- */
  --tblr-primary:        #0056b3;
  --tblr-primary-rgb:    0, 86, 179;
  --tblr-primary-fg:     #ffffff;
  --tblr-primary-darken: #004085;
  --tblr-primary-lighten:#0d6efd;

  /* ---- Warna Aksen ---- */
  --tblr-secondary:      #64748b;
  --tblr-secondary-rgb:  100, 116, 139;

  /* ---- Warna Status ---- */
  --tblr-success:        #16a34a;   /* Disetujui / Hadir */
  --tblr-success-rgb:    22, 163, 74;
  --tblr-warning:        #d97706;   /* Pending / Menunggu */
  --tblr-warning-rgb:    217, 119, 6;
  --tblr-danger:         #dc2626;   /* Revisi / Ditolak */
  --tblr-danger-rgb:     220, 38, 38;
  --tblr-info:           #0284c7;   /* Informasi */
  --tblr-info-rgb:       2, 132, 199;

  /* ---- Background & Surface (Bersih & Terang Tanpa Celah Hitam) ---- */
  --tblr-body-bg:        #ffffff;
  --tblr-card-bg:        #ffffff;
  --tblr-border-color:   #e2e8f0;

  /* ---- Font ---- */
  --tblr-font-sans-serif: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --tblr-body-font-family: var(--tblr-font-sans-serif);
  --tblr-body-font-size:   0.875rem;
  --tblr-body-color:       #1e293b;

  /* ---- Radius & Shadow ---- */
  --tblr-border-radius:    0.5rem;
  --tblr-border-radius-sm: 0.375rem;
  --tblr-border-radius-lg: 0.75rem;
  --tblr-shadow-card:      0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  --tblr-shadow-dropdown:  0 10px 25px rgba(0,0,0,0.1);

  /* ---- BPMP Custom Tokens (Terang & Bersih) ---- */
  --bpmp-gov-strip-bg:   #f8fafc;
  --bpmp-gov-strip-border: #e2e8f0;
  --bpmp-gold:           #d97706;
  --bpmp-gold-bg:        #fef3c7;
  --bpmp-teal:           #0f766e;
  --bpmp-teal-bg:        #ccfbf1;
  --bpmp-sidebar-bg:          #ffffff;
  --bpmp-sidebar-active:      #E8F0FE;
  --bpmp-sidebar-text:        #374151;
  --bpmp-sidebar-text-active: #1D4ED8;
}

/* ======================================================
   2. GLOBAL OVERRIDES & ANTI-CELAH HITAM
   ====================================================== */
html, body {
  font-family: var(--tblr-body-font-family);
  background-color: #ffffff !important;
  background: #ffffff !important;
  color: var(--tblr-body-color);
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
}

/* Matikan seluruh efek padding celah hitam layout-boxed Tabler */
.layout-boxed, 
html[data-bs-layout=boxed] body {
  padding: 0 !important;
  margin: 0 !important;
  background: #ffffff !important;
  background-color: #ffffff !important;
  background-image: none !important;
  --tblr-theme-boxed-border-radius: 0 !important;
}

.layout-boxed .page, 
html[data-bs-layout=boxed] .page,
.page {
  box-shadow: none !important;
  border-radius: 0 !important;
  max-width: 100% !important;
  border: none !important;
  margin: 0 !important;
  background-color: #ffffff !important;
  min-height: 100vh;
}

/* Card shadows */
.card {
  box-shadow: var(--tblr-shadow-card);
  border: 1px solid var(--tblr-border-color);
}

/* Primary button */
.btn-primary {
  --tblr-btn-bg: var(--tblr-primary);
  --tblr-btn-border-color: var(--tblr-primary);
  --tblr-btn-hover-bg: var(--tblr-primary-darken);
  --tblr-btn-hover-border-color: var(--tblr-primary-darken);
}

/* Gov gold button */
.btn-gov-gold {
  background: linear-gradient(135deg, var(--bpmp-gold) 0%, #b45309 100%);
  color: #ffffff;
  border: none;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.btn-gov-gold:hover {
  background: linear-gradient(135deg, #b45309 0%, #92400e 100%);
  color: #ffffff;
}

/* ======================================================
   3. STATUS BADGES
   ====================================================== */
.badge-status-hadir    { background-color: rgba(var(--tblr-success-rgb), 0.1); color: var(--tblr-success); font-weight: 600; }
.badge-status-pending  { background-color: rgba(var(--tblr-warning-rgb), 0.1); color: var(--tblr-warning); font-weight: 600; }
.badge-status-ditolak  { background-color: rgba(var(--tblr-danger-rgb), 0.1);  color: var(--tblr-danger);  font-weight: 600; }
.badge-status-disetujui{ background-color: rgba(var(--tblr-success-rgb), 0.1); color: var(--tblr-success); font-weight: 600; }
.badge-status-revisi   { background-color: rgba(var(--tblr-danger-rgb), 0.1);  color: var(--tblr-danger);  font-weight: 600; }
.badge-status-none     { background-color: rgba(var(--tblr-secondary-rgb), 0.1); color: var(--tblr-secondary); font-weight: 600; }

/* ======================================================
   4. GOV TOP STRIP (Shared across all pages except proyektor)
   ====================================================== */
.gov-top-strip {
  background: #f8fafc;
  color: #475569;
  padding: 6px 20px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ======================================================
   5. STICKY TABLE HEADER
   ====================================================== */
.table-sticky-header thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--tblr-card-bg);
  border-bottom: 2px solid var(--tblr-border-color);
}
.table-responsive-scroll {
  max-height: 70vh;
  overflow-y: auto;
}

/* ======================================================
   6. STAT CARD (reusable)
   ====================================================== */
.stat-card {
  position: relative;
  overflow: hidden;
}
.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--tblr-border-radius);
  font-size: 1.25rem;
}
.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.2;
}
.stat-card .stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--tblr-secondary);
}

/* ======================================================
   7. EMPTY STATE
   ====================================================== */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--tblr-secondary);
}
.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.4;
}
.empty-state .empty-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--tblr-body-color);
  margin-bottom: 0.5rem;
}
.empty-state .empty-text {
  font-size: 0.875rem;
  max-width: 400px;
  margin: 0 auto;
}

/* ======================================================
   8. PAGE HEADER (title + breadcrumb + action)
   ====================================================== */
.page-header-custom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  gap: 0.75rem;
}
.page-header-custom .page-title {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0;
}

/* ======================================================
   9. SIDEBAR OVERRIDES (Tabler vertical navbar - PURE WHITE THEME)
   ====================================================== */
.navbar-vertical,
.navbar-vertical.navbar-dark,
.navbar-vertical.navbar-light,
#sidebarMenu {
  background: #ffffff !important;
  background-color: #ffffff !important;
  border-right: 1px solid #E5E7EB !important;
}
.navbar-vertical .nav-link,
.navbar-vertical.navbar-dark .nav-link,
.navbar-vertical.navbar-light .nav-link {
  color: #374151 !important;
}
.navbar-vertical .nav-link.active,
.navbar-vertical.navbar-dark .nav-link.active,
.navbar-vertical.navbar-light .nav-link.active,
.navbar-vertical .nav-link:hover,
.navbar-vertical.navbar-dark .nav-link:hover {
  color: #1D4ED8 !important;
  background: #E8F0FE !important;
}

/* ======================================================
   10. MOBILE-FIRST ADJUSTMENTS
   ====================================================== */
@media (max-width: 768px) {
  .stat-card .stat-value { font-size: 1.5rem; }
  .page-header-custom { flex-direction: column; align-items: flex-start; }
  .gov-top-strip { font-size: 0.6rem; padding: 4px 12px; }
}

/* ======================================================
   11. PRINT STYLES (sertifikat)
   ====================================================== */
@media print {
  .navbar, .gov-top-strip, .page-header-custom, footer { display: none !important; }
  .card { box-shadow: none !important; border: none !important; }
  body { background: #fff !important; }
}

/* ======================================================
   12. INSTITUTIONAL GOVERNMENT ALERTS
   Standard rapi, kontras tinggi, dan beraksen resmi instansi
   ====================================================== */
.alert {
  border-radius: var(--tblr-border-radius);
  border: 1px solid transparent;
  padding: 0.9rem 1.15rem;
  font-size: 0.875rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  position: relative;
  transition: all 0.2s ease;
}

.alert-primary {
  background-color: #f0f7ff !important;
  border-color: #bcdbfc !important;
  border-left: 4px solid #1a3a5c !important;
  color: #0f2740 !important;
}

.alert-info {
  background-color: #f0fdfa !important;
  border-color: #99f6e4 !important;
  border-left: 4px solid #0d9488 !important;
  color: #115e59 !important;
}

.alert-success {
  background-color: #f0fdf4 !important;
  border-color: #bbf7d0 !important;
  border-left: 4px solid #16a34a !important;
  color: #166534 !important;
}

.alert-warning {
  background-color: #fffbeb !important;
  border-color: #fde68a !important;
  border-left: 4px solid #d97706 !important;
  color: #92400e !important;
}

.alert-danger {
  background-color: #fef2f2 !important;
  border-color: #fecaca !important;
  border-left: 4px solid #dc2626 !important;
  color: #991b1b !important;
}

.alert-icon-box {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

/* ======================================================
   13. STILISASI PORTAL RESMI BPMP SULTRA KEMENDIKDASMEN
   Sesuai desain bpmpsultra.kemendikdasmen.go.id
   ====================================================== */
.bpmp-badge-pill {
  background: #e0f2fe;
  color: #0284c7;
  font-weight: 700;
  border-radius: 50rem;
  padding: 0.35rem 0.85rem;
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  border: 1px solid rgba(2, 132, 199, 0.15);
}

.bpmp-heading-accent {
  position: relative;
  display: inline-block;
  padding-bottom: 12px;
}
.bpmp-heading-accent::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 65px;
  height: 4px;
  background: #0056b3;
  border-radius: 3px;
}

.bpmp-tutwuri-circle {
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 60%, #f0f7ff 100%);
  border: 8px solid #ffffff;
  box-shadow: 0 15px 35px rgba(26, 58, 92, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  position: relative;
}
.bpmp-tutwuri-circle::before {
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 2px dashed rgba(2, 132, 199, 0.25);
  pointer-events: none;
}

.bpmp-feature-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}
.bpmp-feature-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 45, 91, 0.06);
  border-color: #cbd5e1;
}

.bpmp-feature-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #e0f2fe;
  color: #0284c7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

/* Floating Helpdesk Widget (WhatsApp) */
.bpmp-floating-help {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1050;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.bpmp-floating-bubble {
  background: #ffffff;
  color: #1e293b;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.bpmp-floating-bubble .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
}
.bpmp-floating-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #25d366;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 6px 18px rgba(37, 211, 102, 0.35);
  transition: transform 0.2s ease;
}

/* ======================================================
   NAVBAR ENHANCEMENTS & OVERFLOW PREVENTION
   ====================================================== */
.navbar-brand {
  display: flex !important;
  align-items: center !important;
  flex-shrink: 0 !important;
}

.navbar-nav .nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
}

.navbar-nav .nav-link.active {
  color: #0056b3 !important;
}

.navbar-nav .nav-link:hover {
  color: #0056b3 !important;
}
.bpmp-floating-help:hover .bpmp-floating-btn {
  transform: scale(1.08);
  color: #ffffff;
}

/* ======================================================
   TABLER VERTICAL SIDEBAR (THEME LIGHT) & PAGE OFFSET
   HANYA UNTUK HALAMAN ADMIN (body.has-admin-sidebar)
   ====================================================== */
:root {
  --bpmp-sidebar-w: 260px;
  --bpmp-sidebar-collapsed-w: 72px;
}

html, body {
  overflow-x: hidden !important;
}

/* Sidebar HANYA tampil jika di halaman admin (body.has-admin-sidebar) */
body.has-admin-sidebar #app-sidebar,
body.has-admin-sidebar #sidebar-container,
body.has-admin-sidebar #bpmp-sidebar {
  display: block;
}

/* Halaman non-admin (landing page, portal pegawai, login, sertifikat): SEMBUNYIKAN SIDEBAR */
body:not(.has-admin-sidebar) #app-sidebar,
body:not(.has-admin-sidebar) #sidebar-container,
body:not(.has-admin-sidebar) #bpmp-sidebar,
body:not(.has-admin-sidebar) #sidebarMenu,
body:not(.has-admin-sidebar) aside.navbar-vertical {
  display: none !important;
}

/* Halaman non-admin: page-wrapper 100% lebar, tanpa margin kiri */
body:not(.has-admin-sidebar) .page-wrapper {
  margin-left: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
}

/* Sidebar Admin (Latar Putih Bersih / Theme Light) */
#sidebarMenu,
.navbar-vertical.navbar-expand-lg {
  background-color: #ffffff !important;
  border-right: 1px solid #E5E7EB !important;
}

@media (min-width: 992px) {
  body.has-admin-sidebar #sidebarMenu,
  body.has-admin-sidebar .navbar-vertical.navbar-expand-lg {
    width: var(--bpmp-sidebar-w) !important;
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    z-index: 1030 !important;
    background-color: #ffffff !important;
    border-right: 1px solid #E5E7EB !important;
    box-shadow: none !important;
    transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  body.has-admin-sidebar .page-wrapper {
    margin-left: var(--bpmp-sidebar-w) !important;
    width: calc(100% - var(--bpmp-sidebar-w)) !important;
    max-width: calc(100% - var(--bpmp-sidebar-w)) !important;
    min-height: 100vh;
    transition: margin-left 0.2s cubic-bezier(0.4, 0, 0.2, 1), width 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    display: flex;
    flex-direction: column;
  }

  /* Mode Ikon (Collapsed) */
  body.has-admin-sidebar.sidebar-collapsed #sidebarMenu,
  body.has-admin-sidebar.sidebar-collapsed .navbar-vertical.navbar-expand-lg {
    width: var(--bpmp-sidebar-collapsed-w) !important;
  }

  body.has-admin-sidebar.sidebar-collapsed .page-wrapper {
    margin-left: var(--bpmp-sidebar-collapsed-w) !important;
    width: calc(100% - var(--bpmp-sidebar-collapsed-w)) !important;
    max-width: calc(100% - var(--bpmp-sidebar-collapsed-w)) !important;
  }

  body.has-admin-sidebar.sidebar-collapsed .sidebar-hide-collapsed,
  body.has-admin-sidebar.sidebar-collapsed .bpmp-group-title,
  body.has-admin-sidebar.sidebar-collapsed .sidebar-event-selector,
  body.has-admin-sidebar.sidebar-collapsed .sidebar-user-details,
  body.has-admin-sidebar.sidebar-collapsed .nav-link-title,
  body.has-admin-sidebar.sidebar-collapsed #sidebarBadgeLptiPending {
    display: none !important;
  }

  body.has-admin-sidebar.sidebar-collapsed .navbar-brand {
    justify-content: center !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  body.has-admin-sidebar.sidebar-collapsed .navbar-brand .brand-text-hide {
    display: none !important;
  }

  body.has-admin-sidebar.sidebar-collapsed .bpmp-nav-link {
    justify-content: center !important;
    padding: 0.65rem 0.5rem !important;
    margin: 0.15rem 0.35rem !important;
    border-left: 3px solid transparent !important;
    border-radius: 6px !important;
  }

  body.has-admin-sidebar.sidebar-collapsed .bpmp-nav-link.active {
    border-left: 3px solid #1D4ED8 !important;
    border-radius: 0 6px 6px 0 !important;
  }

  body.has-admin-sidebar.sidebar-collapsed .bpmp-nav-link .nav-link-icon {
    margin-right: 0 !important;
  }

  body.has-admin-sidebar.sidebar-collapsed .sidebar-footer {
    padding: 0.75rem 0.25rem !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
  }
}

@media (max-width: 991.98px) {
  body.has-admin-sidebar .page-wrapper {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  body.has-admin-sidebar #sidebarMenu,
  body.has-admin-sidebar .navbar-vertical.navbar-expand-lg {
    width: 260px !important;
    background-color: #ffffff !important;
    border-right: 1px solid #E5E7EB !important;
  }
}

/* Nav Item Link Styling */
.bpmp-nav-link {
  color: #374151 !important;
  font-weight: 500;
  font-size: 0.85rem;
  padding: 0.55rem 0.75rem !important;
  border-radius: 0.375rem;
  margin: 0.1rem 0.5rem;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
  display: flex;
  align-items: center;
  text-decoration: none !important;
}

.bpmp-nav-link .nav-link-icon {
  color: #6B7280 !important;
  transition: color 0.15s ease;
}

.bpmp-nav-link:hover {
  background-color: #F3F4F6 !important;
  color: #111827 !important;
}

.bpmp-nav-link:hover .nav-link-icon {
  color: #374151 !important;
}

.bpmp-nav-link.active {
  background-color: #E8F0FE !important;
  color: #1D4ED8 !important;
  border-left: 3px solid #1D4ED8 !important;
  font-weight: 600 !important;
  border-radius: 0 0.375rem 0.375rem 0 !important;
}

.bpmp-nav-link.active .nav-link-icon {
  color: #1D4ED8 !important;
}

.bpmp-group-title {
  text-transform: uppercase;
  color: #9CA3AF !important;
  font-size: 10px !important;
  letter-spacing: 0.8px;
  font-weight: 700;
  padding: 0.85rem 1rem 0.25rem 1rem;
  user-select: none;
}
