/* ==========================================================================
   FILE: layout.css
   MỤC ĐÍCH: Bố cục chính của sơ đồ, Navbar và Responsive cho Mobile.
   ========================================================================== */

/* --- KHUNG BAO BỌC BẢN ĐỒ LỚP HỌC --- */
.classroom-container {
  width: 100%;
  max-width: 1200px; /* Giới hạn chiều rộng tối đa để màn hình lớn không bị quá loãng */
  margin: 0 auto; /* Căn giữa trang */
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  padding: 20px;
}

/* --- LƯỚI HIỂN THỊ CÁC TỔ --- */
.tables-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* Chia làm 4 cột bằng nhau (4 tổ) */
  gap: 15px;
  margin-bottom: 20px;
}

/* --- MỘT CỘT ĐẠI DIỆN CHO 1 TỔ --- */
.group-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: flex-end; /* Quan trọng: Ép các bàn dồn xuống đáy (gần bục giảng) */
}

/* ==========================================================================
   THANH ĐIỀU HƯỚNG (NAVBAR)
   ========================================================================== */
.custom-navbar {
  background-color: #063158;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  position: sticky; /* Ghim thanh điều hướng ở trên cùng khi cuộn trang */
  top: 0;
  z-index: 50; /* Đảm bảo nằm trên mọi thứ khác */
  width: 100%;
}

.navbar-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 70px;
  padding: 0 20px;
}

/* --- LOGO --- */
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.navbar-brand:hover {
  transform: scale(1.03); /* Phóng to nhẹ khi đưa chuột vào */
}

.brand-logo {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  font-size: 1.3rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-text .text-main {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 1px;
}

.brand-text .text-sub {
  font-size: 0.65rem;
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 2.5px;
  margin-top: 3px;
  text-transform: uppercase;
}

/* --- MENU TRÊN NAVBAR --- */
.navbar-menu {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  height: 100%;
}

.nav-item {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
}

.nav-link {
  color: #ffffff;
  text-decoration: none;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  font-weight: 500;
  transition: background-color 0.3s;
}

.dropdown-arrow {
  transition: transform 0.3s ease;
}

.nav-link:hover,
.nav-item.dropdown:hover .nav-link {
  background-color: rgba(255, 255, 255, 0.1);
}

/* --- DROPDOWN MENU (Menu xổ xuống) --- */
.dropdown-menu {
  position: absolute;
  top: 70px;
  right: 0;
  background-color: #ffffff;
  min-width: 250px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  border-radius: 0 0 8px 8px;
  padding: 8px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(15px);
  transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1); /* Hiệu ứng mượt mà */
  border: 1px solid #e2e8f0;
  border-top: 3px solid #3b82f6;
}

/* Mở menu khi hover vào item cha */
.nav-item.dropdown:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-menu a,
.dropdown-menu .dropdown-label {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  color: #334155;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dropdown-menu a:hover,
.dropdown-menu .dropdown-label:hover {
  background-color: #f1f5f9;
  color: #063158;
  padding-left: 28px; /* Đẩy chữ thụt vào một chút tạo hiệu ứng */
}

/* ==========================================================================
   KHU VỰC BỤC GIẢNG & CỬA VÀO
   ========================================================================== */
.door-icon {
  color: #10b981;
  font-weight: bold;
  font-size: 1.2rem;
}

.blackboard {
  background-color: #334155;
  color: white;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  font-weight: bold;
  letter-spacing: 1px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

.teacher-desk {
  background-color: #fff7ed;
  border: 2px solid #fed7aa;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  font-weight: bold;
  color: #9a3412;
}

/* ==========================================================================
   RESPONSIVE ĐIỆN THOẠI (Dưới 768px)
   ========================================================================== */
.mobile-menu-icon {
  display: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 5px;
  background: transparent;
  border: none;
  color: white;
}

@media (max-width: 768px) {
  .mobile-menu-icon {
    display: block; /* Hiện nút hamburger trên mobile */
  }

  .navbar-menu {
    display: none; /* Ẩn menu ngang ban đầu */
    position: absolute;
    top: 70px;
    left: 0;
    width: 100%;
    background-color: #063158;
    flex-direction: column;
    height: auto;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.2);
  }

  .navbar-menu.active {
    display: flex; /* Hiện menu dọc khi bấm nút hamburger */
  }

  .nav-item {
    width: 100%;
    height: auto;
    flex-direction: column;
    align-items: flex-start;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
  }

  .nav-link {
    width: 100%;
    padding: 15px 20px;
    justify-content: flex-start;
  }

  .nav-link .dropdown-arrow {
    margin-left: auto; /* Đẩy mũi tên sang sát mép phải */
  }

  .dropdown-menu {
    position: static;
    width: 100%;
    background-color: #042442;
    box-shadow: none;
    border: none;
    border-radius: 0;
    padding: 0;
    display: none; /* Ẩn dropdown con */
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: none;
  }

  /* Ghi đè hiệu ứng hover trên PC */
  .nav-item.dropdown:hover .dropdown-menu {
    display: none;
  }

  /* Chỉ hiện dropdown con khi click (JS add class 'open') */
  .nav-item.dropdown.open .dropdown-menu {
    display: block;
  }

  .nav-item.dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
  }

  .dropdown-menu a,
  .dropdown-menu .dropdown-label {
    color: #cbd5e1;
    padding: 12px 20px 12px 40px; /* Thụt lề sâu hơn để biết là menu con */
  }

  .dropdown-menu a:hover,
  .dropdown-menu .dropdown-label:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    padding-left: 45px;
  }

  /* Ẩn chữ phụ của logo cho gọn trên mobile */
  .brand-text .text-sub {
    display: none;
  }
}
