/* Chat web (29/11/2026) — gaya disamakan dengan app TMN Studio (lib/screens/chat.dart). Lihat assets/js/chat_tools.js. */

/* ── Jendela chat melayang: sedikit lebih lega untuk kartu & panel ───────────────────────── */
.rise-chat-wrapper { width: 340px; height: 470px; border-radius: 12px; overflow: hidden; }
.rise-chat-body { height: 346px; position: relative; }
/* Latar biru muda + pola HANYA untuk percakapan terbuka dengan "Latar chat" aktif (bukan daftar percakapan).
   Latar dimatikan admin -> putih seperti sebelum redesain; bubble lawan & pil hari abu-abu (#E5E9EC, warna lama) agar terbedakan. */
.rise-chat-wrapper:has(.rise-chat-footer) .rise-chat-body.chat-wallpaper { background-color: #EEF3F8; }
.rise-chat-wrapper:has(.rise-chat-footer) .rise-chat-body:not(.chat-wallpaper) { background-color: #fff; }
.rise-chat-body:not(.chat-wallpaper) .chat-other .chat-msg:not(.chat-msg-emoji):not(.chat-msg-sticker) { background: #E5E9EC; box-shadow: none; }
.rise-chat-body:not(.chat-wallpaper) .chat-day-sep span { background: #E5E9EC; box-shadow: none; }
/* Warna latar pilihan admin (color picker) yang gelap: bubble lawan & pil hari kembali putih agar kontras. */
.rise-chat-body.chat-bg-dark .chat-other .chat-msg:not(.chat-msg-emoji):not(.chat-msg-sticker) { background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }
.rise-chat-body.chat-bg-dark .chat-day-sep span { background: rgba(255, 255, 255, .92); }

/* Daftar percakapan (masukan user 29/11/2026): yang punya pesan BARU berlatar biru muda + tebal; yang sudah dibaca putih. */
.rise-chat-wrapper .message-row { background: #fff; }
.rise-chat-wrapper .message-row.unread { background: #E3EEFA; }
.rise-chat-wrapper .message-row.unread .media-body { color: #1D2433; font-weight: 600; }
.rise-chat-wrapper .message-row:hover { background: #f2f4f6; }
.rise-chat-wrapper .message-row.unread:hover { background: #D6E6F7; }
/* Percakapan terbuka: kolom flex — isi pesan mengisi sisa tinggi, jadi pratinjau kartu / textarea yang membesar
   tidak mendorong header keluar atau memotong bilah alat (tinggi inline dari autosize diabaikan). */
.rise-chat-wrapper:has(.rise-chat-footer) { display: flex; flex-direction: column; }
.rise-chat-wrapper:has(.rise-chat-footer) > * { flex: 0 0 auto; }
.rise-chat-wrapper:has(.rise-chat-footer) .rise-chat-body { flex: 1 1 auto; height: auto !important; min-height: 0; }
.rise-chat-body.full-height { height: 433px; }
.rise-chat-body.long { height: 432px; }
.rise-chat-body.chat-wallpaper { background-repeat: repeat; background-size: 180px 180px; background-attachment: local; }

/* Bubble: pengirim biru, lawan putih, sudut 16 + ekor 4, lebar mengikuti isi (maks 78%), jam di dalam bubble. */
.rise-chat-body .chat-me, .rise-chat-body .chat-other { padding: 1px 10px; margin-top: 2px; }
.rise-chat-body .chat-other .avatar { margin-top: 2px; }
.rise-chat-body .chat-msg {
    max-width: 78%; padding: 6px 10px 4px; font-size: 13.5px; line-height: 1.35;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .1); user-select: text; -webkit-user-select: text;
}
.rise-chat-body .chat-other .chat-msg { background: #fff; color: #1D2433; border-radius: 4px 16px 16px 16px; }
.rise-chat-body .chat-me .chat-msg { background: #0090FF; color: #fff; border-radius: 16px 4px 16px 16px; }
.rise-chat-body .chat-other .avatar + .chat-msg { max-width: calc(78% - 34px); }
.chat-msg-time { display: block; text-align: right; font-size: 10.5px; margin-top: 2px; opacity: .75; white-space: nowrap; }
.chat-other .chat-msg-time { color: #6b7785; opacity: 1; }

/* Emoji besar (1–3 emoji) & stiker: tanpa bubble, jam di atas pil gelap. */
.rise-chat-body .chat-msg.chat-msg-emoji,
.rise-chat-body .chat-msg.chat-msg-sticker { background: transparent !important; box-shadow: none; padding: 0; }
.chat-msg.chat-msg-emoji .chat-msg-body { font-size: 38px; line-height: 1.15; }
.chat-msg.chat-msg-emoji .chat-msg-time,
.chat-msg.chat-msg-sticker .chat-msg-time {
    display: inline-block; background: rgba(0, 0, 0, .28); color: #fff; opacity: 1; border-radius: 8px; padding: 0 6px;
}
.chat-msg-sticker img.chat-sticker { width: 120px !important; height: 120px !important; }

/* Pemisah hari */
.chat-day-sep { text-align: center; margin: 8px 0 4px; }
.chat-day-sep span {
    display: inline-block; background: rgba(255, 255, 255, .92); color: #4E5E6A; font-size: 11px; font-weight: 600;
    padding: 2px 10px; border-radius: 10px; box-shadow: 0 1px 1px rgba(0, 0, 0, .08);
}

/* Kartu di bubble pengirim (biru) tetap terbaca */
.chat-me .chat-msg .chat-ref-card { background: #fff !important; color: #1D2433 !important; }
.chat-me .chat-msg .chat-ref-card .text-off { color: #6b7785 !important; }

/* ── Komposer ─────────────────────────────────────────────────────────────────────────── */
.chat-tools { position: relative; }
.chat-tools-bar { display: flex; align-items: center; gap: 2px; padding: 4px 6px; }
.chat-tools-bar .chat-tools-btn {
    background: none; border: 0; color: #4E5E6A; width: 30px; height: 30px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center; font-size: 16px; cursor: pointer; padding: 0;
}
.chat-tools-bar .chat-tools-btn:hover { background: #eef3f8; }
.chat-tools-bar .chat-tools-btn.active { color: #4186C3; background: #e3eef8; }
.chat-tools-bar .chat-tools-emoji-btn { font-size: 18px; line-height: 1; }
.chat-tools-bar .chat-tools-spacer { flex: 1; }

.chat-ref-preview {
    display: flex; align-items: center; gap: 8px; margin: 4px 6px; padding: 6px 8px; border-radius: 8px;
    border: 1px solid #d6e2ee; background: #f5f9fd; font-size: 12px;
}
.chat-ref-preview .fa { font-size: 18px; color: #4186C3; width: 20px; text-align: center; }
.chat-ref-preview-text { flex: 1; min-width: 0; }
.chat-ref-preview a.js-chat-ref-preview-close { color: #888; font-size: 18px; text-decoration: none; padding: 0 4px; }

.chat-tools-panel {
    position: absolute; left: 0; right: 0; bottom: 100%; background: #fff; border-top: 1px solid #e1e6ed;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, .08); z-index: 20; height: 230px; display: flex; flex-direction: column;
}
.chat-tools-panel.hide { display: none; }
.chat-tools-tabs { display: flex; border-bottom: 1px solid #eef1f4; }
.chat-tools-tab { flex: 1; text-align: center; padding: 6px; font-size: 12px; font-weight: 600; color: #4E5E6A; }
.chat-tools-tab.active { color: #4186C3; box-shadow: inset 0 -2px 0 #4186C3; }
.chat-tools-tab:hover, .chat-tools-tab:focus { text-decoration: none; }
.chat-tools-body { flex: 1; overflow-y: auto; min-height: 0; }
.chat-tools-body.hide { display: none; }
.chat-emoji-cats { display: flex; gap: 2px; padding: 4px; border-bottom: 1px solid #f2f4f6; position: sticky; top: 0; background: #fff; }
.chat-emoji-cat { padding: 2px 6px; border-radius: 6px; font-size: 16px; opacity: .55; }
.chat-emoji-cat.active { opacity: 1; background: #eef3f8; }
.chat-emoji-cat:hover { text-decoration: none; opacity: 1; }
.chat-emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(32px, 1fr)); padding: 4px; }
.chat-emoji-grid.hide { display: none; }
.chat-emoji { background: none; border: 0; font-size: 21px; line-height: 1; padding: 4px 0; border-radius: 6px; cursor: pointer; }
.chat-emoji:hover { background: #eef3f8; }
.chat-sticker-langs { display: flex; gap: 6px; padding: 6px 6px 0; }
.chat-sticker-lang { padding: 2px 10px; border-radius: 12px; font-size: 12px; color: #4E5E6A; border: 1px solid #dde3ea; }
.chat-sticker-lang.active { background: #4186C3; border-color: #4186C3; color: #fff; }
.chat-sticker-lang:hover, .chat-sticker-lang:focus { text-decoration: none; }
.chat-sticker-grid.hide { display: none; }
.chat-sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 4px; padding: 6px; }
.chat-sticker-btn { background: none; border: 0; border-radius: 8px; padding: 2px; cursor: pointer; }
.chat-sticker-btn:hover { background: #eef3f8; }
.chat-sticker-btn img { width: 100%; height: auto; display: block; }

/* Pemilih kartu */
.chat-ref-picker {
    position: absolute; left: 6px; right: 6px; bottom: 100%; margin-bottom: 4px; background: #fff; border-radius: 10px;
    border: 1px solid #e1e6ed; box-shadow: 0 6px 18px rgba(0, 0, 0, .15); z-index: 21; padding: 8px; max-height: 320px;
    display: flex; flex-direction: column;
}
.chat-ref-picker-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.chat-ref-picker-close { color: #888; font-size: 20px; line-height: 1; }
.chat-ref-picker-close:hover { text-decoration: none; }
.chat-ref-list { overflow-y: auto; margin-top: 6px; min-height: 40px; }
.chat-ref-option { display: flex; gap: 8px; align-items: center; padding: 6px; border-radius: 6px; color: inherit; font-size: 12.5px; }
.chat-ref-option:hover, .chat-ref-option:focus { background: #f2f6fa; text-decoration: none; color: inherit; }
.chat-ref-option .fa { font-size: 18px; color: #4186C3; width: 20px; text-align: center; }
.chat-ref-option-text { flex: 1; min-width: 0; }
.chat-ref-empty, .chat-ref-loading { color: #888; padding: 10px 4px; font-size: 12px; text-align: center; }

/* Jendela chat: textarea tanpa ikon kamera absolut (ikon pindah ke bilah alat) */
/* Jendela chat — satu baris seperti app (29/11/2026): [+] [kolom ketik + 😊] [kirim]; panel di BAWAH baris. */
.rise-chat-footer .chat-compose-row { display: flex; align-items: flex-end; gap: 4px; padding: 6px 6px 6px 4px; }
.rise-chat-footer .chat-compose-row .chat-tools-btn {
    background: none; border: 0; color: #4E5E6A; width: 32px; height: 36px; border-radius: 50%; padding: 0; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.rise-chat-footer .chat-compose-row .chat-tools-btn:hover { background: #eef3f8; }
.rise-chat-footer .chat-compose-row .chat-tools-btn.active { color: #4186C3; background: #e3eef8; }
.rise-chat-footer .chat-compose-row .chat-tools-attach-btn { font-size: 22px; }
.rise-chat-footer .chat-compose-row .chat-tools-attach-btn.has-pending { color: #4186C3; }
.rise-chat-footer .chat-compose-row .chat-tools-emoji-btn { font-size: 18px; line-height: 1; width: 30px; height: 34px; }
.rise-chat-footer .chat-compose-pill {
    flex: 1 1 auto; min-width: 0; display: flex; align-items: flex-end; background: #F4F6F9; border: 1px solid #E1E6ED;
    border-radius: 20px; padding: 0 2px 0 12px;
}
.rise-chat-footer .chat-compose-pill textarea {
    flex: 1 1 auto; min-width: 0; background: transparent; border: 0; resize: none; padding: 8px 2px 7px; height: 36px;
    max-height: 96px; line-height: 20px; font-size: 13.5px;
}
.rise-chat-footer .chat-send-btn {
    flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%; border: 0; background: #4186C3; color: #fff; font-size: 14px;
    display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.rise-chat-footer .chat-send-btn:hover { background: #3576b0; }
.rise-chat-footer .chat-tools-panel,
.rise-chat-footer .chat-attach-panel { position: static; box-shadow: none; border-top: 1px solid #eef1f4; }
.rise-chat-footer .chat-tools-panel { height: 210px; }
.rise-chat-footer .chat-attach-panel { padding: 12px 8px 14px; }

/* Halaman Pesan */
#reply-form-container .chat-tools-bar { padding: 4px 0; }

/* Halaman Pesan: panel & pemilih kartu di alur normal di bawah bilah (tidak terpotong .box-content overflow:auto). */
#reply-form-container .chat-tools-panel,
#reply-form-container .chat-attach-panel,
#reply-form-container .chat-ref-picker { position: static; margin-top: 8px; border: 1px solid #e1e6ed; border-radius: 8px; box-shadow: 0 2px 8px rgba(0, 0, 0, .06); }
#reply-form-container .chat-ref-picker { max-height: 340px; }

/* Panel lampiran tombol [+] (29/11/2026, sama dengan app): tombol bulat berlabel. */
.chat-tools-bar .chat-tools-attach-btn { font-size: 21px; }
.chat-tools-bar .chat-tools-attach-btn.has-pending { color: #4186C3; }
.chat-attach-panel {
    position: absolute; left: 0; right: 0; bottom: 100%; z-index: 20; background: #fff; border-top: 1px solid #e1e6ed;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, .08); display: flex; justify-content: center; gap: 18px; padding: 14px 8px 16px;
}
.chat-attach-panel.hide { display: none; }
.chat-attach-item { background: none; border: 0; width: 84px; padding: 2px; display: flex; flex-direction: column; align-items: center; cursor: pointer; border-radius: 10px; }
.chat-attach-item:hover { background: #f2f6fa; }
.chat-attach-circle {
    width: 52px; height: 52px; border-radius: 50%; border: 1.5px solid #D5DCE5; display: flex; align-items: center; justify-content: center;
    color: #4186C3; font-size: 22px; background: #fff;
}
.chat-attach-item.active .chat-attach-circle { border-color: #4186C3; background: #e3eef8; }
.chat-attach-label { margin-top: 6px; font-size: 12px; color: #4E5E6A; line-height: 1.2; text-align: center; }


