/*
 * Override tema Designesia untuk header mobile — muat PALING AKHIR setelah style.min.css.
 * Mencegah kedip: position fixed, background #fff, margin/padding header-mobile dari jQuery.
 */

/*
 * Desktop: jangan clip dropdown blog (position:absolute di luar box header).
 * Jangan pakai contain:paint/strict pada header atau topbar — membuat topbar hilang
 * dan menu dropdown tidak tampil.
 */
@media (min-width: 992px) {
  header.header-light.has-topbar {
    overflow: visible !important;
  }

  header.header-light.has-topbar > .container,
  header.header-light.has-topbar #mainmenu,
  header.header-light.has-topbar #mainmenu > li.menu-item-blog {
    overflow: visible !important;
  }

  /* Desktop: pill-shaped "Dapatkan Aplikasi" button */
  header.header-light.has-topbar .header-get-app-btn {
    border-radius: 50px !important;
    padding: 10px 22px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    letter-spacing: 0.01em !important;
    width: auto !important;
    min-width: unset !important;
    max-width: unset !important;
    background: linear-gradient(135deg, #1565c0 0%, #38b1ed 100%) !important;
    color: #fff !important;
    border: none !important;
    box-shadow: 0 4px 16px rgba(21, 101, 192, 0.28) !important;
  }
  header.header-light.has-topbar .header-get-app-btn:hover {
    box-shadow: 0 6px 24px rgba(21, 101, 192, 0.40) !important;
    transform: translateY(-1px) !important;
  }
}

/* Sembunyikan toolbar mobile di desktop (scoped child bisa override parent) */
@media (min-width: 992px) {
  .header-mobile-toolbar {
    display: none !important;
  }

  .header-toolbar-desktop {
    display: flex !important;
  }
}

@media (max-width: 991.98px) {
  .header-toolbar-desktop {
    display: none !important;
  }

  .header-mobile-toolbar {
    display: flex !important;
  }

  header.header-light.has-topbar,
  header.header-mobile.header-light.has-topbar,
  header.header-mobile.header-light.transparent.has-topbar {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
    transition: none !important;
    box-shadow: none !important;
  }

  header.header-light.has-topbar:not(.menu-open),
  header.header-mobile.header-light.has-topbar:not(.menu-open) {
    height: 3.5rem !important;
    min-height: 3.5rem !important;
    max-height: 3.5rem !important;
    overflow: hidden !important;
  }

  header.header-mobile.header-light.has-topbar .header-row,
  header.header-mobile.header-light.has-topbar .header-col,
  header.header-light.has-topbar .header-nav-row,
  header.header-light.has-topbar .header-col-logo,
  header.header-light.has-topbar .header-col-actions {
    margin-top: 0 !important;
  }

  header.header-mobile.header-light.has-topbar > .container,
  header.header-light.has-topbar > .container {
    height: 100%;
    padding-top: 0 !important;
    margin-top: 0 !important;
  }

  header.header-mobile .container {
    max-width: 100% !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
  }

  header.header-light.has-topbar .menu_side_area,
  header.header-mobile .menu_side_area {
    width: auto !important;
    margin-left: auto !important;
  }

  header.header-light.has-topbar .header-get-app-btn,
  header.header-mobile .header-get-app-btn {
    font-family:
      "Plus Jakarta Sans",
      system-ui,
      -apple-system,
      sans-serif !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    font-synthesis: none;
    width: 118px !important;
    min-width: 118px !important;
    max-width: 118px !important;
    padding: 7px 10px !important;
  }

  /* Jangan ubah box model #content saat masuk/keluar blog di mobile */
  #content.site-blog-area {
    padding-top: 0 !important;
    background: transparent !important;
  }

  #content.site-blog-area .blog-page,
  #content.site-blog-area .blog-page--pending,
  #content.site-blog-area .blog-page--article {
    background: var(--bg, #f5f7fa);
  }
}

/* Offcanvas Sidebar */
.site-offcanvas-backdrop {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0,0,0,0.4);
  transition: opacity 0.3s;
}

.site-offcanvas {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  width: 300px;
  max-width: 85vw;
  background: #fff;
  box-shadow: -4px 0 20px rgba(0,0,0,0.1);
  overflow-y: auto;
  transition: transform 0.3s ease;
  transform: translateX(0);
}

.site-offcanvas[hidden] {
  display: block !important;
  transform: translateX(100%);
  visibility: hidden;
  pointer-events: none;
}

.site-offcanvas-header {
  display: flex;
  justify-content: flex-end;
  padding: 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.site-offcanvas-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  color: #374151;
  line-height: 1;
}

.site-offcanvas-body {
  padding: 1rem 0;
}

.site-offcanvas-nav {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-offcanvas-nav li a {
  display: block;
  padding: 0.75rem 1.5rem;
  color: #1f2937;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  transition: background 0.15s;
}

.site-offcanvas-nav li a:hover {
  background: #f3f4f6;
}

.site-offcanvas-nav li a.btn-main {
  margin: 0.75rem 1.5rem;
  padding: 0.75rem 1rem;
  border-radius: 50px;
  background: linear-gradient(135deg, #1565c0 0%, #38b1ed 100%);
  color: #fff !important;
  text-align: center;
  font-weight: 700;
}

.site-offcanvas-nav-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 0.5rem 1.5rem;
}

/* Desktop: sembunyikan offcanvas */
@media (min-width: 992px) {
  .site-offcanvas-backdrop,
  .site-offcanvas {
    display: none !important;
  }
}
