/* Flex thay vì stack khối thuần: field--full luôn chiếm trọn 1 hàng (flex-basis 100%, giống hệt
 * hành vi cũ), field--half/--third cùng hàng với field liền kề cũng half/third nhờ flex-wrap tự
 * xuống hàng khi vượt 100% — không cần khái niệm "row" riêng, thứ tự field (đã kéo-thả sắp xếp ở
 * admin) quyết định field nào đứng cạnh field nào. Field bị ẩn (display:none, xem apf-conditional)
 * tự động không chiếm chỗ trong flex row, không cần xử lý gì thêm. */
.apf-fields-wrap {
	display: flex;
	flex-wrap: wrap;
	margin: 0 0 20px;
	gap: 14px 16px;
}

.apf-field {
	flex: 1 1 100%;
}

.apf-field--half {
	flex: 1 1 calc(50% - 8px);
}

.apf-field--third {
	flex: 1 1 calc(33.333% - 11px);
}

@media (max-width: 640px) {
	.apf-field--half,
	.apf-field--third {
		flex: 1 1 100%;
	}
}

.apf-field-label {
	display: block;
	font-weight: 600;
	margin-bottom: 6px;
}

/* Lựa chọn hiện tại hiển thị cạnh nhãn, vd. "Color: Turquoise" */
.apf-field-selected {
	font-weight: 400;
	color: #666;
}

.apf-required {
	color: #b32d2e;
	margin-left: 4px;
}

/* #2 — tooltip "?" cạnh nhãn field, nội dung hiện khi hover/focus */
.apf-field-tip {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 16px;
	height: 16px;
	margin-left: 5px;
	border-radius: 50%;
	background: #b9bfca;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
	vertical-align: middle;
	cursor: help;
	/* Viền trong suốt sẵn ở trạng thái mặc định — để lúc hover (loại "link") chỉ cần đổi màu viền
	 * chứ không thêm border mới, tránh icon đổi kích thước/giật layout khi hover. */
	border: 1.5px solid transparent;
	text-decoration: none;
	transition: background-color 0.15s, border-color 0.15s;
}

.apf-field-tip::before {
	content: "?";
}

/* Loại "link": bấm vào mở URL ở tab mới (không có bubble — click đã điều hướng đi luôn), nên cần
 * cursor + phản hồi hover rõ ràng hơn hẳn "help" mặc định để báo đây là link bấm được, không phải
 * chỉ để đọc. Nền đậm hơn + hiện viền — không đổi kích thước (xem border transparent ở trên). */
.apf-field-tip--link {
	cursor: pointer;
}

.apf-field-tip--link:hover,
.apf-field-tip--link:focus-visible {
	background: #161735;
	border-color: #161735;
	color: white;
}

/* ===== Edit cart item options — link trên trang giỏ hàng/checkout, nút Huỷ và ghi chú "File hiện
 * tại" trên trang sản phẩm khi đang sửa 1 cart item đã có. Xem class-apf-cart-edit.php. */
.apf-edit-cart-link {
	display: inline-block;
	margin-top: 4px;
	font-size: 12.5px;
	color: #161735;
	text-decoration: underline;
}

.apf-edit-cancel {
	margin: 8px 0 0;
}

.apf-edit-cancel a {
	font-size: 13px;
	color: #666;
}

.apf-upload-current-note {
	margin: 0 0 8px;
	padding: 6px 10px;
	border-radius: 6px;
	background: #f3f4f6;
	color: #444;
	font-size: 12.5px;
}

.apf-field-tip-bubble {
	position: absolute;
	bottom: calc(100% + 8px);
	left: 50%;
	transform: translateX(-50%);
	z-index: 20;
	width: max-content;
	max-width: 240px;
	padding: 8px 10px;
	border-radius: 6px;
	background: #1f2430;
	color: #fff;
	font-size: 12.5px;
	font-weight: 400;
	line-height: 1.4;
	text-align: left;
	white-space: normal;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.12s;
	pointer-events: none;
}

.apf-field-tip-bubble::after {
	content: "";
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	border: 5px solid transparent;
	border-top-color: #1f2430;
}

.apf-field-tip:hover .apf-field-tip-bubble,
.apf-field-tip:focus .apf-field-tip-bubble,
.apf-field-tip:focus-visible .apf-field-tip-bubble {
	opacity: 1;
	visibility: visible;
}

.apf-field-error .apf-field-label {
	color: #b32d2e;
}

.apf-input {
	max-width: 100%;
}

/* ===== Select / Text / Textarea — chọn theo tag name (không phải class trần .apf-input) vì
 * class đó cũng nằm trên input ẩn của radio/checkbox/media-grid; scope theo tag để không ăn
 * chéo sang các type khác. */
select.apf-input,
input[type="text"].apf-input,
textarea.apf-input {
	display: block;
	width: 100%;
	border: 1.5px solid #d8dae0;
	border-radius: 10px;
	background-color: #fff;
	color: #1f2430;
	font-family: inherit;
	font-size: 14.5px;
	line-height: 1.4;
	transition: border-color 0.15s, box-shadow 0.15s;
}

textarea.apf-input {
	min-height: 90px;
	resize: vertical;
}

select.apf-input {
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	padding-right: 36px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5 7l5 5 5-5' stroke='%23555b66' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
	background-size: 11px;
	cursor: pointer;
	height: 40px;
}

select.apf-input:hover,
input[type="text"].apf-input:hover,
textarea.apf-input:hover {
	border-color: #b7bac3;
}

select.apf-input:focus,
input[type="text"].apf-input:focus,
textarea.apf-input:focus {
	outline: none;
	border-color: #161735;
	box-shadow: 0 0 0 3px rgba(22, 23, 53, 0.15);
}

input[type="text"].apf-input::placeholder,
textarea.apf-input::placeholder {
	color: #9aa0ab;
}

.apf-radio-group,
.apf-checkbox-group {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.apf-radio-option,
.apf-checkbox-option {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-weight: 400;
}

/* ===== Tag tabs — lọc option theo tag (radio/checkbox inline, swatch trong drawer). Cùng 1 class
 * "ALL" + N tag, style pill nhỏ gọn nhất quán với các "pill" khác đã có trong file này. */
.apf-tag-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}

.apf-tag-tab {
	font-family: inherit;
	font-size: 12.5px;
	font-weight: 600;
	padding: 5px 12px;
	margin-right: 0;
	margin-bottom: 0;
	border: 1.5px solid #d8dae0;
	border-radius: 999px !important;
	background: #fff;
	color: #444;
	cursor: pointer;
	transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.apf-tag-tab:hover {
	border-color: #b7bac3;
}

.apf-tag-tab.is-active {
	border-color: #161735;
	background: #161735;
	color: #fff;
}

.apf-tag-tab:focus-visible {
	outline: 2px solid #161735;
	outline-offset: 2px;
}

/* Option bị lọc-ẩn theo tag — khác .apf-conditional (điều kiện hiển thị): tag chỉ là duyệt tạm,
 * input thật có thể vẫn giữ nguyên trạng thái checked (xem initTagTabs() trong frontend.js).
 * !important bắt buộc: class này áp lên .apf-radio-option/.apf-checkbox-option/.apf-media-tile —
 * mỗi loại đều tự đặt "display" riêng (inline-flex/flex), cùng specificity (0,1,0) như nhau, nên
 * nếu không ép !important thì thứ tự khai báo trong file mới là thứ quyết định ai thắng (ẩn có
 * thể bị chính display riêng của phần tử đè ngược lại) thay vì luôn ẩn như class này phải làm. */
.apf-tag-hidden {
	display: none !important;
}

/* Hàng tab bên trong drawer swatch cần margin dưới nhỏ hơn (đã có padding của
 * .apf-media-grid--drawer ngay sau nó) và margin ngang khớp padding của drawer panel. */
.apf-tag-tabs--drawer {
	margin: 0;
	padding: 12px 16px 12px;
}

/* ===== Display style: Pills (nút bấm dạng chữ) — chỉ đổi CSS, input radio/checkbox thật vẫn
 * còn nguyên (ẩn khỏi mắt nhưng vẫn focus/click được qua <label>) nên cart/pricing/frontend.js
 * không cần biết gì về style này — xem class-apf-field-render-radio.php / -checkbox.php. */
.apf-radio-group--pills .apf-radio-option input,
.apf-checkbox-group--pills .apf-checkbox-option input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	opacity: 0;
}

.apf-radio-group--pills .apf-radio-option,
.apf-checkbox-group--pills .apf-checkbox-option {
	position: relative;
	gap: 0;
	padding: 8px 16px;
	border: 1.5px solid #d8dae0;
	border-radius: 999px;
	background: #fff;
	cursor: pointer;
	transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.apf-radio-group--pills .apf-radio-option:hover,
.apf-checkbox-group--pills .apf-checkbox-option:hover {
	border-color: #b7bac3;
}

.apf-radio-group--pills .apf-radio-option:has(input:checked),
.apf-checkbox-group--pills .apf-checkbox-option:has(input:checked) {
	border-color: #161735;
	background: #161735;
	color: #fff;
}

.apf-radio-group--pills .apf-radio-option:has(input:focus-visible),
.apf-checkbox-group--pills .apf-checkbox-option:has(input:focus-visible) {
	outline: 2px solid #161735;
	outline-offset: 2px;
}

/* ===== Display style: Switch (công tắc bật/tắt) — checkbox thật (name="...[]") ẩn khỏi mắt,
 * track+thumb chỉ là lớp vỏ CSS đọc trạng thái :checked qua sibling combinator (không cần JS). */
.apf-switch {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	cursor: pointer;
	font-weight: 400;
}

.apf-switch-input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	opacity: 0;
}

.apf-switch-track {
	position: relative;
	flex: none;
	width: 40px;
	height: 22px;
	border-radius: 999px;
	background: #ccced4;
	transition: background 0.15s;
}

.apf-switch-thumb {
	position: absolute;
	top: 2px;
	left: 2px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
	transition: transform 0.15s;
}

.apf-switch-input:checked ~ .apf-switch-track {
	background: #161735;
}

.apf-switch-input:checked ~ .apf-switch-track .apf-switch-thumb {
	transform: translateX(18px);
}

.apf-switch-input:focus-visible ~ .apf-switch-track {
	outline: 2px solid #161735;
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.apf-switch-track,
	.apf-switch-thumb {
		transition: none;
	}
}

/* #4 — tổng kết giá ở cuối field group (bảng hoặc 1 dòng tổng) */
.apf-price-summary {
	margin-top: 12px;
}

.apf-price-total-line {
	font-weight: 600;
	font-size: 1.05em;
}

.apf-price-summary-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.95em;
}

.apf-price-summary-table td {
	padding: 5px 0;
	border-bottom: 1px solid #ececec;
	vertical-align: top;
}

.apf-price-summary-table .apf-ps-price {
	text-align: right;
	white-space: nowrap;
	padding-left: 16px;
	font-variant-numeric: tabular-nums;
}

.apf-price-summary-table .apf-ps-base td {
	color: #666;
}

.apf-price-summary-table .apf-ps-total td {
	border-bottom: 0;
	border-top: 2px solid #333;
	font-weight: 700;
	font-size: 1.05em;
	padding-top: 8px;
}

/* =====================================================================
 * Media grid dùng chung cho swatch (option có ảnh)
 * PHP in radio thật (nguồn sự thật); JS ẩn khối đó và dựng lưới tile.
 * Xem APF_Field_Render_Media_Grid + enhanceMediaField() trong frontend.js.
 * ===================================================================== */
.apf-media-field {
	position: relative;
}

/* Khối radio gốc: hiện dạng danh sách chọn được nếu JS tắt (fallback). Khi JS bật (.apf-enhanced)
 * thì ẩn khỏi mắt NHƯNG vẫn focus được để dùng bàn phím (không dùng display:none). */
/* Ẩn radio gốc MẶC ĐỊNH (JS sẽ dựng lưới; skeleton giữ chỗ; <noscript> hiện lại nếu tắt JS) —
 * tránh "loé" danh sách radio trước khi ra ảnh. flex-wrap/gap giữ lại để dùng khi noscript bật
 * display:flex. */
.apf-media-native {
	display: none;
	flex-wrap: wrap;
	gap: 10px;
}

.apf-media-native__opt {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-weight: 400;
}

/* Sau khi JS enhance: ẩn khỏi mắt nhưng VẪN focus được bằng bàn phím (display:block để không
 * bị display:none ở trên làm mất focusability của radio). */
.apf-media-field.apf-enhanced .apf-media-native {
	display: block;
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* Skeleton giữ chỗ trong lúc JS chưa dựng lưới (chống CLS). Cùng gap + aspect-ratio với tile thật
 * nên khi thay bằng lưới thật gần như không đổi chiều cao. Tự ẩn khi field đã enhance. */
.apf-media-skeleton {
	display: grid;
	grid-template-columns: repeat(var(--apf-sk-cols, 6), 1fr);
	gap: 10px;
}

.apf-media-field.apf-enhanced .apf-media-skeleton {
	display: none;
}

.apf-media-skeleton-cell {
	aspect-ratio: 1 / 1;
	border-radius: 10px;
	background: #e9e9ec;
	animation: apf-skeleton-pulse 1.2s ease-in-out infinite;
}

@keyframes apf-skeleton-pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.5; }
}

@media (max-width: 640px) {
	.apf-media-skeleton {
		grid-template-columns: repeat(var(--apf-sk-cols-mobile, 5), 1fr);
	}
	/* Mobile luôn tối đa 5 ô -> ẩn ô thứ 6 trở đi để chiều cao khớp lưới thật (không dư hàng). */
	.apf-media-skeleton-cell:nth-child(n+6) {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.apf-media-skeleton-cell {
		animation: none;
	}
}

/* ----- Lưới tile ----- */
.apf-media-grid {
	display: grid;
	gap: 10px;
	margin: 0;
}

.apf-media-grid--inline {
	grid-template-columns: repeat(var(--apf-inline-cols, 6), 1fr);
}

.apf-media-tile {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 5px;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
	text-align: center;
	/* Grid item mặc định min-width:auto -> co giãn theo nội dung nhỏ nhất, mà nhãn "white-space:
	 * nowrap" (.apf-media-tile__label) có "min-content" = trọn chiều rộng chữ -> cả cột lưới bị
	 * đẩy giãn ra để chứa vừa chữ, phá vỡ layout repeat(N, 1fr) đều cột (tràn ngoài trên mobile,
	 * cột hẹp). Ép min-width:0 để tile chịu co theo đúng track lưới, nhường việc cắt chữ lại cho
	 * text-overflow:ellipsis của .apf-media-tile__label. */
	min-width: 0;
}

.apf-media-thumb {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	box-sizing: border-box;
	border: 1px solid #e2e2e2;
	border-radius: 10px;
	background-size: cover;
	background-repeat: no-repeat;
	background-position: center;
	transition: box-shadow 0.15s, border-color 0.15s;
}

.apf-media-tile.is-selected .apf-media-thumb {
	border-color: #161735;
	box-shadow: 0 0 0 2px #161735;
}

.apf-media-tile.is-focus .apf-media-thumb {
	box-shadow: 0 0 0 2px #161735;
}

.apf-media-thumb--text {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 4px;
	font-size: 12px;
	line-height: 1.2;
	text-align: center;
	word-break: break-word;
	color: #333;
	background: #f5f5f5;
}

.apf-media-tile__label {
	font-size: 12px;
	font-weight: 400;
	line-height: 1.25;
	color: #333;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Nút phóng to (lightbox) — chỉ hiện trên tile có ảnh */
.apf-media-zoom {
	position: absolute;
	top: 4px;
	right: 4px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	color: #333;
	background: rgba(255, 255, 255, 0.9);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.15s;
	min-height: auto;
    min-width: auto;
    margin-right: 0;
}

.apf-media-tile:hover .apf-media-zoom,
.apf-media-zoom:focus-visible {
	opacity: 1;
}

@media (hover: none) {
	.apf-media-zoom {
		opacity: 1;
	}
}

/* ----- Ô cuối "xem thêm": overlay chồng lên chính 1 option ----- */
.apf-media-more__overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	aspect-ratio: 1 / 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	border-radius: 10px;
	color: #fff;
	background: rgba(20, 22, 30, 0.55);
}

.apf-media-more-count {
	font-size: 15px;
	font-weight: 700;
	line-height: 1;
}

.apf-media-more-text {
	font-size: 11px;
	opacity: 0.9;
	font-weight: normal;
    line-height: 15px;
}

.apf-media-more:hover .apf-media-more__overlay {
	background: rgba(20, 22, 30, 0.65);
}

/* ----- Drawer ----- */
.apf-media-drawer {
	position: fixed;
	inset: 0;
	/* Cao hơn hẳn z-index sticky header/nav thường gặp ở theme — giờ drawer gắn thẳng vào <body>
	 * (xem enhanceMediaField() trong frontend.js) nên không còn bị giới hạn bởi containing block
	 * của tổ tiên, chỉ cần z-index đủ cao là chắc chắn phủ lên mọi thứ khác trên trang. */
	z-index: 999999;
}

.apf-media-drawer[hidden] {
	display: none;
}

.apf-media-drawer__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	opacity: 0;
	transition: opacity 0.25s ease;
}

.apf-media-drawer.is-open .apf-media-drawer__backdrop {
	opacity: 1;
}

/* Desktop: sidebar trượt từ phải */
.apf-media-drawer__panel {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	display: flex;
	flex-direction: column;
	width: min(50%, 92vw);
	background: #fff;
	box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
	transform: translateX(100%);
	transition: transform 0.25s ease;
}

.apf-media-drawer.is-open .apf-media-drawer__panel {
	transform: none;
}

.apf-media-drawer__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 14px;
	border-bottom: 1px solid #eee;
}

/* "Nhãn field: lựa chọn đang chọn", vd. "Buckle: Elegant SS Black (Shiny)" — luôn cắt bớt bằng
 * "..." thay vì đẩy nút đóng ra ngoài khi field/lựa chọn có tên dài. */
.apf-media-drawer__title {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-size: 18px;
	font-weight: 600;
	color: #1f2430;
}

.apf-media-drawer__close {
	width: 34px;
	height: 34px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	font-size: 22px;
	line-height: 1;
	color: #333;
	background: #f2f2f3;
	cursor: pointer;
	min-height: auto;
    min-width: auto;
    margin-right: 0;
	margin-bottom: 0;
}

.apf-media-drawer__close:hover {
	background: #e6e6e8;
}

.apf-media-grid--drawer {
	grid-template-columns: repeat(var(--apf-cols, 4), 1fr);
	gap: 12px;
	padding: 16px;
	overflow-y: auto;
}

/* Mobile: bottom sheet trượt từ dưới lên */
@media (max-width: 640px) {
	.apf-media-drawer__panel {
		top: auto;
		left: 0;
		right: 0;
		bottom: 0;
		width: auto;
		max-height: 82vh;
		border-radius: 16px 16px 0 0;
		box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.18);
		transform: translateY(100%);
	}

	.apf-media-drawer.is-open .apf-media-drawer__panel {
		transform: none;
	}
}

/* Khoá cuộn bằng position:fixed (JS set "top" = -scrollY tại lúc khoá) thay vì overflow:hidden —
 * xem ghi chú đầy đủ tại lockBodyScroll()/unlockBodyScroll() trong frontend.js: overflow:hidden
 * làm biến mất thanh cuộn -> trình duyệt reflow toàn trang -> gallery sticky của theme tính lại vị
 * trí và bị giật. width:100% bắt buộc vì position:fixed tự co body theo nội dung, không còn theo
 * chiều rộng viewport, nếu thiếu dòng này trang sẽ bị co hẹp ngang lúc khoá. */
body.apf-media-no-scroll {
	position: fixed;
	left: 0;
	right: 0;
	width: 100%;
}

/* ----- Lightbox ----- */
.apf-media-lightbox {
	position: fixed;
	inset: 0;
	/* Cao hơn drawer 1 bậc — lightbox có thể mở TỪ drawer (bấm icon phóng to trên tile trong
	 * drawer) nên phải luôn phủ lên trên drawer đang mở. */
	z-index: 1000000;
	display: flex;
	align-items: center;
	justify-content: center;
}

.apf-media-lightbox[hidden] {
	display: none;
}

.apf-media-lightbox__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.85);
}

.apf-media-lightbox__img {
	position: relative;
	max-width: 90vw;
	max-height: 90vh;
	border-radius: 6px;
	box-shadow: 0 6px 40px rgba(0, 0, 0, 0.5);
	transition: opacity 0.15s ease;
}

/* Ảnh mới đang preload ở nền (xem renderLightbox() trong frontend.js) -- dim ảnh CŨ đang hiển thị
 * để báo hiệu rõ đang đổi ảnh, tránh cảm giác "giật"/hiện nhầm ảnh trước đó trong lúc chờ tải. */
.apf-media-lightbox__img.is-loading {
	opacity: 0.25;
}

.apf-media-lightbox__close,
.apf-media-lightbox__nav {
	position: absolute;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: 0;
	border-radius: 50%;
	color: #fff;
	background: rgba(255, 255, 255, 0.15);
	cursor: pointer;
	line-height: 1;
	min-height: auto;
    min-width: auto;
    margin-right: 0;
}

.apf-media-lightbox__close:hover,
.apf-media-lightbox__nav:hover {
	background: rgba(255, 255, 255, 0.3);
}

.apf-media-lightbox__close {
	top: 16px;
	right: 20px;
	width: 40px;
	height: 40px;
	font-size: 26px;
}

.apf-media-lightbox__nav {
	top: 50%;
	width: 46px;
	height: 46px;
	font-size: 30px;
	transform: translateY(-50%);
}

.apf-media-lightbox__prev {
	left: 20px;
}

.apf-media-lightbox__next {
	right: 20px;
}

@media (prefers-reduced-motion: reduce) {
	.apf-media-drawer__backdrop,
	.apf-media-drawer__panel,
	.apf-media-thumb,
	.apf-media-zoom {
		transition: none;
	}
}

/* ===== #3 Upload dropzone ===== */
.apf-upload-dropzone {
	padding: 28px 20px;
	border: 2px dashed #cfd2da;
	border-radius: 10px;
	text-align: center;
	cursor: pointer;
	transition: border-color 0.15s, background 0.15s;
}

.apf-upload-dropzone.is-dragover {
	border-color: #161735;
	background: rgba(31, 43, 108, 0.04);
}

.apf-upload-dropzone:focus-visible {
	outline: 2px solid #161735;
	outline-offset: 2px;
}

.apf-upload-hint {
	margin: 0 0 12px;
	color: #555;
}

.apf-upload-note {
	margin: 8px 0 0;
	font-size: 12.5px;
	color: #777;
}

.apf-upload-error {
	margin: 6px 0 0;
	font-size: 12.5px;
	color: #b32d2e;
}

.apf-upload-list {
	list-style: none;
	margin: 10px 0 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.apf-upload-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 7px 10px;
	border: 1px solid #e6e8ec;
	border-radius: 8px;
	background: #f5f6f8;
	font-size: 13.5px;
	margin-left: 0 !important;
}

/* Preview blob tức thì lúc chọn file (URL.createObjectURL) — không đợi upload xong mới hiện. */
.apf-upload-thumb {
	flex: none;
	width: 72px;
	height: 72px;
	border-radius: 6px;
	overflow: hidden;
	background: #e6e8ec;
}

.apf-upload-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.apf-upload-thumb--file {
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 9.5px;
	font-weight: 700;
	letter-spacing: 0.02em;
	color: #667;
}

.apf-upload-meta {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.apf-upload-name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.apf-upload-size {
	color: #777;
	font-size: 11.5px;
	font-variant-numeric: tabular-nums;
}

/* Trạng thái đang tải lên (icon xoay) / đã xong (dấu tick) — bơm bằng CSS, không cần ảnh. */
.apf-upload-status {
	flex: none;
	width: 16px;
	height: 16px;
}

.apf-upload-item.is-uploading .apf-upload-status {
	border: 2px solid #d3d6db;
	border-top-color: #161735;
	border-radius: 50%;
	animation: apf-upload-spin 0.7s linear infinite;
}

.apf-upload-item.is-done .apf-upload-status {
	position: relative;
}

.apf-upload-item.is-done .apf-upload-status::after {
	content: "✓";
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #2e8b57;
	font-size: 13px;
}

@keyframes apf-upload-spin {
	to {
		transform: rotate(360deg);
	}
}

@media (prefers-reduced-motion: reduce) {
	.apf-upload-item.is-uploading .apf-upload-status {
		animation: none;
	}
}

.apf-upload-remove {
	flex: none;
	width: 22px;
	height: 22px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #e2e4e8;
	color: #444;
	line-height: 1;
	cursor: pointer;
}

.apf-upload-remove:hover {
	background: #d3d6db;
}
