/* ===================================================================
   1. VARIABLES & GLOBAL SETTINGS
   =================================================================== */
:root {
  /* Colors */
  --primary-color: #007bff;
  --primary-dark: #0056b3;
  --accent-color: orange;
  --accent-dark: #cc8400;
  --dark-color: #212529;
  --light-color: #f8f9fa;
  --text-color: #495057;
  --border-color: #dee2e6;

  /* Sizing & Spacing */
  --header-height: 65px;
  --breadcrumb-height: 41px;
  --border-radius: 12px;
  --viewer-max-width: 1800px;
  --box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);

  /* Typography */
  --font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  --font-size-h1: clamp(2rem, 1.2rem + 3.5vw, 3.5rem);
  --font-size-h2: clamp(1.8rem, 1.4rem + 2.5vw, 2.5rem);
  --font-size-h3: clamp(1.1rem, 0.9rem + 1vw, 1.3rem);
  --font-size-body: clamp(0.95rem, 0.9rem + 0.25vw, 1.05rem);
  --font-size-large: clamp(1rem, 0.8rem + 1vw, 1.25rem);
  --font-size-small: clamp(0.8rem, 0.75rem + 0.25vw, 0.9rem);
}

/* ===================================================================
   2. BASE STYLES & RESETS
   =================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body {
  font-family: var(--font-family);
  line-height: 1.7;
  background-color: #fff;
  color: var(--text-color);
  padding-top: var(--header-height);
}
a {
  text-decoration: none;
  color: var(--primary-color);
  transition: color 0.3s ease;
}
a:hover {
  color: var(--primary-dark);
}
ul {
  list-style: none;
  padding: 0;
}
h1,
h2,
h3 {
  color: var(--dark-color);
  margin-bottom: 15px;
  font-weight: 700;
}
h1 {
  font-size: var(--font-size-h1);
  line-height: 1.2;
}
h2 {
  font-size: var(--font-size-h2);
  text-align: center;
}
h3 {
  font-size: var(--font-size-h3);
}

/* ===================================================================
   3. LAYOUT & HELPER CLASSES
   =================================================================== */
.container {
  max-width: 1900px;
  margin: 0 auto;
  padding: 0 20px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
.no-results-message {
  text-align: center;
  padding: 40px 20px;
  font-size: 1.1rem;
  color: var(--text-color);
  display: none;
}
.region-title,
.faculty-title,
.section-title {
  text-align: center;
  font-size: 1.8rem;
  margin-top: 30px;
  margin-bottom: 30px;
  padding-bottom: 15px;
  position: relative;
  color: var(--dark-color);
}
.region-title::after,
.faculty-title::after,
.section-title::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 3px;
  background-color: var(--primary-color);
}

/* ===================================================================
   4. COMPONENTS
   =================================================================== */

/* --- Buttons --- */
.btn,
.btn-primary,
.btn-secondary,
.btn-upload,
.updating-section .btn-contribute {
  display: inline-block;
  padding: 12px 28px;
  border-radius: 50px;
  font-weight: 500;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  transition: all 0.3s ease;
  text-align: center;
  text-decoration: none;
}
.btn-primary,
.updating-section .btn-contribute {
  background-color: var(--primary-color);
  color: #fff;
}
.btn-primary:hover,
.updating-section .btn-contribute:hover {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 123, 255, 0.3);
}
.btn-secondary {
  background-color: #fff;
  color: var(--primary-color);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  background-color: var(--light-color);
  color: var(--primary-dark);
}
.btn-upload {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.5);
}
.btn-upload:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: #fff;
}
.btn-primary i,
.updating-section .btn-contribute i {
  color: #fff !important;
}

/* --- Header --- */
.header {
  background: #fff;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  padding: 10px 0;
  display: flex;
  align-items: center;
  transition: padding 0.3s ease, box-shadow 0.3s ease, border-bottom 0.3s ease;
  border-bottom: 1px solid transparent;
}
.header.scrolled {
  padding: 8px 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  border-bottom: 1px solid var(--border-color);
}
.header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}
.header .logo {
  display: flex;
  align-items: center;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary-color);
  transition: transform 0.3s ease;
}
.header.scrolled .logo {
  transform: scale(0.85);
}
.header .logo img {
  width: 155px;
  height: auto;
  transition: height 0.3s ease;
}
.header.scrolled .logo img {
  height: 35px;
  width: auto;
}
.main-nav {
  display: block;
  margin-left: auto;
}
.main-nav ul {
  display: flex;
}
.main-nav ul li {
  margin-left: 30px;
}
.main-nav ul li a {
  color: var(--dark-color);
  font-weight: 500;
  white-space: nowrap;
  position: relative;
  padding: 5px 0;
}
.main-nav ul li a.active,
.main-nav ul li a:hover {
  color: var(--primary-color);
}
.main-nav ul li a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary-color);
  transition: width 0.3s ease;
}
.main-nav ul li a:hover::after,
.main-nav ul li a.active::after {
  width: 100%;
}
.mobile-nav-toggle {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 1001;
}

/* --- Footer --- */
.footer {
  background: var(--dark-color);
  color: #ccc;
  padding: 60px 0 0;
  margin-top: 100px;
}
.footer .container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 40px;
}
.footer h3 {
  color: var(--primary-color);
  font-size: 1.5rem;
}
.footer h4 {
  color: #fff;
  margin-bottom: 20px;
}
.footer-logo {
  display: block;
  width: 222px;
  margin-bottom: 15px;
}
.footer-logo img {
  width: 100%;
  height: auto;
}
.footer-col ul li {
  margin-bottom: 12px;
}
.footer-col ul li a:hover {
  color: #fff;
  padding-left: 5px;
}
.footer .social-links a {
  display: inline-flex;
  height: 40px;
  width: 40px;
  background: rgba(255, 255, 255, 0.1);
  margin-right: 10px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  transition: all 0.3s ease;
}
.footer .social-links a:hover {
  background-color: var(--primary-color);
  transform: translateY(-3px);
}
.copyright {
  text-align: center;
  padding: 25px;
  margin-top: 40px;
  border-top: 1px solid #444;
  font-size: 0.9rem;
}

/* --- Breadcrumb --- */
.breadcrumb {
  background-color: var(--light-color);
  padding: 6px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
  width: 100%;
  display: flex !important;
}
.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  align-items: center;
}
.breadcrumb li {
  display: flex;
  align-items: center;
  white-space: nowrap;
}
.breadcrumb li:not(:first-child)::before {
  content: "›";
  margin: 0 8px;
  color: #999;
}
.breadcrumb li a {
  color: var(--primary-color);
}
.breadcrumb li a:hover {
  text-decoration: underline;
}
.breadcrumb li:first-child a::before {
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  content: "\f015";
  margin-right: 5px;
  font-size: 0.85rem;
}
.breadcrumb li.active {
  color: var(--dark-color);
  font-weight: 500;
}
.breadcrumb li.ellipsis {
  color: #999;
  padding: 0 5px;
}
.breadcrumb li a.icon-only::before {
  margin-right: 0;
  font-size: 1.1rem;
}

/* --- Cards (University, Subject, Teacher) --- */
.university-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
}
.university-card {
  display: flex;
  flex-direction: column;
  text-align: center;
  background: #fff;
  border-radius: var(--border-radius);
  padding: 25px;
  box-shadow: var(--box-shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  border: 1px solid var(--border-color);
  color: inherit;
  position: relative;
  overflow: hidden;
}
.university-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(74, 144, 226, 0.2);
  border-color: var(--primary-color);
}
.university-logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
  margin: 0 auto 20px;
  border-radius: 50%;
  flex-shrink: 0;
  background-color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
  padding: 5px;
}
.university-info {
  flex-grow: 1;
  overflow: hidden;
}
.university-info h3 {
  font-size: 1.1rem;
  line-height: 1.4;
  margin-bottom: 8px;
  min-height: 45px;
  color: var(--dark-color);
  white-space: normal;
}
.university-info p {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-color);
  background-color: var(--light-color);
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
}
.university-card::after {
  content: "Xem tài liệu →";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: var(--primary-color);
  color: #fff;
  padding: 12px;
  font-weight: 500;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}
.university-card:hover::after {
  transform: translateY(0);
}
.subject-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.subject-card {
  display: block;
  background: #fff;
  padding: 25px;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  color: var(--dark-color);
  border: 1px solid var(--border-color);
}
.subject-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 123, 255, 0.15);
  border-color: var(--primary-color);
}
.subject-card i {
  font-size: 2.5rem;
  color: var(--primary-color);
  margin-bottom: 15px;
}
.subject-card h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}
.subject-card .subject-code {
  font-size: 0.9rem;
  color: var(--primary-color);
  font-weight: 600;
}
.teacher-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 25px;
}
.teacher-card {
  display: block;
  background: #fff;
  padding: 25px;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  color: var(--dark-color);
  border: 1px solid var(--border-color);
}
.teacher-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(74, 144, 226, 0.2);
  border-color: var(--primary-color);
}
.teacher-card h3 {
  font-size: 1.2rem;
  margin-bottom: 10px;
  color: var(--dark-color);
}
.teacher-card .teacher-action {
  color: var(--primary-color);
  font-weight: 600;
}
.teacher-card:hover .teacher-action {
  text-decoration: underline;
}

/* --- Search & Filters --- */
.filter-bar {
  padding: 25px 0;
  background-color: var(--light-color);
  border-bottom: 1px solid var(--border-color);
}
.filter-bar .container {
  max-width: 700px;
}
.filter-bar input {
  width: 100%;
  font-size: 1.05rem;
  padding: 15px 20px 15px 50px;
  border-radius: 50px;
  border: 1px solid var(--border-color);
  box-shadow: none;
  transition: all 0.3s ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23888' class='bi bi-search' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 18px center;
  background-size: 18px;
}
.filter-bar input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}
.search-wrapper {
  position: relative;
  max-width: 650px;
  margin: 0 auto;
}
.search-bar {
  display: flex;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  border-radius: 50px;
}
.search-bar input {
  width: 100%;
  padding: 18px 25px;
  border: none;
  border-radius: 50px 0 0 50px;
  font-size: 1rem;
  font-family: var(--font-family);
}
.search-bar input:focus {
  outline: none;
}
.search-bar button {
  padding: 0 30px;
  border: none;
  background: var(--accent-color);
  color: #fff;
  cursor: pointer;
  border-radius: 0 50px 50px 0;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  transition: background-color 0.3s ease;
}
.search-bar button:hover {
  background: var(--accent-dark);
}
#search-suggestions {
  display: none;
  position: absolute;
  top: calc(100% - 10px);
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 0 0 var(--border-radius) var(--border-radius);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
  z-index: 10;
  padding-top: 15px;
  max-height: 350px;
  overflow-y: auto;
}
.suggestion-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  color: var(--text-color);
  text-decoration: none;
  transition: background-color 0.2s ease;
  text-align: left;
}
.suggestion-item:hover {
  background-color: var(--light-color);
  color: var(--primary-color);
}
.suggestion-icon {
  font-size: 1.5rem;
  margin-right: 15px;
  width: 25px;
  text-align: center;
  color: #6e6e6e;
}
.suggestion-icon.fa-file-powerpoint {
  color: #d24726;
}
.suggestion-icon.fa-file-pdf {
  color: #d93025;
}
.suggestion-icon.fa-file-word {
  color: #4285f4;
}
.suggestion-icon.fa-video {
  color: red;
}
.suggestion-icon.fa-atlas {
  color: #34a853;
}
.suggestion-icon.fa-book {
  color: var(--accent-color);
}
.suggestion-title {
  display: block;
  font-weight: 500;
  color: var(--dark-color);
}
.suggestion-path {
  display: block;
  font-size: 0.85rem;
  color: #888;
  margin-top: 2px;
}

/* --- Popups & Modals --- */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 1010;
  display: none;
  justify-content: center;
  align-items: center;
}
.popup-overlay.active {
  display: flex;
}
.popup-content {
  background-color: #fff;
  padding: 30px 40px;
  border-radius: 16px;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
  text-align: center;
  max-width: 400px;
  position: relative;
  transform: scale(0.9);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}
.popup-overlay.active .popup-content {
  transform: scale(1);
  opacity: 1;
}
.popup-content img {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 50%;
  margin-bottom: 20px;
  border: 3px solid var(--primary-color);
}
.popup-content h3 {
  font-size: 1.8rem;
  color: var(--dark-color);
  margin: 0;
}
.popup-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  font-size: 2rem;
  color: #aaa;
  cursor: pointer;
  transition: color 0.3s ease;
}
.popup-close:hover {
  color: var(--dark-color);
}
.form-fields input.input-error,
.form-fields textarea.input-error {
  border-color: #d93025 !important;
  background-color: #fde2e2;
}
.error-message {
  color: #d93025;
  font-size: 0.875rem;
  text-align: left;
  margin-top: -5px;
  margin-bottom: 10px;
  display: none;
}
.error-message.active {
  display: block;
}

/* ===================================================================
   5. PAGE-SPECIFIC SECTIONS
   =================================================================== */

/* --- Page Headers (Hero, University, etc.) --- */
.page-header {
  background-color: var(--primary-color);
  color: #fff;
  text-align: center;
  padding: 50px 0;
}
.page-header h1 {
  color: #fff;
}
.hero-section {
  background: url(/assets/images/anh_bia_lon.webp) center center/cover no-repeat;
  color: #fff;
  text-align: center;
  padding: 120px 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    rgba(0, 123, 255, 0.85),
    rgba(0, 86, 179, 0.95)
  );
}
.hero-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
  margin: 0 auto;
}
.hero-section h1 {
  color: #fff;
  font-size: clamp(2.4rem, 1.6rem + 4vw, 3.5rem);
}
.hero-section p {
  font-size: var(--font-size-large);
  margin-bottom: 40px;
  opacity: 0.9;
}
.hero-cta {
  margin-top: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
}
.hero-cta span {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
}
.university-hero {
  background: var(--light-color);
  padding: 40px 0;
  border-bottom: 1px solid var(--border-color);
}
.university-hero .container {
  display: flex;
  align-items: center;
  gap: 30px;
}
.university-hero-logo {
  width: 100px;
  height: 100px;
  object-fit: contain;
  flex-shrink: 0;
}
.university-hero-info h1 {
  font-size: 2.2rem;
  margin-bottom: 10px;
}
.university-hero-info p {
  font-size: 1.1rem;
  color: var(--text-color);
}
.subject-hero-icon {
  font-size: 4rem;
  color: var(--primary-color);
  margin-left: 0px;
}

/* --- Features Section --- */
.features-section {
  padding: 100px 0;
}
.features-section .container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 40px;
  text-align: center;
}
.feature-icon {
  display: inline-flex;
  width: 80px;
  height: 80px;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-color), #00a9ff);
  border-radius: 50%;
  color: #fff;
  font-size: 2.5rem;
  margin-bottom: 25px;
  box-shadow: 0 5px 15px rgba(0, 123, 255, 0.3);
}
.feature-item h3 {
  margin-bottom: 10px;
}

/* --- Document Bento Grid Section --- */
.documents-section {
  padding: 80px 0;
  background: var(--light-color);
}
.document-bento-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: minmax(230px, auto);
  gap: 25px;
}
.document-card {
  background: #fff;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  padding: 25px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid var(--border-color);
  color: var(--text-color);
  display: flex;
}
.document-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}
.document-card.card-large {
  grid-row: span 2;
}
.document-card-content {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 100%;
}
.document-icon {
  font-size: 2.5rem;
  margin-bottom: 15px;
  width: 45px;
}
.document-icon.pdf {
  color: #d93025;
}
.document-icon.ppt {
  color: #f29900;
}
.document-icon.doc {
  color: #4285f4;
}
.document-info h3 {
  font-size: 1.1rem;
  margin-bottom: 5px;
}
.document-info p {
  font-size: 0.9rem;
  color: #777;
  margin-bottom: 10px;
}
.tag {
  display: inline-block;
  background-color: #eaf2ff;
  color: var(--primary-color);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}
.document-stats {
  margin-top: auto;
  padding-top: 15px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 20px;
  font-size: 0.9rem;
  color: #777;
}
.view-all-link {
  text-align: center;
  margin-top: 40px;
}
.view-all-link .btn-secondary i {
  margin-left: 5px;
  transition: transform 0.3s ease;
}
.view-all-link .btn-secondary:hover i {
  transform: translateX(5px);
}

/* --- Upload Section --- */
.upload-section {
  padding: 100px 0;
  text-align: center;
}
#upload-section .container {
  max-width: 700px;
}
.upload-section h2 {
  color: var(--dark-color);
}
.upload-section > .container > p {
  margin-bottom: 30px;
}
.upload-box {
  border: 3px dashed var(--border-color);
  border-radius: 20px;
  padding: 50px;
  background: var(--light-color);
  transition: border-color 0.3s ease, background-color 0.3s ease;
}
.upload-box:hover {
  border-color: var(--primary-color);
  background-color: #f1f7ff;
}
.upload-box i {
  font-size: 4rem;
  color: var(--primary-color);
  margin-bottom: 20px;
}
.upload-box p {
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--dark-color);
  margin-bottom: 10px;
}
.upload-box span {
  display: block;
  margin-bottom: 30px;
  font-size: 0.9rem;
}
.upload-box .btn-primary {
  padding: 15px 35px;
}
.form-fields input[type="text"],
.form-fields textarea {
  width: 100%;
  padding: 12px;
  margin-bottom: 10px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  font-size: 1rem;
  font-family: var(--font-family);
}
.form-fields textarea {
  resize: vertical;
}

/* --- Updating Section --- */
.updating-section {
  margin-top: 60px !important;
  text-align: center;
  background-color: var(--light-color) !important;
  border: 2px dashed var(--border-color) !important;
  border-radius: var(--border-radius) !important;
  padding: 40px !important;
  transition: all 0.3s ease;
}
.updating-section:hover {
  border-color: var(--primary-color);
  background-color: #f1f7ff !important;
}
.updating-section i {
  color: var(--primary-color);
}

/* --- Document & Video Viewers --- */
.document-viewer-section {
  padding: 0.5rem 0.25rem; /* Giảm padding để tối đa không gian cho viewer */
  max-width: 100%;
}
.document-viewer {
  max-width: var(--viewer-max-width);
  margin: 0 auto;
  background: #fff;
  padding: 14px 18px;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 4px 16px -4px rgba(0, 0, 0, 0.1);
  height: calc(100vh - var(--header-height) - var(--breadcrumb-height) - 28px);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: max-width 0.25s ease, height 0.3s ease;
}
body:not(.has-fixed-breadcrumb) .document-viewer {
  height: calc(100vh - var(--header-height) - 28px);
}
.header.scrolled ~ main .document-viewer {
  height: calc(100vh - 60px - var(--breadcrumb-height) - 28px);
}
.header.scrolled ~ main body:not(.has-fixed-breadcrumb) .document-viewer {
  height: calc(100vh - 60px - 28px);
}
.document-viewer iframe {
  width: 100% !important;
  height: 100% !important;
  border: 0;
  border-radius: 8px;
  background: #fff;
}
body.viewer-narrow .document-viewer {
  max-width: 820px;
}
body.viewer-extra-narrow .document-viewer {
  max-width: 720px;
}
body.viewer-wide .document-viewer {
  max-width: 1180px;
}
.iframe-aspect-ratio-wrapper {
  position: relative;
  width: 100%;
  height: 0;
  padding-top: 75%;
  background-color: var(--light-color);
  border-radius: var(--border-radius);
  overflow: hidden;
}
.iframe-aspect-ratio-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.presentation-container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  box-sizing: border-box;
}
.presentation-wrapper {
  position: relative;
  width: 100%;
  height: 0;
  padding-top: 56.25%;
  background-color: var(--light-color);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--box-shadow);
  transition: padding-top 0.3s ease;
}
.presentation-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.document-note {
  display: flex;
  align-items: center;
  padding: 10px 20px 10px 50px;
  font-size: 0.95rem;
  color: var(--text-color);
  background-color: #f0f5ff;
  border-left: 4px solid var(--primary-color);
  margin: 10px 0;
}
.document-note i {
  margin-right: 12px;
  color: var(--primary-color);
}
.document-a4-viewer-container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
  box-sizing: border-box;
}
.document-a4-page-wrapper {
  position: relative;
  width: 100%;
  height: 0;
  padding-top: 141.4%;
  background-color: #fff;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 40px;
}
.document-a4-page-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.document-part-header,
.video-part-header {
  font-size: 1.5rem;
  font-weight: 600;
  text-align: center;
  color: var(--dark-color);
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}
.video-viewer-container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  box-sizing: border-box;
}
.video-viewer-container .video-aspect-ratio-wrapper {
  margin-bottom: 40px;
}

/* --- Document List --- */
.teachers-list,
.document-list-container {
  padding: 40px 0 80px;
}
.document-section {
  background-color: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  margin-bottom: 20px;
  overflow: hidden;
}
.section-header {
  display: flex;
  align-items: center;
  padding: 15px 20px;
  cursor: pointer;
  background-color: var(--light-color);
}
.section-header:hover {
  background-color: #e9e9e9;
}
.section-header h3 {
  margin: 0;
  font-size: 1.2rem;
}
.section-header i {
  font-size: 1rem;
  margin-right: 15px;
  transition: transform 0.3s ease;
  transform: rotate(-90deg);
}
.document-section.active .section-header i {
  transform: rotate(0deg);
}
.section-content {
  padding: 10px 0;
  display: none;
}
.document-section.active .section-content {
  display: block;
}
.document-item {
  display: flex;
  align-items: center;
  padding: 12px 20px 12px 50px;
  color: var(--dark-color);
  font-size: 1rem;
  transition: all 0.3s ease;
}
a.document-item:hover {
  background-color: #f5f5f5;
  color: var(--primary-color);
}
.document-item i {
  font-size: 20px;
  margin-right: 12px;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}
.document-item:hover i {
  transform: scale(1.1);
}
.document-item .meta-info {
  margin-left: auto;
  font-size: 0.9rem;
  color: var(--text-color);
  background-color: var(--light-color);
  padding: 3px 8px;
  border-radius: 4px;
}
.section-content .sub-heading {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-color);
  padding: 15px 20px 5px 50px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* --- Author Respect Card --- */
.author-respect {
  margin: 24px auto 16px;
  max-width: 900px;
  padding: 16px 18px;
  border-radius: 14px;
  background: linear-gradient(
    180deg,
    rgba(13, 110, 253, 0.08),
    rgba(13, 110, 253, 0.04)
  );
  border: 1px solid rgba(13, 110, 253, 0.15);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}
.respect-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.respect-card i {
  font-size: 1.8rem;
  color: var(--primary-color);
  flex-shrink: 0;
  margin-top: 4px;
}
.respect-text p {
  margin: 0;
  color: #333;
  line-height: 1.6;
}
.respect-text a {
  color: var(--primary-color);
  text-decoration: underline;
}
.respect-text a:hover {
  color: var(--primary-dark);
}

/* ===================================================================
   7. ANIMATIONS & TRANSITIONS
   =================================================================== */
main {
  opacity: 0;
}
.content-is-entering {
  animation: slideInUp 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.content-is-exiting {
  animation: slideOutUp 0.15s cubic-bezier(0.7, 0, 0.84, 0) forwards;
}
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes slideOutUp {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}
@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: 0 0;
  }
}

/* ===================================================================
   8. RESPONSIVE MEDIA QUERIES
   =================================================================== */

/* --- Large Desktops (min-width: 1167px) --- */
@media (min-width: 1167px) {
  .presentation-wrapper {
    max-height: calc(
      100vh - var(--header-height) - var(--breadcrumb-height) - 40px
    );
  }
}

/* --- Laptops & Small Desktops (min-width: 1024px) --- */
@media (min-width: 1024px) {
  .university-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .subject-grid {
    grid-template-columns: repeat(5, 1fr);
  }
  .teacher-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .university-hero-logo {
    margin-left: 0px;
  }
}

/* --- Tablets & Small Desktops (min-width: 767px) and (max-width: 1166px) --- */
@media (min-width: 767px) and (max-width: 1166px) {
  .presentation-wrapper {
    padding-top: 75%;
    max-height: 720px;
  }
}

/* --- Tablets (min-width: 768px and max-width: 1023px) --- */
@media (min-width: 768px) and (max-width: 1023px) {
  .subject-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .teacher-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* --- Mobile & General Tablet Adjustments (max-width: 1100px) --- */
@media (max-width: 1100px) {
  .document-viewer {
    max-width: 95%;
    padding: 12px 14px;
  }
}

/* --- General Mobile & Tablet (max-width: 1024px) --- */
@media (max-width: 1024px) {
  html {
    font-size: 90%;
  }
  .container {
    padding: 0 15px;
  }
  .header {
    --header-height: 65px;
  }
  .hero-content p {
    font-size: 1.1rem;
  }
  .hero-cta {
    flex-direction: column;
    gap: 20px;
  }
  .features-section .container {
    grid-template-columns: 1fr;
    gap: 30px;
  }
  .features-section,
  .documents-section,
  .upload-section {
    padding: 60px 0;
  }
  .upload-box {
    padding: 30px 20px;
  }
  .page-header h1 {
    font-size: 2rem;
    line-height: 1.2;
  }
  .page-header p {
    font-size: 1rem;
  }
  .region-title,
  .faculty-title,
  .section-title {
    font-size: 1.5rem;
    margin-bottom: 20px;
  }
  .university-hero {
    padding: 20px 0;
  }
  .university-hero .container {
    gap: 15px;
  }
  .university-hero-logo {
    width: 60px;
    height: 60px;
  }
  .university-hero-info {
    overflow: hidden;
  }
  .university-hero-info h1 {
    font-size: 1.25rem;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .university-hero-info p {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9rem;
    margin-top: 4px;
  }
  .university-info h3 {
    min-height: auto;
  }
  .mobile-nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    padding: 0;
  }
  .mobile-nav-toggle span {
    width: 100%;
    height: 3px;
    background: var(--dark-color);
    border-radius: 5px;
    transition: all 0.3s ease-in-out;
  }
  .main-nav {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: #fff;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(-10px);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s;
  }
  .main-nav ul {
    flex-direction: column;
  }
  .main-nav ul li {
    margin: 0 !important;
    width: 100%;
  }
  .main-nav ul li a {
    display: block;
    padding: 15px 20px;
    font-size: 1rem;
    border-bottom: 1px solid var(--border-color);
    width: 100%;
    text-align: center;
  }
  .main-nav ul li:last-child a {
    border-bottom: none;
  }
  .main-nav ul li a::after {
    display: none;
  }
  .header.mobile-nav-open .main-nav {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }
  .header.mobile-nav-open .mobile-nav-toggle span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }
  .header.mobile-nav-open .mobile-nav-toggle span:nth-child(2) {
    opacity: 0;
  }
  .header.mobile-nav-open .mobile-nav-toggle span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
  }
  .video-player-container {
    gap: 16px;
  }
  .presentation-container,
  .video-viewer-container,
  .document-a4-viewer-container {
    padding: 0 10px;
  }
  .presentation-wrapper {
    padding-top: 120%;
  }
  .document-a4-page-wrapper {
    border: none;
    box-shadow: none;
    border-radius: 0;
  }
  .document-viewer-section {
    padding: 0.5rem 0;
  }

  /* Khi ở chế độ 2 trang trên mobile, chuyển layout sang chiều dọc */
  #pdf-viewer:not(.single-page-view) #canvas-container {
    flex-direction: column; /* Xếp chồng các slide lên nhau */
  }
  /* Khi ở chế độ 2 trang trên mobile, mỗi slide chiếm 100% chiều rộng */
  #pdf-viewer:not(.single-page-view) #pdf-canvas-left,
  #pdf-viewer:not(.single-page-view) #pdf-canvas-right {
    width: 100%; /* Cho mỗi slide rộng ra toàn màn hình */
  }
}

/* --- Small Mobiles (max-width: 640px) --- */
@media (max-width: 640px) {
  .document-viewer {
    padding: 10px 12px;
    border-radius: 10px;
  }
}

/* --- Small Mobiles (max-width: 480px) --- */
@media (max-width: 480px) {
  h1,
  .hero-section h1 {
    font-size: 2rem;
  }
  .btn {
    padding: 12px 20px;
    font-size: 0.95rem;
  }
  .search-bar button {
    padding: 0 25px;
  }
}

/* /style.css */

/* ===================================================================
   9. CUSTOM PDF VIEWER (Bản tăng tốc)
   =================================================================== */
#pdf-viewer {
  position: relative;
  width: 100%;
  max-width: 1800px;
  margin: 0 auto;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.1);
  background-color: #f0f0f0;
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
  overflow: hidden;
  /* ✅ TĂNG TỐC: Giảm thời gian từ 0.65s xuống 0.4s */
  transition: max-width 0.4s cubic-bezier(0.65, 0, 0.35, 1);
}

/* Khi ở chế độ xem 1 trang, thu hẹp lại kích thước viewer */
#pdf-viewer.single-page-view {
  max-width: 1100px;
}

#canvas-container {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 12px;
  align-items: flex-start;
  /* ✅ TĂNG TỐC: Giảm thời gian từ 0.15s xuống 0.075s */
  transition: opacity 0.075s ease-in-out;
  will-change: opacity;
}

#pdf-viewer.single-page-view #canvas-container {
  gap: 0;
}

#pdf-canvas-left,
#pdf-canvas-right {
  width: 50%;
  height: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  flex-shrink: 0;
  /* ✅ TĂNG TỐC: Giảm thời gian từ 0.65s/0.5s xuống 0.4s/0.3s */
  transition: width 0.4s cubic-bezier(0.65, 0, 0.35, 1),
    opacity 0.3s cubic-bezier(0.65, 0, 0.35, 1),
    transform 0.4s cubic-bezier(0.65, 0, 0.35, 1);
}

/* Chuyển sang chế độ 1 trang */
#pdf-viewer.single-page-view #pdf-canvas-left {
  width: 100%;
}

#pdf-viewer.single-page-view #pdf-canvas-right {
  width: 0;
  opacity: 0;
  transform: translateX(20%) scale(0.95);
  pointer-events: none;
}

/* === PHẦN NÚT ĐIỀU KHIỂN (Giữ nguyên) === */
#pdf-controls {
  position: absolute;
  bottom: 20px;
  left: 50%;
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  background-color: rgba(33, 37, 41, 0.75);
  backdrop-filter: blur(8px);
  padding: 8px 15px;
  border-radius: 50px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 20px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hiện các nút khi di chuột vào khung viewer */
#pdf-viewer:hover #pdf-controls {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

#page-indicator {
  font-weight: 600;
  font-size: 0.9rem;
  color: #fff;
  white-space: nowrap;
}

#pdf-controls .btn {
  background-color: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.5);
  padding: 6px 16px;
  font-size: 0.9rem;
  white-space: nowrap;
  transition: all 0.2s ease;
}

#pdf-controls .btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
  border-color: #fff;
  color: #fff;
  transform: translateY(-2px);
}

#view-toggle-btn {
  padding: 6px 12px;
}

.protection-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  background-color: transparent;
  cursor: default;
}

#canvas-container.pdf-page-transitioning {
  opacity: 0;
}

/* ===================================================================
   10. LOADING OVERLAY
   =================================================================== */
#loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(248, 249, 250, 0.95);
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: opacity 0.3s ease, visibility 0.3s;
  color: var(--text-color);
  border-radius: var(--border-radius);
}
#loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
}
#loading-text {
  font-size: 1.1rem;
  font-weight: 500;
  margin-top: 20px;
}
#loading-progress {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-top: 8px;
}
.loading-spinner {
  width: 50px;
  height: 50px;
  border: 5px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
/* ===================================================================
   PHẦN THÊM VÀO: HIỆU ỨNG CHUYỂN TRANG MƯỢT MÀ
   =================================================================== */

#canvas-container {
  /* Yêu cầu trình duyệt chuyển động mượt mà các thay đổi về độ mờ */
  transition: opacity 0.15s ease-in-out;

  /* Gợi ý cho trình duyệt để tối ưu hiệu năng animation */
  will-change: opacity;
}

/* Đây là lớp CSS chúng ta sẽ dùng JavaScript để kích hoạt.
  Nó sẽ làm cho toàn bộ khu vực chứa slide trở nên trong suốt.
*/
#canvas-container.pdf-page-transitioning {
  opacity: 0;
}
