/* Livecode24 support chat widget — palette matches style.css */
.lc-chat, .lc-chat * { box-sizing: border-box; }
.lc-chat { position: fixed; right: 18px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 8000; font-family: "Sarabun", system-ui, sans-serif; color: #fff; }
.lc-chat-fab { position: relative; width: 60px; height: 60px; border: 0; border-radius: 50%; background: transparent; color: #1b1240; cursor: pointer; display: grid; place-items: center; transition: transform .15s; padding: 0; }
.lc-chat-fab:hover { transform: translateY(-2px) scale(1.04); }
.lc-chat-fab svg { width: 28px; height: 28px; display: none; }
.lc-chat-fab img { width: 60px; height: 60px; border-radius: 50%; display: block; object-fit: cover; box-shadow: 0 8px 24px rgba(0,0,0,.45), 0 0 0 4px rgba(255,210,63,.22); }
.lc-chat-fab .lc-x { display: none; font-size: 28px; font-weight: 700; line-height: 1; width: 60px; height: 60px; border-radius: 50%; background: #ffd23f; color: #1b1240; place-items: center; }
.lc-chat.open .lc-chat-fab img { display: none; }
.lc-chat.open .lc-chat-fab .lc-x { display: grid; }
.lc-chat-badge { position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: #ff3b3b; color: #fff; font-family: "Kanit", system-ui, sans-serif; font-weight: 700; font-size: 12px; display: grid; place-items: center; box-shadow: 0 0 0 2px #140d2e; }
.lc-chat-badge[hidden] { display: none; }
.lc-chat-panel { position: absolute; right: 0; bottom: 76px; width: min(380px, calc(100vw - 24px)); height: min(520px, calc(100vh - 120px)); background: #1a1538; border: 2px solid #2c2558; border-top: 4px solid #ffd23f; border-radius: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.55); display: flex; flex-direction: column; overflow: hidden; }
.lc-chat-panel[hidden] { display: none; }
.lc-chat-hd { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: linear-gradient(180deg, #272052, #1a1538); border-bottom: 1px solid #2c2558; flex: none; }
.lc-chat-hd .lc-av { width: 36px; height: 36px; border-radius: 50%; background: #ffd23f; color: #1b1240; display: grid; place-items: center; flex: none; overflow: hidden; }
.lc-chat-hd .lc-av svg { width: 22px; height: 22px; display: none; }
.lc-chat-hd .lc-av img { width: 36px; height: 36px; object-fit: cover; display: block; }
.lc-chat-hd b { display: block; font-family: "Kanit", system-ui, sans-serif; font-weight: 800; font-size: 16px; line-height: 1.2; }
.lc-chat-hd span { display: block; color: #c3b9ea; font-size: 13px; }
.lc-chat-hd .lc-close { margin-left: auto; width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: #c3b9ea; font-size: 22px; cursor: pointer; }
.lc-chat-hd .lc-close:hover { background: rgba(255,255,255,.08); color: #fff; }
.lc-chat-msgs { flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 10px; background: rgba(6,5,13,.45); }
.lc-chat-empty, .lc-chat-guest { text-align: center; color: #c3b9ea; padding: 24px 12px; font-size: 15px; line-height: 1.6; }
.lc-chat-guest { display: flex; flex-direction: column; align-items: center; gap: 10px; height: 100%; justify-content: center; }
.lc-chat-guest .lc-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.lc-chat-guest a, .lc-chat-send, .lc-chat-attach { font-family: "Kanit", system-ui, sans-serif; font-weight: 700; font-size: 15px; text-decoration: none; border-radius: 999px; padding: 8px 16px; border: 2px solid #ffd23f; }
.lc-chat-guest a.lc-pri, .lc-chat-send { background: #ffd23f; color: #1b1240; }
.lc-chat-guest a.lc-sec { background: transparent; color: #ffd23f; }
.lc-msg { max-width: 86%; padding: 8px 12px; border-radius: 16px; font-size: 15px; line-height: 1.55; word-break: break-word; }
.lc-msg p { margin: 0; white-space: pre-wrap; }
.lc-msg time { display: block; font-size: 11px; opacity: .7; margin-top: 4px; }
.lc-msg img { display: block; max-width: 220px; max-height: 200px; border-radius: 10px; margin: 4px 0; cursor: zoom-in; background: #000; }
.lc-msg.me { align-self: flex-end; background: #ffd23f; color: #1b1240; border-bottom-right-radius: 6px; }
.lc-msg.them { align-self: flex-start; background: #272052; border: 1px solid #2c2558; border-bottom-left-radius: 6px; }
.lc-msg.sys { align-self: center; max-width: 94%; background: rgba(255,210,63,.1); border: 1px dashed #ffd23f; color: #ffe9a0; font-size: 14px; text-align: left; }
.lc-msg.them b, .lc-msg.sys b { display: block; font-family: "Kanit", system-ui, sans-serif; font-size: 13px; color: #ffd23f; margin-bottom: 2px; }
.lc-chat-form { flex: none; display: flex; gap: 8px; align-items: flex-end; padding: 10px; border-top: 1px solid #2c2558; background: #1a1538; }
.lc-chat-form textarea { flex: 1; min-height: 42px; max-height: 96px; resize: none; font: inherit; font-size: 16px; color: #fff; background: rgba(6,5,13,.7); border: 2px solid #2c2558; border-radius: 14px; padding: 8px 12px; outline: none; }
.lc-chat-form textarea:focus { border-color: #ffd23f; }
.lc-chat-attach { width: 42px; height: 42px; padding: 0; display: grid; place-items: center; background: transparent; color: #ffd23f; cursor: pointer; flex: none; }
.lc-chat-attach input { display: none; }
.lc-chat-send { height: 42px; padding: 0 16px; cursor: pointer; flex: none; }
.lc-chat-send:disabled, .lc-chat-attach:disabled { opacity: .5; cursor: not-allowed; }
.lc-chat-err { color: #ffb3b3; font-size: 13px; padding: 0 12px 8px; flex: none; }
.lc-chat-err[hidden] { display: none; }
.lc-chat-form[hidden], .lc-chat-preview[hidden], .lc-chat-panel[hidden] { display: none !important; }
.lc-chat-preview { display: flex; align-items: center; gap: 8px; padding: 0 12px 8px; font-size: 13px; color: #c3b9ea; flex: none; }
.lc-chat-preview img { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; }
.lc-chat-preview button { border: 0; background: transparent; color: #ff3b3b; cursor: pointer; font-size: 18px; }

/* account + admin transcripts */
.ch-hist { display: flex; flex-direction: column; gap: 10px; max-height: 560px; overflow-y: auto; background: rgba(6,5,13,.45); border: 2px solid var(--line, #2c2558); border-radius: 16px; padding: 12px; margin: 0 0 12px; }
.ch-msg { padding: 8px 12px; border-radius: 14px; }
.ch-msg.ch-customer { background: rgba(255,210,63,.16); align-self: flex-end; max-width: 90%; }
.ch-msg.ch-admin { background: rgba(39,32,82,.9); border: 1px solid var(--line, #2c2558); align-self: flex-start; max-width: 90%; }
.ch-msg.ch-system { background: rgba(255,210,63,.08); border: 1px dashed var(--yellow, #ffd23f); }
.ch-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted, #c3b9ea); margin-bottom: 4px; }
.ch-meta b { color: var(--yellow, #ffd23f); font-family: var(--hfont, Kanit, sans-serif); }
.ch-msg p { margin: 0; white-space: pre-wrap; word-break: break-word; }
.ch-msg img { max-width: 220px; max-height: 200px; border-radius: 10px; display: block; margin: 6px 0 0; }
.ch-badge { display: inline-block; min-width: 1.4em; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: #ff3b3b; color: #fff; font-size: 12px; line-height: 1.5; vertical-align: middle; }
.ch-preview { color: var(--muted, #c3b9ea); font-size: 14px; }
.admin-chat-form { margin-top: 12px; }
.unread-row td { background: rgba(255,210,63,.08); }
@media (max-width: 520px) {
  .lc-chat { right: 12px; }
  .lc-chat-panel { width: calc(100vw - 16px); height: min(70vh, calc(100vh - 100px)); right: -6px; }
}
