/* =========================================================
   (03/11/2026) ธีม Dropdown ทั้งระบบ backoffice / branch (โหลดใน function/app_nav_head.php)
   - select2 (single/multi) : ช่อง + ลูกศร chevron + กล่องรายการลอย มุมมน เงา · ตัวเลือก hover/เลือกแล้วมีเครื่องหมายถูก
   - select.minimal (native) : เปลี่ยนลูกศรสามเหลี่ยม+เส้นคั่น เป็น chevron (รายการตอนเปิดเป็นของเบราว์เซอร์ แต่งไม่ได้)
   ไม่กำหนดความสูงช่อง (แต่ละหน้ากำหนดเอง) · สีหลัก --twn-primary
   ========================================================= */
:root {
	--s2-pri: var(--twn-primary, #2B6A94);
	--s2-soft: color-mix(in srgb, var(--s2-pri) 9%, #fff);
	--s2-line: var(--ui-line, #E2E8F0);
	--s2-text: var(--ui-text, #1F2A37);
	--s2-muted: #8592a3;
	--s2-chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 6l4.5 4.5L12.5 6' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	--s2-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-6.5' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* ---------- ช่อง (ปิดอยู่) ---------- */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
	border: 1px solid var(--s2-line) !important;
	border-radius: 10px !important;
	background-color: #fff;
	transition: border-color .15s, box-shadow .15s;
}
.select2-container--default .select2-selection--single:hover,
.select2-container--default .select2-selection--multiple:hover { border-color: color-mix(in srgb, var(--s2-pri) 40%, #fff) !important; }
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--multiple {
	border-color: var(--s2-pri) !important;
	border-radius: 10px !important;
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--s2-pri) 14%, transparent);
	outline: 0;
}
.select2-container--default .select2-selection--single .select2-selection__rendered { color: var(--s2-text); padding-right: 38px; }
.select2-container--default .select2-selection--single .select2-selection__placeholder { color: #9aa5b1; }
.select2-container--default.select2-container--disabled .select2-selection--single,
.select2-container--default.select2-container--disabled .select2-selection--multiple { background-color: var(--ui-bg-mute, #F1F5F9) !important; cursor: not-allowed; }
.select2-container--default.select2-container--disabled .select2-selection__arrow b { opacity: .4; }

/* ลูกศร chevron (แทนสามเหลี่ยม + เส้นคั่น) · กล่องเลือกเป็นจุดอ้างอิงของลูกศร (บางหน้า shopping .select2-container ไม่ได้เป็น relative → ลูกศรลอยขึ้นไปบนกรอบ) */
.select2-container--default .select2-selection--single { position: relative; }
.select2-container--default .select2-selection--single .select2-selection__arrow {
	top: 0 !important; right: 4px !important;
	width: 32px !important; height: 100% !important;
	border: 0 !important; background: none !important;
	transform: none !important; /* ธีมหน้าร้าน shopping ตั้ง translateY(-50%) ไว้คู่ top:50% */
}
.select2-container--default .select2-selection--single .select2-selection__arrow b,
.select2-selection__arrow_new b {
	position: absolute; top: 50% !important; left: 50% !important;
	width: 16px !important; height: 16px !important;
	margin: 0 !important; border: 0 !important;
	background: var(--s2-muted) !important;
	-webkit-mask: var(--s2-chev) center / 16px no-repeat;
	mask: var(--s2-chev) center / 16px no-repeat;
	transform: translate(-50%, -50%);
	transition: transform .2s ease, background-color .15s;
}
.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b,
.select2-container--open .select2-selection__arrow_new b {
	background: var(--s2-pri) !important;
	transform: translate(-50%, -50%) rotate(180deg);
}

/* ---------- กล่องรายการ ---------- */
.select2-container--open .select2-dropdown {
	overflow: hidden;
	padding: 6px;
	border: 1px solid #e3e8ef !important;
	border-radius: 12px !important;
	background: #fff;
	box-shadow: 0 16px 36px rgba(15, 30, 50, .14), 0 3px 8px rgba(15, 30, 50, .06);
	min-width: 150px;
}
.select2-container--open .select2-dropdown--below { margin-top: 6px; animation: s2Down .16s ease-out; }
.select2-container--open .select2-dropdown--above { margin-top: -6px; animation: s2Up .16s ease-out; }
@keyframes s2Down { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes s2Up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ช่องค้นหาในกล่อง */
.select2-container--default .select2-search--dropdown { position: relative; padding: 0 0 6px; }
.select2-container--default .select2-search--dropdown::before {
	content: ""; position: absolute; left: 11px; top: 11px;
	width: 15px; height: 15px;
	background: var(--s2-muted);
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='7' cy='7' r='4.8' fill='none' stroke='%23000' stroke-width='1.8'/%3E%3Cpath d='M10.6 10.6L14 14' stroke='%23000' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") center / 15px no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='7' cy='7' r='4.8' fill='none' stroke='%23000' stroke-width='1.8'/%3E%3Cpath d='M10.6 10.6L14 14' stroke='%23000' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") center / 15px no-repeat;
	pointer-events: none;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
	height: 37px; padding: 0 10px 0 34px;
	border: 1px solid var(--s2-line) !important;
	border-radius: 9px;
	background: var(--ui-bg-soft, #F8FAFC);
	font-size: 14px; color: var(--s2-text);
	outline: 0;
	transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.select2-container--default .select2-search--dropdown .select2-search__field:focus {
	border-color: var(--s2-pri) !important;
	background: #fff;
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--s2-pri) 12%, transparent);
}

/* ตัวเลือก */
.select2-container--default .select2-results > .select2-results__options { max-height: 260px; scrollbar-width: thin; scrollbar-color: #cfd8e3 transparent; }
.select2-container--default .select2-results__option {
	position: relative;
	margin: 1px 0;
	padding: 9px 34px 9px 12px;
	border-radius: 8px;
	font-size: 14.5px; line-height: 1.35;
	color: var(--s2-text);
	transition: background-color .12s, color .12s;
}
.select2-container--default .select2-results__option[aria-selected="true"] {
	background-color: var(--s2-soft) !important;
	color: var(--s2-pri) !important;
	font-weight: 600;
}
.select2-container--default .select2-results__option[aria-selected="true"]::after {
	content: ""; position: absolute; right: 11px; top: 50%;
	width: 16px; height: 16px; margin-top: -8px;
	background: var(--s2-pri);
	-webkit-mask: var(--s2-check) center / 16px no-repeat;
	mask: var(--s2-check) center / 16px no-repeat;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
	background: var(--ui-bg-mute, #F1F5F9) !important;
	color: var(--s2-text) !important;
}
.select2-container--default .select2-results__option--highlighted[aria-selected="true"] {
	background: color-mix(in srgb, var(--s2-pri) 14%, #fff) !important;
	color: var(--s2-pri) !important;
}
.select2-container--default .select2-results__option[aria-disabled="true"] { color: #b4bfcc !important; background: none !important; cursor: not-allowed; }
.select2-container--default .select2-results__option.select2-results__message { color: var(--s2-muted); text-align: center; padding-right: 12px; }
.select2-container--default .select2-results__group { padding: 8px 12px 4px; font-size: 12px; font-weight: 700; color: var(--s2-muted); text-transform: uppercase; letter-spacing: .3px; }

/* multi : ป้ายที่เลือก */
.select2-container--default .select2-selection--multiple .select2-selection__choice {
	border: 0 !important; border-radius: 7px !important;
	background: var(--s2-soft) !important;
	color: var(--s2-pri) !important; font-weight: 600;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove { color: var(--s2-pri) !important; opacity: .65; }
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover { opacity: 1; }

/* ---------- select.minimal (native) : chevron แทนสามเหลี่ยม+เส้นคั่น ----------
   (09/11/2026) รวม select.form-control ทั่วไปใน #page-wrapper (bo/branch) ที่ไม่ได้ใส่ .minimal ด้วย เช่น CMS 9|x, Banner Shopping 2|12, CEO dashboard */
select.minimal, select.minimal:focus,
#page-wrapper select.form-control:not([multiple]):not([size]), #page-wrapper select.form-control:not([multiple]):not([size]):focus {
	-webkit-appearance: none; appearance: none;
	padding-right: 38px !important;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 6l4.5 4.5L12.5 6' fill='none' stroke='%238592a3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
	background-position: right 12px center !important;
	background-size: 16px 16px !important;
	background-repeat: no-repeat !important;
	cursor: pointer;
}
/* (03/11/2026) #customArrow (rpdialog.php) มีไว้ย้ายเข้า select2-multi · หน้าที่ไม่มี select2-multi ลูกศรค้างลอยกลางหน้า → ซ่อน */
#customArrow { display: none; }
.select2-selection #customArrow { display: block; position: absolute; top: 0; right: 4px; width: 32px; height: 100%; } /* ลูกศรชิดขวาเหมือน select2 แบบเลือกเดียว (เดิมต่อท้ายข้อความ) */
.select2-container--default .select2-selection--multiple:has(#customArrow) { position: relative; padding-right: 36px; }
