/* ==========================================================================
   TU Law Application Form - Ultimate Wizard UI v2 (Depth + Motion + Progress)
   ========================================================================== */

@keyframes tuFadeUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes tuPulse {
    0%   { box-shadow: 0 0 0 0 rgba(242,169,0,.45), 0 6px 14px rgba(0,0,0,.18); }
    70%  { box-shadow: 0 0 0 14px rgba(242,169,0,0), 0 6px 14px rgba(0,0,0,.18); }
    100% { box-shadow: 0 0 0 0 rgba(242,169,0,0), 0 6px 14px rgba(0,0,0,.18); }
}
@keyframes tuPop {
    0%   { transform: scale(0) rotate(-30deg); opacity: 0; }
    70%  { transform: scale(1.25) rotate(5deg); opacity: 1; }
    100% { transform: scale(1) rotate(0); }
}
@keyframes tuBadge {
    0%, 100% { opacity: 1; }
    50%      { opacity: .65; }
}

.tu-application-wrapper {
    font-family: 'Prompt', sans-serif !important;
    width: 100%;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 8px 28px rgba(15,23,42,.07);
    overflow: hidden;
    margin-bottom: 60px;
    border: 1px solid #f1f5f9;
}

/* --- 1. Header (ส่วนหัวสีแดง) --- */
.tu-form-header {
    background:
        radial-gradient(circle at 85% 15%, rgba(255,255,255,.14), transparent 45%),
        radial-gradient(circle at 10% 90%, rgba(242,169,0,.12), transparent 40%),
        linear-gradient(135deg, #8A1538 0%, #5c0e25 100%);
    padding: 60px 20px 120px;
    text-align: center;
}
.tu-form-header h2 {
    color: #ffffff !important;
    font-size: 36px !important;
    font-weight: 600 !important;
    margin: 0 0 12px 0 !important;
    text-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.tu-form-header p {
    color: #ffccd5 !important;
    font-size: 18px !important;
    margin: 0 !important;
}

/* --- 2. Step Wizard (ตรงโครงสร้างจริงของ ACF) --- */
body .tu-application-wrapper .acf-fields > .acf-tab-wrap {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: -70px 0 50px 0 !important;
    position: relative;
    z-index: 10;
    display: block !important;
    overflow: visible !important;
}

body .tu-application-wrapper .acf-tab-wrap .acf-tab-group {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    width: 100% !important;
    box-sizing: border-box !important;
    background: transparent !important;
    border: none !important;
    padding: 0 0 46px !important;
    margin: 0 !important;
    height: auto !important;
    overflow: visible !important;
    position: relative;
}

/* เส้นพื้น (track) */
body .tu-application-wrapper .acf-tab-wrap .acf-tab-group::before {
    content: '' !important;
    display: block !important;
    position: absolute;
    top: 28px;
    left: calc(var(--tu-seg, 20%) / 2);
    right: calc(var(--tu-seg, 20%) / 2);
    height: 4px;
    border-radius: 4px;
    background: rgba(255,255,255,.30);
    z-index: 1;
}

/* เส้นความคืบหน้า (progress fill) สีทองเรืองแสง วิ่งตามสเต็ป */
body .tu-application-wrapper .acf-tab-wrap .acf-tab-group::after {
    content: '' !important;
    display: block !important;
    clear: none !important;
    position: absolute;
    top: 28px;
    left: calc(var(--tu-seg, 20%) / 2);
    width: calc(var(--tu-reach, 0) * var(--tu-seg, 20%));
    height: 4px;
    border-radius: 4px;
    background: linear-gradient(90deg, #F2A900, #ffd56a);
    box-shadow: 0 0 6px rgba(242,169,0,.45);
    transition: width .7s cubic-bezier(.22,1,.36,1);
    z-index: 1;
}
/* ความยาวเส้นทอง = ไปถึงสเต็ปที่ผ่านจริงล่าสุด (JS ตั้งค่า --tu-reach / --tu-seg ให้เอง) */

body .tu-application-wrapper .acf-tab-wrap .acf-tab-group li {
    flex: 1 1 0 !important;
    float: none !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    background: transparent !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    position: relative;
    z-index: 2;
}

body .tu-application-wrapper .acf-tab-wrap .acf-tab-group li a {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    width: 100% !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    cursor: pointer;
}

/* วงกลมตัวเลข (ยังไม่ถึง) */
.tu-step-circle {
    width: 60px;
    height: 60px;
    background: #ffffff;
    border: 4px solid #e2e8f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    color: #94a3b8;
    margin-bottom: 12px;
    transition: transform .35s cubic-bezier(.22,1,.36,1), box-shadow .35s ease, border-color .3s ease, background .3s ease;
    box-shadow: 0 3px 8px rgba(0,0,0,.12);
    position: relative;
    z-index: 2;
}

/* ข้อความใต้ Step: ชื่อหลัก (บรรทัดบน) + ชื่อรอง/ภาษาไทย (บรรทัดล่าง ตัวเล็กกว่า) ทุกขั้นตอนเริ่มที่ระดับเดียวกัน */
.tu-step-text {
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    text-align: center;
    line-height: 1.4;
    padding: 0 5px;
    margin-top: 8px;
    white-space: normal;
    transition: color .3s ease;
}
.tu-step-main { display: block; text-wrap: balance; }
.tu-step-sub {
    display: block;
    margin-top: 2px;
    font-size: 12.5px;
    font-weight: 400;
    line-height: 1.45;
    opacity: .85;
    text-wrap: balance;
}
.tu-step-caption strong .tu-step-main { display: block; }
.tu-step-caption strong .tu-step-sub { font-size: 13px; font-weight: 500; opacity: .8; }

/* Hover: ลอยขึ้นเล็กน้อย + ขอบทอง */
body .tu-application-wrapper .acf-tab-group li:not(.active) a:hover .tu-step-circle {
    transform: translateY(-5px);
    border-color: #F2A900;
    color: #8A1538;
    box-shadow: 0 6px 14px rgba(0,0,0,.16);
}
body .tu-application-wrapper .acf-tab-group li:not(.active) a:hover .tu-step-text {
    color: #8A1538;
}

/* กรอกครบและผ่านการตรวจแล้ว (JS ใส่ class tu-step-done): วงกลมทอง + เครื่องหมายถูก */
body .tu-application-wrapper .acf-tab-group li.tu-step-done:not(.active) .tu-step-circle {
    background: linear-gradient(135deg, #F2A900, #ffcf5a);
    border-color: #ffffff;
    font-size: 0;
    box-shadow: 0 3px 8px rgba(242,169,0,.30);
}
body .tu-application-wrapper .acf-tab-group li.tu-step-done:not(.active) .tu-step-circle::before {
    content: '\2713';
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
    animation: tuPop .5s ease both;
}
body .tu-application-wrapper .acf-tab-group li.tu-step-done:not(.active) .tu-step-text {
    color: #1e293b;
    font-weight: 600;
}
body .tu-application-wrapper .acf-tab-group li.tu-step-done:not(.active) .tu-step-text::after {
    content: var(--tu-t-done, 'เสร็จแล้ว');
    display: block;
    margin-top: 2px;
    font-size: 11px;
    font-weight: 500;
    color: #16a34a;
}

/* ขั้นที่ยังกรอกไม่ครบ (JS ใส่ class tu-step-error): วงกลมแดง + เครื่องหมาย ! */
body .tu-application-wrapper .acf-tab-group li.tu-step-error:not(.active) .tu-step-circle {
    background: #fef2f2;
    border-color: #ef4444;
    font-size: 0;
    box-shadow: 0 3px 8px rgba(220,38,38,.25);
}
body .tu-application-wrapper .acf-tab-group li.tu-step-error:not(.active) .tu-step-circle::before {
    content: '!';
    font-size: 28px;
    font-weight: 700;
    color: #dc2626;
    animation: tuPop .5s ease both;
}
body .tu-application-wrapper .acf-tab-group li.tu-step-error:not(.active) .tu-step-text {
    color: #dc2626;
    font-weight: 600;
}
body .tu-application-wrapper .acf-tab-group li.tu-step-error:not(.active) .tu-step-text::after {
    content: var(--tu-t-incomplete, 'ยังไม่ครบ');
    display: block;
    margin-top: 2px;
    font-size: 11px;
    font-weight: 500;
    color: #dc2626;
}
/* อยู่ในขั้นที่มีช่องค้าง: ป้ายเปลี่ยนเป็นสีแดง */
body .tu-application-wrapper .acf-tab-group li.active.tu-step-error .tu-step-text::after {
    content: var(--tu-t-fillin, 'กรอกให้ครบ');
    background: #dc2626;
}

/* กำลังทำอยู่ (active): วงกลมขาว ขอบทอง เรืองแสงเต้นเป็นจังหวะ */
body .tu-application-wrapper .acf-tab-group li.active .tu-step-circle {
    background: #ffffff;
    border-color: #F2A900;
    color: #8A1538;
    transform: scale(1.18);
    animation: tuPulse 2s ease-out infinite;
}
body .tu-application-wrapper .acf-tab-group li.active .tu-step-text {
    color: #8A1538;
    font-weight: 700;
    margin-top: 8px;
}
body .tu-application-wrapper .acf-tab-group li.active .tu-step-text::after {
    content: var(--tu-t-filling, 'กำลังกรอก');
    display: block;
    width: fit-content;
    margin: 6px auto 0;
    padding: 2px 12px;
    font-size: 11px;
    font-weight: 500;
    color: #ffffff;
    background: #8A1538;
    border-radius: 999px;
    box-shadow: none;
    animation: tuBadge 1.8s ease-in-out infinite;
}

/* --- 3. พื้นที่ฟอร์ม --- */
body .tu-application-wrapper .acf-fields {
    padding: 0 40px 50px !important;
    border: none !important;
}

body .tu-application-wrapper .acf-field {
    box-sizing: border-box !important;
    padding: 15px 10px !important;
    border: none !important;
}

/* เด้งเข้าทีละช่องทุกครั้งที่เปลี่ยนสเต็ป */
body .tu-application-wrapper .acf-field:not(.acf-field-tab) {
    animation: tuFadeUp .55s cubic-bezier(.22,1,.36,1) backwards;
}
body .tu-application-wrapper .acf-field:nth-child(2) { animation-delay: .04s; }
body .tu-application-wrapper .acf-field:nth-child(3) { animation-delay: .08s; }
body .tu-application-wrapper .acf-field:nth-child(4) { animation-delay: .12s; }
body .tu-application-wrapper .acf-field:nth-child(5) { animation-delay: .16s; }
body .tu-application-wrapper .acf-field:nth-child(6) { animation-delay: .20s; }
body .tu-application-wrapper .acf-field:nth-child(7) { animation-delay: .24s; }
body .tu-application-wrapper .acf-field:nth-child(8) { animation-delay: .28s; }
body .tu-application-wrapper .acf-field:nth-child(n+9) { animation-delay: .32s; }

body .tu-application-wrapper .acf-label {
    margin-bottom: 8px !important;
}
body .tu-application-wrapper .acf-label label {
    font-family: 'Prompt', sans-serif !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    color: #1e293b !important;
    transition: color .25s ease;
}
/* ช่องที่กำลังกรอก ชื่อ label เปลี่ยนเป็นสีแดงมหาวิทยาลัย */
body .tu-application-wrapper .acf-field:focus-within .acf-label label {
    color: #8A1538 !important;
}

/* --- 3a. จัดแถวฟิลด์ด้วย Flex แทน Float ---
   ACF ใช้ float: ถ้าช่องหนึ่งในแถวสูงกว่าช่องอื่น (เช่น มีข้อความ error) ช่องของแถวถัดไปจะเลื่อนมาติดข้างๆ
   เปลี่ยนเป็น flex-wrap ให้แต่ละแถวอิสระต่อกัน ความสูงไม่กระทบแถวอื่น */
body .tu-application-wrapper .acf-fields {
    display: flex !important;
    flex-wrap: wrap;
    align-items: flex-start;
}
body .tu-application-wrapper .acf-fields::before,
body .tu-application-wrapper .acf-fields::after {
    display: none !important;
}
body .tu-application-wrapper .acf-fields > .acf-field {
    float: none !important;
    clear: none !important;
    flex: 0 0 auto;
}
body .tu-application-wrapper .acf-fields > .acf-field:not([data-width]) { width: 100%; }
body .tu-application-wrapper .acf-fields > .acf-tab-wrap { flex: 0 0 100%; width: 100%; }
/* กันเหนียว: ถ้า ACF ไม่ได้ใส่ width แบบ inline ให้ใช้ค่าจาก data-width */
body .tu-application-wrapper .acf-fields > .acf-field[data-width="20"] { width: 20%; }
body .tu-application-wrapper .acf-fields > .acf-field[data-width="25"] { width: 25%; }
body .tu-application-wrapper .acf-fields > .acf-field[data-width="30"] { width: 30%; }
body .tu-application-wrapper .acf-fields > .acf-field[data-width="33"] { width: 33%; }
body .tu-application-wrapper .acf-fields > .acf-field[data-width="34"] { width: 34%; }
body .tu-application-wrapper .acf-fields > .acf-field[data-width="40"] { width: 40%; }
body .tu-application-wrapper .acf-fields > .acf-field[data-width="50"] { width: 50%; }
body .tu-application-wrapper .acf-fields > .acf-field[data-width="60"] { width: 60%; }
body .tu-application-wrapper .acf-fields > .acf-field[data-width="66"] { width: 66%; }
body .tu-application-wrapper .acf-fields > .acf-field[data-width="67"] { width: 67%; }
body .tu-application-wrapper .acf-fields > .acf-field[data-width="70"] { width: 70%; }
body .tu-application-wrapper .acf-fields > .acf-field[data-width="75"] { width: 75%; }
body .tu-application-wrapper .acf-fields > .acf-field[data-width="80"] { width: 80%; }

/* ฟิลด์ของระบบชำระเงิน ห้ามแสดงในฟอร์มหน้าบ้าน (กันเหนียวอีกชั้น: PHP ไม่ได้แสดงฟิลด์เหล่านี้อยู่แล้ว) */
body .tu-application-wrapper .acf-field[data-name="amount"],
body .tu-application-wrapper .acf-field[data-name="payment_status"],
body .tu-application-wrapper .acf-field[data-name="payment_ref"],
body .tu-application-wrapper .acf-field[data-name="bbl_pay_ref"] {
    display: none !important;
}

/* กลุ่มฟิลด์ (Group) มี .acf-fields ซ้อนอยู่ข้างใน: ไม่ใส่ padding ของฟอร์มหลักซ้ำ
   และขยายออก 10px ทั้งสองข้าง ให้ช่องย่อยชิดแนวเดียวกับช่องอื่นๆ (ช่องแต่ละช่องมี padding ข้าง 10px อยู่แล้ว) */
body .tu-application-wrapper .acf-field .acf-fields {
    padding: 0 !important;
    margin: 0 -10px !important;
    width: calc(100% + 20px);
    background: transparent !important;
    border: 0 !important;
}

/* --- 3b. ช่องไม่บังคับ + คำอธิบายใต้ช่องกรอก (ทำให้ช่องกรอกในแถวเดียวกันอยู่แนวเดียวกัน) --- */

/* เรียง field เป็นแนวตั้ง: label -> ช่องกรอก -> คำอธิบาย
   (ไม่แตะ field ที่ ACF ซ่อนอยู่ เพื่อไม่ให้ระบบแท็บพัง) */
body .tu-application-wrapper .acf-field:not(.acf-field-tab):not([hidden]):not(.acf-hidden):not(.hidden-by-tab):not(.hidden-by-conditional-logic) {
    display: flex;
    flex-direction: column;
}
body .tu-application-wrapper .acf-field .acf-label {
    display: contents;
}
body .tu-application-wrapper .acf-field .acf-label label {
    order: 1;
    display: block;
    margin: 0 0 8px !important;
    line-height: 24px;
}
body .tu-application-wrapper .acf-field .acf-input {
    order: 2;
}
/* คำอธิบาย (Instructions ใน ACF) ย้ายไปอยู่ใต้ช่องกรอก เป็นข้อความช่วยเหลือเล็กๆ */
body .tu-application-wrapper .acf-field .acf-label .description {
    order: 3;
    margin: 8px 2px 0 !important;
    font-size: 13px !important;
    line-height: 1.5 !important;
    color: #64748b !important;
}

/* ป้าย "ไม่บังคับ" อัตโนมัติ สำหรับช่องที่ไม่มีดอกจันสีแดง (ไม่รวมช่องไฟล์แนบ) */
body .tu-application-wrapper .acf-field:is(
    [data-type="text"], [data-type="email"], [data-type="number"], [data-type="url"],
    [data-type="textarea"], [data-type="select"], [data-type="radio"], [data-type="date_picker"]
):not(:has(> .acf-label .acf-required)) .acf-label label::after {
    content: var(--tu-t-optional, 'ไม่บังคับ');
    display: inline-block;
    margin: -3px 0 -3px 8px;
    padding: 0 10px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.5;
    color: #64748b;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    vertical-align: middle;
}

/* --- 4. Input Styles --- */
body .tu-application-wrapper .acf-field input[type="text"],
body .tu-application-wrapper .acf-field input[type="email"],
body .tu-application-wrapper .acf-field input[type="number"],
body .tu-application-wrapper .acf-field select,
body .tu-application-wrapper .acf-field textarea {
    width: 100% !important;
    padding: 14px 16px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 12px !important;
    font-family: 'Prompt', sans-serif !important;
    font-size: 15px !important;
    color: #334155 !important;
    background-color: #f8fafc !important;
    box-sizing: border-box !important;
    height: auto !important;
    box-shadow: none !important;
    transition: all .25s ease !important;
}

body .tu-application-wrapper .acf-field input[type="text"]:hover,
body .tu-application-wrapper .acf-field input[type="email"]:hover,
body .tu-application-wrapper .acf-field input[type="number"]:hover,
body .tu-application-wrapper .acf-field select:hover,
body .tu-application-wrapper .acf-field textarea:hover {
    border-color: #94a3b8 !important;
    background-color: #ffffff !important;
    box-shadow: none !important;
}

body .tu-application-wrapper .acf-field input:focus,
body .tu-application-wrapper .acf-field select:focus,
body .tu-application-wrapper .acf-field textarea:focus {
    background-color: #ffffff !important;
    border-color: #8A1538 !important;
    box-shadow: 0 0 0 3px rgba(138,21,56,.10) !important;
    outline: none !important;
}

/* Custom Select */
body .tu-application-wrapper .acf-field select {
    appearance: none !important;
    -webkit-appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 16px center !important;
    background-size: 16px !important;
    padding-right: 45px !important;
}

/* Custom File Upload (เต็มความกว้างคอลัมน์) */
body .tu-application-wrapper .acf-field .acf-input {
    width: 100% !important;
    display: block !important;
}
/* basic uploader: ช่องไฟล์ + ปุ่มลบไฟล์ เรียงแนวนอน */
body .tu-application-wrapper .acf-field .acf-basic-uploader {
    width: 100% !important;
    display: flex !important;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
body .tu-application-wrapper .acf-field .acf-basic-uploader input[type="file"] {
    flex: 1 1 0;
    min-width: 0;
}
body .tu-application-wrapper .acf-field input[type="file"] {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
    cursor: pointer;
}
body .tu-application-wrapper .acf-field input[type="file"]:hover {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}
body .tu-application-wrapper .acf-field input[type="file"]::file-selector-button {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 16px;
    color: #475569;
    font-family: 'Prompt', sans-serif;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    margin-right: 15px;
    box-shadow: none;
    transition: all .2s ease;
}
body .tu-application-wrapper .acf-field input[type="file"]::file-selector-button:hover {
    background-color: #8A1538;
    border-color: #8A1538;
    color: #ffffff;
}

/* --- 4b. ช่องแนบไฟล์: กล่องเส้นปะ + ปุ่มเลือกไฟล์
   รองรับ 2 แบบ: WP uploader (ผู้ใช้ที่ล็อกอินสิทธิ์สูงเห็น: "No file selected / Add File")
   และ basic uploader (ผู้สมัครทั่วไปเห็น: ปุ่ม Choose File) --- */

body .tu-application-wrapper .acf-field .acf-file-uploader,
body .tu-application-wrapper .acf-field .acf-image-uploader {
    position: relative;
    box-sizing: border-box;
    width: 100%;
    padding: 18px 20px;
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 14px;
    transition: border-color .25s ease, background-color .25s ease;
}
body .tu-application-wrapper .acf-field .acf-file-uploader:hover,
body .tu-application-wrapper .acf-field .acf-image-uploader:hover {
    border-color: #8A1538;
    background: #fff8f9;
}
/* แนบไฟล์แล้ว: เส้นทึบสีเขียวอ่อน */
body .tu-application-wrapper .acf-field .acf-file-uploader.has-value,
body .tu-application-wrapper .acf-field .acf-image-uploader.has-value {
    border-style: solid;
    border-color: #86efac;
    background: #f0fdf4;
}
body .tu-application-wrapper .acf-file-uploader:not(.has-value) .show-if-value,
body .tu-application-wrapper .acf-image-uploader:not(.has-value) .show-if-value { display: none !important; }
body .tu-application-wrapper .acf-file-uploader.has-value .hide-if-value,
body .tu-application-wrapper .acf-image-uploader.has-value .hide-if-value { display: none !important; }

/* ยังไม่มีไฟล์: ไอคอนอัปโหลด + ข้อความ + ปุ่ม (ซ่อนข้อความอังกฤษของ ACF แล้วใส่ภาษาไทยแทน) */
body .tu-application-wrapper .acf-file-uploader .hide-if-value p,
body .tu-application-wrapper .acf-image-uploader .hide-if-value p {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    font-size: 0;
}
body .tu-application-wrapper .acf-file-uploader .hide-if-value p::before,
body .tu-application-wrapper .acf-image-uploader .hide-if-value p::before {
    content: '\f093';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #8A1538;
    background: #fff1f2;
    border-radius: 50%;
}
body .tu-application-wrapper .acf-file-uploader .hide-if-value p::after,
body .tu-application-wrapper .acf-image-uploader .hide-if-value p::after {
    content: 'ยังไม่ได้เลือกไฟล์';
    order: 1;
    flex: 1 1 auto;
    font-family: 'Prompt', sans-serif;
    font-size: 14px;
    color: #64748b;
}
body .tu-application-wrapper .acf-file-uploader a[data-name="add"],
body .tu-application-wrapper .acf-image-uploader a[data-name="add"] {
    order: 2;
    margin-left: auto;
    display: inline-flex !important;
    align-items: center;
    padding: 10px 22px !important;
    font-size: 0 !important;
    color: #ffffff !important;
    text-decoration: none !important;
    border: 0 !important;
    border-radius: 12px !important;
    cursor: pointer;
    background-color: #8A1538 !important;
    background-image: linear-gradient(135deg, #b61d52 0%, #8A1538 50%, #650f2a 100%) !important;
    box-shadow: 0 3px 8px rgba(138,21,56,.22), inset 0 1px 0 rgba(255,255,255,.22), inset 0 -3px 0 rgba(0,0,0,.14) !important;
    transition: transform .28s cubic-bezier(.22,1,.36,1), box-shadow .28s ease;
}
body .tu-application-wrapper .acf-file-uploader a[data-name="add"]::after,
body .tu-application-wrapper .acf-image-uploader a[data-name="add"]::after {
    content: 'เลือกไฟล์';
    font-family: 'Prompt', sans-serif;
    font-size: 14px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,.25);
}
body .tu-application-wrapper .acf-file-uploader a[data-name="add"]:hover,
body .tu-application-wrapper .acf-image-uploader a[data-name="add"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(138,21,56,.28), inset 0 1px 0 rgba(255,255,255,.25), inset 0 -3px 0 rgba(0,0,0,.14) !important;
}
body .tu-application-wrapper .acf-file-uploader a[data-name="add"]:active,
body .tu-application-wrapper .acf-image-uploader a[data-name="add"]:active {
    transform: translateY(1px) scale(.97);
}

/* แนบไฟล์แล้ว: ไอคอนไฟล์ + ชื่อไฟล์ + ปุ่มแก้ไข/ลบ */
body .tu-application-wrapper .acf-file-uploader.has-value .file-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    min-height: 0 !important;
    background: transparent !important;
    border: 0 !important;
}
body .tu-application-wrapper .acf-file-uploader .file-wrap .file-icon {
    position: static !important;
    flex: 0 0 44px;
    padding: 0 !important;
    background: none !important;
    border: 0 !important;
}
body .tu-application-wrapper .acf-file-uploader .file-wrap .file-icon img {
    width: 44px !important;
    height: auto !important;
}
body .tu-application-wrapper .acf-file-uploader .file-wrap .file-info {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0 !important;
    padding: 0 !important;
}
body .tu-application-wrapper .acf-file-uploader .file-wrap .file-info p {
    margin: 0 0 2px;
    font-size: 13px;
    line-height: 1.5;
    color: #475569;
    overflow-wrap: anywhere;
}
body .tu-application-wrapper .acf-file-uploader .file-wrap .file-info strong { font-weight: 600; color: #1e293b; }
body .tu-application-wrapper .acf-file-uploader .file-wrap .file-info a {
    color: #8A1538;
    text-decoration: underline;
    text-underline-offset: 3px;
}
body .tu-application-wrapper .acf-file-uploader .file-wrap .acf-actions {
    position: static !important;
    display: flex !important;
    gap: 6px;
    opacity: 1 !important;
    visibility: visible !important;
}

/* basic uploader (input type=file): ปุ่มสีแดงแบบเดียวกัน */
body .tu-application-wrapper .acf-field input[type="file"]::file-selector-button {
    margin-right: 14px;
    padding: 9px 18px;
    font-family: 'Prompt', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, #b61d52 0%, #8A1538 55%, #650f2a 100%);
    border: 0;
    border-radius: 10px;
    box-shadow: 0 3px 8px rgba(138,21,56,.22), inset 0 1px 0 rgba(255,255,255,.22), inset 0 -3px 0 rgba(0,0,0,.14);
    cursor: pointer;
    transition: filter .2s ease;
}
body .tu-application-wrapper .acf-field input[type="file"]:hover::file-selector-button {
    background: linear-gradient(135deg, #c9205c 0%, #9c1840 55%, #750f30 100%);
    border: 0;
    color: #ffffff;
    filter: brightness(1.05);
}

@media (max-width: 600px) {
    body .tu-application-wrapper .acf-file-uploader .hide-if-value p { flex-wrap: wrap; }
    body .tu-application-wrapper .acf-file-uploader a[data-name="add"] { margin-left: 0; }
}

/* ปุ่มลบไฟล์ที่เลือกไว้ (JS สร้างให้เมื่อเลือกไฟล์แล้ว) */
body .tu-application-wrapper .tu-file-clear {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 14px !important;
    font-family: 'Prompt', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #dc2626 !important;
    background: #ffffff !important;
    border: 1px solid #fecaca !important;
    border-radius: 10px !important;
    box-shadow: 0 1px 2px rgba(15,23,42,.05) !important;
    cursor: pointer;
    animation: tuFadeUp .25s ease backwards;
    transition: transform .25s cubic-bezier(.22,1,.36,1), box-shadow .25s ease, color .2s ease, background .2s ease, border-color .2s ease;
}
body .tu-application-wrapper .tu-file-clear:hover,
body .tu-application-wrapper .tu-file-clear:focus-visible {
    color: #ffffff !important;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    border-color: transparent !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(220,38,38,.25) !important;
}
body .tu-application-wrapper .tu-file-clear:active {
    transform: translateY(0) scale(.97);
}
body .tu-application-wrapper .tu-file-clear:focus-visible {
    outline: 3px solid rgba(242,169,0,.6);
    outline-offset: 2px;
}

/* --- 5. Radio Buttons --- */
body .tu-application-wrapper .acf-radio-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
body .tu-application-wrapper .acf-radio-list label {
    display: flex !important;
    align-items: center;
    padding: 12px 20px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    font-size: 15px !important;
    color: #334155 !important;
    font-weight: 500;
    box-shadow: none;
    transition: all .25s ease;
}
body .tu-application-wrapper .acf-radio-list label:hover {
    transform: translateX(4px);
    border-color: #8A1538;
    box-shadow: none;
}
body .tu-application-wrapper .acf-radio-list input[type="radio"] {
    width: 20px;
    height: 20px;
    margin-right: 15px;
    accent-color: #8A1538;
}
body .tu-application-wrapper .acf-radio-list label:has(input:checked) {
    background: #fff7f8;
    border-color: rgba(138,21,56,.55);
    color: #8A1538 !important;
    box-shadow: none;
}

/* --- 5b. สถานะช่องที่ยังไม่กรอก (JS ใส่ class tu-field-error) --- */
@keyframes tuShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}
body .tu-application-wrapper .acf-field.tu-field-error input[type="text"],
body .tu-application-wrapper .acf-field.tu-field-error input[type="email"],
body .tu-application-wrapper .acf-field.tu-field-error input[type="number"],
body .tu-application-wrapper .acf-field.tu-field-error select,
body .tu-application-wrapper .acf-field.tu-field-error textarea {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
    box-shadow: 0 0 0 3px rgba(239,68,68,.10) !important;
}
body .tu-application-wrapper .acf-field.tu-field-error .acf-file-uploader,
body .tu-application-wrapper .acf-field.tu-field-error .acf-image-uploader {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
}
body .tu-application-wrapper .acf-field.tu-field-error .acf-radio-list label,
body .tu-application-wrapper .acf-field.tu-field-error .acf-checkbox-list label {
    border-color: #fca5a5;
}
body .tu-application-wrapper .acf-field.tu-field-error .acf-label label {
    color: #dc2626 !important;
}
body .tu-application-wrapper .acf-field.tu-field-error.tu-shake .acf-input {
    animation: tuShake .4s ease;
}
body .tu-application-wrapper .tu-error-msg {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.4;
    color: #dc2626;
    animation: tuFadeUp .3s ease backwards;
}
body .tu-application-wrapper .tu-error-msg::before {
    content: '!';
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #dc2626;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
}

/* --- 6. Buttons (ปุ่มนำทาง + ปุ่มส่งใบสมัคร) --- */

/* แถวปุ่ม: เว้นขอบให้ชิดแนวเดียวกับช่องกรอก (40px ของฟอร์ม + 10px ของ field = 50px) */
.tu-global-step-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    box-sizing: border-box;
    width: 100%;
    margin: 0;
    padding: 28px 50px 32px;
    border-top: 1px solid #e2e8f0;
    background: #ffffff;
}

.tu-btn-prev, .tu-btn-next {
    position: relative;
    overflow: hidden;
    font-family: 'Prompt', sans-serif !important;
    padding: 15px 34px !important;
    border-radius: 14px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    letter-spacing: .2px;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent;
    transition: transform .28s cubic-bezier(.22,1,.36,1), box-shadow .28s ease, background .28s ease, color .28s ease, border-color .28s ease !important;
}

/* แสงวาบพาดผ่านปุ่มตอนเอาเมาส์ชี้ */
.tu-btn-prev::after, .tu-btn-next::after {
    content: '';
    position: absolute;
    top: 0;
    left: -80%;
    width: 50%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,.45), transparent);
    transform: skewX(-20deg);
    transition: left .7s ease;
    pointer-events: none;
}
.tu-btn-prev:hover::after, .tu-btn-next:hover::after { left: 130%; }

/* ไอคอนลูกศรในปุ่มขยับตอนชี้ */
.tu-btn-prev svg, .tu-btn-prev i,
.tu-btn-next svg, .tu-btn-next i {
    transition: transform .28s cubic-bezier(.22,1,.36,1);
}
.tu-btn-prev:hover svg, .tu-btn-prev:hover i { transform: translateX(-5px); }
.tu-btn-next:hover svg, .tu-btn-next:hover i { transform: translateX(5px); }

.tu-btn-prev:focus-visible, .tu-btn-next:focus-visible,
body .tu-application-wrapper .acf-form-submit .acf-button:focus-visible {
    outline: 3px solid rgba(242,169,0,.65);
    outline-offset: 3px;
}

/* ปุ่มย้อนกลับ: ขาวนูนนุ่มๆ */
.tu-btn-prev {
    background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%) !important;
    color: #64748b !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 2px 6px rgba(15,23,42,.06), inset 0 1px 0 #ffffff;
}
.tu-btn-prev:hover {
    color: #8A1538 !important;
    border-color: rgba(138,21,56,.35) !important;
    transform: translateX(-4px);
    box-shadow: 0 4px 10px rgba(15,23,42,.08), inset 0 1px 0 #ffffff;
}

/* ปุ่มถัดไป: ไล่สีแดง นูน 3 มิติ เรืองแสงหายใจเบาๆ */
.tu-btn-next {
    margin-left: auto;   /* ถ้ามีปุ่มเดียว (สเต็ปแรก) ให้ชิดขวาเสมอ */
    background: linear-gradient(135deg, #b61d52 0%, #8A1538 50%, #650f2a 100%) !important;
    color: #ffffff !important;
    border: none !important;
    text-shadow: 0 1px 2px rgba(0,0,0,.25);
    box-shadow: 0 4px 10px rgba(138,21,56,.22), inset 0 1px 0 rgba(255,255,255,.22), inset 0 -3px 0 rgba(0,0,0,.14);
}
.tu-btn-next:hover {
    background: linear-gradient(135deg, #c9205c 0%, #9c1840 50%, #750f30 100%) !important;
    transform: translateY(-3px);
    animation: none;
    box-shadow: 0 8px 18px rgba(138,21,56,.28), inset 0 1px 0 rgba(255,255,255,.25), inset 0 -3px 0 rgba(0,0,0,.14);
}
.tu-btn-next:active, .tu-btn-prev:active {
    transform: translateY(1px) scale(.98);
    animation: none;
    box-shadow: 0 2px 4px rgba(15,23,42,.15), inset 0 2px 6px rgba(0,0,0,.20);
}

/* --- พื้นที่ปุ่มส่งใบสมัคร (สเต็ปสุดท้าย) --- */
body .tu-application-wrapper .acf-form-submit {
    display: none;
    box-sizing: border-box;
    margin: 0;
    padding: 0 50px 44px;
    border-top: none;
    text-align: right;
}

/* กล่องค่าธรรมเนียม (div ตัวแรกใน .acf-form-submit) */
body .tu-application-wrapper .acf-form-submit > div {
    box-sizing: border-box !important;
    margin: 0 0 28px !important;
    padding: 18px 24px !important;
    border-radius: 16px !important;
    border: 1px solid #fde68a !important;
    background: #fffbeb !important;
    box-shadow: none !important;
    text-align: center !important;
}

/* ข้อความกำหนดเวลาชำระเงิน (ในกล่องค่าธรรมเนียม ถ้าหลักสูตรตั้งเวลาไว้) */
body .tu-application-wrapper .tu-pay-deadline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 14px 0 0 !important;
    padding-top: 14px;
    border-top: 1px dashed #fcd34d;
    font-size: 14px;
    line-height: 1.6;
    color: #92400e;
    text-align: left;
}
body .tu-application-wrapper .tu-pay-deadline i { color: #d97706; font-size: 16px; }
body .tu-application-wrapper .tu-pay-deadline strong { color: #b91c1c; font-weight: 700; }

/* ปุ่มยืนยัน: ทองไล่สี นูน เรืองแสง มีลูกศรและแสงวาบ */
body .tu-application-wrapper .acf-form-submit .acf-button {
    position: relative;
    font-family: 'Prompt', sans-serif !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #ffffff !important;
    text-shadow: 0 1px 3px rgba(122,72,0,.5);
    padding: 18px 64px 18px 40px !important;
    border: none !important;
    border-radius: 16px !important;
    cursor: pointer !important;
    background-color: #F2A900 !important;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E"),
        linear-gradient(110deg, transparent 35%, rgba(255,255,255,.55) 50%, transparent 65%),
        linear-gradient(135deg, #ffc21a 0%, #F2A900 55%, #e39500 100%) !important;
    background-repeat: no-repeat !important;
    background-size: 20px 20px, 250% 100%, 100% 100% !important;
    background-position: right 26px center, -160% 0, 0 0 !important;
    box-shadow: 0 6px 14px rgba(242,169,0,.30), inset 0 1px 0 rgba(255,255,255,.45), inset 0 -3px 0 rgba(150,90,0,.28);
    transition: transform .28s cubic-bezier(.22,1,.36,1), background-position .6s ease, filter .25s ease, box-shadow .28s ease !important;
}
body .tu-application-wrapper .acf-form-submit .acf-button:hover {
    transform: translateY(-4px);
    filter: brightness(1.05);
    animation: none;
    background-position: right 18px center, 160% 0, 0 0 !important;
    box-shadow: 0 10px 22px rgba(242,169,0,.38), inset 0 1px 0 rgba(255,255,255,.50), inset 0 -3px 0 rgba(150,90,0,.28);
}
body .tu-application-wrapper .acf-form-submit .acf-button:active {
    transform: translateY(1px) scale(.98);
    animation: none;
    box-shadow: 0 3px 6px rgba(242,169,0,.30), inset 0 2px 6px rgba(150,90,0,.35);
}

/* แถบชื่อสเต็ปปัจจุบัน (ใช้เฉพาะมือถือ) */
.tu-step-caption { display: none; }

/* Responsive */
@media (max-width: 768px) {
    .tu-application-wrapper { border-radius: 0; border: none; }
    .tu-form-header { padding: 40px 20px 80px; }
    body .tu-application-wrapper .acf-fields { padding: 0 20px 40px !important; }
    /* Step บนมือถือ: วงกลม 5 ดวงเรียงแถวเดียว มีเส้นเชื่อม และแสดงชื่อสเต็ปปัจจุบันเป็นแถบข้อความด้านล่าง */
    body .tu-application-wrapper .acf-fields > .acf-tab-wrap { margin: -52px 0 12px 0 !important; }
    body .tu-application-wrapper .acf-tab-wrap .acf-tab-group {
        flex-wrap: nowrap;
        padding: 0 0 28px !important;
    }
    body .tu-application-wrapper .acf-tab-wrap .acf-tab-group::before,
    body .tu-application-wrapper .acf-tab-wrap .acf-tab-group::after {
        top: 18px;
        height: 4px;
    }
    body .tu-application-wrapper .acf-tab-wrap .acf-tab-group li {
        flex: 1 1 0 !important;
        margin-bottom: 0 !important;
    }
    body .tu-application-wrapper .acf-tab-group .tu-step-text { display: none !important; }
    .tu-step-circle {
        width: 40px;
        height: 40px;
        margin-bottom: 0;
        font-size: 16px;
        border-width: 3px;
    }
    body .tu-application-wrapper .acf-tab-group .tu-step-circle::before { font-size: 20px !important; }
    body .tu-application-wrapper .acf-tab-group li.active .tu-step-circle { transform: scale(1.12); }

    body .tu-application-wrapper .tu-step-caption {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        padding: 0 12px;
        text-align: center;
    }
    body .tu-application-wrapper .tu-step-count { font-size: 12px; font-weight: 500; color: #94a3b8; }
    body .tu-application-wrapper .tu-step-caption strong { font-size: 18px; font-weight: 700; line-height: 1.4; color: #8A1538; }
    body .tu-application-wrapper .tu-step-flag {
        margin-top: 6px;
        padding: 2px 12px;
        font-size: 11px;
        font-style: normal;
        font-weight: 500;
        color: #ffffff;
        background: #8A1538;
        border-radius: 999px;
    }
    body .tu-application-wrapper .tu-step-flag.is-error { background: #dc2626; }
}

/* มือถือ: ปุ่มและระยะห่าง */
@media (max-width: 768px) {
    .tu-global-step-actions { padding: 20px; gap: 10px; }
    .tu-btn-prev, .tu-btn-next { padding: 14px 20px !important; font-size: 15px !important; }
    body .tu-application-wrapper .acf-form-submit { padding: 0 20px 28px; }
    body .tu-application-wrapper .acf-form-submit .acf-button {
        width: 100% !important;
        padding: 18px 56px 18px 24px !important;
        font-size: 16px !important;
    }
}

/* --- 8. ปุ่มในการ์ดหลักสูตร (หน้ารายการ [tu_program_list]) ---
   ปุ่ม "รายละเอียด" = .tu-detail-btn   |   ปุ่ม "กรอกใบสมัคร" = ลิงก์ที่มี program_id
   มีแสงตามเมาส์ (JS ตั้งค่า --mx / --my) + แสงวาบพาดผ่าน + ยกตัวขึ้นเล็กน้อยตอนชี้ */

@property --glow {
    syntax: '<number>';
    inherits: false;
    initial-value: 0;
}

body .tu-spa-wrapper .program-card .tu-detail-btn,
body .tu-spa-wrapper .program-card a[href*="program_id="] {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    font-weight: 600;
    letter-spacing: .2px;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform .28s cubic-bezier(.22,1,.36,1), box-shadow .28s ease,
                background-color .28s ease, border-color .28s ease, color .28s ease, --glow .3s ease;
}

/* แสงวาบพาดผ่าน */
body .tu-spa-wrapper .program-card .tu-detail-btn::after,
body .tu-spa-wrapper .program-card a[href*="program_id="]::after {
    content: '';
    position: absolute;
    top: 0;
    left: -80%;
    width: 50%;
    height: 100%;
    transform: skewX(-20deg);
    transition: left .7s ease;
    pointer-events: none;
}
body .tu-spa-wrapper .program-card .tu-detail-btn::after {
    background: linear-gradient(120deg, transparent, rgba(138,21,21,.10), transparent);
}
body .tu-spa-wrapper .program-card a[href*="program_id="]::after {
    background: linear-gradient(120deg, transparent, rgba(255,255,255,.45), transparent);
}
body .tu-spa-wrapper .program-card .tu-detail-btn:hover::after,
body .tu-spa-wrapper .program-card a[href*="program_id="]:hover::after {
    left: 130%;
}

/* ปุ่มรายละเอียด: ขาว นูนบางๆ ชี้แล้วขอบ/ตัวหนังสือเป็นแดง มีแสงจางๆ ตามเมาส์ */
body .tu-spa-wrapper .program-card .tu-detail-btn {
    color: #475569;
    background-color: #ffffff;
    background-image:
        radial-gradient(circle 90px at var(--mx, 50%) var(--my, 50%), rgba(138,21,21, calc(var(--glow) * .12)), transparent 70%),
        linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #d7dde6;
    box-shadow: 0 1px 2px rgba(15,23,42,.05), inset 0 1px 0 #ffffff;
}
body .tu-spa-wrapper .program-card .tu-detail-btn:hover {
    --glow: 1;
    color: #8a1515;
    border-color: rgba(138,21,21,.45);
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(138,21,21,.10), inset 0 1px 0 #ffffff;
}

/* ปุ่มกรอกใบสมัคร: แดงไล่สี นูน มีแสงขาวตามเมาส์
   (บังคับตัวหนังสือสีขาวทุกสถานะ กันสีลิงก์ของธีมทับจนอ่านไม่ออกตอนชี้) */
body .tu-spa-wrapper .program-card a[href*="program_id="],
body .tu-spa-wrapper .program-card a[href*="program_id="]:hover,
body .tu-spa-wrapper .program-card a[href*="program_id="]:focus,
body .tu-spa-wrapper .program-card a[href*="program_id="]:active,
body .tu-spa-wrapper .program-card a[href*="program_id="]:visited {
    color: #ffffff !important;
}
body .tu-spa-wrapper .program-card a[href*="program_id="] {
    text-shadow: 0 1px 2px rgba(0,0,0,.25);
    background-color: #8a1515;
    background-image:
        radial-gradient(circle 90px at var(--mx, 50%) var(--my, 50%), rgba(255,255,255, calc(var(--glow) * .35)), transparent 70%),
        linear-gradient(135deg, #a51d1d 0%, #8a1515 55%, #6b1010 100%);
    box-shadow: 0 3px 8px rgba(138,21,21,.22), inset 0 1px 0 rgba(255,255,255,.22), inset 0 -3px 0 rgba(0,0,0,.14);
}
body .tu-spa-wrapper .program-card a[href*="program_id="]:hover {
    --glow: 1;
    background-color: #9a1818;
    background-image:
        radial-gradient(circle 90px at var(--mx, 50%) var(--my, 50%), rgba(255,255,255, calc(var(--glow) * .35)), transparent 70%),
        linear-gradient(135deg, #b52424 0%, #9a1818 55%, #7a1212 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(138,21,21,.28), inset 0 1px 0 rgba(255,255,255,.28), inset 0 -3px 0 rgba(0,0,0,.14);
}

/* กดลง: ยุบลงเหมือนปุ่มจริง */
body .tu-spa-wrapper .program-card .tu-detail-btn:active,
body .tu-spa-wrapper .program-card a[href*="program_id="]:active {
    transform: translateY(0) scale(.97);
    box-shadow: 0 1px 3px rgba(15,23,42,.18), inset 0 2px 5px rgba(0,0,0,.18);
}
body .tu-spa-wrapper .program-card .tu-detail-btn:focus-visible,
body .tu-spa-wrapper .program-card a[href*="program_id="]:focus-visible {
    outline: 3px solid rgba(242,169,0,.6);
    outline-offset: 2px;
}

/* ปุ่มปิดรับสมัคร (disabled) ไม่มีเอฟเฟกต์ */
body .tu-spa-wrapper .program-card button[disabled] {
    border-radius: 12px;
    box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
    body .tu-spa-wrapper .program-card .tu-detail-btn,
    body .tu-spa-wrapper .program-card a[href*="program_id="],
    body .tu-spa-wrapper .program-card .tu-detail-btn::after,
    body .tu-spa-wrapper .program-card a[href*="program_id="]::after {
        transition: none !important;
    }
}

/* --- 9. Popup รายละเอียดหลักสูตร (#tu-detail-modal ในหน้ารายการหลักสูตร) --- */

#tu-detail-modal {
    font-family: 'Prompt', sans-serif;
}

/* พื้นหลังมืดอมแดง เบลอเล็กน้อย (ให้เข้าชุดกับ popup แจ้งเตือน) */
#tu-detail-modal > .tu-modal-close {
    background: rgba(40, 12, 24, .45) !important;
}

#tu-detail-modal #tu-modal-content {
    overflow: hidden;
    border-radius: 24px;
    box-shadow: 0 16px 44px rgba(15, 23, 42, .18);
}
/* แถบแดง-ทองบางๆ ด้านบน */
#tu-detail-modal #tu-modal-content::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 5px;
    background: linear-gradient(90deg, #8A1538 0%, #F2A900 100%);
    z-index: 2;
}

/* ส่วนหัว: ชื่อหลักสูตร */
#tu-detail-modal #tu-modal-content > div:first-child {
    padding: 1.6rem 1.6rem 1.3rem;
    background: linear-gradient(180deg, #ffffff 0%, #fdf8f9 100%);
    border-bottom: 1px solid #f3e4e7;
}
#tu-detail-modal #tu-modal-title {
    font-family: 'Prompt', sans-serif;
    font-size: 1.45rem;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: .1px;
    color: #8a1515;
}
#tu-detail-modal #tu-modal-title::before {
    content: 'รายละเอียดหลักสูตร';
    display: block;
    margin-bottom: 2px;
    font-size: .72rem;
    font-weight: 500;
    letter-spacing: .04em;
    color: #94a3b8;
}

/* ปุ่มปิด (X): วงกลมนูน ชี้แล้วเป็นแดงไล่สี ไอคอนขาว หมุน 90° */
#tu-detail-modal #tu-modal-content button.tu-modal-close {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    line-height: 1;
    color: #94a3b8 !important;
    background-color: #f1f5f9 !important;
    background-image: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%) !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 50% !important;
    box-shadow: 0 2px 6px rgba(15,23,42,.06), inset 0 1px 0 #ffffff !important;
    cursor: pointer;
    transition: transform .28s cubic-bezier(.22,1,.36,1), box-shadow .28s ease, background .28s ease, color .28s ease, border-color .28s ease;
}
#tu-detail-modal #tu-modal-content button.tu-modal-close i {
    color: inherit !important;
    transition: transform .35s cubic-bezier(.22,1,.36,1);
}
#tu-detail-modal #tu-modal-content button.tu-modal-close:hover,
#tu-detail-modal #tu-modal-content button.tu-modal-close:focus-visible {
    color: #ffffff !important;
    background-color: #8a1515 !important;
    background-image: linear-gradient(135deg, #b52424 0%, #8a1515 55%, #6b1010 100%) !important;
    border-color: transparent !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(138,21,21,.28), inset 0 1px 0 rgba(255,255,255,.28), inset 0 -3px 0 rgba(0,0,0,.14) !important;
}
#tu-detail-modal #tu-modal-content button.tu-modal-close:hover i,
#tu-detail-modal #tu-modal-content button.tu-modal-close:focus-visible i {
    transform: rotate(90deg);
}
#tu-detail-modal #tu-modal-content button.tu-modal-close:active {
    transform: translateY(0) scale(.94);
    box-shadow: 0 2px 4px rgba(15,23,42,.18), inset 0 2px 5px rgba(0,0,0,.22) !important;
}
#tu-detail-modal #tu-modal-content button.tu-modal-close:focus-visible {
    outline: 3px solid rgba(242,169,0,.6);
    outline-offset: 2px;
}

/* เนื้อหา */
#tu-detail-modal #tu-modal-content > div:last-child {
    padding: 1.6rem;
    font-size: .95rem;
    line-height: 1.75;
    color: #475569;
    scrollbar-width: thin;
    scrollbar-color: #dbb4bc transparent;
}

/* เนื้อหาจาก ACF (WYSIWYG): หัวข้อ รายการ ลิงก์ */
#tu-detail-modal #tu-modal-details h1,
#tu-detail-modal #tu-modal-details h2,
#tu-detail-modal #tu-modal-details h3,
#tu-detail-modal #tu-modal-details h4 {
    margin: 1.1em 0 .4em;
    font-weight: 600;
    line-height: 1.4;
    color: #8a1515;
}
#tu-detail-modal #tu-modal-details p { margin: .6em 0; }
#tu-detail-modal #tu-modal-details ul { margin: .6em 0; padding-left: 1.4em; list-style: disc; }
#tu-detail-modal #tu-modal-details ol { margin: .6em 0; padding-left: 1.4em; list-style: decimal; }
#tu-detail-modal #tu-modal-details li { margin: .25em 0; }
#tu-detail-modal #tu-modal-details li::marker { color: #8a1515; }
#tu-detail-modal #tu-modal-details strong { color: #1e293b; font-weight: 600; }
#tu-detail-modal #tu-modal-details a {
    color: #8a1515;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* กล่องค่าธรรมเนียม */
#tu-detail-modal #tu-modal-content .bg-red-50 {
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #fff8f9 0%, #fdecee 100%);
    border: 1px solid #f9d6da;
    border-left: 4px solid #8a1515;
    border-radius: 16px;
}
#tu-detail-modal #tu-modal-content .bg-red-50 > p:first-child {
    font-size: 1rem;
    font-weight: 600;
    color: #8a1515;
}
#tu-detail-modal #tu-modal-content .bg-red-50 .fa-circle-info { color: #8a1515; }
#tu-detail-modal #tu-modal-fee {
    margin: 0 2px;
    font-size: 1.3rem;
    font-weight: 700;
    color: #8a1515;
}

/* ทยอยเด้งเข้าตอนเปิด popup */
#tu-detail-modal.flex #tu-modal-content > div:first-child { animation: tuFadeUp .45s cubic-bezier(.22,1,.36,1) .05s backwards; }
#tu-detail-modal.flex #tu-modal-details                   { animation: tuFadeUp .45s cubic-bezier(.22,1,.36,1) .14s backwards; }
#tu-detail-modal.flex #tu-modal-content .bg-red-50         { animation: tuFadeUp .45s cubic-bezier(.22,1,.36,1) .22s backwards; }

@media (prefers-reduced-motion: reduce) {
    #tu-detail-modal *, #tu-detail-modal *::before, #tu-detail-modal *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* --- 10. หน้าต่างเลือกไฟล์ (WordPress Media Modal) ---
   ผู้ใช้ที่ล็อกอินและมีสิทธิ์อัปโหลดสื่อ จะเห็นหน้าต่างนี้ตอนกด "เลือกไฟล์" (ผู้สมัครทั่วไปจะไม่เห็น)
   หน้าต่างนี้อยู่นอก wrapper ของฟอร์ม จึงใช้ selector ของ WordPress ตรงๆ */

/* พื้นหลังมืดอมแดง + เบลอ (เข้าชุดกับ popup อื่น) */
body .media-modal-backdrop {
    background: rgba(40, 12, 24, .55) !important;
    opacity: 1 !important;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

/* กรอบหน้าต่าง: อยู่กลางจอ กว้างไม่เกิน 1200px มุมโค้ง */
body .media-modal {
    top: 4vh !important;
    bottom: 4vh !important;
    left: 0 !important;
    right: 0 !important;
    max-width: 1200px;
    margin: 0 auto;
    font-family: 'Prompt', sans-serif;
}
body .media-modal .media-modal-content {
    overflow: hidden;
    border-radius: 20px;
    box-shadow: 0 16px 44px rgba(15, 23, 42, .28);
}
/* แถบแดง-ทองบางๆ ด้านบน */
body .media-modal .media-modal-content::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 5px;
    background: linear-gradient(90deg, #8A1538 0%, #F2A900 100%);
    z-index: 5;
}
body .media-modal input,
body .media-modal select,
body .media-modal textarea,
body .media-modal button,
body .media-modal .button {
    font-family: 'Prompt', sans-serif;
}

/* ชื่อหน้าต่าง */
body .media-modal .media-frame-title h1 {
    padding: 0 24px;
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 50px;
    color: #8a1515;
}

/* แท็บ Upload files / Media Library */
body .media-modal .media-router .media-menu-item {
    font-weight: 500;
    color: #64748b !important;
    background: transparent !important;
    border-radius: 10px 10px 0 0;
    transition: color .2s ease, background-color .2s ease;
}
body .media-modal .media-router .media-menu-item:hover {
    color: #8a1515 !important;
    background: #fff1f2 !important;
}
body .media-modal .media-router .media-menu-item.active {
    font-weight: 600;
    color: #8a1515 !important;
    background: #ffffff !important;
    box-shadow: inset 0 -3px 0 #8a1515;
}

/* ปุ่มปิด (X): วงกลมนูน ชี้แล้วเป็นแดง ไอคอนขาว หมุน 90° (วาด × ด้วยตัวอักษร ไม่พึ่งฟอนต์ไอคอน) */
body .media-modal .media-modal-close {
    top: 9px;
    right: 18px;
    width: 36px;
    height: 36px;
    padding: 0 !important;
    color: #94a3b8 !important;
    background-color: #f1f5f9 !important;
    background-image: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%) !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 50% !important;
    box-shadow: 0 2px 6px rgba(15,23,42,.06), inset 0 1px 0 #ffffff !important;
    transition: transform .28s cubic-bezier(.22,1,.36,1), box-shadow .28s ease, background .28s ease, color .28s ease;
}
body .media-modal .media-modal-close .media-modal-icon {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background-image: none !important;
    transition: transform .35s cubic-bezier(.22,1,.36,1);
}
body .media-modal .media-modal-close .media-modal-icon::before {
    content: '\00d7' !important;
    margin: 0 !important;
    width: auto !important;
    height: auto !important;
    font: 400 26px/1 'Prompt', sans-serif !important;
    color: inherit !important;
}
body .media-modal .media-modal-close:hover,
body .media-modal .media-modal-close:focus {
    color: #ffffff !important;
    background-color: #8a1515 !important;
    background-image: linear-gradient(135deg, #b52424 0%, #8a1515 55%, #6b1010 100%) !important;
    border-color: transparent !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(138,21,21,.28), inset 0 1px 0 rgba(255,255,255,.28), inset 0 -3px 0 rgba(0,0,0,.14) !important;
}
body .media-modal .media-modal-close:hover .media-modal-icon,
body .media-modal .media-modal-close:focus .media-modal-icon {
    transform: rotate(90deg);
}

/* ป้ายกำกับของตัวกรอง/ค้นหา: ซ่อนแบบ screen-reader ตามที่ WordPress ออกแบบไว้ (ธีมไม่ได้ซ่อนให้) */
body .media-modal .screen-reader-text,
body .media-modal .media-attachment-filters-label,
body .media-modal .media-search-input-label {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    border: 0;
    white-space: nowrap;
}

/* ช่องกรอก / ตัวกรอง / ค้นหา */
body .media-modal .attachment-filters,
body .media-modal input.search,
body .media-modal .media-sidebar input[type="text"],
body .media-modal .media-sidebar textarea,
body .media-modal .media-sidebar select {
    min-height: 36px;
    padding: 0 12px;
    color: #334155 !important;
    background-color: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 10px !important;
    box-shadow: none !important;
    transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease;
}
body .media-modal .media-sidebar textarea { padding: 8px 12px; }
body .media-modal .attachment-filters:hover,
body .media-modal input.search:hover {
    border-color: #94a3b8 !important;
    background-color: #ffffff !important;
}
body .media-modal .attachment-filters:focus,
body .media-modal input.search:focus,
body .media-modal .media-sidebar input[type="text"]:focus,
body .media-modal .media-sidebar textarea:focus,
body .media-modal .media-sidebar select:focus {
    background-color: #ffffff !important;
    border-color: #8a1538 !important;
    box-shadow: 0 0 0 3px rgba(138,21,56,.10) !important;
    outline: none !important;
}

/* รายการไฟล์ (ตาราง thumbnail) */
body .media-modal .attachments { scrollbar-width: thin; scrollbar-color: #dbb4bc transparent; }
body .media-modal .attachment .attachment-preview {
    overflow: hidden;
    background: #f1f5f9;
    border-radius: 12px;
    box-shadow: inset 0 0 0 1px #e2e8f0;
}
body .media-modal .attachment .filename {
    font-size: 12px;
    font-weight: 500;
    color: #475569;
}
body .media-modal .attachment:hover .attachment-preview {
    box-shadow: inset 0 0 0 1px #cbd5e1, 0 6px 14px rgba(15,23,42,.10);
}
body .media-modal .attachment.selected,
body .media-modal .attachment.details {
    border-radius: 14px;
    box-shadow: inset 0 0 0 3px #ffffff, inset 0 0 0 6px #8a1515 !important;
}
body .media-modal .attachment .check,
body .media-modal .attachment .check:hover {
    background: #8a1515 !important;
    box-shadow: 0 0 0 1px #ffffff !important;
}
body .media-modal .attachment .check .media-modal-icon::before { color: #ffffff; }

/* แถบรายละเอียดด้านขวา */
body .media-modal .media-sidebar {
    background: #f8fafc;
    border-left: 1px solid #e2e8f0;
}
body .media-modal .media-sidebar h2,
body .media-modal .attachment-details h2 {
    font-weight: 600;
    color: #8a1515;
}
body .media-modal .media-sidebar a { color: #8a1515; }

/* แถบปุ่มด้านล่าง */
body .media-modal .media-frame-toolbar .media-toolbar {
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
}

/* ปุ่มทั่วไป (รอง): ขาวนูนบางๆ ชี้แล้วเป็นแดง */
body .media-modal .button {
    min-height: 36px;
    padding: 0 18px;
    font-weight: 500;
    color: #475569 !important;
    background-color: #ffffff !important;
    background-image: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
    border: 1px solid #d7dde6 !important;
    border-radius: 10px !important;
    box-shadow: 0 1px 2px rgba(15,23,42,.05), inset 0 1px 0 #ffffff !important;
    transition: transform .25s cubic-bezier(.22,1,.36,1), box-shadow .25s ease, color .2s ease, border-color .2s ease;
}
body .media-modal .button:hover,
body .media-modal .button:focus {
    color: #8a1515 !important;
    border-color: rgba(138,21,56,.45) !important;
    transform: translateY(-1px);
}
body .media-modal .button.button-hero {
    min-height: 46px;
    padding: 0 28px;
    font-size: 15px;
}

/* ปุ่มหลัก (Select / Select Files): แดงไล่สี นูน */
body .media-modal .button.button-primary,
body .media-modal .button.media-button-select,
body .media-modal .browser.button {
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0,0,0,.25);
    background-color: #8a1515 !important;
    background-image: linear-gradient(135deg, #a51d1d 0%, #8a1515 55%, #6b1010 100%) !important;
    border: 0 !important;
    box-shadow: 0 3px 8px rgba(138,21,21,.22), inset 0 1px 0 rgba(255,255,255,.22), inset 0 -3px 0 rgba(0,0,0,.14) !important;
}
body .media-modal .button.button-primary:hover,
body .media-modal .button.media-button-select:hover,
body .media-modal .browser.button:hover {
    color: #ffffff !important;
    background-image: linear-gradient(135deg, #b52424 0%, #9a1818 55%, #7a1212 100%) !important;
    box-shadow: 0 8px 18px rgba(138,21,21,.28), inset 0 1px 0 rgba(255,255,255,.28), inset 0 -3px 0 rgba(0,0,0,.14) !important;
}
body .media-modal .button.button-primary:active,
body .media-modal .button.media-button-select:active,
body .media-modal .browser.button:active {
    transform: translateY(1px) scale(.98);
    box-shadow: 0 2px 4px rgba(15,23,42,.15), inset 0 2px 6px rgba(0,0,0,.20) !important;
}
/* ยังเลือกไฟล์ไม่ได้ (disabled): เทา ไม่มีเอฟเฟกต์ */
body .media-modal .button.button-primary[disabled],
body .media-modal .button.button-primary[disabled]:hover,
body .media-modal .button.media-button-select[disabled],
body .media-modal .button.media-button-select[disabled]:hover,
body .media-modal .button.disabled,
body .media-modal .button.disabled:hover {
    color: #94a3b8 !important;
    text-shadow: none;
    background-color: #e2e8f0 !important;
    background-image: none !important;
    box-shadow: none !important;
    transform: none;
    cursor: not-allowed;
}

/* แท็บ Upload files: กล่องวางไฟล์เส้นปะ */
body .media-modal .uploader-inline {
    margin: 20px !important;
    background: #f8fafc !important;
    border: 2px dashed #cbd5e1 !important;
    border-radius: 20px;
    transition: border-color .25s ease, background-color .25s ease;
}
body .media-modal .uploader-inline.droppable {
    background: #fff8f9 !important;
    border-color: #8a1515 !important;
}
body .media-modal .uploader-inline .drop-instructions { font-weight: 500; color: #64748b; }
body .media-modal .uploader-inline .max-upload-size { color: #94a3b8; }

/* มือถือ: เต็มจอ */
@media (max-width: 782px) {
    body .media-modal { top: 0 !important; bottom: 0 !important; max-width: none; }
    body .media-modal .media-modal-content { border-radius: 0; }
}

/* --- 8b. ช่องค้นหาหลักสูตร: ระยะห่างไอคอนแว่นขยายกับข้อความ --- */
body .tu-spa-wrapper .fa-magnifying-glass {
    left: 18px !important;
    margin-left: 0 !important;
    font-size: 15px;
    transition: color .2s ease;
}
body .tu-spa-wrapper input.tu-search-input-fix {
    padding-left: 50px !important;   /* ไอคอนอยู่ที่ 18px กว้างราว 15px เว้นว่างก่อนข้อความราว 17px */
}
body .tu-spa-wrapper div:focus-within > .fa-magnifying-glass {
    color: #8a1515 !important;
}

/* --- 7. Popup แจ้งเตือน (SweetAlert2: "ข้อมูลไม่ครบถ้วน") ---
   หมายเหตุ: popup อยู่นอก .tu-application-wrapper จึงไม่ใช้ selector ของ wrapper */

@keyframes tuPopIn {
    from { opacity: 0; transform: translateY(26px) scale(.94); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes tuRing {
    0%   { transform: scale(.92); opacity: .7; }
    100% { transform: scale(1.4); opacity: 0; }
}

/* พื้นหลังมืดอมแดง เบลอฟอร์มด้านหลังเล็กน้อย */
body .swal2-container.swal2-backdrop-show,
body .swal2-container.swal2-noanimation {
    background: rgba(40, 12, 24, .42) !important;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

body .swal2-popup {
    position: relative;
    overflow: hidden;
    width: 30em;
    max-width: 92vw;
    padding: 2.4em 2.2em 2.2em !important;
    font-family: 'Prompt', sans-serif !important;
    background: #ffffff;
    border-radius: 24px !important;
    box-shadow: 0 16px 44px rgba(15, 23, 42, .18) !important;
}
body .swal2-popup.swal2-show {
    animation: tuPopIn .45s cubic-bezier(.22,1,.36,1) !important;
}

/* แถบสีแดง-ทอง บางๆ ด้านบน */
body .swal2-popup::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 5px;
    background: linear-gradient(90deg, #8A1538 0%, #F2A900 100%);
}

/* ไอคอนเตือน: ทองอบอุ่น + วงแหวนแผ่ออกเบาๆ */
body .swal2-icon.swal2-warning {
    margin: .4em auto .8em !important;
    color: #F2A900 !important;
    border-color: rgba(242, 169, 0, .55) !important;
    background: #fffbeb;
}
body .swal2-icon.swal2-warning::after {
    content: '';
    position: absolute;
    top: -.25em; left: -.25em; right: -.25em; bottom: -.25em;
    border: 2px solid rgba(242, 169, 0, .5);
    border-radius: 50%;
    pointer-events: none;
    animation: tuRing 2.2s ease-out infinite;
}
body .swal2-icon .swal2-icon-content {
    font-family: 'Prompt', sans-serif !important;
    font-weight: 500;
}

/* ตัวอักษร */
body .swal2-title {
    margin: 0 !important;
    padding: .2em 0 0 !important;
    font-family: 'Prompt', sans-serif !important;
    font-size: 1.6rem !important;
    font-weight: 600 !important;
    line-height: 1.35 !important;
    letter-spacing: .1px;
    color: #1e293b !important;
}
body .swal2-html-container {
    margin: .7em 0 0 !important;
    padding: 0 .4em !important;
    font-family: 'Prompt', sans-serif !important;
    font-size: 1.05rem !important;
    font-weight: 400 !important;
    line-height: 1.75 !important;
    color: #64748b !important;
}

/* ทยอยเด้งเข้าทีละส่วน */
body .swal2-popup.swal2-show .swal2-title          { animation: tuFadeUp .5s cubic-bezier(.22,1,.36,1) .12s backwards; }
body .swal2-popup.swal2-show .swal2-html-container { animation: tuFadeUp .5s cubic-bezier(.22,1,.36,1) .20s backwards; }
body .swal2-popup.swal2-show .swal2-actions        { animation: tuFadeUp .5s cubic-bezier(.22,1,.36,1) .28s backwards; }

/* ปุ่ม */
body .swal2-actions {
    margin: 1.8em auto 0 !important;
    gap: 12px;
}
body .swal2-styled.swal2-confirm,
body .swal2-styled.swal2-cancel {
    position: relative;
    overflow: hidden;
    margin: 0 !important;
    padding: .8em 2.4em !important;
    font-family: 'Prompt', sans-serif !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    letter-spacing: .2px;
    border: 0 !important;
    border-radius: 12px !important;
    cursor: pointer;
    transition: transform .28s cubic-bezier(.22,1,.36,1), box-shadow .28s ease, background .28s ease, color .28s ease !important;
}
/* แสงวาบพาดผ่านตอนชี้ */
body .swal2-styled.swal2-confirm::after,
body .swal2-styled.swal2-cancel::after {
    content: '';
    position: absolute;
    top: 0; left: -80%;
    width: 50%; height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,.45), transparent);
    transform: skewX(-20deg);
    transition: left .7s ease;
    pointer-events: none;
}
body .swal2-styled.swal2-confirm:hover::after,
body .swal2-styled.swal2-cancel:hover::after { left: 130%; }

body .swal2-styled.swal2-confirm {
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0,0,0,.25);
    background-color: #8A1538 !important;
    background-image: linear-gradient(135deg, #b61d52 0%, #8A1538 50%, #650f2a 100%) !important;
    box-shadow: 0 4px 10px rgba(138,21,56,.22), inset 0 1px 0 rgba(255,255,255,.22), inset 0 -3px 0 rgba(0,0,0,.14) !important;
}
body .swal2-styled.swal2-confirm:hover {
    background-image: linear-gradient(135deg, #c9205c 0%, #9c1840 50%, #750f30 100%) !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(138,21,56,.28), inset 0 1px 0 rgba(255,255,255,.25), inset 0 -3px 0 rgba(0,0,0,.14) !important;
}
body .swal2-styled.swal2-confirm:active {
    transform: translateY(1px) scale(.98);
    box-shadow: 0 2px 4px rgba(15,23,42,.15), inset 0 2px 6px rgba(0,0,0,.20) !important;
}
body .swal2-styled.swal2-confirm:focus {
    box-shadow: 0 0 0 3px rgba(242,169,0,.5), 0 4px 10px rgba(138,21,56,.22) !important;
}

body .swal2-styled.swal2-cancel {
    color: #64748b !important;
    background-color: #f1f5f9 !important;
    background-image: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%) !important;
    box-shadow: 0 2px 6px rgba(15,23,42,.06), inset 0 0 0 1px #e2e8f0 !important;
}
body .swal2-styled.swal2-cancel:hover {
    color: #8A1538 !important;
    transform: translateY(-2px);
}

/* รายการสิ่งที่ยังขาด ใน popup */
body .swal2-html-container .tu-missing-intro { margin: 0; }
body .swal2-html-container .tu-missing-list {
    list-style: none;
    margin: 1.1em 0 0;
    padding: 0;
    max-height: 40vh;
    overflow-y: auto;
    text-align: left;
}
body .swal2-html-container .tu-missing-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 8px;
    padding: 10px 14px;
    font-size: .95rem;
    line-height: 1.5;
    color: #7f1d1d;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 12px;
}
body .swal2-html-container .tu-missing-step { font-weight: 600; }
body .swal2-html-container .tu-missing-count {
    white-space: nowrap;
    font-size: .85rem;
    color: #dc2626;
}
body .swal2-html-container .tu-missing-more {
    justify-content: center;
    color: #64748b;
    background: transparent;
    border-style: dashed;
}

body .swal2-close {
    color: #94a3b8;
    transition: color .2s ease, transform .2s ease;
}
body .swal2-close:hover {
    color: #8A1538;
    background: transparent;
    transform: rotate(90deg);
}

@media (max-width: 480px) {
    body .swal2-popup { padding: 2em 1.4em 1.8em !important; }
    body .swal2-title { font-size: 1.35rem !important; }
    body .swal2-html-container { font-size: 1rem !important; }
}
@media (prefers-reduced-motion: reduce) {
    body .swal2-popup, body .swal2-popup *,
    body .swal2-popup *::before, body .swal2-popup *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* ผู้ใช้ที่ปิด animation ในระบบ */
@media (prefers-reduced-motion: reduce) {
    .tu-application-wrapper *,
    .tu-application-wrapper *::before,
    .tu-application-wrapper *::after {
        animation: none !important;
        transition: none !important;
    }
}


/* =====================================================================
   11. เลือกวิธีชำระเงินในขั้นตอนสุดท้าย + กล่องยืนยันข้อมูลที่ดึงมาจากใบสมัครเดิม
   ===================================================================== */
.tu-application-wrapper .tu-pay-methods { margin-top: 18px; padding-top: 16px; border-top: 1px dashed #fcd34d; text-align: center; }
.tu-application-wrapper .tu-pay-methods-title { margin: 0 0 12px !important; font-size: 15px; font-weight: 600; color: #92400e; }
.tu-application-wrapper .tu-pay-methods-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.tu-application-wrapper .tu-pay-method { position: relative; margin: 0 !important; cursor: pointer; }
.tu-application-wrapper .tu-pay-method input { position: absolute; opacity: 0; pointer-events: none; }
.tu-application-wrapper .tu-pay-method span { display: inline-flex; align-items: center; gap: 10px; padding: 12px 20px; font-size: 15px; font-weight: 500; color: #475569; background: #fff; border: 2px solid #e5e7eb; border-radius: 14px; transition: border-color .2s ease, box-shadow .2s ease, color .2s ease, background .2s ease; }
.tu-application-wrapper .tu-pay-method:hover span { border-color: #fcd34d; }
.tu-application-wrapper .tu-pay-method input:checked + span { color: #8A1538; background: #fff7f9; border-color: #8A1538; box-shadow: 0 6px 16px rgba(138,21,56,.14); }
.tu-application-wrapper .tu-pay-method input:focus-visible + span { outline: 3px solid rgba(138,21,56,.35); outline-offset: 2px; }
.tu-application-wrapper .tu-pay-methods-note { margin: 10px 0 0 !important; font-size: 12.5px; color: #a16207; }
.tu-application-wrapper .tu-prefill-confirm { display: flex; align-items: flex-start; justify-content: center; gap: 10px; margin: 18px 0 0 !important; text-align: left; font-size: 14px; line-height: 1.6; color: #92400e; cursor: pointer; }
.tu-application-wrapper .tu-prefill-confirm input { margin-top: 4px; flex: 0 0 auto; }


/* =====================================================================
   12. ปุ่มเลือกไฟล์ของเราเอง (ข้อความตามภาษาของฟอร์ม ไม่ขึ้นกับภาษาเบราว์เซอร์)
   ===================================================================== */
body .tu-application-wrapper .acf-basic-uploader { position: relative; }
body .tu-application-wrapper .acf-field input[type="file"].tu-file-native {
    position: absolute !important; width: 1px !important; height: 1px !important; margin: -1px !important; padding: 0 !important;
    overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; opacity: 0 !important; border: 0 !important;
}
.tu-application-wrapper .tu-file-ui { display: flex; align-items: center; gap: 14px; flex: 1 1 auto; min-width: 0; }
.tu-application-wrapper .tu-file-pick {
    flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; margin: 0 !important; padding: 10px 22px; cursor: pointer;
    font-family: 'Prompt', sans-serif; font-size: 14px; font-weight: 600; line-height: 1.3; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.25);
    border-radius: 12px; background: #8A1538 linear-gradient(135deg, #b61d52 0%, #8A1538 50%, #650f2a 100%);
    box-shadow: 0 3px 8px rgba(138,21,56,.22), inset 0 1px 0 rgba(255,255,255,.22), inset 0 -3px 0 rgba(0,0,0,.14);
    transition: transform .28s cubic-bezier(.22,1,.36,1), box-shadow .28s ease;
}
.tu-application-wrapper .tu-file-pick:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(138,21,56,.28), inset 0 1px 0 rgba(255,255,255,.25), inset 0 -3px 0 rgba(0,0,0,.14); }
.tu-application-wrapper .tu-file-pick:active { transform: scale(.97); }
.tu-application-wrapper .tu-file-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: 'Prompt', sans-serif; font-size: 14px; color: #64748b; }
.tu-application-wrapper .tu-file-name.has-file { color: #1e293b; font-weight: 500; }
.tu-application-wrapper input.tu-file-native:focus-visible + .tu-file-ui .tu-file-pick { outline: 3px solid rgba(138,21,56,.35); outline-offset: 2px; }

/* =====================================================================
   9. กริดการ์ดหลักสูตร (program grid auto-fill)
   การ์ดกว้างอย่างน้อย 300px: จำนวนคอลัมน์ปรับตามความกว้างจริงของพื้นที่ที่วางเนื้อหา (ไม่ขึ้นกับความกว้างหน้าจอ)
   สูงสุด 3 คอลัมน์ · พื้นที่แคบลงลดเหลือ 2 และ 1 คอลัมน์เอง · เปลี่ยน 300px เพื่อปรับขนาดการ์ดขั้นต่ำ
   ===================================================================== */
.tu-spa-wrapper #grid-open,
.tu-spa-wrapper #grid-closed {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, max(300px, calc((100% - 3rem) / 3))), 1fr));
}

/* =====================================================================
   13. มือถือ/แท็บเล็ต: ช่องแนบไฟล์ (ทุกฟอร์ม: สมัครเรียน, สมัครงาน)
   ช่องที่ตั้งความกว้างเป็น % ใน ACF (เช่น 33%) บนจอแคบจะถูกบีบจนข้อความและปุ่ม "เลือกไฟล์" เรียงแปลก
   - ช่องไฟล์/รูป: ต่ำกว่า 900px เรียงเต็มแถว (ช่องละหนึ่งบรรทัด)
   - ช่องอื่นที่ตั้งความกว้างเป็น %: ต่ำกว่า 640px เรียงเต็มแถว
   ===================================================================== */
@media (max-width: 900px) {
    body .tu-application-wrapper .acf-fields > .acf-field[data-type="file"],
    body .tu-application-wrapper .acf-fields > .acf-field[data-type="image"] {
        width: 100% !important;
        flex: 0 0 100% !important;
    }
}
@media (max-width: 640px) {
    body .tu-application-wrapper .acf-fields > .acf-field[data-width] {
        width: 100% !important;
        flex: 0 0 100% !important;
    }
    body .tu-application-wrapper .tu-file-ui { flex-wrap: wrap; gap: 8px 12px; }
    body .tu-application-wrapper .tu-file-name { flex: 1 1 100%; }
}

/* =====================================================================
   14. เอกสารแนบภายหลัง (โมดูล late-docs): ช่องไฟล์ที่แนบภายหลังได้ ไม่ขึ้นป้าย "ไม่บังคับ" (ใช้ข้อความ "แนบภายหลังได้ ถึงวันที่ ..." ใต้ชื่อช่องแทน)
   ===================================================================== */
body .tu-application-wrapper .acf-field.tu-late-doc .acf-label label::after { display: none !important; }
body .tu-application-wrapper .acf-field.tu-late-doc .acf-label .description { color: #b45309 !important; font-weight: 500; }

/* =====================================================================
   15. กรณีที่รับสมัครที่ล็อกตามหลักสูตร (โมดูล program-case): ซ่อนตัวเลือกในฟอร์ม ค่าถูกตั้งตามหลักสูตรแล้ว
   ===================================================================== */
body .tu-application-wrapper .acf-field.tu-case-locked { display: none !important; }

/* =====================================================================
   16. ปุ่มสมัครใน Popup รายละเอียดหลักสูตร: ตัวอักษรขาวตลอด (กันสี a:hover ของธีมทับ) พื้นสีเดียวกับปุ่มบนการ์ด
   ===================================================================== */
body #tu-detail-modal .tu-modal-btn-apply { background-color: #8a1515; color: #fff !important; text-decoration: none !important; font-weight: 600; box-shadow: 0 2px 6px rgba(138,21,21,.25); transition: background-color .2s ease, transform .2s ease, box-shadow .2s ease; }
body #tu-detail-modal .tu-modal-btn-apply:hover,
body #tu-detail-modal .tu-modal-btn-apply:focus,
body #tu-detail-modal .tu-modal-btn-apply:active,
body #tu-detail-modal .tu-modal-btn-apply:visited { color: #fff !important; text-decoration: none !important; }
body #tu-detail-modal .tu-modal-btn-apply:hover { background-color: #9a1818; transform: translateY(-1px); box-shadow: 0 6px 14px rgba(138,21,21,.28); }
body #tu-detail-modal .tu-modal-btn-apply:focus-visible { outline: 3px solid rgba(138,21,21,.35); outline-offset: 2px; }
body #tu-detail-modal .tu-modal-btn-apply span { color: inherit !important; }


/* =====================================================================
   17. แถบ "ดึงข้อมูลจากใบสมัครครั้งก่อน": อยู่ใต้วงกลมขั้นตอน (script.js ย้ายมา) เต็มความกว้างของคอลัมน์ฟอร์ม
   ===================================================================== */
body .tu-application-wrapper .acf-fields > .tu-prefill-note { flex: 0 0 100%; width: 100%; box-sizing: border-box; margin: 0 0 24px !important; position: relative; z-index: 1; }
body .tu-application-wrapper .tu-prefill-note[data-empty="1"] { background: #f8fafc !important; border-color: #e2e8f0 !important; color: #475569 !important; }


/* =====================================================================
   18. ช่อง "ยืนยันอีเมล / เลขบัตรประชาชน" (กรอก 2 รอบ)
   ===================================================================== */
body .tu-application-wrapper .tu-confirm-wrap { margin-top: 20px; }
body .tu-application-wrapper .tu-confirm-label { display: block; margin: 0 0 8px; font-weight: 600; font-size: 15px; color: #1e293b; }
body .tu-application-wrapper .tu-confirm-input { width: 100%; box-sizing: border-box; padding: 14px 18px; border: 1px solid #e2e8f0; border-radius: 14px; background: #f8fafc; font: inherit; color: #1e293b; transition: border-color .2s, box-shadow .2s; }
body .tu-application-wrapper .tu-confirm-input:focus { outline: 0; border-color: #8A1538; box-shadow: 0 0 0 4px rgba(138,21,56,.12); background: #fff; }
body .tu-application-wrapper .tu-confirm-wrap.is-ok .tu-confirm-input { border-color: #16a34a; background: #f0fdf4; }
body .tu-application-wrapper .tu-confirm-wrap.is-bad .tu-confirm-input { border-color: #dc2626; background: #fef2f2; }
body .tu-application-wrapper .tu-confirm-hint { display: block; margin-top: 6px; font-size: 12.5px; color: #64748b; }
body .tu-application-wrapper .tu-confirm-wrap.tu-confirm-nopaste .tu-confirm-hint { color: #b45309; font-weight: 600; }
body .tu-application-wrapper .tu-confirm-error { display: block; min-height: 0; margin-top: 4px; font-size: 13px; color: #dc2626; font-weight: 500; }


/* ===== 19. ข้อความเตือน "ชำระเงินแล้วแก้สาขาไม่ได้" ในกล่องชำระเงิน + ช่องสาขาที่ล็อกในหน้าแก้ไขใบสมัคร ===== */
.tu-branch-note { display: flex; gap: 8px; align-items: flex-start; justify-content: center; margin: 12px auto 0; max-width: 560px; padding: 9px 12px; border-radius: 10px; background: #fff1f2; border: 1px solid #fecdd3; color: #9f1239; font-size: 13.5px; line-height: 1.5; text-align: left; }
.tu-branch-note i { margin-top: 3px; }
.tu-locked-field select, .tu-locked-field .select2-container { opacity: .65; cursor: not-allowed; }
.tu-locked-field .acf-label .description { color: #9f1239; }