/* Unicrium Meet v4: tabs, chat, group talk. Uses the tokens from style.css. */
.tabs { display: flex; gap: 6px; margin: 18px 0 14px; border-bottom: 1px solid var(--border); }
.tab { flex: 1; background: none; border: none; color: var(--text-muted); font: 500 14px var(--sans); padding: 10px 0; cursor: pointer; border-bottom: 2px solid transparent; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { margin-top: 4px; }
.group-input { min-height: 96px; resize: vertical; font-family: var(--mono); font-size: 13px; }
.link-btn { background: none; border: none; color: var(--accent); font: 500 14px var(--sans); cursor: pointer; padding: 6px 4px; }

.chat-list { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; }
.chat-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; color: var(--text); cursor: pointer; }
.chat-row code { font-family: var(--mono); font-size: 13px; color: var(--accent); flex-shrink: 0; }
.chat-preview { flex: 1; color: var(--text-muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { background: var(--accent); color: var(--bg); border-radius: 10px; font-size: 11px; font-weight: 700; padding: 1px 7px; }

.chat-view { display: flex; flex-direction: column; height: min(62vh, 560px); }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.chat-status { font-size: 12px; color: var(--text-dim); padding: 6px 0; }
.chat-status.on { color: var(--success); }
.chat-status.wait { color: var(--accent); }
.messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 8px 2px; }
.msg { max-width: 82%; padding: 8px 11px; border-radius: 12px; font-size: 14px; line-height: 1.4; word-wrap: break-word; }
.msg.in { align-self: flex-start; background: var(--bg-elevated); border: 1px solid var(--border); }
.msg.out { align-self: flex-end; background: rgba(212, 165, 116, 0.14); border: 1px solid var(--accent-dim); }
.msg-text { white-space: pre-wrap; }
.msg-meta { font-size: 11px; color: var(--text-dim); margin-top: 3px; text-align: right; }
.msg.in .msg-meta { text-align: left; }
.msg-meta.read { color: var(--success); }
.chat-form { display: flex; gap: 8px; padding-top: 8px; }
.chat-form input { flex: 1; min-width: 0; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 10px; color: var(--text); font: 14px var(--sans); padding: 11px 12px; }
.chat-form input:focus { outline: none; border-color: var(--accent); }
.send-btn { width: auto !important; padding: 0 16px !important; margin: 0 !important; }

#group { background: var(--bg); display: flex; flex-direction: column; padding: calc(var(--safe-top) + 8px) 8px calc(var(--safe-bottom) + 92px); gap: 8px; }
.group-grid { flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 6px; align-content: start; overflow-y: auto; }
.tile { position: relative; background: #000; border-radius: 10px; overflow: hidden; aspect-ratio: 4 / 3; border: 1px solid var(--border); }
.tile video { width: 100%; height: 100%; object-fit: cover; }
.tile-label { position: absolute; left: 6px; bottom: 6px; font: 11px var(--mono); color: #fff; background: rgba(0,0,0,.55); padding: 2px 6px; border-radius: 6px; }
.group-chat { height: 30vh; display: flex; flex-direction: column; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 10px; padding: 6px 8px; }
.group-controls { position: fixed; left: 0; right: 0; transform: none; justify-content: center; bottom: calc(var(--safe-bottom) + 14px); }

.wallet-backup { position: fixed; bottom: 12px; right: 12px; z-index: 50; font-size: 12px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border-bright); background: var(--bg-elevated); color: var(--text); opacity: .85; }

/* v4.3 file transfer */
.attach-btn { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 10px; color: var(--text); font-size: 16px; padding: 0 11px; cursor: pointer; flex-shrink: 0; }
.attach-btn:hover { border-color: var(--accent); }
.file-msg { min-width: 220px; }
.file-head { font-weight: 600; word-break: break-all; }
.file-sub { text-align: left !important; }
.file-thumb { display: block; max-width: 220px; max-height: 220px; border-radius: 8px; margin: 6px 0; cursor: zoom-in; }
.file-bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin: 6px 0 2px; }
.file-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.file-state { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.file-state.st-done { color: var(--success); }
.file-state.st-failed, .file-state.st-cancelled, .file-state.st-rejected { color: #e06c75; }
.file-actions { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; align-items: center; }
.file-btn { background: transparent; border: 1px solid var(--border); border-radius: 8px; color: var(--text); font: 12px var(--sans); padding: 4px 10px; cursor: pointer; text-decoration: none; }
.file-btn.ok { border-color: var(--accent); color: var(--accent); }
.msg.sys { align-self: center; max-width: 92%; font-size: 12px; color: #e06c75; background: transparent; border: 1px dashed var(--border); }
.file-bar.paused span { background: var(--text-dim); }
.file-state.st-paused { color: var(--accent); }

/* v4.4 address sharing, QR, contacts */
.input-row { display: flex; gap: 6px; align-items: stretch; }
.input-row > .addr-input { flex: 1; min-width: 0; }
.scan-btn { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 10px; color: var(--text); padding: 0 12px; cursor: pointer; font-size: 16px; flex-shrink: 0; margin-bottom: 12px; }
.scan-btn:hover { border-color: var(--accent); }
.modal { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.72); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal.hidden { display: none; }
.modal-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 14px; padding: 18px; width: min(360px, 100%); text-align: center; }
.qr-box { background: #fff; border-radius: 10px; padding: 12px; display: inline-block; margin: 10px 0; }
.qr-box img { display: block; width: 220px; height: 220px; image-rendering: pixelated; }
.qr-text { display: block; word-break: break-all; font-size: 12px; margin: 6px 0 12px; }
.modal-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.scan-video { width: 100%; border-radius: 10px; background: #000; aspect-ratio: 1; object-fit: cover; }
.contact-row { display: flex; align-items: center; gap: 8px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.contact-row .contact-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-row code { font-size: 12px; color: var(--text-muted); }
.contact-row .link-btn { padding: 2px 4px; font-size: 13px; }
.hidden { display: none !important; }

/* v4.5 screen sharing */
.ctrl.btn-screen.active { background: var(--accent, #d4a574); color: #0b0b0d; }
.ctrl.btn-screen.unsupported { opacity: .35; }
.screen-banner { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 5; background: rgba(0,0,0,.7); color: #fff; font-size: 12px; padding: 4px 10px; border-radius: 8px; }
#call.screen-on #remote-video { object-fit: contain; }
.group-grid.has-screen { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.group-grid.has-screen .tile { aspect-ratio: 4 / 3; }
.group-grid.has-screen .tile.tile-screen { grid-column: 1 / -1; order: -1; aspect-ratio: 16 / 9; }
.group-grid.has-screen .tile.tile-screen video { object-fit: contain; }

/* Incoming-call ringing (2.1.1) */
.notify-banner { display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin:10px 0; padding:10px 12px;
  border:1px solid rgba(212,168,67,.35); background:rgba(212,168,67,.08); border-radius:10px; font-size:13px; }
.notify-banner span { flex:1; min-width:200px; }
.missed-calls { display:block; width:100%; margin:8px 0; padding:8px 12px; border-radius:10px; text-align:left;
  border:1px solid rgba(248,81,73,.4); background:rgba(248,81,73,.1); color:#ff7b72; font-size:13px; cursor:pointer; }
.ring-banner { margin-bottom:14px; padding:12px; border-radius:10px; background:#d29922; color:#111; font-weight:700;
  animation: ringflash 0.9s steps(2, start) infinite; }
@keyframes ringflash { to { visibility:hidden; } }
#incoming .incoming-card { animation: ringpulse 1.6s ease-in-out infinite; }
@keyframes ringpulse { 0%,100% { box-shadow:0 0 0 0 rgba(63,185,80,.0);} 50% { box-shadow:0 0 0 14px rgba(63,185,80,.25);} }

/* Message options (v4.6) */
.msg { position: relative; }
.msg-menu { position: absolute; top: 2px; right: 2px; width: 26px; height: 26px; border: 0; border-radius: 8px; background: transparent; color: inherit; opacity: .55; font-size: 16px; line-height: 1; cursor: pointer; }
.msg-menu:hover, .msg-menu:focus-visible { opacity: 1; background: rgba(127,127,127,.18); }
.msg[data-mid] { padding-right: 30px; }
.msg.deleted { font-style: italic; opacity: .6; }

/* Group rooms (v4.7) */
.btn-secondary { display: block; width: 100%; padding: 11px 14px; border: 1px solid var(--border-bright); border-radius: 8px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.btn-secondary:hover { border-color: var(--accent); }
.room-card { text-align: left; max-height: 86vh; overflow: auto; }
.room-card label { display: block; margin-top: 10px; }
.room-card input, .room-card textarea { width: 100%; margin-top: 4px; }
.room-picks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.room-members { max-height: 34vh; overflow: auto; font: 13px var(--mono); }
.room-members div { padding: 5px 0; border-bottom: 1px solid var(--border); }
.room-err { color: #ff7b72; font-size: 13px; min-height: 1em; }

/* Channels (v4.8) */
.btn-pair { display: flex; gap: 8px; margin-top: 8px; }
.room-card .hint { font-size: 12px; opacity: .75; margin-top: 8px; }

/* Bots (v4.8) */
.bot-cmds { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 0; max-height: 92px; overflow: auto; }
.bot-tag { font: 11px var(--mono); color: var(--accent); }

/* Emoji and stickers (v4.10) */
.emote-panel { border: 1px solid var(--border-bright); border-radius: 12px; background: var(--bg-elevated); margin-top: 8px; overflow: hidden; }
.emote-tabs { display: flex; border-bottom: 1px solid var(--border); }
.emote-tabs button { flex: 1; padding: 9px; border: 0; background: none; color: inherit; font: 13px var(--sans); cursor: pointer; opacity: .65; }
.emote-tabs button.on { opacity: 1; box-shadow: inset 0 -2px var(--accent); }
.emote-body { height: 230px; overflow: auto; padding: 8px; overscroll-behavior: contain; }
.emote-h { font-size: 11px; opacity: .6; margin: 6px 2px 2px; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); }
.emoji-grid button { border: 0; background: none; font-size: 24px; line-height: 38px; height: 38px; padding: 0; cursor: pointer; border-radius: 8px; }
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.sticker-grid button { border: 0; background: none; padding: 4px; cursor: pointer; border-radius: 10px; }
.emoji-grid button:hover, .sticker-grid button:hover, .emoji-grid button:focus-visible, .sticker-grid button:focus-visible { background: rgba(255,255,255,.08); }
.sticker-grid .sticker { width: 100%; height: auto; display: block; }
.msg .sticker { width: 132px; height: 132px; display: block; }
.msg:has(> .is-sticker) { background: none !important; border-color: transparent !important; }
.msg-text.emoji-1 { font-size: 46px; line-height: 1.15; }
.msg-text.emoji-n { font-size: 30px; line-height: 1.2; }

.connect-error { margin: 10px 0; padding: 10px 12px; border: 1px solid #ff7b72; border-radius: 10px; color: #ffb4ae; font-size: 14px; text-align: left; }
.pw-input { display: block; width: 100%; box-sizing: border-box; margin: 8px 0; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border-bright); background: var(--bg); color: var(--text); font-size: 15px; }
.pw-input.hidden { display: none; }
.pw-err { min-height: 1.2em; color: #e06c75; font-size: 13px; margin: 4px 0 10px; }
.wallet-protect { right: auto; left: 12px; border-color: #e0a84f; }
