* {
  font-family: Verdana, sans-serif !important;
}

html {
  font-size: clamp(12px, 3.5vw, 14px);
  scroll-behavior: smooth;
}

:root {
  --ink: #8C6ACC;
  --accent: #8a5cc7;
  --accent-soft: #b89ae6;
}

/* CĂN CHỈNH VĂN BẢN */
.text-justify { text-align: justify; }
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.no-underline, 
.no-underline:hover, 
.no-underline:active {
  text-decoration: none !important;
}

/* NỀN NGOÀI */
body {
  font-family: 'Verdana', sans-serif;
  margin: 0;
  padding: 0;
  background: url("images/nen.jpg") center/cover fixed no-repeat;
  color: var(--ink);
}

/* LOGO GÓC TRÁI */
.logo {
  position: fixed;
  top: 20px;
  left: 20px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8a5cc7, #b89ae6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Verdana', serif;
  font-size: 1.6rem;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 6000;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.logo:hover {
  transform: scale(1.08);
}

/* KHUNG NỘI DUNG */
.page {
  max-width: 1100px;
  margin: 40px auto;
  padding: 25px;
  background:
    linear-gradient(rgba(255,255,255,0.85), rgba(255,255,255,0.85)),
    url("images/lop12a14.jpg");
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #CC99FF;
  border-radius: 12px;
  box-shadow: 0 12px 35px rgba(0,0,0,0.12);
  border: 1px solid rgba(0,0,0,0.05);
}

/* MENU FLOATING DESKTOP */
.menu-wrapper {
  position: fixed;
  top: calc(20px + 120px + 10px); 
  left: 20px; 
  visibility: hidden;
  z-index: 9999;
  animation: slideDown 0.25s ease-out;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.menu-wrapper.show {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.top-menu {
  display: flex;
  flex-direction: column;
  padding: 15px 20px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  width: max-content;
  min-width: 90px;
}

.top-menu a {
  font-family: inherit;
  color: inherit;
  font-size: 14px;
  padding: 10px 0;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.25);
  position: relative;
}

.top-menu a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0%;
  height: 2px;
  background: currentColor;
  transition: width 0.25s ease;
}

.top-menu a:hover::after {
  width: 100%;
}

.top-menu a:last-child {
  border-bottom: none;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* HEADER & SECTIONS */
header {
  text-align: center;
  padding: 10px 10px 25px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

header h1 {
  font-family: 'Verdana', serif;
  font-size: 2.4rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
}

header h2 {
  font-family: 'Verdana', serif;
  font-size: 1.2rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #6b4a9e;
}

section {
  padding: 25px 5px;
  border-bottom: 1px dashed rgba(0,0,0,0.08);
}

.section-title {
  font-family: 'Verdana', serif;
  font-size: 1.4rem;
  margin-bottom: 12px;
  color: #5a3c8a;
  position: relative;
}

.section-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 40%;
  height: 2px;
  background: linear-gradient(to right, var(--accent-soft), transparent);
}

/* CARDS & FLEX/GRID */
.intro-grid {
  display: grid;
  grid-template-columns: 2fr 1.5fr;
  gap: 25px;
}

.intro-card,
.member-card,
.message-card {
  background: rgba(255,255,255,0.55);
  border-radius: 10px;
  padding: 15px 18px;
  border: 1px solid rgba(0,0,0,0.06);
}

.lop-flex {
  display: flex;
  justify-content: space-between;
  text-align: center;
  width: 100%;
}

.lop-flex div {
  flex: 1;
  padding: 12px 0;
  font-family: inherit;
  font-size: 1.2em;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.25s ease, color 0.25s ease;
}

.lop-flex div:hover {
  transform: scale(1.1);
  color: #ff6600;
}

/* GIÁO VIÊN */
.teacher-box-i a {
  color: #8a5cc7;
  text-decoration: none;
}

.teacher-box-i a:hover {
  color: #b78cff;
  text-decoration: underline;
}

.teacher-box {
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(255,255,255,0.55);
  padding: 2px 10px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.06);
  margin-bottom: 6px;
}

.teacher-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8a5cc7, #b89ae6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #fff;
}

.teacher-box h4,
.teacher-box p {
  line-height: 1.4;
  margin: 04px 0;
}

/* THÀNH VIÊN & POPUP */
.student-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px 20px;
  margin-top: 20px;
}

.student {
  padding: 8px 10px;
  background: rgba(255,255,255,0.6);
  border-radius: 6px;
  text-align: center;
  cursor: pointer;
  color: #6b4a9e;
  font-weight: 500;
  transition: 0.2s;
}

.student:hover {
  background: #f2e8ff;
  color: #8a5cc7;
  transform: translateY(-2px);
}

.popup {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(5px);
  justify-content: center;
  align-items: center;
  z-index: 999;
}

.popup-content {
  background: #f7f0ff;
  border: 2px solid #c8a8ff;
  border-radius: 14px;
  padding: 20px;
  width: 340px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.2);
  animation: popupShow 0.25s ease-out;
  text-align: center;
}

@keyframes popupShow {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

.close {
  float: right;
  font-size: 26px;
  cursor: pointer;
  color: #6b4a9e;
}

.avatar-frame {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid #d8c2ff;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2A73C2;
}

.student-photo {
  width: 110%;
  height: 110%;
  object-fit: contain;
  object-position: center 0%;
}

.info-box {
  text-align: left;
  margin-top: 10px;
  color: #4a3a6b;
}

.info-box p { margin: 6px 0; }
.info-box span { white-space: pre-line; }

/* TIMELINE */
.timeline {
  position: relative;
  margin: 20px 0;
  padding-left: 25px;
  border-left: 3px solid rgba(138, 92, 199, 0.35);
}

.timeline-item {
  position: relative;
  margin-bottom: 25px;
}

.timeline-dot {
  position: absolute;
  left: -11px;
  top: 4px;
  width: 16px;
  height: 16px;
  background: #c8a8ff;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 0 6px rgba(0,0,0,0.2);
}

.timeline-content {
  background: rgba(255,255,255,0.55);
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transition: 0.25s;
}

.timeline-content:hover {
  transform: translateX(6px);
  background: rgba(255,255,255,0.75);
}

.timeline-content h4 {
  margin: 0;
  font-size: 1.1rem;
  color: #6b4a9e;
  font-weight: bold;
}

.timeline-content p {
  margin: 6px 0 0;
  color: #4a3a6b;
  line-height: 1.5;
}

.timeline-content.with-photo {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.timeline-content.with-photo img {
  width: 120px;
  height: 90px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.1);
  box-shadow: 0 3px 10px rgba(0,0,0,0.15);
  flex-shrink: 0;
}

/* CAROUSEL ALBUM */
.carousel-wrapper {
  position: relative;
  width: 100%;
  overflow: hidden;
  padding: 5px 0;
}

.carousel {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 10px 5px;
}

.carousel::-webkit-scrollbar { display: none; }

.carousel-item {
  flex: 0 0 22%;
  background: rgba(255,255,255,0.55);
  border-radius: 10px;
  padding: 8px;
  text-align: center;
  text-decoration: none;
  color: #8a5cc7;
  font-weight: 600;
  border: 1px solid rgba(0,0,0,0.06);
  transition: 0.25s;
}

.carousel-item:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.carousel-item img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 6px;
}

.carousel-item span {
  display: block;
  font-size: 13px;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: #8a5cc7;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 20px;
  z-index: 10;
  opacity: 0.8;
  transition: 0.2s;
}

.carousel-btn:hover { opacity: 1; }
.carousel-btn.left { left: 0; }
.carousel-btn.right { right: 0; }

/* ALBUM GRID & NAV */
.album-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding: 10px;
}

.album-container img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  object-position: center;
  border-radius: 8px;
  border: 1px solid #ddd;
  background: #fafafa;
  padding: 4px;
  cursor: pointer;
  transition: 0.25s;
}

.album-container img:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.album-nav {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 20px 0 30px;
}

.album-btn, .download-btn {
  display: inline-block;
  padding: 10px 18px;
  background: #8a5cc7;
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  transition: 0.2s;
  white-space: nowrap;
}

.album-btn:hover, .download-btn:hover {
  background: #6b4a9e;
}

/* DIARY LIST */
.diary-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 18px;
  margin-top: 15px;
}

.diary-item {
  display: flex;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(255,255,255,0.55);
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.06);
  text-decoration: none;
  color: #5a3c8a;
  transition: 0.25s;
  align-items: center;
}

.diary-item:hover {
  transform: translateX(6px);
  background: rgba(255,255,255,0.75);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.diary-item .icon { font-size: 28px; }

.diary-item .text h4 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.diary-item .text p {
  margin: 4px 0 0;
  font-size: 0.9rem;
  opacity: 0.8;
}

/* NÚT ĐIỀU HƯỚNG CỐ ĐỊNH 2 BÊN */
.side-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 45px;
  height: 45px;
  background: #8a5cc7;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  transition: 0.25s;
  z-index: 9999;
  opacity: 0.35;
}

.side-nav:hover {
  opacity: 1;
  transform: translateY(-50%) scale(1.12);
  background: #6b4a9e;
}

.left-nav { left: 15px; }
.right-nav { right: 15px; }

.side-nav::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.75);
  color: white;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s;
  white-space: nowrap;
}

.left-nav::after { left: 55px; }
.right-nav::after { right: 55px; }
.side-nav:hover::after { opacity: 1; }

footer {
  text-align: center;
  padding: 18px 5px 5px;
  font-size: 0.8rem;
  color: #8a6a9e;
  font-style: italic;
}

/* ==================================
   POPUP PHÓNG TO ẢNH TRONG ALBUM
================================== */
.photo-popup {
  display: none; /* Ẩn mặc định */
  position: fixed; /* Ghim cố định trên màn hình */
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.85); /* Nền đen mờ */
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  justify-content: center;
  align-items: center;
  z-index: 9999; /* Nằm trên cùng mọi thành phần */
}

/* Định dạng cho bức ảnh được phóng to */
.photo-popup img {
  max-width: 90%;
  max-height: 90vh; /* Giới hạn chiều cao ảnh không bị tràn màn hình */
  border-radius: 8px;
  box-shadow: 0 4px 25px rgba(0,0,0,0.6);
  object-fit: contain; /* Đảm bảo ảnh luôn giữ đúng tỷ lệ, không méo */
}

/* Nút tắt (X) ở góc phải */
.photo-close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 40px;
  color: white;
  cursor: pointer;
  font-weight: bold;
  transition: transform 0.2s ease, color 0.2s ease;
}

.photo-close:hover {
  color: #c8a8ff;
  transform: scale(1.1);
}

/* =========================================================
   MEDIA QUERIES TỐI ƯU HÓA CHO MOBILE VÀ TABLET
   ========================================================= */
@media (max-width: 900px) {
  .album-container { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .page {
    width: 92%;
    margin: 70px auto 20px;
    padding: 15px 12px;
    background-size: cover; /* Chống méo hình nền */
  }

  header h1 { font-size: 1.5rem; line-height: 1.3; }
  header h2 { font-size: 0.95rem; }

  /* Dàn lại các cột nội dung */
  .intro-grid, .diary-list { grid-template-columns: 1fr; gap: 15px; }
  .student-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  
  /* Căn chỉnh Popup học sinh */
  .popup-content { width: 90%; max-width: 320px; padding: 15px; }

/* ==================================
     HIỆU ỨNG MENU ĐỔ XUỐNG NHỎ GỌN (NHƯ DESKTOP) DÀNH CHO MOBILE
  ================================== */
  .menu-wrapper {
    position: fixed;
    top: 70px; /* Vị trí thả xuống ngay dưới logo (10px top + 50px cao + 10px hở) */
    left: 10px;
    width: max-content; 
    height: auto;
    background: transparent;
    box-shadow: none;
    transform: translateY(-10px); /* Trượt từ trên xuống như desktop */
    transition: opacity 0.25s ease, transform 0.25s ease;
    opacity: 0; 
    visibility: hidden;
    pointer-events: none;
    z-index: 9998;
  }

  /* Trạng thái hiện menu */
  .menu-wrapper.show {
    transform: translateY(0);
    opacity: 1; 
    visibility: visible;
    pointer-events: auto;
  }

  .top-menu {
    height: auto;
    padding: 15px 20px; 
    background: rgba(255, 255, 255, 0.95); /* Làm nền đục 95% để dễ đọc chữ trên điện thoại */
    border-radius: 16px; /* Bo góc tròn như desktop */
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  }
  
  .top-menu a { 
    font-size: 15px; 
    padding: 12px 0; 
    color: #5a3c8a; 
  }

  /* Khi active class .show -> Trượt về vị trí cũ (0) */
  .menu-wrapper.show {
    transform: translateX(0); 
  }

  .top-menu {
    height: 100%;
    padding: 70px 20px 20px; /* Chừa không gian cho logo ở trên */
    background: transparent;
    border: none;
    box-shadow: none;
  }
  .top-menu a { font-size: 16px; padding: 15px 0; color: #5a3c8a; }

  /* Gắn cố định logo trên mobile */
  .logo { width: 50px; height: 50px; top: 10px; left: 10px; z-index: 9999; }
  .logo:hover { transform: none; }

  .carousel-item { flex: 0 0 70%; }
  .side-nav { display: none; } /* Ẩn nút điều hướng trái/phải dư thừa trên mobile */
}

@media (max-width: 600px) {
  .album-container { grid-template-columns: 1fr; }
  .album-nav { flex-direction: column; gap: 10px; }
  .album-btn { width: 100%; text-align: center; }
  .timeline-content.with-photo { flex-direction: column; }
  .timeline-content.with-photo img { width: 100%; height: auto; }
}