/* ----- the chat screen (CodyChat's layout): header 50px, left panel for rooms, centre log + input bar, right user panel 280px,
   footer bar 50px. Dark values: log #151515, panels #191919, bars #111. ----- */
.page-chat { background: var(--bg); overflow: hidden; }
.page-chat .app-head { position: fixed; top: 0; left: 0; right: 0; }
.chat-head { padding: 0 5px; }
.head-btn { width: 40px; height: 50px; border: 0; background: none; color: #fff; font-size: 18px; }
.head-btn:hover { background: var(--row-hover); }
.page-chat .app-brand { padding: 0 6px; }
.head-room { margin-left: 8px; max-width: 34vw; font-size: var(--fs-sm); font-weight: 700; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.head-avatar { position: relative; }
.top-status { position: absolute; right: -2px; bottom: -2px; width: 14px; height: 14px; border: 2px solid var(--bg-head); border-radius: 50%; background: var(--bg-head); }
.float-menu.float-left { left: 5px; right: auto; width: 280px; }
.fmenu-item, .fmenu-item:hover, .fmenu-item:focus, .fmenu-item span { text-decoration: none; }
a.fmenu-item { color: var(--text); }

.chat-shell { position: fixed; top: 50px; bottom: 50px; left: 0; right: 0; display: flex; overflow: hidden; background: var(--bg); }

/* panels */
.side-panel { flex: none; display: flex; flex-direction: column; background: #191919; min-height: 0; }
.left-panel { width: 380px; border-right: 1px solid rgba(255,255,255,.05); box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.right-panel { width: 280px; border-left: 1px solid rgba(255,255,255,.05); }
.right-panel.is-closed { display: none; }
.panel-bar { flex: none; display: flex; align-items: center; height: 40px; border-bottom: 1px solid rgba(255,255,255,.05); }
.panel-btn, .panel-opt { width: 40px; height: 40px; border: 0; background: none; color: var(--text); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.panel-btn:hover, .panel-opt:hover { background: var(--row-hover); }
.panel-opt.on { background: var(--pill-on); cursor: default; }
.panel-title { flex: 1; padding: 0 14px; font-weight: 700; }
.panel-gap { flex: 1; }
.panel-data { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 0 20px 0; }
.panel-loading { display: flex; justify-content: center; padding: 30px 0; }
.panel-loading .spin { display: block; width: 26px; height: 26px; border-color: var(--line); border-top-color: var(--accent); }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 6px 14px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.panel-head .count { padding: 1px 8px; border-radius: 100px; background: var(--accent); color: #fff; font-size: 11px; letter-spacing: 0; }
.panel-head.off .count { background: rgba(255,255,255,.12); }
.panel-empty { padding: 4px 14px 8px 14px; font-size: var(--fs-sm); color: var(--text-muted); }

/* people list */
.user-item { position: relative; display: flex; align-items: center; gap: 8px; width: calc(100% - 12px); margin: 0 6px; padding: 5px 10px; border: 0; border-radius: 5px; background: none; color: var(--text); text-align: left; cursor: pointer; }
.user-item:hover { background: var(--row-hover); }
.user-item.is-off { opacity: .55; }
.user-item .u-av { position: relative; flex: none; width: 36px; height: 36px; }
.user-item .u-av img.acav { display: block; width: 36px; height: 36px; border-radius: 50%; }
.user-item .u-dot { position: absolute; right: -2px; bottom: -2px; width: 13px; height: 13px; border-radius: 50%; border: 2px solid #191919; background: #191919; }
.user-item .u-text { flex: 1; min-width: 0; padding: 0 2px; }
.user-item .u-name { display: block; font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-item .u-mood { display: block; font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-item .u-rank { flex: none; height: 15px; width: auto; }

/* the log */
.chat-center { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; background: #151515; overscroll-behavior: contain; overflow-anchor: none; /* the script keeps the reading position itself */ }
.chat-log { list-style: none; margin: 0; padding: 0; min-height: 100%; display: flex; flex-direction: column; justify-content: flex-end; }
.chat-top { min-height: 72px; padding: 14px 14px 8px 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--text-muted); font-size: 12px; }
.chat-top .spin { display: inline-block; width: 18px; height: 18px; border-color: var(--line); border-top-color: var(--accent); }
.chat-top b { color: var(--text); }
.chat-top .top-desc { margin-top: 2px; }

.chat-line { display: flex; align-items: flex-start; width: 100%; padding: 10px; word-wrap: break-word; overflow: hidden; }
.chat-line:hover { background: rgba(255,255,255,.02); }
.cl-av { flex: none; align-self: flex-start; width: 40px; padding: 0; border: 0; background: none; cursor: pointer; }
.cl-av img { display: block; width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.cl-main { flex: 1; min-width: 0; padding-left: 6px; }
.cl-head { display: flex; align-items: center; }
.cl-name { flex: 1; min-width: 0; padding: 0; border: 0; background: none; color: var(--text); font-size: 12px; font-weight: 700; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-name img { display: inline-block; height: 11px; width: auto; margin: 0 3px 0 0; vertical-align: -1px; }
.cl-date { flex: none; width: 65px; font-size: 10px; text-align: center; color: #666; }
.cl-more { flex: none; width: 24px; height: 20px; padding: 0; border: 0; background: none; color: #666; font-size: 10px; cursor: pointer; }
.cl-more:hover { color: var(--text); }
.cl-text { line-height: 1.4em; display: inline-block; max-width: 100%; overflow-wrap: anywhere; }
.cl-text a { color: var(--accent); }
.chat-line.is-mine .cl-text { color: #fff; }

.sys-line { display: flex; align-items: center; width: 100%; padding: 5px 10px; font-size: 12px; color: #999; }
.sys-av { flex: none; align-self: center; width: 40px; padding: 0; border: 0; background: none; cursor: pointer; }
.sys-av img { display: block; width: 24px; height: 24px; margin: 0 auto; border-radius: 50%; }
.sys-text { padding: 0 5px; }
.sys-text button { padding: 0; border: 0; background: none; color: #bbb; font: inherit; font-weight: 700; cursor: pointer; }
.sys-text button:hover { color: #fff; }
.chat-line.is-new { animation: cb-fade .25s ease both; }

.chat-new { position: absolute; left: 50%; bottom: 62px; transform: translateX(-50%); z-index: 5; padding: 7px 16px; border: 0; border-radius: 100px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; box-shadow: 0 4px 16px rgba(0,0,0,.5); cursor: pointer; }

/* a reply shows the line it answers above its own text (CodyChat's quote box) */
.cl-quote { display: flex; align-items: center; gap: 8px; width: 100%; max-width: 560px; margin: 3px 0 5px 0; padding: 5px 8px; border: 0; border-left: 3px solid var(--accent); border-radius: 4px; background: rgba(255,255,255,.05); color: var(--text); text-align: left; cursor: pointer; }
.cl-quote:hover { background: rgba(255,255,255,.08); }
.cl-quote img { flex: none; width: 22px; height: 22px; border-radius: 50%; }
.cl-quote .q-body { min-width: 0; display: block; }
.cl-quote .q-name { display: block; font-size: 11px; font-weight: 700; color: var(--accent); }
.cl-quote .q-text { display: block; font-size: 12px; color: #bdbdbd; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-quote.is-gone { cursor: default; border-left-color: #555; }
.cl-quote.is-gone .q-text { font-style: italic; color: #777; }
.chat-line.is-flash { animation: cb-flash 1.6s ease; }
@keyframes cb-flash { 0%, 60% { background: rgba(3,173,216,.22); } 100% { background: transparent; } }

.reply-bar { flex: none; display: flex; align-items: center; gap: 10px; padding: 7px 8px 7px 12px; border-top: 1px solid rgba(255,255,255,.05); border-left: 3px solid var(--accent); background: #1e1e1e; }
.reply-bar[hidden] { display: none; }
.reply-av { flex: none; width: 28px; height: 28px; border-radius: 50%; }
.reply-text { flex: 1; min-width: 0; }
.reply-label { display: block; font-size: 11px; color: var(--text-muted); }
.reply-label b { color: var(--accent); }
.reply-preview { display: block; font-size: 12px; color: #bdbdbd; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-x { flex: none; width: 34px; height: 34px; border: 0; border-radius: 50%; background: none; color: var(--text); cursor: pointer; }
.reply-x:hover { background: var(--row-hover); }

/* input bar */
.input-wrap { flex: none; height: 50px; padding: 5px; background: #191919; border-top: 1px solid rgba(255,255,255,.05); }
.input-table { display: flex; align-items: center; height: 100%; margin: 0; }
.chat-input { flex: 1; min-width: 0; height: 100%; padding: 0 16px; border: 1px solid transparent; border-radius: 100px; background: #262626; color: var(--text); font-size: 16px; outline: none; }
.chat-input::placeholder { color: var(--text-muted); }
.chat-input:focus { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.send-btn { flex: none; width: 44px; height: 100%; border: 0; background: none; color: #f6f6f6; font-size: 20px; cursor: pointer; }
.send-btn:hover { color: var(--accent); }

/* the "..." menu on a line */
.line-menu { position: fixed; z-index: 70; min-width: 190px; padding: 4px 0; border-radius: 5px; background: var(--bg-menu); box-shadow: var(--shadow); }

/* footer bar */
.chat-foot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; height: 50px; background: #111; }
.foot-gap { flex: 1; }
.foot-item { width: 50px; height: 100%; border: 0; background: none; color: #fff; font-size: 18px; cursor: pointer; }
.foot-item:hover { background: var(--row-hover); }

/* compact room list inside the left panel */
.room-card-compact { padding: 8px 12px; }
.room-card-compact .room-icon-wrap, .room-card-compact .room-icon { width: 50px; height: 50px; }
.room-card-compact .room-icon { border-radius: 5px; }
.room-card-compact .room-name { font-size: 14px; }
.room-card-compact .room-desc { font-size: 11px; padding: 1px 0; }
.room-card-compact .room-tag { width: 14px; height: 14px; }
.room-card-compact .room-count { font-size: 14px; }

@media (max-width: 800px) {
  .head-room { display: none; }
  .side-panel { position: absolute; top: 0; bottom: 0; z-index: 30; max-width: 100%; box-shadow: 0 0 24px rgba(0,0,0,.6); }
  .left-panel { left: 0; width: min(380px, 100%); }
  .right-panel { right: 0; width: min(280px, 100%); }
}
.chat-line.is-pending { opacity: .6; }
