/* =========================================
   MERIDIA — messaging.css
   Messagerie sécurisée
   ========================================= */

.msg-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 540px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* --- Conversation list (left) --- */
.msg-list {
  background: var(--white);
  border-right: 0.5px solid var(--border);
  display: flex;
  flex-direction: column;
}
.msg-list-header {
  padding: 0.9rem 1rem;
  border-bottom: 0.5px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.msg-list-header .title { font-size: 12px; font-weight: 500; }
.msg-list-header .unread-count { font-size: 10px; color: var(--gold); }

.msg-item {
  padding: 0.85rem 1rem;
  border-bottom: 0.5px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}
.msg-item:last-child { border-bottom: none; }
.msg-item:hover { background: var(--gray-100); }
.msg-item.act { background: var(--info-bg); }
.msg-item .mi-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
}
.msg-item .mi-name { font-size: 12px; color: var(--text-main); }
.msg-item.unread .mi-name { font-weight: 500; color: var(--navy); }
.msg-item .mi-time { font-size: 10px; color: var(--text-muted); }
.msg-item .mi-prev {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 210px;
}
.unread-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--navy);
  flex-shrink: 0;
}

/* --- Message view (right) --- */
.msg-view {
  background: var(--white);
  display: flex;
  flex-direction: column;
}
.msg-view-header {
  padding: 0.9rem 1.25rem;
  border-bottom: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.mv-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--info-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--info-txt);
  flex-shrink: 0;
}
.mv-name { font-size: 13px; font-weight: 500; }
.mv-role { font-size: 11px; color: var(--text-muted); }
.mv-time {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
}

/* --- Message bubbles --- */
.msg-body {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  max-height: 380px;
}
.bubble-wrap { display: flex; flex-direction: column; }

.bubble {
  max-width: 72%;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-lg);
  font-size: 12px;
  line-height: 1.65;
}
.bubble.recv {
  background: var(--gray-100);
  color: var(--text-main);
  align-self: flex-start;
  border-bottom-left-radius: 2px;
}
.bubble.sent {
  background: var(--navy);
  color: var(--white);
  align-self: flex-end;
  border-bottom-right-radius: 2px;
}
.bubble-time {
  font-size: 10px;
  color: var(--text-light);
  margin-top: 4px;
}
.bubble-time.right { text-align: right; }

/* Empty state */
.msg-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-muted);
  padding: 2rem;
  text-align: center;
}

/* --- Compose bar --- */
.msg-compose {
  padding: 0.9rem 1.25rem;
  border-top: 0.5px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: center;
}
.msg-compose input {
  flex: 1;
  padding: 8px 14px;
  border: 0.5px solid var(--border-md);
  border-radius: 20px;
  font-size: 12px;
  font-family: var(--font-sans);
  background: var(--white);
  color: var(--text-main);
  outline: none;
  transition: border-color 0.15s;
}
.msg-compose input:focus { border-color: var(--navy); }
.msg-compose button {
  background: var(--navy);
  color: var(--white);
  border: none;
  padding: 7px 18px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: var(--transition);
}
.msg-compose button:hover { background: var(--navy-mid); }

/* --- Responsive --- */
@media (max-width: 768px) {
  .msg-layout { grid-template-columns: 1fr; }
  .msg-list { max-height: 240px; overflow-y: auto; border-right: none; border-bottom: 0.5px solid var(--border); }
}
