/*
 * ux-enhance.css — สไตล์สำหรับ UX เสริม (คลิกแถว / ปุ่มขึ้นบน / สถานะกำลังบันทึก)
 */

/* แถวตารางที่คลิกได้ */
.ticket-list tbody tr.row-clickable {
    cursor: pointer;
}

/* ปุ่มเลื่อนขึ้นบนสุด */
.ux-to-top {
    position: fixed;
    right: 22px;
    bottom: 24px;
    z-index: 1500;
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: #22314f;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 10px 26px rgba(24, 24, 27, .28);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(.92);
    transition: opacity .25s, visibility .25s, transform .25s cubic-bezier(.21, 1.02, .73, 1), background .18s;
}

.ux-to-top.is-show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.ux-to-top:hover {
    background: #3f5680;
    transform: translateY(-2px) scale(1);
}

.ux-to-top:active {
    transform: translateY(0) scale(.94);
}

.ux-to-top svg { display: block; }

/* ปุ่มกำลังบันทึก (กันกดซ้ำ) */
.btn.is-submitting {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn.is-submitting::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, .55);
    border-top-color: #fff;
    border-radius: 50%;
    animation: uxSpin .6s linear infinite;
}

/* ปุ่มขอบ/ขาว: สปินเนอร์สีเข้ม */
.btn-border.is-submitting::after,
.btn--blue-border.is-submitting::after,
.header-action-btn--draft.is-submitting::after {
    border-color: rgba(24, 24, 27, .25);
    border-top-color: #22314f;
}

@keyframes uxSpin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .btn.is-submitting::after { animation: none; }
    .ux-to-top { transition: none; }
}

/* ===== แถวที่โฟกัสด้วยคีย์ลัด ===== */
.ticket-list tbody tr.is-row-focus > td {
    box-shadow: inset 0 0 0 9999px rgba(24,119,242,.06);
}
.ticket-list tbody tr.is-row-focus > td:first-child {
    box-shadow: inset 3px 0 0 #2563eb, inset 0 0 0 9999px rgba(24,119,242,.06);
}

/* ===== ปุ่มคัดลอกรหัส ===== */
.ux-copy {
    margin-left: 6px;
    width: 22px; height: 22px;
    border: 1px solid #dde7f5;
    border-radius: 6px;
    background: #fff;
    color: #7286a3;
    font-size: 12px;
    cursor: pointer;
    vertical-align: middle;
    transition: background-color .15s ease, color .15s ease;
}
.ux-copy:hover { background: #2563eb; color: #fff; border-color: #2563eb; }

/* ===== toast ===== */
.ux-toast {
    position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(8px);
    z-index: 6000; padding: 10px 16px;
    border-radius: 10px; background: #22314f; color: #fff;
    font-size: 13.5px; font-weight: 600;
    box-shadow: 0 10px 28px rgba(16,24,40,.28);
    opacity: 0; transition: opacity .2s ease, transform .2s ease;
}
.ux-toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== ร่างคำตอบอัตโนมัติ ===== */
.ux-draft-hint {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 8px; padding: 8px 12px;
    border: 1px solid #cdeccd; border-radius: 9px;
    background: #f0fdf4; color: #15803d;
    font-size: 13px; font-weight: 600;
}
.ux-draft-clear {
    border: 1px solid #bbf7d0; border-radius: 7px;
    background: #fff; color: #15803d;
    padding: 3px 10px; font-weight: 700; cursor: pointer;
}

/* ===== empty state ===== */
.ux-empty {
    padding: 48px 20px; text-align: center;
}
.ux-empty__icon { font-size: 40px; margin-bottom: 10px; }
.ux-empty__title { color: #344054; font-size: 16px; font-weight: 800; }
.ux-empty__sub { margin-top: 4px; color: #98a2b3; font-size: 13.5px; }

/* ===== เปลี่ยนสถานะ inline ===== */
.ux-status { position: relative; display: inline-block; }
.ux-status__btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border: 1px solid #dde7f5; border-radius: 999px;
    background: #fff; color: #344054; font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.ux-status__btn:hover { border-color: #2563eb; color: #2563eb; }
.ux-status__btn i { font-style: normal; font-size: 10px; color: #98a2b3; }
.ux-status__btn.is-loading { opacity: .6; pointer-events: none; }
.ux-status__menu {
    position: absolute; z-index: 50; top: calc(100% + 4px); left: 0;
    min-width: 160px; padding: 4px;
    border: 1px solid #dde7f5; border-radius: 10px; background: #fff;
    box-shadow: 0 12px 28px rgba(16,24,40,.16);
}
.ux-status__item {
    display: block; width: 100%; text-align: left;
    padding: 8px 10px; border: 0; border-radius: 7px; background: transparent;
    color: #3f5680; font-size: 13px; font-weight: 600; cursor: pointer;
}
.ux-status__item:hover { background: #eff4fc; color: #22314f; }
.ux-status__item.is-current { color: #1d4ed8; background: #e7f0fe; }

/* ===== help overlay ===== */
.ux-help {
    position: fixed; inset: 0; z-index: 6000;
    display: flex; align-items: center; justify-content: center;
    padding: 20px; background: rgba(9,9,11,.45);
}
.ux-help__card {
    width: min(420px, 100%); padding: 22px 24px;
    border-radius: 16px; background: #fff; box-shadow: 0 24px 60px rgba(16,24,40,.28);
}
.ux-help__card h3 { margin: 0 0 12px; font-size: 18px; font-weight: 800; color: #22314f; }
.ux-help__card ul { list-style: none; margin: 0 0 16px; padding: 0; }
.ux-help__card li { padding: 7px 0; border-bottom: 1px solid #f1f1f4; color: #475467; font-size: 14px; }
.ux-help__card kbd {
    display: inline-block; min-width: 22px; padding: 2px 7px; text-align: center;
    border: 1px solid #cfdcee; border-bottom-width: 2px; border-radius: 6px;
    background: #fafcff; color: #22314f; font-size: 12px; font-weight: 700;
}
.ux-help__close {
    width: 100%; min-height: 42px; border: 0; border-radius: 10px;
    background: #22314f; color: #fff; font-weight: 700; cursor: pointer;
}

/* ปุ่มกลับขึ้นบนของ HESK เดิม (กล่องเทา) — เลิกใช้ทุกหน้า เหลือ .ux-to-top ธีมเดียวทั้งเว็บ */
a.back-to-top { display: none !important; }
/* dock-notif และ dock-mail: บังคับให้กระดิ่ง/ไอคอนอยู่บน label อยู่ล่างเสมอ */
.navbar__list .dock-extra-item.dock-notif,
.navbar__list .dock-extra-item.dock-mail {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.navbar__list .dock-extra-item.dock-notif .hesk-notif,
.navbar__list .dock-extra-item.dock-mail .profile__item--mail {
    order: 1;  /* ไอคอนอยู่บน */
}

.navbar__list .dock-extra-item .dock-label {
    order: 2;  /* label อยู่ล่าง */
}
/* มือถือ: ซ่อน brand ใน header จริง (โชว์ clone ใน .ux-mhead แทน) */
@media (max-width: 899px) {
    .hesk-brand--desktop-only {
        display: none !important;
    }
}

/* desktop: ลบ clone ออกด้วย CSS (กันกรณี .ux-mhead ไม่ถูกลบ) */
@media (min-width: 900px) {
    .ux-mhead { display: none !important; }
}