/* ==========================================================================
   TÂM AN FUTURE (TA FUTURE) — OCEAN CYAN-BLUE (#0891b2) THEME & MOBILE UI/UX
   Version: 4.6.0
   1. Unified Ocean Cyan-Blue (#0891b2) Brand Tokens & Component Harmonization
   2. Comprehensive Mobile UI/UX Overhaul (< 1200px & < 768px)
   ========================================================================== */

:root {
	--ta-brand: #0891b2;
	--ta-brand-hover: #0e7490;
	--ta-brand-deep: #155e75;
	--ta-brand-abyss: #083344;
	--ta-brand-bright: #06b6d4;
	--ta-brand-soft: #ecfeff;
	--ta-brand-soft-2: #cffafe;
	--ta-brand-border: #a5f3fc;
	--bs-main: #0891b2 !important;
	--bs-lunar: #0891b2 !important;
	--bs-primary: #0891b2 !important;
	--bs-primary-rgb: 8, 145, 178 !important;
	--fh-brand: #0891b2 !important;
	--fh-brand-dark: #0e7490 !important;
	--fh-brand-soft: rgba(8, 145, 178, 0.08) !important;
}

/* --------------------------------------------------------------------------
   1. GLOBAL BRAND HARMONIZATION (#0891b2 OCEAN CYAN-BLUE)
   -------------------------------------------------------------------------- */
.bg-main,
.bg-primary {
	background-color: #0891b2 !important;
}
.text-main,
.text-primary {
	color: #0891b2 !important;
}
.border-main,
.border-primary {
	border-color: #0891b2 !important;
}
.bg-label-primary {
	background-color: #ecfeff !important;
	color: #0891b2 !important;
}

/* Primary & Brand Buttons */
.btn-primary,
.btn-main {
	background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%) !important;
	border-color: #0891b2 !important;
	color: #ffffff !important;
	box-shadow: 0 3px 10px -2px rgba(8, 145, 178, 0.32);
}
.btn-primary:hover,
.btn-primary:focus,
.btn-main:hover,
.btn-main:focus {
	background: linear-gradient(135deg, #0e7490 0%, #155e75 100%) !important;
	border-color: #0e7490 !important;
	color: #ffffff !important;
}
.btn-outline-primary {
	color: #0891b2 !important;
	border-color: #0891b2 !important;
}
.btn-outline-primary:hover,
.btn-outline-primary.active,
.btn-check:checked + .btn-outline-primary {
	background-color: #0891b2 !important;
	border-color: #0891b2 !important;
	color: #ffffff !important;
}

/* Top Search Type Toggle Pills (Cao tầng / Thấp tầng / Thông tin) */
.btn-check:checked + .btn-outline-default,
.btn-check:active + .btn-outline-default,
.js__search-stock-type.active {
	background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%) !important;
	border-color: #0891b2 !important;
	color: #ffffff !important;
	font-weight: 600;
}

/* Active Pagination, Tabs & Nav Pills */
.page-item.active .page-link,
.pagination li.active a,
.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
	background-color: #0891b2 !important;
	border-color: #0891b2 !important;
	color: #ffffff !important;
	box-shadow: 0 2px 8px rgba(8, 145, 178, 0.28) !important;
}
.nav-tabs .nav-link.active {
	color: #0891b2 !important;
	border-bottom-color: #0891b2 !important;
}
.form-check-input:checked {
	background-color: #0891b2 !important;
	border-color: #0891b2 !important;
}
.form-control:focus,
.form-select:focus,
.input-group-merge:focus-within {
	border-color: #0891b2 !important;
	box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.14) !important;
}

/* Notification Badges in Header */
.badge-notifications.bg-main,
.badge-notifications.bg-danger {
	background-color: #0891b2 !important;
	color: #ffffff !important;
	font-weight: 700;
}

/* Exclusive Inventory Hero & Compare Dock Ocean Gradient */
.ta-excl-hero {
	background: linear-gradient(135deg, #0f172a 0%, #164e63 54%, #0891b2 100%) !important;
	border-color: rgba(103, 232, 249, 0.28) !important;
}
.ta-compare-dock {
	background: linear-gradient(135deg, #0f172a 0%, #164e63 60%, #0891b2 100%) !important;
	box-shadow: 0 20px 48px -8px rgba(8, 51, 68, 0.45), 0 0 0 1px rgba(103, 232, 249, 0.32) !important;
}

/* Chat Widget FAB Harmonization */
#fhchat {
	--fhc-fh: #0891b2 !important;
	--fhc-fh-d: #0e7490 !important;
}
.fhc-fab {
	background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%) !important;
	box-shadow: 0 10px 26px rgba(8, 145, 178, 0.38), 0 2px 6px rgba(8, 145, 178, 0.26) !important;
}

/* --------------------------------------------------------------------------
   2. MOBILE & TABLET LAYOUT SAFETY (< 1200px)
   -------------------------------------------------------------------------- */
@media (max-width: 1199.98px) {
	html,
	body {
		max-width: 100vw;
		overflow-x: clip;
	}
	.layout-page {
		padding-left: 0 !important;
		max-width: 100vw;
		overflow-x: clip;
	}

	/* Inner Pages Sticky Mobile Topbar (#layout-navbar) */
	#layout-navbar.layout-navbar {
		margin: 0 !important;
		width: 100% !important;
		max-width: 100% !important;
		border-radius: 0 !important;
		padding: 6px 12px !important;
		min-height: 56px !important;
		height: auto !important;
		background: rgba(255, 255, 255, 0.97) !important;
		backdrop-filter: blur(12px);
		-webkit-backdrop-filter: blur(12px);
		border-bottom: 1px solid #e2e8f0 !important;
		box-shadow: 0 2px 12px rgba(15, 23, 42, 0.05) !important;
		top: 0 !important;
		z-index: 1085 !important;
	}
	#layout-navbar .layout-menu-toggle {
		margin-right: 8px !important;
	}
	#layout-navbar .layout-menu-toggle .nav-link {
		width: 38px;
		height: 38px;
		border-radius: 10px;
		background: #ecfeff;
		color: #0891b2 !important;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		padding: 0 !important;
	}
	#layout-navbar .navbar-nav-right {
		flex: 1 1 auto;
		min-width: 0;
		gap: 6px;
	}
	#layout-navbar .navbar-nav-right > .navbar-nav:first-child {
		flex: 1 1 auto;
		min-width: 0;
	}
}

/* --------------------------------------------------------------------------
   3. PHONE UI/UX OVERHAUL (< 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 767.98px) {
	/* Reserve space for fixed Bottom Navigation Bar so content is NEVER clipped */
	.layout-content-navbar.phone .content-wrapper,
	.content-wrapper {
		padding-bottom: calc(82px + env(safe-area-inset-bottom)) !important;
	}

	/* --- A. HOME MOBILE HERO & HEADER (FIXED WHITE-ON-WHITE BUG FOR ALL USERS!) --- */
	.ta-home-mb-page {
		background: #f4f7fa !important;
	}
	.header-mobile.ta-mb-topbar {
		position: sticky !important;
		top: 0 !important;
		z-index: 1090 !important;
		background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%) !important;
		border-bottom: 1px solid rgba(255, 255, 255, 0.14);
		box-shadow: 0 4px 16px rgba(8, 51, 68, 0.16);
		padding-top: env(safe-area-inset-top) !important;
	}
	.header-mobile.ta-mb-topbar .icon_menu {
		width: 38px;
		height: 38px;
		background: rgba(255, 255, 255, 0.16) !important;
		border: 1px solid rgba(255, 255, 255, 0.22);
		color: #ffffff !important;
		display: inline-flex;
		align-items: center;
		justify-content: center;
	}
	.body_mobile {
		background: linear-gradient(160deg, #0891b2 0%, #0e7490 55%, #155e75 100%) !important;
		padding-top: 0 !important;
	}
	.body_mobile .top_slide_mobile {
		padding: 14px 14px 20px !important;
		gap: 12px !important;
	}
	.body_mobile .owl_top_slide {
		scrollbar-width: none;
		-webkit-overflow-scrolling: touch;
		padding-bottom: 2px;
	}
	.body_mobile .owl_top_slide .item_slide {
		min-width: 64vw !important;
		max-height: none !important;
		background: rgba(255, 255, 255, 0.15) !important;
		backdrop-filter: blur(8px);
		-webkit-backdrop-filter: blur(8px);
		border: 1px solid rgba(255, 255, 255, 0.24) !important;
		border-radius: 14px !important;
		padding: 12px 14px !important;
	}
	.body_mobile .bottom_content {
		border-top-left-radius: 24px !important;
		border-top-right-radius: 24px !important;
		background: #ffffff !important;
		margin-top: -6px;
	}
	.body_mobile .list_menu_grid {
		padding: 20px 12px 12px !important;
		margin-bottom: 16px !important;
		border-top-left-radius: 24px !important;
		border-top-right-radius: 24px !important;
		box-shadow: 0 4px 18px rgba(15, 23, 42, 0.04) !important;
	}
	.body_mobile .item_menu_grid .item_icon {
		width: 52px !important;
		height: 52px !important;
		max-width: 52px !important;
		border-radius: 15px !important;
		border: 1px solid #e2e8f0;
		box-shadow: 0 4px 12px rgba(8, 145, 178, 0.08) !important;
	}
	.body_mobile .item_menu_grid span.fs-12 {
		font-size: 11.5px !important;
		line-height: 1.25;
		display: block;
		margin-top: 2px;
	}

	/* --- B. MOBILE SEARCH BAR & SUGGESTION PANEL (NO OVERFLOW!) --- */
	.search_header_mb {
		width: 100% !important;
		max-width: 100% !important;
		height: 38px;
		border-radius: 999px !important;
		background: #f1f5f9 !important;
		border: 1px solid #e2e8f0 !important;
		padding: 2px 10px !important;
		align-items: center;
	}
	.search_header_mb input.form-control {
		background: transparent !important;
		font-size: 13px !important;
		min-width: 0 !important;
	}
	/* Home Mobile Expandable Search Sheet */
	.search_header_home_mb {
		position: fixed !important;
		left: 12px !important;
		right: 12px !important;
		top: calc(58px + env(safe-area-inset-top)) !important;
		width: auto !important;
		max-width: none !important;
		height: 44px !important;
		background: #ffffff !important;
		border: 1px solid #a5f3fc !important;
		border-radius: 14px !important;
		box-shadow: 0 16px 36px rgba(8, 51, 68, 0.24) !important;
		z-index: 1100 !important;
		display: none;
		align-items: center;
		padding: 4px 12px !important;
	}
	.search_header_home_mb.show {
		display: flex !important;
	}
	.search_suggest {
		position: fixed !important;
		left: 10px !important;
		right: 10px !important;
		top: calc(60px + env(safe-area-inset-top)) !important;
		width: auto !important;
		min-width: 0 !important;
		max-width: calc(100vw - 20px) !important;
		max-height: 70vh !important;
		border-radius: 14px !important;
		box-shadow: 0 20px 44px rgba(15, 23, 42, 0.22) !important;
		z-index: 1105 !important;
	}
	.search_header_home_mb .search_suggest {
		top: calc(108px + env(safe-area-inset-top)) !important;
	}

	/* --- C. APP-GRADE 5-TAB BOTTOM NAVIGATION BAR --- */
	.bottom-navbar:not(.fh-academy) {
		position: fixed !important;
		left: 0 !important;
		right: 0 !important;
		bottom: 0 !important;
		height: calc(62px + env(safe-area-inset-bottom)) !important;
		background: rgba(255, 255, 255, 0.97) !important;
		backdrop-filter: blur(16px);
		-webkit-backdrop-filter: blur(16px);
		border-top: 1px solid #e2e8f0 !important;
		box-shadow: 0 -6px 24px rgba(15, 23, 42, 0.07) !important;
		z-index: 1080 !important;
		padding: 0 !important;
	}
	.bottom-navbar:not(.fh-academy) > div {
		height: 62px !important;
		padding: 4px 6px 4px !important;
		margin-bottom: env(safe-area-inset-bottom);
		display: grid !important;
		grid-template-columns: repeat(5, minmax(0, 1fr));
		align-items: center;
		width: 100%;
	}
	.ta-bnav-item {
		min-width: 0;
		padding: 4px 2px !important;
		text-decoration: none !important;
		color: #64748b !important;
		gap: 2px;
		position: relative;
	}
	.ta-bnav-item .icon i {
		font-size: 21px !important;
		line-height: 1;
		transition: transform 0.16s ease, color 0.16s ease;
	}
	.ta-bnav-label {
		font-size: 10.5px !important;
		font-weight: 600;
		line-height: 1.15;
		color: inherit;
	}
	.ta-bnav-item.active {
		color: #0891b2 !important;
	}
	.ta-bnav-item.active .ta-bnav-label {
		color: #0891b2 !important;
		font-weight: 700;
	}
	.ta-bnav-center .ta-bnav-orb {
		width: 44px !important;
		height: 44px !important;
		margin-top: -18px !important;
		margin-bottom: 2px !important;
		border-radius: 50% !important;
		background: linear-gradient(135deg, #06b6d4 0%, #0891b2 55%, #0e7490 100%) !important;
		border: 3px solid #ffffff !important;
		box-shadow: 0 6px 16px rgba(8, 145, 178, 0.42) !important;
		display: flex !important;
		align-items: center !important;
		justify-content: center !important;
	}
	.ta-bnav-center .ta-bnav-orb img {
		width: 24px !important;
		height: 24px !important;
		object-fit: contain;
		border-radius: 4px;
	}

	/* --- D. DE-COLLIDE FLOATING BUTTONS (.action, .fhc-fab, .ta-compare-dock) --- */
	/* Future Way chat is already a primary tab in .bottom-navbar, so move .fhc-fab cleanly above .action */
	.fhc-fab {
		right: 14px !important;
		bottom: calc(128px + env(safe-area-inset-bottom)) !important;
		width: 44px !important;
		height: 44px !important;
		border-radius: 50% !important;
		z-index: 1036 !important;
	}
	.ta-compare-dock {
		bottom: calc(70px + env(safe-area-inset-bottom)) !important;
		left: 10px !important;
		right: 10px !important;
		transform: none !important;
		max-width: none !important;
		padding: 10px 12px !important;
		border-radius: 14px !important;
		gap: 8px !important;
		z-index: 1075 !important;
	}

	/* --- E. PREVENT DASHBOARD CARD & FILTER BAR HORIZONTAL OVERFLOW --- */
	.container-xxl,
	.container-sm {
		padding-left: 12px !important;
		padding-right: 12px !important;
	}
	.card {
		border-radius: 14px !important;
	}
	.card-header {
		padding: 12px 14px !important;
		flex-wrap: wrap !important;
		gap: 8px;
	}
	.card-body {
		padding: 12px 14px !important;
	}
	.card-header .w-px-400,
	.card-header .w-px-350,
	.card-header .w-px-300,
	.card-header .w-px-250,
	.card-header .w-px-200,
	.card-header .w-px-175,
	.card-header .w-px-150,
	.ta-dash .w-px-400,
	.ta-dash .w-px-350,
	.ta-dash .w-px-300,
	.ta-dash .w-px-250 {
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
	}

	/* --- F. BẢNG HÀNG (/bang-hang/ & /project/...) MOBILE POLISH --- */
	.divider .divider-text.fs-3 {
		font-size: 15px !important;
		white-space: normal !important;
		line-height: 1.35;
	}
	.project_highfloor .building-name,
	.ta-proj-tile {
		min-height: 40px;
		border-radius: 10px !important;
		font-size: 13px !important;
		font-weight: 600 !important;
		display: inline-flex;
		align-items: center;
		justify-content: center;
	}

	/* --- G. QUỸ ĐỘC QUYỀN (/ta-doc-quyen/) MOBILE POLISH --- */
	.ta-excl-hero {
		padding: 16px !important;
		border-radius: 14px !important;
		gap: 12px !important;
	}
	.ta-excl-title {
		font-size: 18px !important;
		line-height: 1.3;
	}
	.ta-excl-sub {
		font-size: 12px !important;
	}
	.ta-excl-hero-right {
		width: 100%;
		justify-content: space-between;
		gap: 6px !important;
	}
	.ta-excl-time {
		width: 100%;
		justify-content: center;
		font-size: 11.5px !important;
		padding: 5px 10px !important;
	}
	.ta-hero-btn {
		flex: 1 1 calc(50% - 6px);
		justify-content: center;
		padding: 8px 10px !important;
		font-size: 12px !important;
	}
	.ta-kpi-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
		gap: 10px !important;
	}
	.ta-kpi-card {
		padding: 12px !important;
		gap: 10px !important;
		border-radius: 12px !important;
	}
	.ta-kpi-icon {
		width: 36px !important;
		height: 36px !important;
		font-size: 18px !important;
	}
	.ta-kpi-val {
		font-size: 16px !important;
	}

	/* --- H. MẶT BẰNG DỰ ÁN (LEAFLET MAP) MOBILE TOUCH UX --- */
	.map,
	.map-container {
		height: calc(100dvh - 215px) !important;
		min-height: 430px !important;
		max-height: 640px !important;
		border-radius: 12px !important;
	}
	.js__block-tabs {
		flex-wrap: nowrap !important;
		justify-content: flex-start !important;
		overflow-x: auto !important;
		-webkit-overflow-scrolling: touch;
		padding-bottom: 6px;
		gap: 6px;
	}
	.js__block-tabs > * {
		flex-shrink: 0;
	}
	.leaflet-touch .leaflet-bar a {
		width: 36px !important;
		height: 36px !important;
		line-height: 36px !important;
	}

	/* --- I. CRM & TABLES SMOOTH MOBILE SCROLLING --- */
	.crm-role-tabs {
		display: flex !important;
		overflow-x: auto !important;
		flex-wrap: nowrap !important;
		width: 100%;
		-webkit-overflow-scrolling: touch;
		padding-bottom: 2px;
	}
	.crm-role-tabs .btn {
		white-space: nowrap;
		flex-shrink: 0;
	}
	.table-responsive,
	.table-freeze {
		-webkit-overflow-scrolling: touch;
	}
}

/* --------------------------------------------------------------------------
   4. RESPONSIVE NARROW-SCREEN TOPBAR & QUICKVIEW POPOVER (< 768px)
   Ensures zero overlap on 390px viewports even in desktop-UA mode, and
   prevents .webui-popover / .ta-unit-sheet from clipping off mobile screens!
   -------------------------------------------------------------------------- */
@media (max-width: 767.98px) {
	/* Desktop-mode top_search inside narrow < 768px viewports */
	#layout-navbar .navbar-nav-right .btn-group[role="group"] {
		flex-shrink: 0;
	}
	#layout-navbar .navbar-nav-right .js__search-stock-type {
		padding: 4px 6px !important;
		font-size: 11px !important;
		line-height: 1.2 !important;
	}
	@media (max-width: 480px) {
		/* On <= 480px narrow screens, collapse the 3 wide radio buttons so search input & icons never collide */
		#layout-navbar .navbar-nav-right .btn-group[role="group"] .js__search-stock-type:not(.active) {
			display: none !important;
		}
		#layout-navbar .navbar-nav-right .btn-group[role="group"] .js__search-stock-type.active {
			border-radius: 8px !important;
			padding: 5px 8px !important;
		}
	}
	#layout-navbar .search_header {
		flex: 1 1 auto;
		min-width: 0 !important;
	}
	#layout-navbar .search_header input.form-control {
		width: 100% !important;
		min-width: 70px !important;
		padding: 5px 8px !important;
		font-size: 12.5px !important;
	}

	/* Unit QuickView Popover (.webui-popover & .ta-unit-sheet) Mobile Fit */
	.webui-popover,
	.webui-popover.webui-popover-ta-stock {
		left: 10px !important;
		right: 10px !important;
		width: calc(100vw - 20px) !important;
		max-width: calc(100vw - 20px) !important;
		min-width: 0 !important;
		max-height: 82dvh !important;
		overflow-y: auto !important;
	}
	.webui-popover .arrow {
		display: none !important;
	}
	.ta-unit-sheet {
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
	}
	.ta-unit-sheet .ta-uh {
		padding: 14px 14px 14px !important;
	}
	.ta-unit-sheet .ta-uh-code,
	.ta-unit-sheet .ta-uh-price-val {
		font-size: 18px !important;
	}
	.ta-unit-sheet .ta-ubody {
		padding: 10px 12px !important;
	}
	.ta-unit-sheet .ta-ufoot,
	.ta-unit-sheet .ta-uactions {
		flex-wrap: wrap !important;
		padding: 10px 12px !important;
		gap: 8px !important;
	}
}


/* Single-line <select> carets & Quỹ độc quyền right-edge breathing room */
select:not([multiple]):not([size]),
select.form-select:not([multiple]):not([size]),
select.form-control:not([multiple]):not([size]) {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  display: inline-flex !important;
  align-items: center !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.65rem center !important;
  background-size: 12px 12px !important;
  padding-right: 2.1rem !important;
}
select.w-100:not([multiple]):not([size]),
select.form-select:not(.w-auto):not([multiple]):not([size]),
select.form-control:not(.w-auto):not([multiple]):not([size]) {
  display: flex !important;
}
select::-ms-expand {
  display: none !important;
}
select::picker-icon {
  display: none !important;
  content: "" !important;
}
#tableStockDQ,
.freeze-table {
  padding-bottom: 12px;
}
#tableStockDQ table th:last-child,
#tableStockDQ table td:last-child {
  padding-right: 18px !important;
}
