/**
 * Sidebar widgets — đồng nhất mọi vùng widget (blog, shop, UX Builder…).
 */

:root {
	--ntm-sidebar-bg: #fff;
	--ntm-sidebar-border: rgba(0, 0, 0, 0.08);
	--ntm-sidebar-shadow: 0 8px 28px rgba(0, 0, 0, 0.05);
	--ntm-sidebar-gap: 20px;
	--ntm-sidebar-link: #2b2b2b;
	--ntm-sidebar-link-hover: var(--ntm-home-primary, var(--primary-color));
}

/* Vùng sidebar — reset danh sách Flatsome UX Builder */
:is(
	#secondary,
	.post-sidebar,
	#shop-sidebar,
	.sidebar-inner,
	.sidebar-wrapper,
	.sidebar-product
) {
	list-style: none;
	margin: 0;
	padding: 0;
}

.sidebar-wrapper > :is(aside, .widget),
.sidebar-wrapper > li > :is(aside, .widget) {
	display: block;
}

/* Card widget */
.ntm-sidebar-scope .widget,
:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .widget {
	background: var(--ntm-sidebar-bg);
	border: 1px solid var(--ntm-sidebar-border);
	border-radius: var(--ntm-home-radius-sm, 10px);
	box-shadow: var(--ntm-sidebar-shadow);
	margin: 0 0 var(--ntm-sidebar-gap);
	padding: 22px 22px 18px;
}

.ntm-sidebar-scope .widget:last-child,
:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .widget:last-child {
	margin-bottom: 0;
}

/* Tiêu đề widget */
.ntm-sidebar-scope .widget-title,
.ntm-sidebar-scope .widget-title span,
:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .widget-title,
:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .widget-title span {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 0 16px !important;
	padding: 0 0 12px !important;
	border-bottom: 2px solid color-mix(in srgb, var(--ntm-home-primary, var(--primary-color)) 16%, #fff);
	font-size: 0.78rem !important;
	font-weight: 700 !important;
	letter-spacing: 0.08em;
	line-height: 1.3 !important;
	text-transform: uppercase;
	color: #1a1a1a !important;
}

.ntm-sidebar-scope .widget-title::before,
:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .widget-title::before {
	content: '';
	flex-shrink: 0;
	width: 4px;
	height: 14px;
	border-radius: 2px;
	background: var(--ntm-sidebar-link-hover);
}

.ntm-sidebar-scope .widget .is-divider,
:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .widget .is-divider {
	display: none !important;
}

/* Danh sách link */
.ntm-sidebar-scope .widget :is(ul, ol),
:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .widget :is(ul, ol) {
	list-style: none;
	margin: 0;
	padding: 0;
}

.ntm-sidebar-scope .widget li,
:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .widget li {
	margin: 0;
	border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.ntm-sidebar-scope .widget li:last-child,
:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .widget li:last-child {
	border-bottom: 0;
}

.ntm-sidebar-scope .widget li > a,
:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .widget li > a {
	display: block;
	position: relative;
	padding: 11px 18px 11px 0;
	font-size: 0.92rem;
	font-weight: 500;
	line-height: 1.45;
	text-decoration: none;
	color: var(--ntm-sidebar-link) !important;
	transition: color 0.2s ease, padding-left 0.2s ease;
}

.ntm-sidebar-scope .widget li > a:hover,
:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .widget li > a:hover {
	padding-left: 6px;
	color: var(--ntm-sidebar-link-hover) !important;
}

.ntm-sidebar-scope .widget li > a::after,
:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .widget li > a::after {
	content: '›';
	position: absolute;
	top: 50%;
	right: 0;
	opacity: 0;
	color: var(--ntm-sidebar-link-hover);
	transform: translateY(-50%);
	transition: opacity 0.2s ease;
}

.ntm-sidebar-scope .widget li > a:hover::after,
:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .widget li > a:hover::after {
	opacity: 1;
}

.ntm-sidebar-scope .widget li .children,
:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .widget li .children {
	margin: 0;
	padding-left: 12px;
	border-top: 1px solid rgba(0, 0, 0, 0.04);
}

.ntm-sidebar-scope .widget li .children li > a,
:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .widget li .children li > a {
	font-size: 0.86rem;
	font-weight: 400;
	color: #555 !important;
}

.ntm-sidebar-scope .widget .current-cat > a,
:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .widget .current-cat > a {
	color: var(--ntm-sidebar-link-hover) !important;
	font-weight: 600;
}

.ntm-sidebar-scope .widget .post-count,
.ntm-sidebar-scope .widget li .count,
:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .widget .post-count,
:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .widget li .count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 22px;
	margin-left: 6px;
	padding: 2px 7px;
	border-radius: 999px;
	background: color-mix(in srgb, var(--ntm-home-primary, var(--primary-color)) 12%, #fff);
	font-size: 0.72rem;
	font-weight: 600;
	color: var(--ntm-sidebar-link-hover);
	vertical-align: middle;
}

/* Bài viết mới — hiển thị đủ tiêu đề, không giới hạn dòng */
.ntm-sidebar-scope .widget_recent_entries li,
:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .widget_recent_entries li {
	overflow: visible;
}

.ntm-sidebar-scope .widget_recent_entries li > a,
:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .widget_recent_entries li > a {
	display: block !important;
	overflow: visible !important;
	padding: 11px 22px 11px 0;
	line-height: 1.5;
	max-height: none !important;
	height: auto !important;
	white-space: normal;
	word-break: break-word;
	overflow-wrap: break-word;
	-webkit-line-clamp: unset !important;
	line-clamp: unset !important;
	-webkit-box-orient: unset !important;
}

.ntm-sidebar-scope .widget_recent_entries li > a::after,
:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .widget_recent_entries li > a::after {
	top: 11px;
	transform: none;
	opacity: 0.3;
}

.ntm-sidebar-scope .widget_recent_entries li > a:hover,
:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .widget_recent_entries li > a:hover {
	padding-left: 0;
}

/* Tìm kiếm */
.ntm-sidebar-scope .widget_search .searchform,
:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .widget_search .searchform {
	margin: 0;
}

.ntm-sidebar-scope .widget_search .flex-row,
:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .widget_search .flex-row {
	align-items: stretch;
	overflow: hidden;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: var(--ntm-home-radius-sm, 10px);
	background: #f8f9f9;
}

.ntm-sidebar-scope .widget_search .search-field,
:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .widget_search .search-field {
	height: 46px;
	margin: 0 !important;
	padding: 0 14px;
	border: 0 !important;
	background: transparent;
	box-shadow: none !important;
	font-size: 0.92rem;
	color: #333;
}

.ntm-sidebar-scope .widget_search .search-field::placeholder,
:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .widget_search .search-field::placeholder {
	color: #999;
}

.ntm-sidebar-scope .widget_search .ux-search-submit,
:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .widget_search .ux-search-submit {
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 48px;
	height: 46px;
	margin: 0 !important;
	padding: 0 14px;
	border: 0 !important;
	border-radius: 0 !important;
	background: var(--ntm-sidebar-link-hover) !important;
	color: #fff !important;
}

.ntm-sidebar-scope .widget_search .ux-search-submit:hover,
:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .widget_search .ux-search-submit:hover {
	background: var(--ntm-home-primary-dark, color-mix(in srgb, var(--primary-color) 82%, #000)) !important;
}

.ntm-sidebar-scope .widget_search .ux-search-submit svg,
:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .widget_search .ux-search-submit svg {
	fill: currentColor;
}

/* Flatsome Recent Posts (nếu dùng widget Flatsome) */
.ntm-sidebar-scope .flatsome_recent_posts .recent-blog-posts-li,
:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .flatsome_recent_posts .recent-blog-posts-li {
	border-bottom: 1px solid rgba(0, 0, 0, 0.06);
	padding: 10px 0;
}

.ntm-sidebar-scope .flatsome_recent_posts .recent-blog-posts-li:last-child,
:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .flatsome_recent_posts .recent-blog-posts-li:last-child {
	border-bottom: 0;
}

.ntm-sidebar-scope .flatsome_recent_posts a,
:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .flatsome_recent_posts a {
	color: var(--ntm-sidebar-link) !important;
	font-weight: 500;
}

.ntm-sidebar-scope .flatsome_recent_posts .post-title,
:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .flatsome_recent_posts .post-title {
	display: block;
	overflow: visible;
	line-height: 1.5;
	max-height: none;
	white-space: normal;
	word-break: break-word;
}

.ntm-sidebar-scope .flatsome_recent_posts a:hover,
:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .flatsome_recent_posts a:hover {
	color: var(--ntm-sidebar-link-hover) !important;
}

@media only screen and (max-width: 849px) {
	:is(#secondary, .post-sidebar, #shop-sidebar, .sidebar-inner, .sidebar-wrapper, .sidebar-product) .widget {
		padding: 18px 16px 14px;
	}
}
