/* ==========================================================
   BombaszVids – ismerősök, üzenetek, csoportok, felugró ablakok
   ========================================================== */

/* ---------- számlálók a menüben ---------- */
.nav-badge {
  margin-left: auto;
  min-width: 20px; height: 20px; padding: 0 6px;
  display: inline-grid; place-items: center;
  border-radius: 999px; background: var(--accent); color: #fff;
  font-size: 11.5px; font-weight: 700; font-style: normal;
}
.tabbar { grid-template-columns: repeat(4, 1fr) !important; }
.tabbar .nav-badge { position: absolute; top: 2px; left: calc(50% + 6px); margin: 0; min-width: 18px; height: 18px; font-size: 10.5px; box-shadow: 0 0 0 2px var(--bg); }

/* ---------- profil: gombok, jelölések ---------- */
.profile-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.profile-actions .btn svg { width: 16px; height: 16px; }
.request-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.request-row .member { flex: 1; min-width: 200px; }
.request-actions { display: flex; gap: 8px; padding-right: 8px; }

/* ---------- üzenetek ---------- */
.msg-page { padding: 72px 0 0; min-height: 0; }
.msg-layout {
  display: grid; grid-template-columns: 340px 1fr;
  height: calc(100vh - 72px); height: calc(100dvh - 72px);
  border-top: 1px solid var(--line);
}
.msg-side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: rgba(255, 255, 255, .015); }
.msg-side-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 10px; }
.msg-side-head h1 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.chat-list { list-style: none; overflow-y: auto; padding: 4px 8px 16px; flex: 1; }
.chat-item { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--r-md); text-decoration: none; }
.chat-item:hover { background: rgba(255, 255, 255, .04); }
.chat-item.is-active { background: rgba(229, 72, 77, .1); }
.chat-item-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.chat-item-top { display: flex; align-items: baseline; gap: 8px; }
.chat-item-top b { flex: 1; font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item-top time { font-size: 12px; color: var(--text-3); flex-shrink: 0; }
.chat-item-preview { font-size: 13.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item.is-unread b, .chat-item.is-unread .chat-item-preview { color: var(--text); font-weight: 700; }
.unread-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.chat-empty { padding: 30px 16px; text-align: center; color: var(--text-3); line-height: 1.8; }
.chat-empty .btn { margin-top: 10px; }

.group-avatar { --s: 46px; position: relative; width: var(--s); height: var(--s); flex-shrink: 0; display: block; }
.group-avatar .avatar { position: absolute; }
.group-avatar .avatar:first-child { left: 0; top: 0; }
.group-avatar .avatar:nth-child(2) { right: 0; bottom: 0; box-shadow: 0 0 0 2px var(--bg); border-radius: 50%; }
.group-avatar .avatar:only-child { left: 50%; top: 50%; transform: translate(-50%, -50%); }

.msg-thread { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.thread-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.thread-back { display: none; }
.thread-who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; text-decoration: none; }
.thread-title { display: grid; min-width: 0; line-height: 1.3; }
.thread-title b { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-title small { font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-empty { flex: 1; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--text-3); text-align: center; padding: 20px; }
.thread-empty svg { width: 44px; height: 44px; stroke-width: 1.5; }

.msg-scroll { flex: 1; overflow-y: auto; padding: 14px 16px 8px; overscroll-behavior: contain; }
.msg-items { display: flex; flex-direction: column; gap: 2px; max-width: 900px; margin: 0 auto; }
.load-more { align-self: center; margin: 4px 0 10px; font-size: 13px; }
.day-divider { display: flex; justify-content: center; margin: 14px 0 8px; }
.day-divider span { font-size: 12px; font-weight: 600; color: var(--text-3); padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, .05); }
.center { text-align: center; }
.first-hint { margin-top: 40px; }

.msg { display: flex; align-items: flex-end; gap: 8px; position: relative; }
.msg.first { margin-top: 8px; }
.msg.mine { flex-direction: row-reverse; }
.msg-avatar { width: 30px; flex-shrink: 0; }
.msg-body { display: flex; flex-direction: column; max-width: min(72%, 560px); }
.msg.mine .msg-body { align-items: flex-end; }
.msg-author { font-size: 12px; color: var(--text-3); margin: 0 0 3px 12px; font-weight: 600; }
.bubble {
  padding: 8px 13px; border-radius: 18px;
  background: var(--surface-2); color: var(--text);
  font-size: 14.5px; line-height: 1.45;
  white-space: pre-wrap; overflow-wrap: anywhere;
  outline: none;
}
.msg.mine .bubble { background: var(--accent); color: #fff; }
.msg:not(.mine).first .bubble { border-top-left-radius: 6px; }
.msg.mine.first .bubble { border-top-right-radius: 6px; }
.bubble a { color: inherit; text-decoration: underline; }
.msg-meta { font-size: 11px; color: var(--text-3); margin: 2px 8px 0; opacity: 0; transition: opacity .15s; }
.msg:hover .msg-meta, .msg:focus-within .msg-meta, .msg:last-child .msg-meta { opacity: 1; }
.msg.is-editing .bubble { box-shadow: 0 0 0 2px #f5a524; }
.msg-actions { display: none; align-self: center; gap: 4px; }
.msg.mine:hover .msg-actions, .msg.mine:focus-within .msg-actions { display: flex; }
.msg-actions button { font-size: 12px; color: var(--text-3); padding: 3px 7px; border-radius: 6px; }
.msg-actions button:hover { color: var(--text); background: rgba(255, 255, 255, .06); }

.composer {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 14px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
.composer textarea {
  flex: 1; resize: none; max-height: 160px;
  padding: 11px 16px; border-radius: 22px;
  background: rgba(255, 255, 255, .06); border: 1px solid var(--line-2);
  font: inherit; font-size: 15px; color: inherit; outline: none; line-height: 1.4;
}
.composer textarea:focus { border-color: var(--accent); }
.composer-send { width: 44px; height: 44px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: #fff; transition: transform .15s, background .15s; }
.composer-send:hover { background: var(--accent-2); }
.composer-send:active { transform: scale(.92); }
.composer-send svg { width: 20px; height: 20px; }

/* ---------- felugró ablakok ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 1200; display: grid; place-items: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .65); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal-card {
  position: relative; width: min(460px, 100%); max-height: min(640px, 90vh);
  display: flex; flex-direction: column; gap: 12px;
  padding: 18px; border-radius: var(--r-xl);
  background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow);
  animation: rise .25s var(--ease) both;
}
.modal-card header { display: flex; align-items: center; justify-content: space-between; }
.modal-card header h2 { font-size: 18px; font-weight: 700; }
.modal-card .search-sm { width: 100%; }
.modal-card .field { margin: 0; }
.modal-card .field input, .rename-row input {
  width: 100%; padding: 10px 12px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line-2);
  border-radius: var(--r-md); outline: none; font: inherit; color: inherit;
}
.modal-card footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pick-list, .gm-list { list-style: none; overflow-y: auto; display: grid; gap: 2px; min-height: 80px; }
.pick { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--r-md); cursor: pointer; }
.pick:hover { background: rgba(255, 255, 255, .04); }
.pick.is-on { background: rgba(229, 72, 77, .1); }
.pick input { width: 18px; height: 18px; accent-color: var(--accent); }
.pick span { display: grid; }
.pick small { font-size: 12px; color: var(--ok); }
.modal-sub { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.gm { display: flex; align-items: center; gap: 10px; padding: 6px 4px; }
.gm a { display: flex; align-items: center; gap: 10px; flex: 1; text-decoration: none; }
.rename-row { display: flex; gap: 8px; }
.gm-actions { justify-content: flex-start !important; }
.danger-text { color: var(--accent-2) !important; }

@media (max-width: 959px) {
  .msg-page { padding-top: 64px; }
  .msg-layout { height: calc(100dvh - 64px - var(--tabbar-h) - env(safe-area-inset-bottom)); }
}
@media (max-width: 899px) {
  .msg-layout { grid-template-columns: 1fr; }
  .msg-layout .msg-thread { display: none; }
  .msg-layout.has-open .msg-side { display: none; }
  .msg-layout.has-open .msg-thread { display: flex; }
  .thread-back { display: grid; }
  .msg-body { max-width: 82%; }
}
