/* Lumorra – Üzenetek (app.css + styles.css tokenekre építve) */

.chat {
  display: grid; grid-template-columns: 300px 1fr;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-soft); overflow: hidden; height: calc(100vh - 148px); min-height: 520px;
}

/* Közös avatar */
.avatar { flex: 0 0 auto; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 1.1rem; }
.avatar.sm { width: 40px; height: 40px; font-size: 1rem; }

/* Beszélgetés-lista */
.convo-list { border-right: 1px solid var(--line); overflow-y: auto; }
.convo { display: flex; gap: .7rem; align-items: center; width: 100%; text-align: left; border: 0; background: none; cursor: pointer; padding: .8rem .9rem; border-bottom: 1px solid var(--line); }
.convo:hover { background: var(--bg-soft); }
.convo.active { background: var(--brand-light); }
.convo-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: .15rem; }
.convo-top { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.convo-top b { color: var(--ink); font-size: .95rem; }
.convo-score { color: var(--brand-dark); font-weight: 800; font-size: .78rem; }
.convo-last { color: var(--ink-soft); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Szál */
.thread { display: flex; flex-direction: column; min-width: 0; }
.thread-empty { margin: auto; text-align: center; color: var(--ink-soft); padding: 2rem; max-width: 340px; }
.thread-live { display: flex; flex-direction: column; height: 100%; min-height: 0; }

.thread-head { display: flex; align-items: center; gap: .7rem; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.th-meta { display: flex; flex-direction: column; min-width: 0; }
.th-meta b { color: var(--ink); }
.th-sub { color: var(--ink-soft); font-size: .78rem; }
.th-report { margin-left: auto; font-weight: 700; font-size: .82rem; color: var(--brand-dark); white-space: nowrap; }

.messages { flex: 1 1 auto; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .5rem; background: var(--bg-soft); }
.msg-hint { margin: auto; color: var(--ink-soft); font-size: .88rem; text-align: center; }
.bubble { max-width: 76%; padding: .55rem .8rem; border-radius: 14px; font-size: .92rem; line-height: 1.4; word-wrap: break-word; }
.bubble.them { align-self: flex-start; background: #fff; border: 1px solid var(--line); color: var(--ink); border-bottom-left-radius: 4px; }
.bubble.me { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }

/* AI-segéd */
.ai-suggest { border-top: 1px solid var(--line); padding: .7rem 1rem; background: #fff; }
.ai-suggest-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .5rem; flex-wrap: wrap; }
.ai-suggest-head > span { font-weight: 700; font-size: .85rem; color: var(--brand-darker); }
.ai-tabs { display: flex; gap: .3rem; }
.ai-tab { border: 1px solid var(--line); background: #fff; color: var(--ink-soft); border-radius: 999px; padding: .25rem .7rem; font-size: .78rem; font-weight: 600; cursor: pointer; font-family: inherit; }
.ai-tab.active { background: var(--brand-light); border-color: var(--brand-mint); color: var(--brand-darker); }
.ai-chips { display: flex; flex-direction: column; gap: .4rem; }
.ai-chip { text-align: left; border: 1px dashed var(--brand-mint); background: var(--brand-light); color: var(--ink); border-radius: 12px; padding: .5rem .7rem; font-size: .86rem; cursor: pointer; font-family: inherit; line-height: 1.35; }
.ai-chip:hover { border-style: solid; background: #fff; }

.composer { display: flex; gap: .6rem; padding: .8rem 1rem; border-top: 1px solid var(--line); background: #fff; }
.composer input { flex: 1; border: 1px solid var(--line); border-radius: 999px; padding: .6rem .9rem; font-size: .95rem; font-family: inherit; color: var(--ink); }
.composer input:focus { outline: 2px solid var(--brand); border-color: var(--brand); }
.composer .btn { white-space: nowrap; }

@media (max-width: 820px) {
  .chat { grid-template-columns: 1fr; height: auto; }
  .convo-list { max-height: 34vh; }
  .messages { min-height: 40vh; }
}

/* --- Profilkép a beszélgetés-listában és a fejlécben ---
   Az .avatar <span>, ezért kell az inline-flex: enélkül a beillesztett
   kép nem tudna a szülőhöz igazodni. */
.avatar { position: relative; overflow: hidden; }
.avatar.has-foto > span[aria-hidden] { visibility: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
