/**
 * Mobile-First Responsive UX & Touch Optimization - ALS Vietnam (ALS Steel)
 * Theme: ngoisaoso
 * Features: Off-canvas Drawer, Bottom Action Bar, Responsive Tables, Aspect-Ratio Media
 */

/* ==========================================================================
   OFF-CANVAS DRAWER NAVIGATION (MOBILE & TABLET <= 991px)
   ========================================================================== */
@media (max-width: 991.98px) {
	/* Header Mobile Layout Adjustments */
	header {
		padding: 6px 0;
	}

	header .header-wrap,
	header .container {
		display: flex !important;
		align-items: center !important;
		justify-content: space-between !important;
		flex-wrap: nowrap !important;
		width: 100% !important;
		padding-left: 16px !important;
		padding-right: 16px !important;
	}

	header .logo {
		flex: 0 0 auto;
	}

	header .logo img {
		max-height: 42px;
	}

	/* Hide desktop search and old menu bar in header */
	/* Search bar sits between logo and hamburger */
	header .headerSearch {
		display: block !important;
		flex: 1 1 auto !important;
		min-width: 0;
		margin: 0 8px !important;
	}

	header .headerSearch .formSearch,
	header .headerSearch .formSearch input,
	header .headerSearch .formSearch input:focus {
		width: 100% !important;
		min-width: 0;
	}

	header .headerSearch .formSearch {
		padding: 2px 4px 2px 12px;
	}

	header .headerSearch .formSearch input {
		font-size: 0.85rem;
		padding: 6px 4px;
	}

	header .headerSearch .formSearch button {
		position: static !important;
		flex: 0 0 auto;
		width: 30px;
		height: 30px;
	}

	header .headermenu {
		display: none !important;
	}

	header .mobile-menu-trigger {
		margin-left: auto !important;
		order: 99;
	}

	/* Hide old desktop menu dropdown */
	.menumain ul#menumain {
		display: none !important;
	}

	/* Hide duplicated hamburger rendered inside the menu block (center) */
	.menumain .navbar-toggler {
		display: none !important;
	}

	/* Modern Hamburger Button (uneven bars, right aligned) */
	.mobile-menu-trigger {
		display: inline-flex !important;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		width: 44px;
		height: 44px;
		padding: 0;
		background: transparent;
		border: none;
		border-radius: 12px;
		cursor: pointer;
		box-shadow: none;
		transition: background var(--transition-fast);
		margin: 0;
		-webkit-tap-highlight-color: transparent;
	}

	.mobile-menu-trigger:hover,
	.mobile-menu-trigger:focus,
	.mobile-menu-trigger:active {
		background: rgba(25, 70, 141, 0.08);
		outline: none;
		box-shadow: none;
	}

	.hamburger-box {
		width: 26px;
		height: 18px;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		align-items: flex-end;
	}

	.hamburger-inner {
		display: block;
		height: 2.5px;
		background-color: var(--brand-primary);
		border-radius: 2px;
		margin: 0;
		transition: width var(--transition-normal);
	}

	.hamburger-inner:nth-child(1) { width: 100%; }
	.hamburger-inner:nth-child(2) { width: 72%; }
	.hamburger-inner:nth-child(3) { width: 48%; }

	.mobile-menu-trigger:hover .hamburger-inner,
	.mobile-menu-trigger:active .hamburger-inner {
		width: 100%;
	}

	/* Product block: 2 items per row on mobile */
	.block_news_products .item {
		margin-bottom: 1rem;
	}

	.block_news_products .item .simg {
		height: 120px;
	}

	.block_news_products .item .sdes a {
		font-size: 0.82rem;
		line-height: 1.3;
	}

	.block_news_products .item .sdes p {
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
		overflow: hidden;
		font-size: 0.78rem;
	}
}

/* ==========================================================================
   OFF-CANVAS DRAWER COMPONENT
   ========================================================================== */
.mobile-drawer-overlay {
	position: fixed;
	inset: 0;
	background-color: rgba(15, 23, 42, 0.6);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	z-index: 9998;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

body.drawer-open .mobile-drawer-overlay {
	opacity: 1;
	visibility: visible;
}

.mobile-drawer {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	width: 86%;
	max-width: 360px;
	background: #ffffff;
	z-index: 9999;
	transform: translateX(100%);
	transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
	box-shadow: -8px 0 32px rgba(15, 23, 42, 0.2);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

body.drawer-open .mobile-drawer {
	transform: translateX(0);
}

body.drawer-open {
	overflow: hidden !important;
	touch-action: none;
}

/* Drawer Header */
.drawer-header {
	padding: 16px 20px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	border-bottom: 1px solid var(--border-light);
	background: #ffffff;
}

.drawer-header .drawer-brand img {
	max-height: 38px;
	width: auto;
}

.drawer-close-btn {
	width: 40px;
	height: 40px;
	border-radius: var(--radius-full);
	background: var(--surface-bg);
	border: 1px solid var(--border-light);
	color: var(--text-secondary);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	font-size: 1.1rem;
	transition: all var(--transition-fast);
}

.drawer-close-btn:hover {
	background: #fee2e2;
	color: var(--brand-accent);
	border-color: #fca5a5;
}

/* Drawer Search Bar */
.drawer-search {
	padding: 14px 20px;
	background: var(--surface-bg);
	border-bottom: 1px solid var(--border-light);
}

.drawer-search-form {
	display: flex;
	align-items: center;
	background: #ffffff;
	border: 1px solid var(--border-light);
	border-radius: var(--radius-full);
	padding: 4px 6px 4px 16px;
	box-shadow: var(--shadow-subtle);
}

.drawer-search-form:focus-within {
	border-color: var(--brand-primary);
	box-shadow: 0 0 0 3px rgba(25, 70, 141, 0.12);
}

.drawer-search-form input {
	flex: 1;
	border: none;
	background: transparent;
	font-size: 0.92rem;
	color: var(--text-primary);
	outline: none;
	padding: 6px 0;
}

.drawer-search-form button {
	width: 34px;
	height: 34px;
	border-radius: var(--radius-full);
	background: var(--brand-primary);
	border: none;
	color: #ffffff;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background var(--transition-fast);
}

.drawer-search-form button:hover {
	background: var(--brand-accent);
}

/* Drawer Navigation Body (Scrollable) */
.drawer-body {
	flex: 1;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: 12px 0;
}

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

.drawer-nav-item {
	border-bottom: 1px solid rgba(226, 232, 240, 0.6);
}

.drawer-nav-link-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 13px 20px;
	min-height: 48px; /* Touch target */
}

.drawer-nav-link {
	font-family: 'Montserrat', sans-serif;
	font-size: 0.95rem;
	font-weight: 600;
	color: var(--text-primary);
	text-decoration: none;
	flex: 1;
	display: flex;
	align-items: center;
	gap: 10px;
}

.drawer-nav-link:hover,
.drawer-nav-item.active > .drawer-nav-link-row .drawer-nav-link {
	color: var(--brand-primary);
}

.drawer-accordion-btn {
	width: 38px;
	height: 38px;
	border-radius: var(--radius-sm);
	background: var(--surface-bg);
	border: 1px solid var(--border-light);
	color: var(--text-muted);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	margin-left: 8px;
	transition: all var(--transition-fast);
}

.drawer-accordion-btn .fa-chevron-down {
	transition: transform var(--transition-normal);
	font-size: 0.8rem;
}

.drawer-nav-item.is-expanded > .drawer-nav-link-row .drawer-accordion-btn {
	background: rgba(25, 70, 141, 0.08);
	color: var(--brand-primary);
	border-color: rgba(25, 70, 141, 0.2);
}

.drawer-nav-item.is-expanded > .drawer-nav-link-row .drawer-accordion-btn .fa-chevron-down {
	transform: rotate(180deg);
}

/* Accordion Submenu Items */
.drawer-submenu-list {
	list-style: none;
	margin: 0;
	padding: 4px 0 8px 30px;
	background: var(--surface-bg);
	border-top: 1px solid var(--border-light);
	display: none;
}

.drawer-nav-item.is-expanded > .drawer-submenu-list {
	display: block;
}

.drawer-submenu-item a {
	display: block;
	padding: 10px 16px 10px 8px;
	font-size: 0.88rem;
	font-weight: 500;
	color: var(--text-secondary);
	border-left: 2px solid transparent;
	transition: all var(--transition-fast);
}

.drawer-submenu-item a:hover {
	color: var(--brand-accent);
	border-left-color: var(--brand-accent);
	padding-left: 12px;
}

/* Drawer Footer */
.drawer-footer {
	padding: 16px 20px;
	background: #ffffff;
	border-top: 1px solid var(--border-light);
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.drawer-hotline-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 12px 16px;
	background: linear-gradient(135deg, var(--brand-primary) 0%, #0d2e63 100%);
	color: #ffffff !important;
	border-radius: var(--radius-md);
	font-family: 'Montserrat', sans-serif;
	font-weight: 700;
	font-size: 0.95rem;
	text-decoration: none;
	box-shadow: 0 4px 12px rgba(25, 70, 141, 0.25);
	transition: all var(--transition-fast);
}

.drawer-hotline-btn:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 16px rgba(25, 70, 141, 0.35);
}

.drawer-hotline-btn em {
	font-size: 1.1rem;
	animation: subtle-pulse 1.8s infinite;
}

@keyframes subtle-pulse {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.15); }
}

/* ==========================================================================
   BOTTOM ACTION BAR (MOBILE FIRST <= 767px)
   ========================================================================== */
@media (max-width: 767.98px) {
	/* Avoid content cut-off by the bottom fixed bar */
	body {
		padding-bottom: 70px !important;
	}

	/* Bottom Action Bar Container */
	.bottom-action-bar {
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		height: 60px;
		background: rgba(255, 255, 255, 0.96);
		backdrop-filter: blur(14px);
		-webkit-backdrop-filter: blur(14px);
		border-top: 1px solid var(--border-light);
		box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
		z-index: 9990;
		display: flex;
		align-items: center;
		justify-content: space-around;
		padding: 0 8px;
		padding-bottom: env(safe-area-inset-bottom, 0px);
		transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	}

	/* Smart hide on scroll down */
	.bottom-action-bar.is-hidden {
		transform: translateY(100%);
	}

	/* Action Bar Item */
	.action-bar-item {
		flex: 1;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding: 6px 4px;
		color: var(--text-secondary);
		text-decoration: none;
		font-size: 0.72rem;
		font-weight: 600;
		min-height: 48px;
		border-radius: var(--radius-sm);
		transition: all var(--transition-fast);
		position: relative;
	}

	.action-bar-item:hover,
	.action-bar-item:active {
		color: var(--brand-primary);
	}

	.action-bar-item em,
	.action-bar-item i {
		font-size: 1.15rem;
		margin-bottom: 3px;
		transition: transform var(--transition-fast);
	}

	.action-bar-item:active em {
		transform: scale(0.9);
	}

	/* Unified style: brand-blue icons, grey text */
	.action-bar-item {
		color: #6b7280;
	}

	.action-bar-item:hover,
	.action-bar-item:active {
		color: #6b7280;
	}

	.action-bar-item svg {
		width: 22px;
		height: 22px;
		margin-bottom: 3px;
		color: var(--brand-primary);
		fill: none;
		stroke: currentColor;
		stroke-width: 1.8;
		stroke-linecap: round;
		stroke-linejoin: round;
	}

	.action-bar-item:active svg {
		transform: scale(0.9);
	}

	/* Hide old floating hotline / back-to-top on mobile in favor of bottom bar */
	.show_hotline,
	#back-to-top {
		display: none !important;
	}

	/* Product list: 2 items per row on mobile */
	.viewcat_grid .row {
		--bs-gutter-x: 0.75rem;
	}

	.viewcat_grid .col-6 {
		width: 50%;
	}

	.viewcat_grid .item {
		margin-bottom: 18px;
	}

	.viewcat_grid .item .simg {
		height: 120px;
	}

	.viewcat_grid .item .sdes {
		padding: 10px 8px;
	}

	/* Sub-banner on mobile */
	.banner_sub {
		min-height: 130px;
		height: 160px !important;
		padding: 20px 14px !important;
	}

	.banner_sub span:first-child {
		font-size: 1.35rem !important;
	}

	.banner_sub .des {
		font-size: 0.9rem;
	}
}

/* ==========================================================================
   RESPONSIVE DATA TABLES (ALS TECHNICAL SPECIFICATIONS)
   ========================================================================== */
.table-responsive-wrapper {
	width: 100%;
	overflow: hidden;
	margin: 1.5rem 0;
	border: 1px solid var(--border-light);
	border-radius: var(--radius-md);
	background: #ffffff;
	box-shadow: var(--shadow-subtle);
	position: relative;
}

.table-responsive-wrapper table {
	margin-bottom: 0 !important;
	width: 100% !important;
	max-width: 100% !important;
	min-width: 0 !important;
	border-collapse: collapse;
	table-layout: auto;
}

.table-responsive-wrapper table th {
	background: var(--surface-bg);
	color: var(--text-primary);
	font-family: 'Montserrat', sans-serif;
	font-weight: 600;
	font-size: 0.88rem;
	padding: 11px 16px;
	border-bottom: 2px solid var(--border-light);
	white-space: normal !important;
	word-break: break-word;
	overflow-wrap: break-word;
	word-wrap: break-word;
}

.table-responsive-wrapper table td {
	padding: 11px 16px;
	font-size: 0.88rem;
	color: var(--text-secondary);
	border-bottom: 1px solid var(--border-light);
	white-space: normal !important;
	word-break: break-word;
	overflow-wrap: break-word;
	word-wrap: break-word;
	vertical-align: top;
}

.table-responsive-wrapper table th:first-child,
.table-responsive-wrapper table td:first-child {
	padding-left: 18px !important;
	font-weight: 600;
	color: var(--text-primary);
}

.table-responsive-wrapper table th:last-child,
.table-responsive-wrapper table td:last-child {
	padding-right: 18px !important;
}

.table-responsive-wrapper table tr:last-child td {
	border-bottom: 0 !important;
}

.table-responsive-wrapper table tr:hover td {
	background: rgba(25, 70, 141, 0.03);
}

.table-responsive-wrapper table td p {
	margin-bottom: 0.35rem;
	line-height: 1.5;
}

.table-responsive-wrapper table td p:last-child {
	margin-bottom: 0;
}

/* Mobile Table Swipe Hint - hidden because tables wrap without scrolling */
.table-scroll-hint {
	display: none !important;
}

@media (max-width: 767.98px) {
	.table-responsive-wrapper {
		margin: 1rem 0;
	}

	.table-responsive-wrapper table td,
	.table-responsive-wrapper table th {
		padding: 9px 12px;
		font-size: 0.84rem;
	}

	.table-responsive-wrapper table th:first-child,
	.table-responsive-wrapper table td:first-child {
		padding-left: 14px !important;
		width: 110px !important;
		min-width: 90px;
	}

	.table-responsive-wrapper table th:last-child,
	.table-responsive-wrapper table td:last-child {
		padding-right: 14px !important;
	}

	.table-scroll-hint {
		display: none !important;
	}
}

/* ==========================================================================
   PAGINATION
   ========================================================================== */
ul.pagination {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 6px;
	margin: 24px 0;
	padding: 0;
	list-style: none;
}

ul.pagination > li {
	margin: 0;
	float: none;
}

ul.pagination > li > a,
ul.pagination > li > span {
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 38px;
	height: 38px;
	padding: 0 12px;
	font-size: 0.9rem;
	font-weight: 600;
	line-height: 1;
	color: #4b5563;
	background: #ffffff;
	border: 1px solid #e5e7eb;
	border-radius: 10px !important;
	text-decoration: none;
	margin: 0 !important;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
	transition: all 0.2s ease;
}

ul.pagination > li > a:hover,
ul.pagination > li > a:focus {
	color: var(--brand-primary);
	border-color: var(--brand-primary);
	background: rgba(25, 70, 141, 0.06);
	outline: none;
}

ul.pagination > li.active > a,
ul.pagination > li.active > a:hover {
	color: #ffffff;
	background: var(--brand-primary);
	border-color: var(--brand-primary);
	box-shadow: 0 4px 10px rgba(25, 70, 141, 0.28);
}

ul.pagination > li.disabled > a,
ul.pagination > li.disabled > span {
	color: #9ca3af;
	background: #f3f4f6;
	border-color: #e5e7eb;
	box-shadow: none;
	pointer-events: none;
}

@media (max-width: 575.98px) {
	ul.pagination {
		gap: 4px;
	}

	ul.pagination > li > a,
	ul.pagination > li > span {
		min-width: 34px;
		height: 34px;
		padding: 0 8px;
		font-size: 0.85rem;
		border-radius: 8px !important;
	}
}
