﻿/* ===== Cơ bản ===== */
body {
  font-family: "Segoe UI", sans-serif;
  background: #eef3f8;
  margin: 0;
  padding: 0;
  min-height: 100vh; /* dùng height để giới hạn */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto; /* cho phép cuộn nếu nội dung vượt màn hình */
}

/* ===== Màn hình đăng nhập ===== */
#login-screen {
  text-align: center;
  background: white;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  width: 300px;
}

#login-screen input {
  display: block;
  width: 90%;
  margin: 10px auto;
  padding: 10px;
  border-radius: 5px;
  border: 1px solid #ccc;
}

#login-screen button {
  padding: 8px 16px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

#login-screen button:hover {
  background: #0056b3;
}

/* ===== Màn hình chat ===== */
#chat-screen {
  display: flex;
  flex-direction: row;
  width: 95%;
  max-width: 1000px;
  min-height: 90vh;
  border-radius: 10px;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
  background: white;
}

/* ===== Form Setting (Admin) ===== */
#admin-btn {
  background: transparent;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  margin-left: auto;
}

#admin-panel {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: white;
  overflow-y: auto;
  padding: 20px;
  font-size: 14px;
  box-sizing: border-box;
  z-index: 10;
  display: none;
}

#admin-panel input,
#admin-panel select {
  width: 100%;
  padding: 10px;
  margin: 6px 0;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-family: "Segoe UI", sans-serif;
  font-size: 14px;
  box-sizing: border-box;
}

#admin-panel button {
  padding: 8px 14px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  margin-top: 8px;
}

#admin-panel button:hover {
  background: #0056b3;
}

/* ===== Sidebar (Danh bạ + Nhóm) ===== */
#sidebar {
  width: 260px;
  background: #f3f6fb;
  border-right: 1px solid #ccc;
  padding: 10px;
  display: flex;
  flex-direction: column;
}

#sidebar h3 {
  margin: 10px 0 5px;
  font-size: 15px;
  color: #333;
}

#sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

#sidebar li {
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 5px;
  cursor: pointer;
  transition: 0.2s;
}

#sidebar li:hover {
  background: #d0e3ff;
}

#sidebar button {
  background: #007bff;
  color: white;
  border: none;
  border-radius: 5px;
  padding: 8px;
  margin-top: 8px;
  cursor: pointer;
}

#sidebar button:hover {
  background: #0056b3;
}

/* ===== Thông tin người dùng ===== */
.user-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #007bff;
  color: white;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 14px;
}

#logout-btn {
  background: transparent;
  border: none;
  color: white;
  font-size: 16px;
  cursor: pointer;
}

/* ===== Khu vực chat ===== */
#chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: white;
}

#chat-header {
  background: #007bff;
  color: white;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#chat-header #back-btn {
  display: none;
  background: transparent;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
}

#room-name {
  font-weight: bold;
  font-size: 16px;
}

#chat-box {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  background: #f9fbfe;
  word-wrap: break-word;
}

/* ===== Tin nhắn ===== */
.message {
  margin: 6px 0;
  padding: 6px 8px;
  background: #e6f0ff;
  border-radius: 6px;
}

.system {
  font-style: italic;
  color: gray;
  margin: 4px 0;
}


/* ===== icon Reaction Popup ===== */
.reaction-popup {
  position: absolute;
  display: flex;
  gap: 6px;
  background: white;
  border: 1px solid #ccc;
  border-radius: 30px;
  padding: 5px 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  z-index: 20;
}

.reaction-popup span {
  cursor: pointer;
  font-size: 20px;
  transition: transform 0.2s;
}

.reaction-popup span:hover {
  transform: scale(1.3);
}

/* ===== Form gửi tin ===== */
#form,
#upload-form {
  display: flex;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid #ddd;
}

#msg,
#file-input {
  flex: 1;
  padding: 8px;
  border-radius: 5px;
  border: 1px solid #ccc;
}

#form button,
#upload-form button {
  background: #007bff;
  color: white;
  border: none;
  border-radius: 5px;
  padding: 8px 14px;
  cursor: pointer;
}

#form button:hover,
#upload-form button:hover {
  background: #0056b3;
}

/* ===== Nút xóa ===== */
#delete-btn {
  margin: 8px;
  padding: 6px 12px;
  border: none;
  color: white;
  border-radius: 5px;
  cursor: pointer;
  background: red;
}

/* ===== Responsive cho điện thoại ===== */
@media (max-width: 700px) {
  #chat-screen {
    flex-direction: column;
    width: 100%;
    height: 100vh;
    border-radius: 0;
  }

  #sidebar {
    width: 100%;
    height: 100%;
    position: absolute;
    background: #f3f6fb;
    z-index: 2;
    transition: 0.3s;
  }

  #chat-area {
    width: 100%;
    height: 100%;
    display: none;
  }

  #chat-area.active {
    display: flex;
  }

  #sidebar.hidden {
    display: none;
  }

  #back-btn {
    display: inline-block !important;
  }

  #user-list li,
  #group-list li {
    padding: 12px;
    font-size: 17px;
  }
}

/* ====== LỊCH NHÓM (full screen overlay) ====== */
#calendar-box {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: white;
  overflow-y: auto;
  padding: 20px;
  font-size: 14px;
  box-sizing: border-box;
  z-index: 10;
  display: none;
}

/* Input + textarea trong lịch */
#calendar-box input,
#calendar-box textarea {
  width: 100%;
  padding: 10px;
  margin: 6px 0;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-family: "Segoe UI", sans-serif;
  font-size: 14px;
  box-sizing: border-box;
}

/* Textarea mô tả sự kiện */
#calendar-box textarea,
#event-desc {
  min-height: 80px;
  resize: vertical;
}

/* Nút trong lịch */
#calendar-box button {
  padding: 8px 14px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.2s;
}

#calendar-box button:hover {
  background: #0056b3;
}

/* Nút quay lại */
#back-to-chat {
  background: #007bff;
  color: white;
  border: none;
  border-radius: 5px;
  padding: 8px 12px;
  margin-bottom: 12px;
  cursor: pointer;
}

#back-to-chat:hover {
  background: #0056b3;
}
/* danj caya */
.tree, .tree ul {
  list-style-type: none;
  padding-left: 10px;
  margin: 0;
}

.tree span {
  cursor: pointer;
  font-weight: bold;
  display: block;
  margin: 8px 0;
  color: #333;
}

.nested {
  display: none;
  margin-left: 10px;
}

.active {
  display: block;
}

.tree li {
  padding: 4px 0;
}

.link {
  color: #333;
  font-weight: bold;
  text-decoration: none;
  background-color: #f5f5f5;
  padding: 5px 10px;
  border-radius: 5px;
  transition: 0.3s;
}
.link:hover {
  color: white;
  background-color: #333;
}