/* ============================================
   ABood Header - Udemy-style
   ============================================ */

:root {
	--abood-hdr-bg: #ffffff;
	--abood-hdr-text: #1a1a1a;
	--abood-hdr-text-light: #6a6f73;
	--abood-hdr-primary: #2496BF;
	--abood-hdr-primary-hover: #1d7a9e;
	--abood-hdr-border: #e0e0e0;
	--abood-hdr-hover-bg: #f7f9fa;
	--abood-hdr-shadow: 0 2px 4px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
	--abood-hdr-height: 70px;
	--abood-hdr-radius: 9999px;
	--abood-hdr-transition: 0.2s ease;
}

/* ── Hide old headers ── */
#apus-header,
.apus-header,
#apus-header-mobile,
.header-mobile,
#apus-mobile-menu,
.apus-offcanvas.d-block,
.over-dark {
	display: none !important;
}

/* ── Fix main content padding ── */
#apus-main-content {
	padding-top: var(--abood-hdr-height) !important;
}

/* ── Reduce first Elementor section margin after fixed header ── */
/* The theme's page-sidebar layout adds large margin-top on the first section
   assuming a non-fixed header. With our fixed header + padding-top, that
   margin becomes excessive. This generic selector works on any page/site. */
body.abs-has-page-sidebar #main-content > #main > .elementor > section.elementor-top-section:first-of-type {
	margin-top: 10px !important;
}

/* ── Header Base ── */
.abood-header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 1000;
	background: var(--abood-hdr-bg);
	border-bottom: 1px solid var(--abood-hdr-border);
	height: var(--abood-hdr-height);
	box-sizing: border-box;
}

.admin-bar .abood-header {
	top: 32px;
}

.abood-header *,
.abood-header *::before,
.abood-header *::after {
	box-sizing: border-box;
}

.abood-header-inner {
	display: flex;
	align-items: center;
	height: 100%;
	max-width: 100%;
	padding: 0 24px;
	gap: 12px;
	position: relative;
}

/* ── Logo ── */
.abood-header-logo {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	text-decoration: none;
}

.abood-header-logo img {
	height: 85px;
	width: auto;
	display: block;
}

/* ── Explore Button ── */
.abood-explore {
	position: relative;
	flex-shrink: 0;
}

.abood-explore-btn {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 8px 16px;
	border: none;
	background: transparent;
	color: var(--abood-hdr-text);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	border-radius: 6px;
	transition: background var(--abood-hdr-transition);
	white-space: nowrap;
	font-family: inherit;
}

.abood-explore-btn:hover {
	background: var(--abood-hdr-hover-bg);
	color: var(--abood-hdr-primary);
}

.abood-explore-btn svg {
	transition: transform var(--abood-hdr-transition);
}

.abood-explore.is-open .abood-explore-btn svg {
	transform: rotate(180deg);
}

.abood-explore-dropdown {
	display: none;
	position: absolute;
	top: calc(100% + 8px);
	right: 0;                            /* align to right edge of Explore button */
	left: auto;
	background: var(--abood-hdr-bg);
	border: 1px solid var(--abood-hdr-border);
	border-radius: 8px;
	box-shadow: var(--abood-hdr-shadow);
	min-width: 240px;
	max-width: calc(100vw - 24px);       /* never exceed viewport */
	z-index: 100;
	padding: 8px 0;
	animation: aboodFadeIn 0.15s ease;
}

.abood-explore.is-open .abood-explore-dropdown {
	display: block;
}

.abood-explore-dropdown ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.abood-explore-dropdown li a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 20px;
	color: var(--abood-hdr-text);
	text-decoration: none;
	font-size: 14px;
	transition: background var(--abood-hdr-transition);
}

.abood-explore-dropdown li a:hover {
	background: var(--abood-hdr-hover-bg);
	color: var(--abood-hdr-primary);
}

.abood-cat-count {
	font-size: 12px;
	color: var(--abood-hdr-text-light);
	background: var(--abood-hdr-hover-bg);
	padding: 2px 8px;
	border-radius: 12px;
}

/* ── Search Bar ── */
.abood-search {
	position: absolute;
	left: 50%;
	transform: translateX(-50%);
	width: 42%;
	max-width: 600px;
	min-width: 280px;
	z-index: 2;
}

.abood-search-form {
	display: flex;
	align-items: center;
	background: var(--abood-hdr-hover-bg);
	border: 1px solid var(--abood-hdr-border);
	border-radius: var(--abood-hdr-radius);
	height: 42px;
	padding: 0 12px;
	transition: border-color var(--abood-hdr-transition), box-shadow var(--abood-hdr-transition);
	position: relative;
}

.abood-search.is-focused .abood-search-form {
	border-color: var(--abood-hdr-primary);
	box-shadow: 0 0 0 3px rgba(36, 150, 191, 0.15);
	background: #fff;
}

.abood-search-icon {
	flex-shrink: 0;
	color: var(--abood-hdr-text-light);
	margin-right: 8px;
}

.abood-search-input {
	flex: 1;
	border: none;
	background: transparent;
	font-size: 14px;
	color: var(--abood-hdr-text);
	outline: none;
	height: 100%;
	padding: 0;
	font-family: inherit;
}

.abood-search-input::placeholder {
	color: #b0b0b0;
}

.abood-search-submit {
	display: none;
}

/* ── Search Dropdown ── */
.abood-search-dropdown {
	display: none;
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	right: 0;
	background: var(--abood-hdr-bg);
	border: 1px solid var(--abood-hdr-border);
	border-radius: 12px;
	box-shadow: var(--abood-hdr-shadow);
	z-index: 100;
	max-height: 400px;
	overflow-y: auto;
	animation: aboodFadeIn 0.15s ease;
}

.abood-search.is-dropdown-open .abood-search-dropdown {
	display: block;
}

.abood-search-dropdown-title {
	padding: 12px 16px 8px;
	font-size: 12px;
	font-weight: 700;
	color: var(--abood-hdr-text-light);
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.abood-search-categories ul {
	list-style: none;
	margin: 0;
	padding: 0 0 8px;
}

.abood-search-categories li a {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 16px;
	color: var(--abood-hdr-text);
	text-decoration: none;
	font-size: 14px;
	transition: background var(--abood-hdr-transition);
}

.abood-search-categories li a:hover {
	background: var(--abood-hdr-hover-bg);
}

.abood-search-categories li a svg {
	flex-shrink: 0;
	color: var(--abood-hdr-text-light);
}

.abood-search-categories li a .abood-cat-count {
	margin-left: auto;
	font-size: 12px;
}

/* ── Search Results ── */
.abood-search-result-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 16px;
	text-decoration: none;
	color: var(--abood-hdr-text);
	transition: background var(--abood-hdr-transition);
}

.abood-search-result-item:hover {
	background: var(--abood-hdr-hover-bg);
}

.abood-search-result-thumb {
	width: 48px;
	height: 36px;
	border-radius: 4px;
	object-fit: cover;
	flex-shrink: 0;
}

.abood-search-result-info {
	flex: 1;
	min-width: 0;
}

.abood-search-result-title {
	font-size: 14px;
	font-weight: 500;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	color: var(--abood-hdr-text);
}

.abood-search-result-cat {
	font-size: 12px;
	color: var(--abood-hdr-text-light);
}

.abood-search-see-all {
	display: block;
	padding: 12px 16px;
	text-align: center;
	color: var(--abood-hdr-primary);
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	border-top: 1px solid var(--abood-hdr-border);
}

.abood-search-see-all:hover {
	background: var(--abood-hdr-hover-bg);
}

/* ── Spinner ── */
.abood-search-loading {
	padding: 24px;
	text-align: center;
}

.abood-spinner {
	display: inline-block;
	width: 24px;
	height: 24px;
	border: 3px solid var(--abood-hdr-border);
	border-top-color: var(--abood-hdr-primary);
	border-radius: 50%;
	animation: aboodSpin 0.6s linear infinite;
}

/* ── Right Section ── */
.abood-header-right {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-left: auto;
	flex-shrink: 0;
}

/* ── Cart ── */
.abood-cart {
	position: relative;
}

.abood-cart-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	color: var(--abood-hdr-text);
	text-decoration: none;
	transition: background var(--abood-hdr-transition);
	position: relative;
}

.abood-cart-btn:hover {
	background: var(--abood-hdr-hover-bg);
	color: var(--abood-hdr-primary);
}

.abood-cart-count {
	position: absolute;
	top: 2px;
	right: 0;
	min-width: 18px;
	height: 18px;
	line-height: 18px;
	font-size: 10px;
	font-weight: 700;
	color: #fff;
	background: var(--abood-hdr-primary);
	border-radius: 9px;
	text-align: center;
	padding: 0 4px;
}

.abood-cart-count[data-count="0"],
.abood-cart-count:empty {
	display: none;
}

/* ── Auth Buttons ── */
.abood-auth {
	display: flex;
	align-items: center;
	gap: 8px;
}

.abood-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 8px 20px;
	font-size: 14px;
	font-weight: 600;
	border-radius: 6px;
	text-decoration: none;
	cursor: pointer;
	transition: all var(--abood-hdr-transition);
	white-space: nowrap;
	border: 2px solid transparent;
	font-family: inherit;
	line-height: 1.4;
}

.abood-btn-outline {
	border-color: var(--abood-hdr-primary);
	color: var(--abood-hdr-primary);
	background: transparent;
}

.abood-btn-outline:hover {
	background: rgba(36, 150, 191, 0.08);
	color: var(--abood-hdr-primary-hover);
	border-color: var(--abood-hdr-primary-hover);
}

.abood-btn-solid {
	background: var(--abood-hdr-primary);
	color: #fff;
	border-color: var(--abood-hdr-primary);
}

.abood-btn-solid:hover {
	background: var(--abood-hdr-primary-hover);
	border-color: var(--abood-hdr-primary-hover);
	color: #fff;
}

.abood-btn-sm {
	padding: 6px 16px;
	font-size: 13px;
}

/* ── User Avatar Dropdown ── */
.abood-user {
	position: relative;
}

/* Hide avatar on pages that already have sidebar with user info */
body.abs-has-sidebar .abood-user,
body.abs-has-page-sidebar .abood-user {
	display: none !important;
}

.abood-user-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	border: 2px solid transparent;
	background: transparent;
	cursor: pointer;
	padding: 0;
	transition: border-color var(--abood-hdr-transition);
	overflow: hidden;
}

.abood-user-btn:hover {
	border-color: var(--abood-hdr-primary);
}

.abood-user-btn img {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	object-fit: cover;
}

.abood-user-dropdown {
	display: none;
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	background: var(--abood-hdr-bg);
	border: 1px solid var(--abood-hdr-border);
	border-radius: 8px;
	box-shadow: var(--abood-hdr-shadow);
	min-width: 220px;
	z-index: 100;
	padding: 8px 0;
	animation: aboodFadeIn 0.15s ease;
}

.abood-user.is-open .abood-user-dropdown {
	display: block;
}

.abood-user-info {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 16px;
	border-bottom: 1px solid var(--abood-hdr-border);
	margin-bottom: 4px;
}

.abood-user-info img {
	width: 40px;
	height: 40px;
	border-radius: 50%;
}

.abood-user-name {
	font-size: 14px;
	font-weight: 600;
	color: var(--abood-hdr-text);
}

.abood-user-dropdown ul,
.abood-user-dropdown li {
	list-style: none;
	margin: 0;
	padding: 0;
}

.abood-user-dropdown li a {
	display: block;
	padding: 8px 16px;
	color: var(--abood-hdr-text);
	text-decoration: none;
	font-size: 14px;
	transition: background var(--abood-hdr-transition);
}

.abood-user-dropdown li a:hover {
	background: var(--abood-hdr-hover-bg);
	color: var(--abood-hdr-primary);
}

.abood-menu-divider {
	border-top: 1px solid var(--abood-hdr-border);
	margin: 4px 0;
}

/* ── Mobile Search Icon ── */
.abood-mobile-search-btn {
	display: none;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border: none;
	background: transparent;
	color: var(--abood-hdr-text);
	cursor: pointer;
	border-radius: 50%;
	transition: background var(--abood-hdr-transition);
}

.abood-mobile-search-btn:hover {
	background: var(--abood-hdr-hover-bg);
}

/* ── Hamburger ── */
.abood-hamburger {
	display: none;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	width: 40px;
	height: 40px;
	border: none;
	background: transparent;
	cursor: pointer;
	border-radius: 50%;
	padding: 0;
	gap: 5px;
	transition: background var(--abood-hdr-transition);
}

.abood-hamburger:hover {
	background: var(--abood-hdr-hover-bg);
}

.abood-hamburger span {
	display: block;
	width: 20px;
	height: 2px;
	background: var(--abood-hdr-text);
	border-radius: 2px;
	transition: all var(--abood-hdr-transition);
}

.abood-hamburger span:nth-child(2) {
	width: 14px;
}

/* ── Mobile Search Overlay ── */
.abood-mobile-search-overlay {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 1100;
	background: var(--abood-hdr-bg);
}

.abood-mobile-search-overlay.is-open {
	display: flex;
	flex-direction: column;
}

.admin-bar .abood-mobile-search-overlay {
	top: 32px;
}

.abood-mobile-search-header {
	padding: 12px 16px;
	border-bottom: 1px solid var(--abood-hdr-border);
}

.abood-mobile-search-header .abood-search-form {
	height: 44px;
}

.abood-mobile-search-close {
	display: flex;
	align-items: center;
	justify-content: center;
	border: none;
	background: transparent;
	color: var(--abood-hdr-text-light);
	cursor: pointer;
	padding: 4px;
	flex-shrink: 0;
}

.abood-mobile-search-body {
	flex: 1;
	overflow-y: auto;
	padding: 8px 0;
}

/* ── Off-Canvas ── */
.abood-offcanvas-overlay {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 1050;
	background: rgba(0, 0, 0, 0.5);
	transition: opacity var(--abood-hdr-transition);
}

.abood-offcanvas-overlay.is-open {
	display: block;
}

.abood-offcanvas {
	position: fixed;
	top: 0;
	left: 0;
	width: 300px;
	max-width: 85vw;
	height: 100%;
	z-index: 1060;
	background: var(--abood-hdr-bg);
	transform: translateX(-100%);
	transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.admin-bar .abood-offcanvas {
	top: 32px;
	height: calc(100% - 32px);
}

.abood-offcanvas.is-open {
	transform: translateX(0);
}

.abood-offcanvas-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px;
	border-bottom: 1px solid var(--abood-hdr-border);
	gap: 12px;
}

.abood-offcanvas-close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border: none;
	background: transparent;
	color: var(--abood-hdr-text-light);
	cursor: pointer;
	border-radius: 50%;
	flex-shrink: 0;
	transition: background var(--abood-hdr-transition);
}

.abood-offcanvas-close:hover {
	background: var(--abood-hdr-hover-bg);
}

.abood-offcanvas-user {
	display: flex;
	align-items: center;
	gap: 10px;
	text-decoration: none;
	color: var(--abood-hdr-text);
	font-weight: 600;
	font-size: 14px;
}

.abood-offcanvas-user img {
	width: 36px;
	height: 36px;
	border-radius: 50%;
}

.abood-offcanvas-auth {
	display: flex;
	gap: 8px;
	flex: 1;
}

.abood-offcanvas-auth .abood-btn {
	flex: 1;
	text-align: center;
}

.abood-offcanvas-nav {
	flex: 1;
	overflow-y: auto;
	padding: 8px 0;
}

.abood-offcanvas-menu {
	list-style: none;
	margin: 0;
	padding: 0;
}

.abood-offcanvas-menu li a {
	display: block;
	padding: 12px 20px;
	color: var(--abood-hdr-text);
	text-decoration: none;
	font-size: 15px;
	transition: background var(--abood-hdr-transition);
}

.abood-offcanvas-menu li a:hover {
	background: var(--abood-hdr-hover-bg);
	color: var(--abood-hdr-primary);
}

.abood-offcanvas-menu .sub-menu {
	list-style: none;
	margin: 0;
	padding: 0;
}

.abood-offcanvas-menu .sub-menu li a {
	padding-left: 36px;
	font-size: 14px;
	color: var(--abood-hdr-text-light);
}

/* ── Desktop/Mobile toggles ── */
.abood-desktop-only {
	display: flex;
}

.abood-mobile-only {
	display: none !important;
}

/* ── Responsive: <1200px (Tablet & Mobile) ── */
@media (max-width: 1199px) {
	.abood-desktop-only {
		display: none !important;
	}

	.abood-mobile-only {
		display: flex !important;
	}

	.abood-header-inner {
		padding: 0 16px;
		position: relative;
		justify-content: space-between;
	}

	.abood-search {
		display: none;
	}

	/* Center logo absolutely on mobile (Udemy style) */
	.abood-header-logo {
		position: absolute;
		left: 50%;
		transform: translateX(-50%);
		z-index: 1;
		pointer-events: auto;
	}

	.abood-header-logo img {
		height: 75px;
	}

	/* Hamburger on the left */
	.abood-hamburger {
		flex-shrink: 0;
	}

	/* Icons on the right */
	.abood-header-right {
		margin-left: auto;
	}

	#apus-main-content {
		padding-top: var(--abood-hdr-height) !important;
	}
}

/* ── Responsive: <768px (Small Mobile) ── */
@media (max-width: 767px) {
	:root {
		--abood-hdr-height: 60px;
	}

	.abood-header-inner {
		padding: 0 12px;
	}

	.abood-header-logo img {
		height: 65px;
	}

	.abood-header-right {
		gap: 2px;
	}

	.abood-mobile-search-btn,
	.abood-hamburger {
		width: 38px;
		height: 38px;
	}
}

/* ── Admin bar responsive ── */
@media (max-width: 782px) {
	.admin-bar .abood-header {
		top: 46px;
	}

	.admin-bar .abood-offcanvas {
		top: 46px;
		height: calc(100% - 46px);
	}

	.admin-bar .abood-mobile-search-overlay {
		top: 46px;
	}
}

@media (max-width: 600px) {
	.admin-bar .abood-header {
		top: 0;
	}

	.admin-bar .abood-offcanvas {
		top: 0;
		height: 100%;
	}

	.admin-bar .abood-mobile-search-overlay {
		top: 0;
	}
}

/* ── RTL Support ── */
html[dir="rtl"] .abood-search-icon {
	margin-right: 0;
	margin-left: 8px;
}

html[dir="rtl"] .abood-user-dropdown {
	right: auto;
	left: 0;
}

html[dir="rtl"] .abood-offcanvas {
	left: auto;
	right: 0;
	transform: translateX(100%);
}

html[dir="rtl"] .abood-offcanvas.is-open {
	transform: translateX(0);
}

html[dir="rtl"] .abood-offcanvas-menu .sub-menu li a {
	padding-left: 20px;
	padding-right: 36px;
}

html[dir="rtl"] .abood-explore-dropdown {
	left: auto;
	right: 0;
}

@media (max-width: 1199px) {
	html[dir="rtl"] .abood-header-logo {
		left: 50%;
		right: auto;
		transform: translateX(-50%);
	}
}

/* ── Header always on top, full width ── */
/* Header stays full width above everything - sidebars go below it */
body.abs-has-sidebar .abood-header,
body.abs-has-page-sidebar .abood-header,
body.left-main .abood-header {
	left: 0;
	right: 0;
	z-index: 1010;
}

/* Push sidebar down below header */
body.abs-has-sidebar .abs-sidebar,
body.abs-has-sidebar #abs-sidebar {
	top: var(--abood-hdr-height) !important;
	height: calc(100vh - var(--abood-hdr-height)) !important;
}

body.abs-has-page-sidebar .main-page-sidebar .sidebar-wrapper,
body.abs-has-page-sidebar .main-page-sidebar.left-main .sidebar-wrapper,
body.left-main .main-page-sidebar .sidebar-wrapper {
	top: var(--abood-hdr-height) !important;
	height: calc(100vh - var(--abood-hdr-height)) !important;
}

/* Admin bar: push sidebar further down */
.admin-bar.abs-has-sidebar .abs-sidebar,
.admin-bar.abs-has-sidebar #abs-sidebar {
	top: calc(var(--abood-hdr-height) + 32px) !important;
	height: calc(100vh - var(--abood-hdr-height) - 32px) !important;
}

.admin-bar.abs-has-page-sidebar .main-page-sidebar .sidebar-wrapper,
.admin-bar.abs-has-page-sidebar .main-page-sidebar.left-main .sidebar-wrapper,
.admin-bar.left-main .main-page-sidebar .sidebar-wrapper {
	top: calc(var(--abood-hdr-height) + 32px) !important;
	height: calc(100vh - var(--abood-hdr-height) - 32px) !important;
}

@media (max-width: 782px) {
	.admin-bar.abs-has-sidebar .abs-sidebar,
	.admin-bar.abs-has-sidebar #abs-sidebar {
		top: calc(var(--abood-hdr-height) + 46px) !important;
		height: calc(100vh - var(--abood-hdr-height) - 46px) !important;
	}

	.admin-bar.abs-has-page-sidebar .main-page-sidebar .sidebar-wrapper,
	.admin-bar.abs-has-page-sidebar .main-page-sidebar.left-main .sidebar-wrapper,
	.admin-bar.left-main .main-page-sidebar .sidebar-wrapper {
		top: calc(var(--abood-hdr-height) + 46px) !important;
		height: calc(100vh - var(--abood-hdr-height) - 46px) !important;
	}
}

@media (max-width: 600px) {
	.admin-bar.abs-has-sidebar .abs-sidebar,
	.admin-bar.abs-has-sidebar #abs-sidebar {
		top: var(--abood-hdr-height) !important;
		height: calc(100vh - var(--abood-hdr-height)) !important;
	}

	.admin-bar.abs-has-page-sidebar .main-page-sidebar .sidebar-wrapper,
	.admin-bar.abs-has-page-sidebar .main-page-sidebar.left-main .sidebar-wrapper,
	.admin-bar.left-main .main-page-sidebar .sidebar-wrapper {
		top: var(--abood-hdr-height) !important;
		height: calc(100vh - var(--abood-hdr-height)) !important;
	}
}

/* ── Animations ── */
@keyframes aboodFadeIn {
	from {
		opacity: 0;
		transform: translateY(-4px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes aboodSpin {
	to {
		transform: rotate(360deg);
	}
}

/* ── Global overflow prevention ── */
/* Handled by the Universal viewport fit section below */

/* Fix elements that can exceed viewport width */
#wrapper-container {
	max-width: 100%;
}

/* Ensure rows and containers don't overflow */
.row,
.container,
.container-fluid,
.elementor-section-wrap,
.elementor-section,
#apus-main-content {
	max-width: 100%;
}

/* Fix sidebar layout content from overflowing */
body.abs-has-sidebar .tutor-frontend-dashboard-maincontent,
body.abs-has-page-sidebar .main-page-sidebar > .row > .col-lg-8,
body.abs-has-page-sidebar .main-page-sidebar > .row > .col-lg-9,
body.abs-has-page-sidebar .main-page-sidebar > .row > [class*="col-"] {
	max-width: 100%;
	overflow-x: hidden;
}

/* On mobile, remove sidebar margin/padding so content takes full width */
@media (max-width: 991px) {
	body.abs-has-sidebar #wrapper-container,
	body.abs-has-page-sidebar #wrapper-container {
		margin-left: 0 !important;
		margin-right: 0 !important;
	}

	body.abs-has-page-sidebar .main-page-sidebar.left-main > .row > [class*="col-"] {
		width: 100% !important;
		flex: 0 0 100% !important;
		max-width: 100% !important;
	}
}

/* ── Universal viewport fit — ALL devices ── */
*,
*::before,
*::after {
	box-sizing: border-box;
}

/* ── Theme's mobile sidebar toggle — kept visible ── */

/* ── Viewport overflow prevention ── */
/* ONLY on main content area — header is OUTSIDE so dropdowns are not clipped */
#apus-main-content,
#main-container,
.site-main,
footer,
#apus-footer {
	overflow-x: hidden;
}

/* ── Mobile & Tablet responsive fix (<1200px) ── */
@media (max-width: 1199px) {
	/* WordPress alignwide/alignfull blocks — must not exceed viewport */
	.alignwide,
	.alignfull,
	[class*="wp-block-woocommerce"],
	.wp-block-woocommerce-cart,
	.wc-block-cart {
		max-width: 100% !important;
		margin-left: 0 !important;
		margin-right: 0 !important;
		overflow-x: hidden;
	}

	/* Main content area — max-width only, NO overflow-x:hidden so tables can scroll */
	#main-content,
	.main-page,
	.site-main,
	.entry-content,
	.page-content {
		max-width: 100%;
	}

	/* WooCommerce cart/checkout blocks */
	.wc-block-cart .wc-block-cart__main,
	.wc-block-cart .wc-block-cart__sidebar,
	.wc-block-components-product-name,
	.wc-block-cart-items,
	.wc-block-cart-items__row {
		max-width: 100% !important;
		overflow-wrap: break-word;
		word-wrap: break-word;
	}

	/* 10. Coupon */
	.woocommerce .coupon {
		display: flex !important;
		flex-wrap: wrap !important;
		gap: 8px;
		width: 100% !important;
	}

	.woocommerce .coupon #coupon_code {
		flex: 1 !important;
		min-width: 0 !important;
	}

	/* General wide elements */
	img, video, iframe, pre, blockquote {
		max-width: 100% !important;
	}

	/* Elementor */
	.elementor-section,
	.elementor-widget-wrap,
	.elementor-element {
		max-width: 100% !important;
	}

	/* Tutor LMS */
	.tutor-wrap,
	.tutor-course-details-page {
		max-width: 100% !important;
		overflow-x: hidden;
	}

	/* Sidebar layout — full width on mobile */
	.sidebar-wrapper.sidebar-blog {
		display: none;
	}

	#main-content.col-lg-8 {
		width: 100% !important;
		flex: 0 0 100% !important;
		max-width: 100% !important;
	}
}

/* ── Custom Header Order support ── */
/* Dynamic CSS from PHP handles ordering/visibility within .abood-header-right */

/* ── Dropdowns: stay within viewport on all screens ── */
@media (max-width: 1199px) {
	/* Explore dropdown — prevent overflow */
	.abood-explore-dropdown {
		left: auto !important;
		right: 0;
		min-width: 200px;
		max-width: calc(100vw - 30px);
	}

	/* User dropdown — prevent overflow */
	.abood-user-dropdown {
		right: 0;
		left: auto !important;
		min-width: 200px;
		max-width: calc(100vw - 30px);
	}

	/* Search dropdown — prevent overflow */
	.abood-search-dropdown {
		max-width: calc(100vw - 30px);
		left: 0;
		right: 0;
	}
}

@media (max-width: 480px) {
	/* On very small screens, dropdowns take nearly full width */
	.abood-explore-dropdown,
	.abood-user-dropdown {
		position: fixed !important;
		left: 10px !important;
		right: 10px !important;
		top: var(--abood-hdr-height) !important;
		min-width: auto;
		max-width: none;
		width: auto;
		border-radius: 8px;
		box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
	}
}
