/**
 * ==========================================================================
 * [DPS CUSTOM FIX] - 2026-10-17 - Dev: DPS
 * Mục đích: Stylesheet Cho Trang Tìm Chi Nhánh & Liên Hệ (Store Locator)
 *           - Phân lập 100% (Scoped CSS)
 *           - Chuẩn Responsive 2 Cột Desktop & 1-Chạm Mobile
 *           - Tương thích Leaflet.js & Zero Emoji Policy
 * ==========================================================================
 */

/* Triệt tiêu hoàn toàn breadcrumb / title banner thừa của theme Freshio */
.freshio-breadcrumb,
.page-template-contact-locator .freshio-breadcrumb,
.page-id-7485 .freshio-breadcrumb {
	display: none !important;
	height: 0 !important;
	min-height: 0 !important;
	padding: 0 !important;
	margin: 0 !important;
	overflow: hidden !important;
	visibility: hidden !important;
	opacity: 0 !important;
}

/* 1. Main Wrapper & Typography */
.ksf-locator-wrapper {
	width: 100%;
	max-width: 1360px;
	margin: 0 auto;
	padding: 16px 0 32px 0;
	box-sizing: border-box;
	color: #1e293b;
	font-family: inherit;
}

/* 2. Header Banner */
.ksf-locator-header {
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	padding: 18px 24px;
	margin-bottom: 16px;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.ksf-locator-header-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 14px;
}

.ksf-locator-title {
	margin: 0 0 4px 0 !important;
	font-size: 20px !important;
	font-weight: 700 !important;
	color: #008848 !important;
	letter-spacing: -0.3px;
	line-height: 1.3 !important;
}

.ksf-locator-slogan {
	margin: 0 !important;
	font-size: 13.5px !important;
	color: #64748b !important;
	font-weight: 500 !important;
}

.ksf-locator-hotline-box {
	display: flex;
	align-items: center;
	gap: 10px;
	background: #f8fafc;
	padding: 8px 16px;
	border-radius: 30px;
	border: 1px solid #e2e8f0;
}

.ksf-hotline-label {
	font-size: 12px;
	color: #64748b;
	font-weight: 600;
}

.ksf-hotline-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: #008848 !important;
	font-weight: 700 !important;
	font-size: 15px !important;
	text-decoration: none !important;
	transition: color 0.15s ease;
}

.ksf-hotline-link:hover {
	color: #006837 !important;
}

/* 3. District Filters */
.ksf-locator-filters {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 16px;
	flex-wrap: wrap;
}

.ksf-filter-label {
	font-size: 12.5px;
	font-weight: 700;
	color: #475569;
}

.ksf-filter-pills {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.ksf-filter-btn {
	background: #ffffff;
	border: 1.5px solid #cbd5e1;
	color: #334155;
	padding: 7px 16px;
	border-radius: 20px;
	font-size: 12.5px;
	font-weight: 700;
	cursor: pointer;
	transition: all 0.15s ease;
	line-height: 1;
	outline: none;
}

.ksf-filter-btn:hover {
	border-color: #008848;
	color: #008848;
}

.ksf-filter-btn.active {
	background: #008848 !important;
	border-color: #008848 !important;
	color: #ffffff !important;
	box-shadow: 0 2px 8px rgba(0, 136, 72, 0.25);
}

/* 4. Mobile Tab Switcher (Ẩn mặc định trên Desktop) */
.ksf-mobile-tab-switcher {
	display: none;
}

/* 5. Main Split Body */
.ksf-locator-body {
	display: grid;
	grid-template-columns: 440px 1fr;
	gap: 20px;
	min-height: 600px;
	align-items: stretch;
}

/* 5.1. Sidebar (Danh Sách Chi Nhánh) */
.ksf-locator-sidebar {
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	padding: 16px;
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.ksf-sidebar-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding-bottom: 12px;
	margin-bottom: 12px;
	border-bottom: 1px solid #f1f5f9;
	font-size: 12.5px;
	font-weight: 700;
	color: #0f172a;
	letter-spacing: 0.3px;
}

.ksf-badge-open {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	background: #ecfdf5;
	color: #16a34a;
	font-size: 11px;
	font-weight: 700;
	padding: 3px 8px;
	border-radius: 12px;
	border: 1px solid #bbf7d0;
}

.ksf-branches-list {
	display: flex;
	flex-direction: column;
	gap: 12px;
	overflow-y: auto;
	max-height: 540px;
	padding-right: 4px;
}

/* Tùy chỉnh thanh cuộn danh sách */
.ksf-branches-list::-webkit-scrollbar {
	width: 5px;
}
.ksf-branches-list::-webkit-scrollbar-thumb {
	background: #cbd5e1;
	border-radius: 4px;
}

/* Branch Card */
.ksf-branch-card {
	background: #ffffff;
	border: 1.5px solid #e2e8f0;
	border-radius: 10px;
	padding: 12px;
	display: flex;
	gap: 12px;
	align-items: flex-start;
	cursor: pointer;
	transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
	box-sizing: border-box;
	text-decoration: none !important;
}

.ksf-branch-card:hover {
	border-color: #008848;
	background: #fbfdfc;
	box-shadow: 0 4px 14px rgba(0, 136, 72, 0.08);
}

.ksf-branch-card.is-active {
	border-color: #008848 !important;
	background: #f0fdf4 !important;
	box-shadow: 0 4px 16px rgba(0, 136, 72, 0.14) !important;
}

.ksf-card-media {
	width: 76px;
	height: 76px;
	min-width: 76px;
	border-radius: 8px;
	overflow: hidden;
	background: #f1f5f9;
	border: 1px solid #e2e8f0;
	flex-shrink: 0;
}

.ksf-card-media img {
	width: 100% !important;
	height: 100% !important;
	object-fit: cover !important;
	display: block !important;
}

.ksf-card-content {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
}

.ksf-card-meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 4px;
}

.ksf-district-tag {
	font-size: 10.5px;
	font-weight: 700;
	background: #e0f2fe;
	color: #0369a1;
	padding: 2px 7px;
	border-radius: 4px;
}

.ksf-status-dot {
	font-size: 10.5px;
	font-weight: 600;
	color: #16a34a;
}

.ksf-card-title {
	margin: 0 0 4px 0 !important;
	font-size: 13.5px !important;
	font-weight: 700 !important;
	color: #0f172a !important;
	line-height: 1.35 !important;
}

.ksf-card-address {
	margin: 0 0 8px 0 !important;
	font-size: 11.5px !important;
	color: #64748b !important;
	line-height: 1.4 !important;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.ksf-card-actions {
	display: flex !important;
	align-items: center !important;
	gap: 5px !important;
	flex-wrap: nowrap !important; /* Tuyệt đối không rớt dòng */
	margin-top: auto !important;
	width: 100% !important;
}

.ksf-btn-card-call,
.ksf-btn-card-maps,
.ksf-btn-card-viewmap {
	flex: 1 1 0 !important;
	min-width: 0 !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 4px !important;
	padding: 5px 4px !important;
	border-radius: 6px !important;
	font-size: 11px !important;
	font-weight: 700 !important;
	text-decoration: none !important;
	transition: all 0.15s ease !important;
	line-height: 1.2 !important;
	box-sizing: border-box !important;
	white-space: nowrap !important;
	border: 1px solid transparent !important;
}

.ksf-btn-card-call {
	background: #ecfdf5 !important;
	color: #008848 !important;
	border-color: #bbf7d0 !important;
}
.ksf-btn-card-call:hover {
	background: #008848 !important;
	color: #ffffff !important;
	border-color: #008848 !important;
}

.ksf-btn-card-maps {
	background: #008848 !important;
	color: #ffffff !important;
	border-color: #008848 !important;
}
.ksf-btn-card-maps:hover {
	background: #006837 !important;
	border-color: #006837 !important;
}

.ksf-btn-card-viewmap {
	background: #f1f5f9 !important;
	color: #334155 !important;
	border-color: #cbd5e1 !important;
	cursor: pointer !important;
	margin-left: 0 !important; /* Xóa margin-left: auto */
}
.ksf-btn-card-viewmap:hover {
	background: #e2e8f0 !important;
	color: #0f172a !important;
	border-color: #94a3b8 !important;
}

.ksf-btn-text-full {
	display: inline;
}
.ksf-btn-text-short {
	display: none;
}

@media (max-width: 1280px) {
	.ksf-btn-text-full {
		display: none !important;
	}
	.ksf-btn-text-short {
		display: inline !important;
	}
}

/* 5.2. Map Panel */
.ksf-locator-map-panel {
	background: #ffffff;
	border: 1px solid #cbd5e1;
	border-radius: 12px;
	overflow: hidden;
	position: relative;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
	height: 600px !important;
	min-height: 600px !important;
	max-height: 600px !important;
	display: flex;
	flex-direction: column;
}

.ksf-map-container {
	width: 100% !important;
	height: 100% !important;
	min-height: 600px !important;
	max-height: 600px !important;
	z-index: 1;
	position: relative;
	outline: none;
}

/* Skeleton Loading */
.ksf-map-skeleton {
	position: absolute;
	inset: 0;
	background: #f8fafc;
	z-index: 500;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	color: #64748b;
	font-size: 13px;
	font-weight: 600;
	transition: opacity 0.3s ease;
}

.ksf-skeleton-spinner {
	width: 32px;
	height: 32px;
	border: 3px solid #e2e8f0;
	border-top-color: #008848;
	border-radius: 50%;
	animation: ksfSpin 0.75s linear infinite;
}

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

/* 6. Leaflet Map Customizations */
.ksf-map-marker {
	background: transparent;
	border: none;
	cursor: pointer;
	filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.25));
	transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ksf-map-marker:hover {
	transform: scale(1.12);
}

.leaflet-popup-content-wrapper {
	padding: 0 !important;
	border-radius: 10px !important;
	box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15) !important;
	overflow: hidden !important;
}

.leaflet-popup-content {
	margin: 0 !important;
	line-height: 1.4 !important;
}

/* Popup Content Card */
.ksf-map-popup {
	font-family: inherit;
	width: 250px;
	padding: 12px;
	box-sizing: border-box;
}

.ksf-popup-img-wrap {
	width: 100%;
	height: 110px;
	border-radius: 6px;
	overflow: hidden;
	margin-bottom: 8px;
	background: #f1f5f9;
}

.ksf-popup-img-wrap img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.ksf-popup-title {
	font-size: 13px !important;
	font-weight: 700 !important;
	color: #008848 !important;
	margin: 0 0 4px 0 !important;
}

.ksf-popup-address {
	font-size: 11px !important;
	color: #475569 !important;
	margin: 0 0 6px 0 !important;
	line-height: 1.35 !important;
}

.ksf-popup-phone {
	font-size: 11.5px !important;
	margin: 0 0 10px 0 !important;
	color: #0f172a !important;
}

.ksf-popup-phone a {
	color: #0284c7 !important;
	font-weight: 700 !important;
	text-decoration: none !important;
}

.ksf-popup-actions {
	display: flex;
	gap: 6px;
}

.ksf-popup-actions a {
	flex: 1;
	text-align: center;
	padding: 6px 4px;
	border-radius: 4px;
	font-size: 11px;
	font-weight: 700;
	text-decoration: none !important;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
}

.ksf-popup-btn-dir {
	background: #008848 !important;
	color: #ffffff !important;
}

.ksf-popup-btn-call {
	background: #0284c7 !important;
	color: #ffffff !important;
}

/* 7. Legal Box */
.ksf-locator-legal {
	margin-top: 20px;
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	padding: 16px 22px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 14px;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.ksf-legal-company {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	max-width: 680px;
}

.ksf-legal-icon {
	color: #008848;
	flex-shrink: 0;
	margin-top: 2px;
}

.ksf-legal-name {
	font-size: 13.5px !important;
	font-weight: 700 !important;
	color: #0f172a !important;
	margin: 0 0 3px 0 !important;
}

.ksf-legal-text {
	font-size: 12px !important;
	color: #64748b !important;
	margin: 0 0 2px 0 !important;
	line-height: 1.4 !important;
}

.ksf-legal-contacts {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

.ksf-legal-cta-btn {
	background: #ecfdf5;
	border: 1.5px solid #008848;
	color: #008848 !important;
	padding: 8px 14px;
	border-radius: 8px;
	font-size: 12.5px;
	font-weight: 700;
	text-decoration: none !important;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	transition: all 0.15s ease;
}

.ksf-legal-cta-btn:hover {
	background: #008848;
	color: #ffffff !important;
}

.ksf-legal-zalo-btn {
	background: #0068ff;
	color: #ffffff !important;
	padding: 8px 14px;
	border-radius: 8px;
	font-size: 12.5px;
	font-weight: 700;
	text-decoration: none !important;
	transition: background 0.15s ease;
}

.ksf-legal-zalo-btn:hover {
	background: #0056d6;
}

/* ==========================================================================
   RESPONSIVE DESIGN CHO TABLET & MOBILE
   ========================================================================== */
@media (max-width: 991px) {
	.ksf-locator-body {
		grid-template-columns: 350px 1fr;
		gap: 14px;
	}
}

@media (max-width: 768px) {
	.ksf-locator-wrapper {
		padding: 10px 0 85px 0 !important; /* Khoảng đệm 85px chống che bởi Mobile Bottom Bar */
	}

	.ksf-locator-header {
		padding: 14px 16px;
		margin-bottom: 12px;
	}

	.ksf-locator-title {
		font-size: 17px !important;
	}

	/* 1. Bộ lọc khu vực: KHÔNG cuộn ngang, tự động wrap hiển thị đủ 4 quận */
	.ksf-locator-filters {
		display: flex !important;
		flex-direction: column !important;
		align-items: flex-start !important;
		gap: 6px !important;
		margin-bottom: 12px !important;
	}

	.ksf-filter-pills {
		display: flex !important;
		flex-wrap: wrap !important;
		overflow-x: visible !important;
		width: 100% !important;
		gap: 6px !important;
		padding-bottom: 0 !important;
	}

	.ksf-filter-btn {
		white-space: nowrap !important;
		padding: 5px 10px !important;
		font-size: 11.5px !important;
		flex-shrink: 0 !important;
	}

	/* 2. Kích hoạt Mobile Segmented Tab Switcher (1 hàng, không rớt dòng số 4) */
	.ksf-mobile-tab-switcher {
		display: flex !important;
		background: #ffffff;
		border: 1px solid #e2e8f0;
		border-radius: 8px;
		padding: 4px;
		margin-bottom: 12px;
		gap: 6px;
	}

	.ksf-mobile-tab-btn {
		flex: 1 !important;
		padding: 8px 6px !important;
		border-radius: 6px !important;
		font-size: 12.5px !important;
		font-weight: 700 !important;
		border: none !important;
		background: #f8fafc !important;
		color: #475569 !important;
		cursor: pointer !important;
		display: inline-flex !important;
		align-items: center !important;
		justify-content: center !important;
		gap: 6px !important;
		transition: all 0.15s ease !important;
		outline: none !important;
		white-space: nowrap !important;
	}

	.ksf-mobile-tab-btn span {
		white-space: nowrap !important;
	}

	.ksf-mobile-tab-btn.active {
		background: #008848 !important;
		color: #ffffff !important;
		box-shadow: 0 2px 6px rgba(0, 136, 72, 0.25) !important;
	}

	/* Tab Switch Panel Logic */
	.ksf-locator-body {
		display: block !important;
	}

	.ksf-locator-sidebar {
		width: 100% !important;
		max-height: none !important;
		padding: 12px;
	}

	.ksf-branches-list {
		max-height: none !important;
		overflow-y: visible !important;
		padding-right: 0 !important;
	}

	.ksf-locator-map-panel {
		width: 100% !important;
		height: 520px !important;
		min-height: 520px !important;
		display: none; /* Ẩn mặc định, bật khi chuyển sang tab Bản Đồ */
	}

	.ksf-map-container {
		min-height: 520px !important;
		height: 520px !important;
	}

	/* 3. Thẻ chi nhánh Mobile: Cả 3 nút cùng 1 hàng duy nhất */
	.ksf-card-actions {
		width: 100% !important;
		margin-top: 8px !important;
		display: flex !important;
		flex-wrap: nowrap !important;
		gap: 4px !important;
	}

	.ksf-btn-card-call,
	.ksf-btn-card-maps,
	.ksf-btn-card-viewmap {
		flex: 1 1 0 !important;
		display: inline-flex !important;
		text-align: center !important;
		justify-content: center !important;
		padding: 6px 2px !important;
		font-size: 10.5px !important;
		margin-left: 0 !important;
	}

	.ksf-btn-text-full {
		display: none !important;
	}
	.ksf-btn-text-short {
		display: inline !important;
	}

	.ksf-locator-legal {
		padding: 14px 16px;
		margin-top: 14px;
	}

	.ksf-legal-contacts {
		width: 100%;
	}

	.ksf-legal-cta-btn,
	.ksf-legal-zalo-btn {
		width: 100%;
		justify-content: center;
		text-align: center;
	}
}
