/* community.css - professional chat layout */
.community-wrapper {
  max-width: 1100px;
  margin: 28px auto;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

/* Left: groups list */
.groups-list {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.06);
  height: calc(100vh - 100px);
  overflow: auto;
}

.groups-list h3 {
  margin: 0 0 12px 0;
  color: #175515;
  font-size: 18px;
}

.group-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s, transform .08s;
  margin-bottom: 8px;
  background: #f7faf8;
}

.group-item:hover {
  background: #eef6ee;
  transform: translateY(-1px);
}

.group-item .meta {
  display: flex;
  flex-direction: column;
}

.group-item .meta .name {
  font-weight: 700;
  color: #145012;
}

.group-item .meta .desc {
  font-size: 13px;
  color: #666;
  margin-top: 3px;
}

/* Join button */
.join-btn {
  background: #175515;
  color: #fff;
  padding: 6px 10px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 13px;
}

.join-btn.joined {
  background: #e6f3e6;
  color: #175515;
  border: 1px solid #cfe9cf;
}

/* Right: chat area */
.chat-area {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 100px);
}

.chat-header {
  background: #fff;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-header img.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #175515;
}

.chat-header .title {
  font-weight: 700;
  color: #175515;
}
.chat-header .sub { color: #666; font-size: 13px; }

.chat-messages {
  background: linear-gradient(180deg, #f7faf8, #ffffff);
  flex: 1;
  margin-top: 12px;
  padding: 18px;
  border-radius: 12px;
  overflow-y: auto;
  box-shadow: inset 0 1px 0 rgba(0,0,0,0.02);
}

/* single message */
.msg {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
  align-items: flex-start;
}
.msg .avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  flex-shrink: 0;
}
.msg .bubble {
  max-width: 78%;
  background: #fff;
  padding: 10px 12px;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.04);
  color: #222;
}
.msg.me {
  flex-direction: row-reverse;
}
.msg.me .bubble {
  background: #e9f6e9;
  color: #143f14;
}

/* message meta */
.msg .meta {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}
.msg .meta .name { font-weight:700; color:#175515; font-size:13px; }
.msg .meta .time { color:#777; font-size:12px; }

/* message image */
.msg img.msg-img {
  margin-top: 8px;
  max-width: 300px;
  border-radius: 10px;
  display: block;
}

/* composer */
.composer {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.composer input[type="text"] {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #ddd;
  font-size: 14px;
}
.composer button.send {
  background: #175515;
  color: white;
  padding: 10px 14px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
}

.group-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.group-card {
    background: white;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid #ddd;
    transition: 0.2s;
}

.group-card:hover {
    background: #f3f9f3;
    border-color: #175515;
}

/* Chat Message Style */
.message {
    max-width: 70%;
    padding: 10px 14px;
    margin: 10px 0;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    font-family: Arial, sans-serif;
}

/* Other people's messages */
.message.other {
    background: #ffffff;
    border: 1px solid #e5e5e5;
    align-self: flex-start;
}

/* Your own messages */
.message.me {
    background: #daf5d9;
    border: 1px solid #b7e7b4;
    align-self: flex-end;
}

/* Sender name */
.message .sender {
    font-size: 13px;
    font-weight: bold;
    color: #175515;
    margin-bottom: 3px;
}

/* Text */
.message .text {
    font-size: 15px;
    color: #333;
}

/* Timestamp */
.message .time {
    font-size: 11px;
    color: #666;
    margin-top: 4px;
    align-self: flex-end;
}

/* Message image */
.chat-img {
    width: 180px;
    margin-top: 6px;
    border-radius: 8px;
}

.chat-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 10px;
    flex-shrink: 0;
}

/* Layout for other user's message */
.msg.other {
    display: flex;
    align-items: flex-start;
    margin-bottom: 14px;
}

/* Layout for your messages */
.msg.me {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 14px;
}

/* Chat bubble */
.bubble {
    background: #ffffff;
    padding: 10px 14px;
    border-radius: 12px;
    max-width: 70%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.msg.me .bubble {
    background: #daf5d9;
}



.small-muted { font-size:12px; color:#777; }

/* responsive */
@media (max-width: 900px) {
  .community-wrapper { grid-template-columns: 1fr; padding: 12px; }
  .groups-list { height: auto; order: 2; }
  .chat-area { order: 1; height: auto; margin-bottom: 18px; }
}
