/*--------------------------------------------------------------
# Mobile Bottom Navigation
Sticky bottom bar shown only on mobile viewports, with 5 quick
access items (Home, Trending, Cari, Bagikan, Lainnya). The middle
"Cari" item is raised inside a floating circle, sitting above the
bar itself.
--------------------------------------------------------------*/

.kbn-bottom-nav,
.kbn-more-overlay,
.kbn-more-drawer,
.kbn-toast {
	display: none;
}

@media (max-width: 782px) {

	.kbn-more-overlay,
	.kbn-more-drawer,
	.kbn-toast {
		display: block;
	}

	.kbn-bottom-nav {
		display: block !important;
		position: fixed !important;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 100020;
		background: var(--warnaheader, #ffffff);
		box-shadow: 0 -2px 14px rgba(0, 0, 0, 0.08);
		padding-bottom: env(safe-area-inset-bottom, 0);
	}

	/* Reserve space at the very bottom of the page so this fixed
	   bar never covers footer content or floating widgets/ads. */
	body.kbn-has-bottom-nav {
		padding-bottom: var(--kbn-bottom-nav-height, 64px);
	}

	[data-theme="dark"] .kbn-bottom-nav {
		box-shadow: 0 -2px 14px rgba(0, 0, 0, 0.35);
	}

	.kbn-bottom-nav-list {
		display: flex;
		align-items: flex-end;
		justify-content: space-between;
		list-style: none;
		margin: 0;
		padding: 0 4px;
	}

	.kbn-bottom-nav-list li {
		flex: 1 1 0;
		min-width: 0;
	}

	.kbn-bottom-nav-item {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: flex-end;
		gap: 4px;
		padding: 8px 2px 10px;
		text-decoration: none !important;
		color: var(--font-color, #1a1a1a);
		text-align: center;
		background: none;
		border: 0;
		width: 100%;
		font-family: inherit;
		cursor: pointer;
	}

	.kbn-bottom-nav-item .kbn-icon {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 24px;
		height: 24px;
	}

	.kbn-bottom-nav-item .kbn-icon svg {
		width: 100%;
		height: 100%;
		stroke: currentColor;
	}

	.kbn-bottom-nav-item .kbn-label {
		font-size: 12px;
		line-height: 1.2;
		font-weight: 400;
		white-space: nowrap;
	}

	/* Center "Cari" item: floats above the bar inside a soft halo. */
	.kbn-bottom-nav-item.kbn-primary {
		position: relative;
		padding-top: 0;
	}

	.kbn-bottom-nav-item.kbn-primary::before {
		content: "";
		position: absolute;
		width: 80px;
		height: 80px;
		top: -15px;
		left: 50%;
		transform: translateX(-50%);
		z-index: 2;
		box-shadow: 0 0 25px rgba(0, 0, 0, 0.05);
		border-radius: 50px;
		background: var(--warnaheader, #ffffff);
	}

	.kbn-bottom-nav-item.kbn-primary::after {
		content: "";
		position: absolute;
		width: 60px;
		height: 60px;
		top: -5px;
		left: 50%;
		transform: translateX(-50%);
		background: rgba(0, 0, 0, 0.06);
		border-radius: 50px;
		z-index: 3;
	}

	[data-theme="dark"] .kbn-bottom-nav-item.kbn-primary::after {
		background: rgba(255, 255, 255, 0.08);
	}

	.kbn-bottom-nav-item.kbn-primary .kbn-icon {
		position: relative;
		z-index: 4;
	}

	.kbn-bottom-nav-item.kbn-primary .kbn-icon svg {
		width: 24px;
		height: 24px;
	}

	.kbn-bottom-nav-item.kbn-primary .kbn-label {
		position: relative;
		z-index: 4;
		color: var(--themecolor, #009BA9);
		font-weight: 600;
	}

	.kbn-bottom-nav-item:active {
		opacity: 0.7;
	}

	/* Neutralize the theme's global a:hover/a:focus link-color rule so
	   tapping any bottom-nav link doesn't change its color. */
	#kbn-bottom-nav a:hover,
	#kbn-bottom-nav a:focus,
	#kbn-bottom-nav a:active,
	#kbn-bottom-nav a:visited {
		color: var(--font-color, #1a1a1a);
		outline: none;
		text-decoration: none;
	}

	/* Shared popup base: full-width strip sitting right above the
	   bar. The "Cari", "Bagikan", and "Trending" popups all use this. */
	.kbn-open-toggle {
		position: absolute;
		left: 0;
		right: 0;
		bottom: 100%;
		transform: translateY(6px);
		margin-bottom: 0;
		background: var(--bg-color-dua, #f5f5f6);
		border-radius: 0;
		box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
		padding: 14px 16px;
		opacity: 0;
		visibility: hidden;
		pointer-events: none;
		transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
		z-index: 1;
		max-height: 70vh;
		overflow-y: auto;
	}

	.kbn-open-toggle.kbn-open {
		opacity: 1;
		visibility: visible;
		pointer-events: auto;
		transform: translateY(1px);
	}

	/* Cari popup: pill-shaped search bar. Gaya .kbn-search-form/-input/
	   -submit ada di style.css (dipakai bersama search icon header juga,
	   supaya tetap tergaya walau Mobile Bottom Nav dinonaktifkan). */
	#kbn-search-popup *,
	#kbn-search-popup *:focus,
	#kbn-search-popup *:focus-visible,
	#kbn-search-popup *:active {
		outline: none !important;
		box-shadow: none !important;
	}

	[data-theme="dark"] .kbn-open-toggle {
		box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.35);
	}

	.kbn-share-list {
		display: flex;
		align-items: center;
		justify-content: center;
		gap: 16px;
		list-style: none;
		margin: 0;
		padding: 0;
	}

	.kbn-share-list li {
		flex: 0 0 auto;
	}

	.kbn-share-btn {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 34px;
		height: 34px;
		border-radius: 50%;
		background: rgba(0, 0, 0, 0.06);
		text-decoration: none !important;
		transition: transform 0.15s ease;
	}

	[data-theme="dark"] .kbn-share-btn {
		background: rgba(255, 255, 255, 0.08);
	}

	.kbn-share-btn:active {
		transform: scale(0.9);
	}

	.kbn-share-btn svg {
		width: 16px;
		height: 16px;
	}

	.kbn-share-copy svg {
		stroke: #6b7280;
	}

	[data-theme="dark"] .kbn-share-copy svg {
		stroke: #b7bcc4;
	}

	.kbn-x-icon,
	.kbn-threads-icon {
		fill: var(--font-color, #1a1a1a);
	}

	/* Trending popup: numbered list of top most-viewed posts. */
	.kbn-trending-list {
		list-style: none;
		margin: 0;
		padding: 0;
	}

	.kbn-trending-item {
		position: relative;
		min-height: 34px;
		padding: 8px 0;
		border-bottom: 1px solid rgba(0, 0, 0, 0.06);
	}

	[data-theme="dark"] .kbn-trending-item {
		border-bottom-color: rgba(255, 255, 255, 0.08);
	}

	.kbn-trending-item:last-child {
		border-bottom: 0;
	}

	.kbn-trend-rank {
		position: absolute;
		top: 6px;
		left: 0;
		width: 34px;
		font-size: 18px;
		line-height: 1.3;
		font-weight: 700;
		font-style: italic;
		color: rgba(128, 128, 128, 0.6);
	}

	.kbn-trend-title {
		display: block;
		margin-left: 40px;
		font-size: 13px;
		line-height: 1.4;
		font-weight: 700;
		color: var(--font-color, #1a1a1a);
		text-decoration: none !important;
	}

	.kbn-trending-empty {
		margin: 0;
		padding: 10px 0;
		text-align: center;
		font-size: 13px;
		color: rgba(128, 128, 128, 0.7);
	}

	/* "Lainnya" drawer: slides in from the right, ~95% width, showing
	   whatever widgets are placed in the "Mobile Bottom Nav - Lainnya"
	   widget area. Both the overlay and the drawer stop right above
	   the bottom nav bar so it stays fully visible and usable. */
	.kbn-more-overlay {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: var(--kbn-bottom-nav-height, 64px);
		background: rgba(0, 0, 0, 0.5);
		opacity: 0;
		visibility: hidden;
		transition: opacity 0.25s ease, visibility 0.25s ease;
		z-index: 100010;
	}

	.kbn-more-overlay.kbn-open {
		opacity: 1;
		visibility: visible;
	}

	.kbn-more-drawer {
		position: fixed;
		top: 0;
		bottom: var(--kbn-bottom-nav-height, 64px);
		right: 0;
		width: 95%;
		max-width: 380px;
		background: var(--warnaheader, #ffffff);
		box-shadow: -8px 0 30px rgba(0, 0, 0, 0.25);
		transform: translateX(100%);
		transition: transform 0.3s ease;
		z-index: 100011;
		display: flex;
		flex-direction: column;
	}

	.kbn-more-drawer.kbn-open {
		transform: translateX(0);
	}

	.kbn-more-close {
		background: none;
		border: 0;
		padding: 4px;
		cursor: pointer;
		color: var(--font-color, #1a1a1a);
		display: flex;
	}

	.kbn-more-close svg {
		width: 20px;
		height: 20px;
	}

	.kbn-more-body {
		flex: 1 1 auto;
		overflow-y: auto;
		padding: 16px;
		-webkit-overflow-scrolling: touch;
	}

	.kbn-more-body .widget {
		margin: 0 0 24px;
		background: none !important;
		border: 0 !important;
		box-shadow: none !important;
		padding: 0 !important;
	}

	.kbn-more-body .widget:last-child {
		margin-bottom: 0;
	}

	/* Match the widget-title look used by the post sidebar
	   (.judul-sidebar-single / .judul-sidebar-right) so the "Lainnya"
	   drawer widgets look consistent with sidebar widgets, in both
	   light and dark mode. */
	.kbn-more-body .widget-title {
		position: relative;
		text-transform: capitalize;
		font-family: 'Heebo', sans-serif;
		font-size: 20px;
		font-weight: 900;
		color: var(--font-000, #000);
		padding-left: 14px;
		padding-bottom: 10px;
		margin: 0 0 14px;
		border-bottom: 1px solid var(--border-eee, #eee);
		text-align: left;
	}

	.kbn-more-body .widget-title::before {
		content: "";
		position: absolute;
		top: 2px;
		left: 0;
		width: 4px;
		height: 18px;
		background: var(--ornament1, #D13438);
	}

	.kbn-more-body .widget img,
	.kbn-more-body .widget svg {
		display: block;
		margin-left: auto;
		margin-right: auto;
		max-width: 100%;
		height: auto;
	}

	.kbn-more-empty {
		margin: 0;
		text-align: center;
		font-size: 13px;
		color: rgba(128, 128, 128, 0.7);
	}

	body.kbn-more-locked {
		overflow: hidden;
	}

	/* ==================================================================
	 * Versi AMP (<amp-lightbox> / <amp-sidebar>) menggantikan
	 * .kbn-open-toggle & .kbn-more-drawer JS-driven di atas -- dipakai
	 * HANYA saat kibaran_is_amp() true (lihat inc/mobile-bottom-nav.php).
	 * Gaya dasar .kbn-amp-lightbox/-inner/-close ada di style.css (dipakai
	 * bersama header search & share popup juga, supaya tetap tergaya
	 * walau Mobile Bottom Nav dinonaktifkan). Di sini cukup .kbn-amp-share-note
	 * & drawer "Lainnya" yang memang khusus bottom-nav.
	 * ================================================================== */
	/* .kbn-amp-share-note, .kbn-amp-copy-link/-input: ada di css/amp.css
	   (universal) -- dipakai bersama popup share ARTIKEL juga
	   (kibaran_social_share() di inc/core.php), yang tak terkait Mobile
	   Bottom Nav sama sekali. */

	/* amp-sidebar[side="right"] sudah menangani slide-in & overlay-nya
	   sendiri -- cukup tata isinya, reuse .kbn-more-body yang sudah ada. */
	amp-sidebar.kbn-more-drawer-amp {
		width: 84vw;
		max-width: 360px;
		background: var(--warnaheader, #ffffff);
		box-sizing: border-box;
		padding: 44px 16px 20px;
	}

	amp-sidebar.kbn-more-drawer-amp .kbn-amp-lightbox-close {
		top: 8px;
		right: 12px;
	}
}
