/* /css/messages.css
   Стилі сторінок /messages/ та /messages/dialog.php
*/

.msg-threads{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.msg-thread{
  display:flex;
  align-items:stretch;
  gap:12px;
  padding:12px;
  border-radius:16px;
  background:#fff;
  border:1px solid rgba(0,0,0,.08);
  text-decoration:none;
  color:inherit;
  transition:transform .05s ease, box-shadow .15s ease, border-color .15s ease;
}

.msg-thread:hover{
  transform:translateY(-1px);
  box-shadow:0 8px 20px rgba(0,0,0,.06);
  border-color:rgba(0,0,0,.12);
}

.msg-thread.unread{
  border-color: rgba(25,135,84,.35);
  box-shadow: 0 0 0 3px rgba(25,135,84,.10);
}

.msg-thread-left{
  width:92px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:8px;
  flex:0 0 auto;
}

.msg-thread-ava{
  width:64px;
  height:64px;
  border-radius:18px;
  overflow:hidden;
  border:1px solid rgba(0,0,0,.08);
  background:#f3f4f6;
}

.msg-thread-ava img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

.msg-thread-name{
  text-align:center;
  font-weight:700;
  font-size:12.5px;
  line-height:1.15;
  max-height:2.35em;
  overflow:hidden;
}

.msg-thread-mid{
  flex:1 1 auto;
  min-width:0;
  display:flex;
  flex-direction:column;
  justify-content:center;
  gap:8px;
}

.msg-thread-last{
  color:#111827;
  font-size:14px;
  line-height:1.35;
  max-height:2.7em;
  overflow:hidden;
}

.msg-thread-meta{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.msg-thread-right{
  width:110px;
  flex:0 0 auto;
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  justify-content:space-between;
}

.msg-thread-time{
  font-size:12px;
  color:#6b7280;
}

.msg-thread-open{
  font-size:12px;
  color:#6b7280;
}

/* empty */
.msg-empty .msg-empty-title{
  font-weight:800;
  margin-bottom:6px;
}

/* chat */
.msg-chat-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}

.msg-chat-left{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
}

.msg-peer{
  display:flex;
  align-items:center;
  gap:10px;
}

.msg-peer-ava{
  width:44px;
  height:44px;
  border-radius:14px;
  overflow:hidden;
  border:1px solid rgba(0,0,0,.08);
  background:#f3f4f6;
}

.msg-peer-ava img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

.msg-peer-name{
  font-weight:900;
  line-height:1.1;
}

.msg-peer-sub{
  font-size:12px;
  color:#6b7280;
}

.msg-chat-actions{
  display:flex;
  gap:8px;
}

.msg-closed-note{
  background: rgba(255,193,7,.12);
  border:1px solid rgba(255,193,7,.25);
  border-radius:14px;
  padding:10px 12px;
  margin-bottom:12px;
  color:#7a5b00;
}

.msg-chat-card{
  border:1px solid rgba(0,0,0,.08);
  background:#fff;
  border-radius:18px;
  overflow:hidden;
}

.msg-chat-body{
  padding:14px 14px 10px;
  height: 62vh;
  min-height: 420px;
  max-height: 820px;
  overflow:auto;
  background:
    radial-gradient(1100px 260px at 0% 0%, rgba(13,110,253,.06), transparent 60%),
    radial-gradient(900px 240px at 100% 0%, rgba(25,135,84,.05), transparent 55%),
    #fff;
}

.msg-system{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  color:#6b7280;
  font-size:12px;
  margin:10px 0;
}

.msg-system em{
  font-style:normal;
  color:#9ca3af;
}

.msg-bubble-row{
  display:flex;
  margin:10px 0;
}

.msg-bubble-row.mine{ justify-content:flex-end; }
.msg-bubble-row.theirs{ justify-content:flex-start; }

.msg-bubble{
  max-width: 78%;
  border-radius: 16px;
  padding: 10px 12px;
  border: 1px solid rgba(0,0,0,.08);
  background: #fff;
}

.msg-bubble-row.mine .msg-bubble{
  background: rgba(13,110,253,.08);
  border-color: rgba(13,110,253,.18);
}

.msg-text{
  font-size:14px;
  line-height:1.35;
  color:#111827;
}

.msg-time{
  margin-top:6px;
  font-size:11px;
  color:#6b7280;
  text-align:right;
}

.msg-atts{
  margin-top:8px;
  display:flex;
  flex-direction:column;
  gap:10px;
}

.msg-att.img{
  display:block;
  text-decoration:none;
  color:inherit;
}

.msg-att.img img{
  width:100%;
  max-width:360px;
  border-radius:14px;
  border:1px solid rgba(0,0,0,.08);
  display:block;
}

.msg-att .cap{
  margin-top:6px;
  font-size:12px;
  color:#6b7280;
}

.msg-att.audio audio{
  width: 320px;
  max-width: 100%;
}

.msg-att.video video{
  width: 360px;
  max-width: 100%;
  border-radius:14px;
  border:1px solid rgba(0,0,0,.08);
}

.msg-att.file{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid rgba(0,0,0,.08);
  text-decoration:none;
  color:inherit;
  background:#fff;
  max-width:420px;
}

.msg-att.file:hover{
  border-color: rgba(0,0,0,.14);
}

.msg-att.file .file-ic{
  width:34px;
  height:34px;
  border-radius:12px;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(108,117,125,.10);
}

.file-name{
  font-weight:800;
  font-size:13px;
  line-height:1.2;
}

.file-sub{
  font-size:12px;
  color:#6b7280;
}

.msg-chat-foot{
  border-top:1px solid rgba(0,0,0,.06);
  padding:12px;
  background:#fff;
}

.msg-send-form{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.msg-input{
  resize: vertical;
  border-radius:14px !important;
}

.msg-send-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
}

.msg-send-hint{
  font-size:12px;
  color:#6b7280;
}

@media (max-width: 576px){
  .msg-thread-right{ display:none; }
  .msg-thread-left{ width:84px; }
  .msg-chat-body{ height: 58vh; min-height: 360px; }
  .msg-bubble{ max-width: 92%; }
}
