/*
 * Nút tải danh mục PDF, kiểu trắng viền màu nhấn.
 * Điện thoại (<= 767px): tab dọc dính mép phải.
 * Máy tính (>= 768px, khi bật trong cài đặt): nút vuông 60px nằm trên cột Gọi/Zalo/Messenger.
 */
.cem-pdf {
	display: none;
	position: fixed;
	right: 0;
	bottom: calc(var(--cem-pdf-bottom, 152px) + env(safe-area-inset-bottom, 0px));
	z-index: 99990;
	font-size: 14px;
	line-height: 1.4;
	color: #1f2933;
	-webkit-tap-highlight-color: transparent;
}
@media (max-width: 767px) {
	.cem-pdf { display: block; }
}
.cem-pdf.cem-pdf--desktop { display: block; }

.cem-pdf [hidden] { display: none !important; }
.cem-pdf button,
.cem-pdf a { box-sizing: border-box; font-family: inherit; }

/* Tab thu gọn (điện thoại) */
.cem-pdf button.cem-pdf__tab {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 44px;
	height: auto;
	min-height: 140px;
	margin: 0;
	padding: 14px 0;
	line-height: 1;
	border: 2px solid var(--cem-pdf-accent, #cc202b);
	border-right: 0;
	border-radius: 14px 0 0 14px;
	background: #fff;
	color: var(--cem-pdf-accent, #cc202b);
	cursor: pointer;
	box-shadow: 0 2px 10px rgba(31, 41, 51, 0.22);
}
.cem-pdf__tab-text {
	writing-mode: vertical-rl;
	white-space: nowrap;
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	letter-spacing: 0.02em;
	text-transform: none;
}
.cem-pdf__tab-short { display: none; }

/* Khung mở rộng */
.cem-pdf__panel {
	position: absolute;
	right: max(12px, env(safe-area-inset-right, 0px));
	bottom: 0;
	width: 312px;
	max-width: calc(100vw - 24px);
	padding: 16px;
	background: #fff;
	border: 2px solid var(--cem-pdf-accent, #cc202b);
	border-radius: 16px;
	box-shadow: 0 6px 20px rgba(31, 41, 51, 0.22);
	display: flex;
	flex-direction: column;
	gap: 12px;
}
.cem-pdf__panel[hidden] { display: none !important; }
.cem-pdf__head { display: flex; align-items: flex-start; gap: 10px; }
.cem-pdf__badge {
	flex: none;
	width: 36px;
	height: 36px;
	border-radius: 8px;
	background: #fce8ea;
	background: color-mix(in srgb, var(--cem-pdf-accent, #cc202b) 12%, #fff);
	display: flex;
	align-items: center;
	justify-content: center;
}
.cem-pdf__heading { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cem-pdf__heading strong { font-size: 15px; font-weight: 700; color: #1f2933; }
.cem-pdf__heading small { font-size: 12px; color: #4b5563; }
.cem-pdf button.cem-pdf__close {
	flex: none;
	width: 40px;
	height: 40px;
	margin: -4px -4px 0 0;
	padding: 0;
	border: 1px solid #8a94a0;
	border-radius: 8px;
	background: #fff;
	color: #1f2933;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}
.cem-pdf__desc { margin: 0; font-size: 13px; line-height: 1.45; color: #374151; }
.cem-pdf a.cem-pdf__download {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: 48px;
	border-radius: 10px;
	background: var(--cem-pdf-accent, #cc202b);
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	text-decoration: none;
}
.cem-pdf button.cem-pdf__hide {
	height: 36px;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: #374151;
	font-size: 13px;
	text-decoration: underline;
	text-transform: none;
	cursor: pointer;
}

/* Đã ẩn: chỉ còn mép nhỏ, vùng chạm mở rộng ra 44px */
.cem-pdf button.cem-pdf__handle {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 72px;
	margin: 0;
	padding: 0;
	border: 1.5px dashed var(--cem-pdf-accent, #cc202b);
	border-right: 0;
	border-radius: 10px 0 0 10px;
	background: #fce8ea;
	background: color-mix(in srgb, var(--cem-pdf-accent, #cc202b) 12%, #fff);
	color: var(--cem-pdf-accent, #cc202b);
	cursor: pointer;
}
.cem-pdf__handle::before {
	content: "";
	position: absolute;
	top: -8px;
	bottom: -8px;
	left: -24px;
	right: 0;
}

.cem-pdf button:focus-visible,
.cem-pdf a:focus-visible {
	outline: 3px solid #1f2933;
	outline-offset: 2px;
}

/* Máy tính: nút vuông nằm trên cột nút liên hệ có sẵn */
@media (min-width: 768px) {
	.cem-pdf {
		bottom: var(--cem-pdf-bottom-desktop, 300px);
	}
	.cem-pdf button.cem-pdf__tab {
		width: 60px;
		height: 60px;
		min-height: 0;
		padding: 0;
		gap: 1px;
		margin-right: var(--cem-pdf-right-desktop, 13px);
		border-right: 2px solid var(--cem-pdf-accent, #cc202b);
		border-radius: 14px;
	}
	.cem-pdf__tab-text { display: none; }
	.cem-pdf__tab-short {
		display: block;
		font-size: 11px;
		font-weight: 700;
		letter-spacing: 0.04em;
		text-transform: none;
	}
	.cem-pdf__panel {
		right: calc(var(--cem-pdf-right-desktop, 13px) + 60px + 14px);
		width: 320px;
	}
}

@media print {
	.cem-pdf { display: none !important; }
}
