/* =====================================================
   ISC BIOTROP LEARNING MODULE - Custom Theme
   Minimalist, Clean, & Flat Academic Design
   ===================================================== */

/* Import Google Font */
@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@400;500;600;700;800&display=swap');

/* =====================================================
   CORE TYPOGRAPHY & GENERAL
   ===================================================== */
body {
  font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
  color: #343a40 !important;
  /* Charcoal text from official website */
  background-color: #ffffff;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  color: #112a14;
  scroll-margin-top: 85px !important; /* Offset for sticky header */
}

a {
  color: #024800;
  text-decoration: none;
  transition: color 0.15s ease-in-out;
}

a:hover {
  color: #013000;
}

/* =====================================================
   NAVBAR (MODUL / PROGRAM VIEW)
   ===================================================== */
.navbar {
  font-family: 'Source Sans 3', sans-serif !important;
  background-color: #ffffff !important;
  /* White background globally */
  border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
}

.navbar-brand,
.navbar .nav-link,
.navbar-title {
  color: #024800 !important;
  /* Green text globally */
}

.navbar .nav-link:hover {
  color: #013000 !important;
}

/* Ensure mobile toggles and search icon are visible in white navbar */
.navbar-toggler-icon {
  filter: invert(20%) sepia(80%) saturate(1500%) hue-rotate(90deg) brightness(85%) contrast(90%);
}

.quarto-btn-toggle i,
.quarto-search-button i,
.navbar .bi-search {
  color: #024800 !important;
}

/* =====================================================
   SIDEBAR (TABLE OF CONTENTS)

.sidebar {
  font-family: 'Source Sans 3', sans-serif !important;
  background-color: #ffffff !important;
  border-right: 1px solid rgba(0, 0, 0, 0.05) !important;
  padding: 0.25rem 0.75rem 1.5rem 0.75rem !important; /* Pushed close to top */
}

/* Hide default title to prevent duplicates */
.sidebar-title {
  display: none !important;
}

/* Static clean TABLE OF CONTENTS title at the top of the menu (no burger icon) */
.sidebar-menu-container::before {
  content: "TABLE OF CONTENTS" !important;
  display: block !important;
  font-family: 'Source Sans 3', sans-serif !important;
  font-weight: 700 !important;
  font-size: 0.72rem !important;
  text-transform: uppercase !important;
  letter-spacing: 1.2px !important;
  color: #2e3d30 !important;
  padding: 10px 12px 14px 12px !important;
  margin-bottom: 1.25rem !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
}

/* Sidebar item spacing */
.sidebar-item {
  margin-bottom: 4px !important;
}

/* Base style for sidebar links */
.sidebar-link {
  font-size: 0.83rem !important;
  font-weight: 500 !important;
  color: #495057 !important;
  padding: 8px 12px !important;
  display: flex !important;
  align-items: center !important;
  transition: all 0.15s ease !important;
  border-radius: 6px !important;
  text-decoration: none !important;
  border-left: 4px solid transparent !important; /* prevent layout shifts */
}

.sidebar-link:hover {
  color: #024800 !important;
  background-color: #f4f6f4 !important;
}

/* Home icon for the index.html page link */
.sidebar-link[href*="index.html"]::before {
  content: "\f425" !important;
  font-family: 'bootstrap-icons' !important;
  margin-right: 12px !important;
  font-size: 0.95rem !important;
  display: inline-block !important;
  vertical-align: middle !important;
  color: #495057 !important;
}

.sidebar-link.active[href*="index.html"]::before,
.sidebar-link:hover[href*="index.html"]::before {
  color: #024800 !important;
}

/* Chapter Number and Title Separation & Grid-like Alignment */
.sidebar-link .menu-text {
  display: flex !important;
  align-items: flex-start !important;
  width: 100% !important;
}

.sidebar-link span.chapter-number {
  font-weight: 700 !important;
  color: #6c757d !important; /* clean charcoal gray by default */
  margin-right: 8px !important;
  min-width: 20px !important;
  flex-shrink: 0 !important;
  display: inline-block !important;
  font-size: 0.8rem !important;
  letter-spacing: -0.2px !important;
  margin-top: 1px !important; /* vertically align with first line of title */
}

.sidebar-link span.chapter-number::before {
  content: "0" !important; /* Prepend 0 for double digit numbering */
}

.sidebar-link:hover span.chapter-number,
.sidebar-link.active span.chapter-number {
  color: #024800 !important;
}

.sidebar-link span.chapter-title {
  color: #343a40 !important;
  flex-grow: 1 !important;
  display: inline-block !important;
  line-height: 1.35 !important;
}

.sidebar-link:hover span.chapter-title {
  color: #024800 !important;
}

/* Active sidebar item styling (Pill style + Gold vertical line) */
.sidebar-link.active {
  font-weight: 700 !important;
  color: #024800 !important;
  background-color: #e2ebe3 !important; /* premium light sage active background */
  border-left: 4px solid #C5A880 !important; /* gold vertical stripe */
  border-radius: 6px !important;
  padding-left: 8px !important; /* compensate for gold border thickness */
}

.sidebar-link.active span.chapter-title {
  color: #024800 !important;
  font-weight: 700 !important;
}

/* Remove default Quarto active borders & paddings */
.sidebar-item-container {
  border-left: none !important;
  padding-left: 0 !important;
}

.sidebar-item-container.active,
.sidebar-item-container:has(.active) {
  border-left: none !important;
  padding-left: 0 !important;
}

/* Hide duplicate page Table of Contents (TOC) inside left sidebar */
#quarto-sidebar nav[role="doc-toc"],
#quarto-sidebar #TOC,
#quarto-sidebar .toc-active {
  display: none !important;
}

/* =====================================================
   RIGHT SIDEBAR (PAGE TABLE OF CONTENTS)
   ===================================================== */
#quarto-margin-sidebar {
  font-family: 'Source Sans 3', sans-serif !important;
  padding-top: 0.5rem !important;
  z-index: 990 !important;
}

@media (min-width: 992px) {
  #quarto-margin-sidebar {
    position: sticky !important;
    top: 90px !important; /* offset for sticky header */
    height: calc(100vh - 90px - 40px) !important;
    overflow-y: auto !important;
  }
}

#TOC {
  border-left: 1px solid rgba(0, 0, 0, 0.05) !important;
  padding-left: 14px !important;
}

#TOC #toc-title {
  font-family: 'Source Sans 3', sans-serif !important;
  font-weight: 700 !important;
  font-size: 0.72rem !important;
  text-transform: uppercase !important;
  letter-spacing: 1.2px !important;
  color: #2e3d30 !important;
  border-bottom: none !important;
  padding-bottom: 0 !important;
  margin-bottom: 12px !important;
  margin-top: 0 !important;
}

#TOC ul {
  padding-left: 0 !important;
  list-style: none !important;
}

#TOC ul li {
  margin-bottom: 6px !important;
}

#TOC ul li a.nav-link {
  font-size: 0.78rem !important;
  font-weight: 500 !important;
  color: #6c757d !important;
  padding: 2px 0 !important;
  transition: all 0.15s ease-in-out !important;
  border-left: 2px solid transparent !important;
  padding-left: 8px !important;
}

#TOC ul li a.nav-link:hover {
  color: #024800 !important;
  padding-left: 12px !important; /* subtle slide on hover */
}

#TOC ul li a.nav-link.active {
  color: #024800 !important;
  font-weight: 700 !important;
  border-left: 2px solid #C5A880 !important; /* gold vertical indicator */
  background-color: transparent !important;
}

/* De-highlight parent TOC item when a child TOC item is active */
#TOC li:has(li a.nav-link.active) > a.nav-link.active {
  border-left: 2px solid transparent !important;
  font-weight: 500 !important;
  color: #6c757d !important;
}

/* Keep Quarto Header (Navbar) Sticky & Locked at the top globally */
#quarto-header {
  position: fixed !important;
  top: 0 !important;
  width: 100% !important;
  z-index: 1030 !important;
}

.headroom {
  transform: translateY(0) !important; /* Disable scroll-hiding animation */
  transition: none !important;
}

/* Sticky App-Shell Layout on Desktop Screens */
@media (min-width: 992px) {
  /* Lock Sidebar to be Sticky/Fixed on Left on Desktop */
  #quarto-sidebar {
    position: fixed !important;
    top: 56px !important;
    left: 0 !important;
    width: 250px !important;
    height: calc(100vh - 56px) !important; /* Runs all the way to the bottom */
    overflow-y: auto !important; /* Scrollable inside sidebar list if too many items */
    padding-bottom: 50px !important; /* Prevent bottom items from being clipped */
    background-color: #ffffff !important;
    z-index: 1010 !important;
    border-right: 1px solid rgba(0, 0, 0, 0.05) !important;
  }
  
  /* Footer styles - scroll naturally at the bottom of the content */
  .footer {
    position: relative !important;
    background-color: #ffffff !important;
    border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
    padding: 10px 24px !important; /* Extremely compact vertical padding */
    margin: 0 !important;
    font-size: 0.85rem;
    color: #6c757d;
  }

  /* Shift footer to the right of the sidebar on desktop for pages with a sidebar */
  body:not(:has(.portal-container)) .footer {
    margin-left: 250px !important;
    width: auto !important;
  }

  /* Force the footer contents to align horizontally and push globe to the right */
  .nav-footer {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-start !important; /* Align to the top right */
    width: 100% !important;
  }

  .nav-footer-center {
    display: none !important; /* Remove spacer so space-between pushes right content to the edge */
  }

  .nav-footer-right {
    display: flex !important;
    justify-content: flex-end !important;
    align-items: flex-start !important;
  }

  /* Align logo on top, and text on a new line directly below it */
  .nav-footer-left p {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 6px !important;
    white-space: nowrap !important; /* Keep it on a single line */
  }

  .nav-footer-left img {
    max-height: 35px !important; /* compact logo height */
    display: block !important;
    margin: 0 !important;
  }

  .nav-footer-right ul {
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: flex-start !important;
    margin-top: 4px !important; /* align vertically with the top of the logo */
  }

  /* Prevent overlapping content under sticky header */
  #quarto-content {
    margin-top: 56px !important; /* header spacing */
    padding-bottom: 20px !important; /* spacing above natural footer */
  }

  main.content {
    padding-bottom: 40px !important; /* content scroll margin */
  }
}

/* Fallback for Mobile and Tablet Screens (Natural scroll to save vertical space) */
@media (max-width: 991.98px) {
  .footer {
    border-top: 1px solid #f1f3f1;
    font-size: 0.85rem;
    color: #6c757d;
    padding: 1rem 1rem !important;
    margin-top: 2rem !important;
    background-color: #ffffff !important;
  }
  
  .nav-footer {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 12px !important;
  }

  .nav-footer-left p {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    gap: 8px !important;
    margin: 0 !important;
  }

  .footer img {
    max-height: 35px !important;
    display: block;
    margin: 0 auto !important;
  }
}

/* =====================================================
   CODE BLOCKS & MONOSPACE
   ===================================================== */
pre,
code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.875rem;
}

/* =====================================================
   CALLOUT BLOCKS
   ===================================================== */
.callout {
  border-radius: 6px !important;
  border-left-width: 4px !important;
  border-top: 1px solid rgba(0, 0, 0, 0.03) !important;
  border-right: 1px solid rgba(0, 0, 0, 0.03) !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.03) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02) !important;
}

.callout-note {
  border-left-color: #024800 !important;
}

.callout-note .callout-header {
  background-color: #eef5ef !important;
  color: #024800 !important;
  font-weight: 600;
}

/* =====================================================
   PORTAL LANDING PAGE OVERRIDES (Halaman Pilihan Program)
   Hanya aktif jika halaman mengandung .portal-container
   ===================================================== */
body:has(.portal-container) {
  background: linear-gradient(135deg, #f2f7f3 0%, #ffffff 50%, #f7f9f7 100%) !important;
  position: relative;
  overflow-x: hidden;
}

/* Glowing aesthetic corner blobs in background */
body:has(.portal-container)::before {
  content: "" !important;
  position: fixed !important;
  top: -15% !important;
  left: -15% !important;
  width: 50vw !important;
  height: 50vw !important;
  background: radial-gradient(circle, rgba(2, 72, 0, 0.05) 0%, rgba(2, 72, 0, 0) 70%) !important;
  z-index: -1 !important;
  pointer-events: none !important;
}

body:has(.portal-container)::after {
  content: "" !important;
  position: fixed !important;
  bottom: -15% !important;
  right: -15% !important;
  width: 50vw !important;
  height: 50vw !important;
  background: radial-gradient(circle, rgba(197, 168, 128, 0.08) 0%, rgba(197, 168, 128, 0) 70%) !important;
  z-index: -1 !important;
  pointer-events: none !important;
}

/* Sembunyikan sidebar kiri, navigasi tambahan, header default quarto, cover image, dan margin sidebar */
body:has(.portal-container) #quarto-sidebar,
body:has(.portal-container) .quarto-sidebar-toggle,
body:has(.portal-container) .quarto-secondary-nav,
body:has(.portal-container) .toc-actions,
body:has(.portal-container) #TOC,
body:has(.portal-container) .quarto-title-breadcrumbs,
body:has(.portal-container) #title-block-header,
body:has(.portal-container) .quarto-cover-image,
body:has(.portal-container) #quarto-margin-sidebar {
  display: none !important;
}

/* Matikan Quarto CSS Grid untuk halaman portal agar bisa rata tengah sempurna */
body:has(.portal-container) #quarto-content.quarto-container {
  display: block !important;
}

body:has(.portal-container) main#quarto-document-content {
  margin: 0 auto !important;
  max-width: 900px !important;
  width: 100% !important;
  padding: 3rem 1rem 5rem 1rem !important;
}

/* =====================================================
   PORTAL COMPONENTS (Home Gateway Layout)
   ===================================================== */
.portal-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
}

.portal-title {
  font-size: 2.6rem !important;
  font-weight: 800 !important;
  color: #112a14 !important; /* Premium dark forest green */
  margin-bottom: 0.75rem !important;
  letter-spacing: -0.8px;
}

.portal-subtitle {
  font-size: 1.15rem;
  color: #556056; /* Subtle green-charcoal */
  font-weight: 500;
  margin-bottom: 1.75rem;
  letter-spacing: 0.2px;
}

.portal-divider {
  width: 120px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #024800 20%, #C5A880 50%, #024800 80%, transparent);
  margin: 0 auto 3.5rem auto;
}

/* Grid Kartu Program */
.portal-cards {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  width: 100%;
  max-width: 850px;
  margin-top: 1rem;
}

@media (max-width: 768px) {
  .portal-cards {
    flex-direction: column;
    align-items: center;
    gap: 2rem;
  }
}

.portal-card {
  flex: 1;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(2, 72, 0, 0.08);
  border-radius: 12px;
  padding: 3.5rem 2.25rem 2.75rem 2.25rem;
  text-align: center;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
  backdrop-filter: blur(8px);
}

.portal-card:hover {
  transform: translateY(-6px);
  border-color: rgba(2, 72, 0, 0.18);
  box-shadow: 0 16px 36px rgba(2, 72, 0, 0.08);
}

/* Program Type Badge */
.portal-card-badge {
  position: absolute;
  top: 18px;
  right: 18px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 5px 12px;
  border-radius: 20px;
  line-height: 1 !important;
  display: inline-block !important;
}

.badge-reguler {
  background-color: #e2ebe3;
  color: #024800;
  border: 1px solid rgba(2, 72, 0, 0.15);
}

.badge-ncp {
  background-color: #f7ede2;
  color: #b07d40;
  border: 1px solid rgba(197, 168, 128, 0.25);
}

/* Icon program berbentuk gambar bulat */
.portal-card-icon-img {
  width: 90px;
  height: 90px;
  object-fit: contain;
  margin-bottom: 1.5rem;
  display: block;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.portal-card:hover .portal-card-icon-img {
  transform: scale(1.06);
}

.portal-card-title {
  font-size: 1.45rem !important;
  font-weight: 700 !important;
  color: #112a14 !important;
  margin-bottom: 1rem !important;
}

.portal-card p {
  font-size: 0.88rem;
  color: #556056;
  line-height: 1.6;
  margin-bottom: 2.5rem;
  flex-grow: 1;
}

/* Tombol Akses Modul - Premium Flat Button */
.btn-portal {
  display: block;
  width: 100%;
  background-color: #024800;
  color: #ffffff !important;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.8px;
  padding: 0.85rem 1.5rem;
  border-radius: 6px !important;
  border: 1px solid #024800;
  transition: all 0.2s ease;
  text-transform: uppercase;
}

.btn-portal:hover {
  background-color: #013000;
  border-color: #013000;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(2, 72, 0, 0.25);
  transform: translateY(-1px);
}

/* Portal bottom Info Bar */
.portal-info-bar {
  display: flex;
  justify-content: center;
  gap: 4rem;
  width: 100%;
  max-width: 850px;
  margin-top: 5rem;
  padding-top: 2.5rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

@media (max-width: 768px) {
  .portal-info-bar {
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    margin-top: 4rem;
    padding-top: 2rem;
  }
}

.portal-info-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  font-size: 0.88rem;
  color: #556056;
  gap: 4px;
}

.portal-info-item i {
  font-size: 1.4rem;
  color: #C5A880; /* Premium gold icons */
  margin-bottom: 6px;
}

.portal-info-item strong {
  color: #112a14;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.8px;
  margin-bottom: 2px;
}

/* =====================================================
   CUSTOM SLEEK SCROLLBAR
   ===================================================== */
/* Webkit Browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: rgba(2, 72, 0, 0.25) !important; /* Soft forest green matching the theme */
  border-radius: 20px !important;
  border: 2px solid transparent !important;
  background-clip: padding-box !important;
  transition: background-color 0.2s ease !important;
}

::-webkit-scrollbar-thumb:hover {
  background-color: rgba(2, 72, 0, 0.5) !important; /* Darker green on hover */
}

/* Firefox standard scrollbar properties */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(2, 72, 0, 0.25) transparent;
}

/* =====================================================
   SPONSORS
   ===================================================== */
.sponsorsFooter {
  width: 100% !important;
  padding: 10px 0 10px !important;
  margin-top: 0px !important;
  z-index: 1 !important;
  text-align: center !important;
}

.sponsorsFooter h2 {
  font-weight: 300 !important;
  color: #556056 !important;
  font-size: 24px !important;
  margin-top: 30px !important;
  margin-bottom: 20px !important;
  border-bottom: 1px solid rgba(2, 72, 0, .15) !important;
  padding-bottom: 8px !important;
}

.sponsorsFooter ul {
  padding: 0 !important;
  margin: 15px 0 0 0 !important;
  list-style: none !important;
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  gap: 20px !important;
}

.sponsorsFooter ul li {
  margin: 0 !important;
  flex: 0 0 auto !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}

.sponsorsFooter img {
  border-radius: 3px !important;
  height: auto !important;
  vertical-align: middle !important;
  max-width: 100% !important;
  max-height: 70px !important;
  width: auto !important;
}

.sblogos__link {
  border: none !important;
  outline: 0 !important;
  text-decoration: none !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  width: 100% !important;
}

@media (max-width: 768px) {
  .sponsorsFooter ul {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 15px !important;
  }

  .sponsorsFooter img {
    max-height: 50px !important;
  }
}