/* (02/11/2026) ธีม SweetAlert แบบ Modern UI — ใช้ร่วม backoffice / branch / shopping
   ครอบคลุม 3 ไลบรารีที่ใช้ในระบบ:
   - SweetAlert v1  (.sweet-alert)  assets/libs/sweetalert       ← หน้าหลักทั้งหมด
   - SweetAlert 2.x (.swal-modal)   assets/js/sweetalert.min.js  ← หน้า login
   - SweetAlert2    (.swal2-popup)  cdn sweetalert2@11            ← บางหน้า (shopping login, branch barcode)
   ไอคอนวาดใหม่ด้วย SVG (วงกลมสีอ่อน + สัญลักษณ์) · ปุ่มยืนยันใช้สีตามประเภท alert
   ถ้าโค้ดกำหนด confirmButtonColor เอง: #DD6B55 → แดง, #AAAAAA → เทา, สีอื่นคงตามที่ตั้ง */
:root {
	--sw-success: #22C55E; --sw-success-d: #16A34A; --sw-success-bg: #DCFCE7; --sw-success-ring: #F0FDF4;
	--sw-error: #EF4444;   --sw-error-d: #DC2626;   --sw-error-bg: #FEE2E2;   --sw-error-ring: #FEF2F2;
	--sw-warning: #F59E0B; --sw-warning-d: #D97706; --sw-warning-bg: #FEF3C7; --sw-warning-ring: #FFFBEB;
	--sw-info: #3B82F6;    --sw-info-d: #2563EB;    --sw-info-bg: #DBEAFE;    --sw-info-ring: #EFF6FF;
	--sw-question: #8B5CF6; --sw-question-bg: #EDE9FE; --sw-question-ring: #F5F3FF;
	--sw-primary: #2563EB;
	--sw-secondary-bg: #EEF1F5; --sw-secondary-text: #334155;
	--sw-title: #0F172A; --sw-text: #475569;
	--sw-ico-success: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2316A34A' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
	--sw-ico-error: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23DC2626' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M7 7l10 10M17 7L7 17'/%3E%3C/svg%3E");
	--sw-ico-warning: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23D97706' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M12 5.5v8.5'/%3E%3Ccircle cx='12' cy='18.6' r='1.7' fill='%23D97706' stroke='none'/%3E%3C/svg%3E");
	--sw-ico-info: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232563EB' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M12 10.5v8'/%3E%3Ccircle cx='12' cy='5.8' r='1.7' fill='%232563EB' stroke='none'/%3E%3C/svg%3E");
	--sw-ico-question: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237C3AED' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8.8 8.8a3.2 3.2 0 1 1 4.6 2.9c-.9.5-1.4 1.1-1.4 2.1v.7'/%3E%3Ccircle cx='12' cy='18.6' r='1.6' fill='%237C3AED' stroke='none'/%3E%3C/svg%3E");
}

/* ============ SweetAlert v1 (.sweet-alert) ============ */
.sweet-overlay { background-color: rgba(15, 23, 42, .45) !important; }
body .sweet-alert {
	font-family: inherit;
	border-radius: 18px;
	padding: 28px 28px 26px;
	box-shadow: 0 24px 60px rgba(15, 23, 42, .18), 0 2px 8px rgba(15, 23, 42, .06);
}
@media all and (min-width: 541px) {
	body .sweet-alert { width: 440px; margin-left: -248px; }
}
body .sweet-alert h2 { margin: 6px 0 8px; font-size: 22px; font-weight: 600; line-height: 1.35; color: var(--sw-title); }
body .sweet-alert p { font-size: 15.5px; font-weight: 400; line-height: 1.6; color: var(--sw-text); }
body .sweet-alert .sa-icon:not(.sa-custom) {
	width: 72px; height: 72px; margin: 6px auto 18px;
	border: 0 !important; border-radius: 50%;
	background: center / 38px 38px no-repeat;
	box-sizing: content-box;
}
body .sweet-alert .sa-icon:not(.sa-custom) > *,
body .sweet-alert .sa-icon:not(.sa-custom)::before,
body .sweet-alert .sa-icon:not(.sa-custom)::after { display: none !important; }
body .sweet-alert .sa-icon.sa-success { background-color: var(--sw-success-bg); background-image: var(--sw-ico-success); box-shadow: 0 0 0 9px var(--sw-success-ring); }
body .sweet-alert .sa-icon.sa-error   { background-color: var(--sw-error-bg);   background-image: var(--sw-ico-error);   box-shadow: 0 0 0 9px var(--sw-error-ring); }
body .sweet-alert .sa-icon.sa-warning { background-color: var(--sw-warning-bg); background-image: var(--sw-ico-warning); box-shadow: 0 0 0 9px var(--sw-warning-ring); }
body .sweet-alert .sa-icon.sa-info    { background-color: var(--sw-info-bg);    background-image: var(--sw-ico-info);    box-shadow: 0 0 0 9px var(--sw-info-ring); }
body .sweet-alert .sa-icon.sa-custom  { border-radius: 14px; }

body .sweet-alert button {
	min-width: 112px; height: 44px; margin: 22px 5px 0; padding: 0 24px;
	font-family: inherit; font-size: 15.5px; font-weight: 500;
	border-radius: 10px; box-shadow: none !important;
	transition: filter .15s, transform .05s;
}
body .sweet-alert button:hover { filter: brightness(.94); }
body .sweet-alert button:active { transform: translateY(1px); }
body .sweet-alert button.cancel { background-color: var(--sw-secondary-bg) !important; color: var(--sw-secondary-text) !important; }
/* สีปุ่มยืนยัน: ค่าเริ่มต้นของ lib (#8CD4F5) และ #53E69D ที่ใช้ทั่วระบบ → ตามประเภท alert */
body .sweet-alert button.confirm[style*="140, 212, 245"],
body .sweet-alert button.confirm[style*="83, 230, 157"] { background-color: var(--sw-primary) !important; }
body .sweet-alert:has(.sa-success[style*="block"]) button.confirm[style*="140, 212, 245"],
body .sweet-alert:has(.sa-success[style*="block"]) button.confirm[style*="83, 230, 157"] { background-color: var(--sw-success-d) !important; }
body .sweet-alert:has(.sa-error[style*="block"]) button.confirm[style*="140, 212, 245"],
body .sweet-alert:has(.sa-error[style*="block"]) button.confirm[style*="83, 230, 157"] { background-color: var(--sw-error) !important; }
body .sweet-alert:has(.sa-warning[style*="block"]) button.confirm[style*="140, 212, 245"],
body .sweet-alert:has(.sa-warning[style*="block"]) button.confirm[style*="83, 230, 157"] { background-color: var(--sw-warning) !important; }
body .sweet-alert:has(.sa-info[style*="block"]) button.confirm[style*="140, 212, 245"],
body .sweet-alert:has(.sa-info[style*="block"]) button.confirm[style*="83, 230, 157"] { background-color: var(--sw-info-d) !important; }
body .sweet-alert button.confirm[style*="221, 107, 85"] { background-color: var(--sw-error) !important; }
body .sweet-alert button.confirm[style*="170, 170, 170"] { background-color: var(--sw-secondary-bg) !important; color: var(--sw-secondary-text) !important; }
body .sweet-alert fieldset input { height: 44px; border-radius: 10px; border: 1px solid #D8DEE9; font-size: 15px; box-shadow: none; }
body .sweet-alert fieldset input:focus { border-color: var(--sw-primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
body .sweet-alert .sa-error-container { border-radius: 10px; }

/* ============ SweetAlert 2.x (.swal-modal) ============ */
body .swal-overlay { background-color: rgba(15, 23, 42, .45); }
body .swal-overlay .swal-modal {
	width: 440px; max-width: calc(100% - 32px);
	font-family: inherit;
	border-radius: 18px; padding: 10px 6px 4px;
	box-shadow: 0 24px 60px rgba(15, 23, 42, .18), 0 2px 8px rgba(15, 23, 42, .06);
}
body .swal-overlay .swal-title { font-size: 22px; font-weight: 600; color: var(--sw-title); padding: 6px 20px 0; }
body .swal-overlay .swal-text { font-size: 15.5px; line-height: 1.6; color: var(--sw-text); text-align: center; display: block; }
body .swal-overlay .swal-icon:not(.swal-icon--custom) {
	width: 72px; height: 72px; margin: 22px auto 14px;
	border: 0 !important; border-radius: 50%;
	background: center / 38px 38px no-repeat;
	box-sizing: content-box;
}
body .swal-overlay .swal-icon:not(.swal-icon--custom) > *,
body .swal-overlay .swal-icon:not(.swal-icon--custom)::before,
body .swal-overlay .swal-icon:not(.swal-icon--custom)::after { display: none !important; }
body .swal-overlay .swal-icon.swal-icon--success { background-color: var(--sw-success-bg); background-image: var(--sw-ico-success); box-shadow: 0 0 0 9px var(--sw-success-ring); }
body .swal-overlay .swal-icon.swal-icon--error   { background-color: var(--sw-error-bg);   background-image: var(--sw-ico-error);   box-shadow: 0 0 0 9px var(--sw-error-ring); }
body .swal-overlay .swal-icon.swal-icon--warning { background-color: var(--sw-warning-bg); background-image: var(--sw-ico-warning); box-shadow: 0 0 0 9px var(--sw-warning-ring); animation: none; }
body .swal-overlay .swal-icon.swal-icon--info    { background-color: var(--sw-info-bg);    background-image: var(--sw-ico-info);    box-shadow: 0 0 0 9px var(--sw-info-ring); }
body .swal-overlay .swal-footer { text-align: center; padding: 8px 16px 18px; margin-top: 8px; }
body .swal-overlay .swal-button {
	min-width: 112px; height: 44px; padding: 0 24px;
	font-family: inherit; font-size: 15.5px; font-weight: 500;
	border-radius: 10px; box-shadow: none !important;
	background-color: var(--sw-primary) !important; color: #fff;
}
body .swal-overlay .swal-button:hover { filter: brightness(.94); }
body .swal-overlay .swal-button--cancel { background-color: var(--sw-secondary-bg) !important; color: var(--sw-secondary-text) !important; }
body .swal-overlay .swal-modal:has(.swal-icon--success) .swal-button--confirm { background-color: var(--sw-success-d) !important; }
body .swal-overlay .swal-modal:has(.swal-icon--error) .swal-button--confirm   { background-color: var(--sw-error) !important; }
body .swal-overlay .swal-modal:has(.swal-icon--warning) .swal-button--confirm { background-color: var(--sw-warning) !important; }
body .swal-overlay .swal-modal:has(.swal-icon--info) .swal-button--confirm    { background-color: var(--sw-info-d) !important; }
body .swal-overlay .swal-button--danger { background-color: var(--sw-error) !important; }

/* ============ SweetAlert2 (.swal2-popup) ============ */
body .swal2-container.swal2-backdrop-show { background: rgba(15, 23, 42, .45); }
body .swal2-popup {
	width: 440px; max-width: calc(100% - 32px);
	font-family: inherit;
	border-radius: 18px; padding: 28px 22px 24px;
	box-shadow: 0 24px 60px rgba(15, 23, 42, .18), 0 2px 8px rgba(15, 23, 42, .06);
}
body .swal2-popup .swal2-title { font-size: 22px; font-weight: 600; color: var(--sw-title); padding-top: 4px; }
body .swal2-popup .swal2-html-container { font-size: 15.5px; line-height: 1.6; color: var(--sw-text); }
body .swal2-popup .swal2-icon {
	width: 72px; height: 72px; margin: 4px auto 16px;
	border: 0 !important; border-radius: 50%;
	background: center / 38px 38px no-repeat;
}
body .swal2-popup .swal2-icon > *, body .swal2-popup .swal2-icon::before, body .swal2-popup .swal2-icon::after { display: none !important; }
body .swal2-popup .swal2-icon.swal2-success  { background-color: var(--sw-success-bg);  background-image: var(--sw-ico-success);  box-shadow: 0 0 0 9px var(--sw-success-ring); }
body .swal2-popup .swal2-icon.swal2-error    { background-color: var(--sw-error-bg);    background-image: var(--sw-ico-error);    box-shadow: 0 0 0 9px var(--sw-error-ring); }
body .swal2-popup .swal2-icon.swal2-warning  { background-color: var(--sw-warning-bg);  background-image: var(--sw-ico-warning);  box-shadow: 0 0 0 9px var(--sw-warning-ring); }
body .swal2-popup .swal2-icon.swal2-info     { background-color: var(--sw-info-bg);     background-image: var(--sw-ico-info);     box-shadow: 0 0 0 9px var(--sw-info-ring); }
body .swal2-popup .swal2-icon.swal2-question { background-color: var(--sw-question-bg); background-image: var(--sw-ico-question); box-shadow: 0 0 0 9px var(--sw-question-ring); }
body .swal2-popup .swal2-actions { margin-top: 22px; gap: 10px; }
body .swal2-popup .swal2-styled {
	min-width: 112px; height: 44px; margin: 0; padding: 0 24px;
	font-size: 15.5px; font-weight: 500; border-radius: 10px; box-shadow: none !important;
}
body .swal2-popup .swal2-styled.swal2-confirm { background-color: var(--sw-primary); }
body .swal2-popup.swal2-icon-success .swal2-styled.swal2-confirm { background-color: var(--sw-success-d); }
body .swal2-popup.swal2-icon-error .swal2-styled.swal2-confirm   { background-color: var(--sw-error); }
body .swal2-popup.swal2-icon-warning .swal2-styled.swal2-confirm { background-color: var(--sw-warning); }
body .swal2-popup.swal2-icon-info .swal2-styled.swal2-confirm    { background-color: var(--sw-info-d); }
body .swal2-popup .swal2-styled.swal2-cancel,
body .swal2-popup .swal2-styled.swal2-deny { background-color: var(--sw-secondary-bg); color: var(--sw-secondary-text); }
body .swal2-popup .swal2-close { color: #94A3B8; font-size: 28px; }
body .swal2-popup .swal2-close:hover { color: var(--sw-title); }

@media (max-width: 480px) {
	body .sweet-alert h2, body .swal-overlay .swal-title, body .swal2-popup .swal2-title { font-size: 20px; }
	body .sweet-alert button, body .swal-overlay .swal-button, body .swal2-popup .swal2-styled { min-width: 96px; }
}
