.chat-gallery {
  display: grid;
  gap: 4px;
  max-width: 520px;
  border-radius: 8px;
  overflow: hidden;
  margin-top: 8px;
  margin-left: 50px;
}

.select-to-chat:not(.fullscreen) .chat-gallery {
  margin-left: 32px;
}  
/* === 1 ảnh === */
.chat-gallery.layout-1 {
  grid-template-columns: 1fr;
}
.chat-gallery.layout-1 img {
  max-width: 550px;
  width: 100%;
  height: auto;
  margin: 0 auto;
  display: block;
}

/* ✅ Ghi đè khi chỉ có 1 ảnh */
.chat-gallery.layout-1 .chat-gallery-item {
  aspect-ratio: auto;        /* Bỏ tỉ lệ cố định */
  height: auto;              /* Tự co theo nội dung */
  overflow: visible;         /* Không cắt ảnh */
}

.chat-gallery.layout-1 .chat-gallery-item img {
  object-fit: contain;       /* Giữ nguyên tỷ lệ ảnh gốc */
  max-height: 600px;         /* Giới hạn chiều cao tối đa */
  border-radius: 8px;
}

/* === 2 ảnh: chia đôi ngang === */
.chat-gallery.layout-2 {
  grid-template-columns: repeat(2, 1fr);
}

/* === 3 ảnh: 1 trên to, 2 dưới chia đôi === */
.chat-gallery.layout-3 {
  grid-template-columns: repeat(2, 1fr);
  grid-template-areas:
    "a a"
    "b c";
  grid-auto-flow: dense;
}
.chat-gallery.layout-3 .chat-gallery-item:nth-child(1) { grid-area: a; }
.chat-gallery.layout-3 .chat-gallery-item:nth-child(2) { grid-area: b; }
.chat-gallery.layout-3 .chat-gallery-item:nth-child(3) { grid-area: c; }

/* === 4 ảnh: lưới 2x2 === */
.chat-gallery.layout-4 {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

/* === 5 ảnh: 2 trên chia đôi, 3 dưới chia đều === */
.chat-gallery.layout-5 {
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(2, 1fr);
}
.chat-gallery.layout-5 .chat-gallery-item:nth-child(1) { grid-column: 1 / span 3; grid-row: 1; }
.chat-gallery.layout-5 .chat-gallery-item:nth-child(2) { grid-column: 4 / span 3; grid-row: 1; }
.chat-gallery.layout-5 .chat-gallery-item:nth-child(3) { grid-column: 1 / span 2; grid-row: 2; }
.chat-gallery.layout-5 .chat-gallery-item:nth-child(4) { grid-column: 3 / span 2; grid-row: 2; }
.chat-gallery.layout-5 .chat-gallery-item:nth-child(5) { grid-column: 5 / span 2; grid-row: 2; }

/* === Ảnh chung === */
.chat-gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  aspect-ratio: 4 / 3;
}
.chat-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
}
.chat-gallery-item:hover img {
  transform: scale(1.03);
}

/* === Overlay “+x ảnh” === */
.chat-gallery-item.has-overlay .img-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 28px;
  font-weight: 600;
  display: flex;
  justify-content: center;
  align-items: center;
}






/* === Forum Layout === */
/*
.select-to-chat.fullscreen .forum-message-wrapper {
    background-image: linear-gradient(to right, rgb(175 175 175 / 5%) 1px, #00000000 1px), linear-gradient(to bottom, rgb(175 175 175 / 0%) 1px, #00000070 1px);
color: #ffffff;
    
}
*/
.forum-message-wrapper {
    margin-bottom: 10px;
    border-radius: 8px;
    padding: 12px;
    transition: background-color 0.15s ease;
    cursor: pointer;
    box-sizing: border-box;
        box-shadow: 1px 5px 15px rgba(0, 0, 0, 0.2);
    background-size: 20px 20px;
    background-position: top left;
    border: 1px solid #8e8e8e4f  
    
}
 
.forum-message-wrapper .msg-reaction-btn {
  display: none !important;
}
/* ====== GROUP CHAT ====== */
.forum-message-wrapper .msg.basic-other-msg .bubble {
  background: none; /* màu nhạt hơn, hoặc viền riêng */
    padding: 0;
  max-width: 100%;
}

.forum-message-wrapper .msg.basic-user-msg .bubble {
  background: none;
    padding: 0;
  max-width: 100%;
}
  

/* Ẩn avatar ở group chat */
.forum-message-wrapper .chat-avatar {
  display: none !important;
}



 

.forum-card-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  opacity: 0.8;
  margin-bottom: 6px;
}

.forum-card-title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
    line-height: 1.2;
    text-align: left;
}

/* === Ảnh ghép thumbnail === */
/* ==== FORUM THUMB GRID ==== */
/* === Grid Container === */
.forum-grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); /* ✅ auto co giãn số cột */
  gap: 14px; /* khoảng cách giữa các card */
  align-items: stretch; /* ✅ card cao bằng nhau */
  justify-content: center;
  padding: 10px;
  box-sizing: border-box;
}

.forum-thumb-grid {
  display: grid;
  width: 100%;
  height: 205px;
  overflow: hidden;
  border-radius: 6px;
  margin-bottom: 8px;
  gap: 2px;
      border: 1px solid #8e8e8e4f;
}

/* === 1 ảnh === */
.forum-thumb-grid.layout-1 {
  grid-template-columns: 1fr;
}

/* === 2 ảnh: chia đôi ngang === */
.forum-thumb-grid.layout-2 {
  grid-template-columns: repeat(2, 1fr);
}

/* === 3 ảnh: 1 trên, 2 dưới === */
.forum-thumb-grid.layout-3 {
  grid-template-columns: repeat(2, 1fr);
  grid-template-areas:
    "a a"
    "b c";
  grid-auto-flow: dense;
}
.forum-thumb-grid.layout-3 .forum-thumb-item:nth-child(1) { grid-area: a; }
.forum-thumb-grid.layout-3 .forum-thumb-item:nth-child(2) { grid-area: b; }
.forum-thumb-grid.layout-3 .forum-thumb-item:nth-child(3) { grid-area: c; }

/* === 4 ảnh: lưới 2x2 === */
.forum-thumb-grid.layout-4 {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

/* === 5 ảnh: 2 trên chia đôi, 3 dưới chia đều === */
.forum-thumb-grid.layout-5 {
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(2, 1fr);
}
.forum-thumb-grid.layout-5 .forum-thumb-item:nth-child(1) { grid-column: 1 / span 3; grid-row: 1; }
.forum-thumb-grid.layout-5 .forum-thumb-item:nth-child(2) { grid-column: 4 / span 3; grid-row: 1; }
.forum-thumb-grid.layout-5 .forum-thumb-item:nth-child(3) { grid-column: 1 / span 2; grid-row: 2; }
.forum-thumb-grid.layout-5 .forum-thumb-item:nth-child(4) { grid-column: 3 / span 2; grid-row: 2; }
.forum-thumb-grid.layout-5 .forum-thumb-item:nth-child(5) { grid-column: 5 / span 2; grid-row: 2; }

/* === ITEM === */
.forum-thumb-item {
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
}
.forum-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.forum-thumb-item.has-overlay .img-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  font-size: 24px;
  font-weight: 600;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* === Thumbnail text fallback === */
.forum-thumb-text {
  border-radius: 6px;
  height: 210px;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
  margin-bottom: 8px;
      box-sizing: border-box;
}

/* === Tags & Meta === */
.forum-card-tags {
  margin-top: 4px;
}
.forum-tag {
  display: inline-block;
  border-radius: 4px;
  padding: 2px 6px;
  margin-right: 4px;
  font-size: 12px;
}

.forum-card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  opacity: 0.8;
  margin-top: 6px;
}

