/* Extracted styles from library.twig */

/* ===== PDF lock + save modal ===== */
.locked-page {
  position: relative;
  filter: blur(5px);
  pointer-events: none;
  user-select: none;
}

.locked-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 22px;
  font-weight: bold;
  color: var(--text-primary);
  z-index: 100;
}

.save-to-view-overlay-backdrop {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background: rgba(0, 0, 0, 0.75) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 8px !important;
  z-index: 100 !important;
  pointer-events: auto !important;
}

.save-to-view-modal {
  position: relative !important;
  z-index: 10001 !important;
  background: #fff !important;
  padding: 36px 28px 32px !important;
  border-radius: 22px !important;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.14),
    0 8px 16px rgba(15, 23, 42, 0.06) !important;
  width: 90% !important;
  max-width: min(420px, 90vw) !important;
  text-align: center !important;
  filter: none !important;
  pointer-events: auto !important;
  margin: 20px !important;
  border: 1px solid rgba(226, 232, 240, 0.9) !important;
}

.save-to-view-modal h3 {
  font-size: 18px !important;
  font-weight: 800 !important;
  color: #111418 !important;
  margin-bottom: 8px !important;
  margin-top: 0 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em !important;
  line-height: 1.35 !important;
}

.save-to-view-modal p {
  font-size: 14px !important;
  color: #6b7280 !important;
  margin-bottom: 24px !important;
  padding: 0 16px !important;
  line-height: 1.6 !important;
}

.btn-save-document {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%) !important;
  color: #fff !important;
  border: none !important;
  padding: 14px 28px !important;
  border-radius: 999px !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.35) !important;
  transition: all 0.3s !important;
  width: 100% !important;
  max-width: 280px !important;
  margin: 0 auto !important;
  display: block !important;
}

.btn-save-document:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 12px 20px -3px rgba(13, 127, 242, 0.3),
    0 6px 8px -2px rgba(13, 127, 242, 0.2) !important;
}

.btn-save-document:active {
  transform: translateY(0) !important;
}

.pdf-page {
  margin: 0 auto 32px;
  position: relative;
  width: fit-content;
  background: #fff;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  border-radius: 8px;
  overflow: hidden;
}

.pdf-page canvas {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: auto;
}

.pdf-page .save-to-view-overlay-backdrop {
  overflow: visible;
}

.pdf-page:last-child {
  margin-bottom: 0;
}

.pdf-page-placeholder {
  margin: 0 auto 32px;
  position: relative;
  width: 100%;
  max-width: 800px;
  background: #fff;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  border-radius: 8px;
}

.pdf-page-placeholder:last-child {
  margin-bottom: 0;
}

#pdf-viewer {
  will-change: scroll-position;
}

/* Khung ngoài trang chi tiết tài liệu (nền xám nhạt tổng thể) */
.lib-doc-viewer-card {
  background: #f1f3f7;
  border-radius: 28px;
  padding: 24px 28px;
  border: 1px solid #e2e6ee;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 8px 32px rgba(15, 23, 42, 0.06);
}
/* Vùng xám đậm = mặt đọc tài liệu (PDF canvas nằm trong đây) */
#main-content .lib-pdf-viewer-host#pdf-viewer,
.lib-pdf-document-surface#pdf-viewer {
  position: relative;
  height: auto !important;
  min-height: 650px;
  max-height: min(78vh, 960px);
  overflow-y: auto !important;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  width: 100%;
  margin-left: auto !important;
  margin-right: auto !important;
  padding: 20px 18px 28px !important;
  border-radius: 38px;
  border: 7px solid var(--line-gradient-02, #FFF);
  background: #D5D5D5;
  box-shadow: 0 2px 20px 0 #B6B6B6 inset;
}

#main-content .lib-pdf-viewer-host#pdf-viewer::-webkit-scrollbar,
.lib-pdf-document-surface#pdf-viewer::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.lib-pdf-preview-wrap {
  overflow: visible;
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 14px;
  /* Chừa chỗ cho nửa thanh công cụ thò ra dưới mép #pdf-viewer (responsive theo viewport) */
  padding-bottom: clamp(26px, 5vmin, 48px);
}

/* Cột khung PDF + overlay giới hạn (chiếm phần còn lại) */
.lib-pdf-viewer-stack {
  flex: 1;
  min-width: 0;
  position: relative;
}

/* Khung máy đọc: xám nhạt, bo lớn */
.lib-pdf-viewer-frame {
  position: relative;
  border-radius: 24px;
  background: #eef1f6;
  border: 1px solid #dde3ec;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
  padding: 18px 22px 76px;
}

.lib-pdf-viewer-chrome {
  position: relative;
  padding-right: 0;
  overflow: visible;
}

/* Ba nút pill — ngoài khung xem, xếp dọc (mockup)
   z-index > .save-to-view-overlay-backdrop / .locked-overlay (100) để không bị modal khóa trang đè */
.lib-pdf-right-tabs {
  position: absolute;
  left: 100%;
  top: 20%;
  z-index: 120;
  flex-shrink: 0;
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 4px 0;
}

.lib-pdf-side-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 0 30px 30px 0;
  border: 2px solid var(--line-gradient-01, #fff);
  background: var(
    --blue-gradient-01,
    linear-gradient(90deg, #316dd3 0%, #1eb8ff 141.2%)
  );
  box-shadow: 0 -2px 2px 0 rgba(255, 255, 255, 0.25) inset,
    0 4px 8px 0 #fff inset, 0 4px 4px 0 rgba(74, 183, 255, 0.35);
  backdrop-filter: blur(3px);
  padding: 10px 20px;

  color: #FFF;
font-family: Lexend;
font-size: 14px;
font-style: normal;
font-weight: 700;
  line-height: normal;
}

/* Giữ glass + glow như .lib-pdf-side-tab; bóng ngoài đẩy sang phải để mép trái (dính khung PDF) gần như không có glow */
.lib-pdf-side-tab.annotation-btn {
  border-left: none;
  box-shadow: 0 -2px 2px 0 rgba(255, 255, 255, 0.25) inset,
    0 4px 8px 0 #fff inset,
    4px 4px 8px 0 rgba(74, 183, 255, 0.32),
    6px 0 12px -4px rgba(74, 183, 255, 0.22);
}

/* .lib-pdf-side-tab:hover {
  filter: brightness(1.05);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.lib-pdf-side-tab.annotation-btn.active {
  background: linear-gradient(180deg, #1d4ed8 0%, #1e40af 100%);
  box-shadow: 0 10px 26px rgba(30, 64, 175, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
} */

.lib-pdf-side-tab__ico {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Nút Highlight + panel chọn màu (picker ngoài <button> — HTML hợp lệ) */
.lib-pdf-highlight-wrap {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  align-items: flex-start;
}

.lib-pdf-color-picker.color-picker-popup {
  position: absolute;
  right: calc(100% + 12px);
  top: 0;
  left: auto;
  margin: 0;
  z-index: 130;
  display: none;
  min-width: 200px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(226, 232, 240, 0.95);
  box-shadow: 0 -4px 4px 0 rgba(255, 255, 255, 0.25) inset,
    0 8px 16px 0 #fff inset, 0 8px 28px rgba(15, 23, 42, 0.12),
    0 4px 4px 0 rgba(74, 183, 255, 0.25);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.lib-pdf-color-picker.color-picker-popup.show {
  display: block;
}

.lib-pdf-color-picker .color-picker-title {
  color: #1f2937;
  font-weight: 700;
  margin-bottom: 12px;
}

/* Bottom glass pill — tâm thanh nằm trên mép dưới vùng đọc (#pdf-viewer): nửa trong / nửa ngoài */
.lib-pdf-bottom-bar {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 50%);
  z-index: 120;
  width: calc(100% - 48px);
  max-width: 920px;
  pointer-events: none;
  overflow: visible;
}

.lib-pdf-bottom-bar__pill {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px 14px;
  padding: 11px 20px;
  margin: 0 auto;
  width: fit-content;
  border-radius: 29px;
  background: rgba(255, 255, 255, 0.50);
  box-shadow: 0 -4px 4px 0 rgba(255, 255, 255, 0.25) inset, 0 8px 16px 0 #FFF inset, 0 4px 4px 0 rgba(74, 183, 255, 0.35);
  backdrop-filter: blur(3px);
  overflow: visible;
}

.lib-pdf-bottom-bar__pill .zoom-controls-toolbar,
.lib-pdf-bottom-bar__pill .page-counter-toolbar {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  padding: 0 !important;
  gap: 10px !important;
}

.lib-pdf-zoom-btn {
  color: #2563eb !important;
  background: rgba(37, 99, 235, 0.08) !important;
}

.lib-pdf-zoom-btn:hover {
  background: rgba(37, 99, 235, 0.16) !important;
}

.lib-pdf-zoom-level {
  color: #0f172a !important;
  font-weight: 700 !important;
  min-width: 52px !important;
}

.lib-pdf-page-counter {
  font-weight: 700 !important;
  font-size: 14px !important;
  color: #334155 !important;
  gap: 2px !important;
}

.lib-pdf-page-sep {
  margin: 0 2px;
  opacity: 0.7;
}

.lib-pdf-page-suffix {
  margin-left: 2px;
  font-weight: 600;
  color: #64748b;
}

/* Nút yêu thích (chưa thích: nền trắng + đổ bóng; đã thích: nền xanh + icon trắng) */
.lib-pdf-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: none;
  background: #fff;
  box-shadow: 0 3px 4px 0 rgba(133, 183, 217, 0.35);
  color: #5e5e5e;
  flex-shrink: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease,
    color 0.2s ease;
}

.lib-pdf-icon-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 10px 0 rgba(133, 183, 217, 0.45);
}

.lib-pdf-icon-btn.liked {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.lib-pdf-icon-btn.liked:hover {
  filter: brightness(1.06);
}

.lib-pdf-bar-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  border: none;
  flex-shrink: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  white-space: nowrap;
}

.lib-pdf-bar-btn__icon {
  flex-shrink: 0;
}

/* Tooltip glass khi hover nút Lưu / Tải xuống */
.lib-pdf-save-with-tooltip,
.lib-pdf-download-with-tooltip {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
}

.lib-pdf-save-tooltip,
.lib-pdf-download-tooltip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  z-index: 200;
  min-width: 240px;
  max-width: min(340px, 82vw);
  padding: 14px 18px;
  border-radius: 16px;
  background: white;
  box-shadow: 0 -4px 4px 0 rgba(255, 255, 255, 0.25) inset, 0 8px 16px 0 #fff inset, 0 4px 4px 0 rgba(74, 183, 255, 0.35);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  color: #374151;
  text-align: left;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.lib-pdf-save-with-tooltip:hover .lib-pdf-save-tooltip,
.lib-pdf-download-with-tooltip:hover .lib-pdf-download-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.lib-pdf-save-with-tooltip:has(#btn-save-library.saved) .lib-pdf-save-tooltip {
  display: none !important;
}

@media (hover: none), (max-width: 991px) {
  .lib-pdf-save-tooltip,
  .lib-pdf-download-tooltip {
    display: none;
  }
}

/* Lưu — chưa lưu: giống nút tim (chưa thích) / chia sẻ; đã lưu: nền xanh + chữ trắng */
#btn-save-library.lib-pdf-bar-btn--save.unsaved {
  border-radius: 10px !important;
  background: #fff !important;
  color: #5e5e5e !important;
  box-shadow: 0 3px 4px 0 rgba(133, 183, 217, 0.35) !important;
}

#btn-save-library.lib-pdf-bar-btn--save.unsaved:hover {
  filter: none;
  transform: scale(1.02);
  box-shadow: 0 4px 10px 0 rgba(133, 183, 217, 0.45) !important;
}

#btn-save-library.lib-pdf-bar-btn--save.saved {
  border-radius: 10px !important;
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%) !important;
  color: #fff !important;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
}

#btn-save-library.lib-pdf-bar-btn--save.saved:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

/* Chia sẻ: cùng phong cách nút yêu thích (nền trắng, bo 10px, bóng xanh nhạt, icon xám) */
#btn-share-library.lib-pdf-bar-btn--share {
  width: 40px;
  height: 40px;
  min-width: 40px;
  padding: 0;
  justify-content: center;
  gap: 0;
  border-radius: 10px !important;
  background: #fff !important;
  color: #5e5e5e !important;
  box-shadow: 0 3px 4px 0 rgba(133, 183, 217, 0.35) !important;
}

#btn-share-library.lib-pdf-bar-btn--share:hover {
  filter: none;
  transform: scale(1.05);
  box-shadow: 0 4px 10px 0 rgba(133, 183, 217, 0.45) !important;
}

/* Tải xuống — pill xanh, chữ/icon trắng (kế nút Lưu) */
#btn-download-library.lib-pdf-bar-btn--download {
  position: relative;
  gap: 8px;
  padding: 8px 20px 8px 16px;
  border-radius: 10px;
  border: none;
  background: var(--blue-gradient-01, linear-gradient(90deg, #316DD3 0%, #1EB8FF 141.2%));
  color: #fff !important;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

#btn-download-library.lib-pdf-bar-btn--download:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.4);
}

.lib-pdf-download-btn__hint {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.92;
  pointer-events: none;
  line-height: 0;
}

.lib-mobile-top-actions {
  display: none;
}

@media (max-width: 991px) {
  .breadcrumb-container {
    display: none !important;
  }

  .lib-mobile-top-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    margin-bottom: 12px;
  }

  .lib-mobile-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #316dd3;
    font-family: Lexend, system-ui, sans-serif;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
  }

  .lib-mobile-action-buttons {
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }

  .lib-mobile-circle-btn,
  .lib-mobile-download-btn {
    border: 1px solid rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 8px rgba(15, 23, 42, 0.08);
    color: #475569;
  }

  .lib-mobile-circle-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .lib-mobile-circle-btn.is-active {
    color: #2563eb;
    background: #eaf4ff;
    border-color: #cfe2ff;
  }

  .lib-mobile-download-btn {
    border-radius: 14px;
    height: 42px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #fff;
    background: linear-gradient(90deg, #316dd3 0%, #1eb8ff 141.2%);
    box-shadow: 0 4px 8px rgba(74, 183, 255, 0.35);
    font-family: Lexend, system-ui, sans-serif;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
  }

  .lib-mobile-download-btn span {
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
  }

  .lib-pdf-preview-wrap {
    flex-direction: column;
    gap: 0;
  }

  .lib-doc-viewer-card {
    padding: 16px 14px;
    border-radius: 22px;
  }

  .lib-pdf-viewer-frame {
    padding: 14px 14px 72px;
    border-radius: 20px;
  }

  #main-content .lib-pdf-viewer-host#pdf-viewer,
  .lib-pdf-document-surface#pdf-viewer {
    max-width: none;
    padding: 14px 10px 20px !important;
    border-radius: 14px;
  }

  .lib-pdf-viewer-chrome {
    padding-right: 0;
    padding-bottom: 0;
  }

  .lib-pdf-right-tabs {
    display: none;
  }

  .lib-pdf-side-tab {
    border-radius: 14px;
    min-width: 48px;
    padding: 8px 6px 10px;
  }

  .lib-pdf-side-tab__txt {
    max-height: 56px;
    font-size: 10px;
  }

  .lib-pdf-bottom-bar {
    width: calc(100% - 24px);
    left: 50%;
    bottom: 0;
    transform: translate(-50%, 50%);
  }

  .lib-pdf-bottom-bar__pill {
    padding: 8px 12px;
    gap: 8px 10px;
  }

  .lib-pdf-bottom-bar__pill #btn-favorite-library,
  .lib-pdf-bottom-bar__pill #btn-share-library,
  .lib-pdf-bottom-bar__pill .lib-pdf-save-with-tooltip,
  .lib-pdf-bottom-bar__pill .lib-pdf-download-with-tooltip {
    display: none !important;
  }

  .lib-pdf-bar-btn__text {
    display: none;
  }

  .lib-pdf-bar-btn {
    padding: 8px 12px;
  }

  #btn-share-library.lib-pdf-bar-btn--share {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    padding: 0 !important;
  }

  #btn-save-library.lib-pdf-bar-btn--save {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    padding: 0 !important;
    justify-content: center;
    gap: 0;
  }

  #btn-download-library.lib-pdf-bar-btn--download {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    padding: 0 !important;
    justify-content: center;
    gap: 0;
    border-radius: 10px !important;
  }

  .lib-pdf-download-btn__hint {
    display: none;
  }
}

/* ===== Library detail: feature cards (PDF sidebar) ===== */
.lib-detail-sidebar-features {
  align-self: flex-start;
}

@media (min-width: 992px) {
  .lib-detail-sidebar-features .lib-detail-feature-stack {
    position: sticky;
    top: 88px;
  }
}

.lib-detail-feature-card {
  border-radius: 18px;
  padding: 18px 18px 16px;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: 0 -4px 4px 0 rgba(255, 255, 255, 0.2) inset,
    0 8px 24px rgba(74, 183, 255, 0.12), 0 2px 8px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.lib-detail-feature-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 -4px 4px 0 rgba(255, 255, 255, 0.25) inset,
    0 12px 28px rgba(74, 183, 255, 0.18), 0 4px 12px rgba(15, 23, 42, 0.08);
}

.lib-detail-feature-card__icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  color: #0d9fbd;
  background: linear-gradient(
    135deg,
    rgba(13, 159, 189, 0.18),
    rgba(49, 109, 211, 0.12)
  );
}

.lib-detail-feature-card__title {
  font-size: 15px;
  font-weight: 700;
  color: #111418;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.lib-detail-feature-card__text {
  font-size: 13px;
  line-height: 1.55;
  color: #4b5563;
  margin: 0;
}

@media (max-width: 991px) {
  .lib-detail-sidebar-features .lib-detail-feature-stack {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 12px !important;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .lib-detail-sidebar-features .lib-detail-feature-card {
    flex: 0 0 min(280px, 85vw);
    min-height: 100%;
  }
}

@media (max-width: 576px) {
  .save-to-view-modal {
    padding: 24px 20px !important;
    max-width: 95% !important;
  }

  .save-to-view-modal h3 {
    font-size: 18px !important;
  }

  .save-to-view-modal p {
    font-size: 13px !important;
    padding: 0 !important;
  }

  .btn-save-document {
    padding: 10px 20px !important;
    font-size: 14px !important;
  }
}

/* ===== Share popup + limit popup ===== */
.share-popup-overlay {
  display: none;
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(0, 0, 0, 0.5) !important;
  z-index: 10000 !important;
  animation: fadeIn 0.3s ease;
  margin: 0 !important;
  padding: 0 !important;
}

.share-popup-overlay.active {
  display: block !important;
}

.share-popup {
  background: #fff;
  border: 1px solid #dce8f8;
  border-radius: 22px;
  padding: 26px 24px 22px;
  max-width: 430px;
  width: 90%;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.2);
  animation: slideDown 0.3s ease;
  position: fixed;
  z-index: 10001 !important;
}

.share-popup-overlay,
.share-popup-overlay * {
  pointer-events: auto;
}

body.share-popup-open {
  overflow: hidden !important;
  position: relative;
}

body.share-popup-open .share-popup-overlay {
  z-index: 10000 !important;
  position: fixed !important;
}

body.share-popup-open .share-popup {
  z-index: 10001 !important;
  position: fixed !important;
}

body.share-popup-open header,
body.share-popup-open .header,
body.share-popup-open nav {
  z-index: 9999 !important;
}

.share-popup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.share-popup-close:hover {
  background: #f8fafc;
  color: #475569;
}

.share-popup-title {
  text-align: center;
  font-family: Lexend;
  font-size: 32px;
  font-style: normal;
  font-weight: 700;
  line-height: normal;
  letter-spacing: -0.64px;
  text-transform: capitalize;
  color: var(--text-primary);
}

.share-options {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 14px;
}

.share-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 10px 8px;
  min-width: 98px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid #e2e8f0;
  flex: 1;
  border-radius: 16px;
  background: #F4F4F4;
}

.share-option:hover {
  background: var(--bg-card-hover);
  transform: translateY(-3px);
}

.share-option-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.share-option-icon svg {
  width: 28px;
  height: 28px;
}

.share-option-label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  text-align: center;
}

.share-facebook .share-option-icon { background: #1877f2; }
.share-zalo .share-option-icon { background: #0068ff; }
.share-twitter .share-option-icon { background: #1da1f2; }
.share-telegram .share-option-icon { background: #0088cc; }
.share-messenger .share-option-icon { background: #00b2ff; }
.share-whatsapp .share-option-icon { background: #25d366; }
.share-email .share-option-icon { background: #ea4335; }
.share-copy .share-option-icon { background: #6c757d; }

.share-copy-link {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 0;
}

.share-copy-link-label {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #64748b;
  text-align: center;
}

.share-copy-input-group {
  display: flex;
  gap: 10px;
}

.share-copy-input {
  flex: 1;
  padding: 11px 14px;
  border: 1px solid #d6e0ee;
  border-radius: 10px;
  font-size: 13px;
  color: #334155;
  background: #f8fafc;
}

.share-copy-button {
  padding: 11px 16px;
  background: #3b82f6;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  box-shadow: none;
}

.share-copy-button:hover {
  filter: brightness(1.04);
}

.share-copy-button.copied {
  background: #28a745;
}

.limit-popup-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9999;
  animation: fadeIn 0.3s ease;
}

.limit-popup-overlay.active {
  display: flex;
  justify-content: center;
  align-items: center;
}

.limit-popup {
  background: var(--bg-card-dark);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 40px 30px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 8px 32px var(--glass-shadow);
  animation: bounceIn 0.5s ease;
  text-align: center;
}

.limit-popup-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  background: var(--bg-card-hover);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse 2s infinite;
}

.limit-popup-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-light);
  margin-bottom: 15px;
}

.limit-popup-message {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 25px;
}

.limit-popup-btn {
  background: var(--primary-gradient);
  color: var(--text-primary);
  border: none;
  border-radius: 12px;
  padding: 14px 40px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 16px rgba(50, 159, 255, 0.3);
}

.limit-popup-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(50, 159, 255, 0.4);
}

.limit-popup-btn:active {
  transform: translateY(0);
}

.limit-popup--out-of-credits {
  position: relative;
  text-align: center;
  max-width: 690px;
  padding: 30px 30px 26px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid #e2f4ff;
  color: #2f2f2f;
  box-shadow: 0 -4px 4px 0 rgba(255, 255, 255, 0.25) inset, 0 8px 16px 0 #fff inset, 0 4px 4px 0 rgba(74, 183, 255, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.limit-popup--out-of-credits .limit-popup-title {
  margin: 0 0 10px;
  font-family: Lexend, system-ui, sans-serif;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.64px;
  text-transform: capitalize;
  background: linear-gradient(90deg, #316dd3 0%, #1eb8ff 141.2%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.limit-popup--out-of-credits .limit-popup-message {
  color: #2f2f2f;
  font-size: 15px;
  line-height: 1.5;
  font-weight: 500;
  margin: 0 0 14px;
  font-family: Lexend, system-ui, sans-serif;
}

.limit-popup-x {
  position: absolute;
  top: 14px;
  right: 14px;
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px;
  line-height: 0;
  border-radius: 8px;
}

.limit-popup-x:hover {
  color: #475569;
  background: #f1f5f9;
}

.download-limit-share-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: stretch;
  opacity: 0.8;
}

.download-limit-link-input {
  flex: 1;
  min-width: 360px;
  max-width: 520px;
  padding: 14px 30px;
  border-radius: 19px;
  border: none;
  background: #fff;
  font-size: 15px;
  color: #2f2f2f;
  letter-spacing: -0.15px;
  font-family: Lexend, system-ui, sans-serif;
  text-align: left;
}

.download-limit-copy-btn {
  flex-shrink: 0;
  padding: 14px 30px;
  border-radius: 19px;
  border: none;
  background: linear-gradient(90deg, #316dd3 0%, #1eb8ff 141.2%);
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  line-height: normal;
  letter-spacing: -0.17px;
  cursor: pointer;
  white-space: nowrap;
  font-family: Lexend, system-ui, sans-serif;
  box-shadow: 0 4px 4px rgba(74, 183, 255, 0.35);
}

.download-limit-copy-btn:hover {
  filter: brightness(1.05);
}

.download-limit-copy-success {
  font-size: 0.875rem;
  color: #16a34a;
  font-weight: 600;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.download-limit-copy-success__icon {
  display: inline-flex;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: #dcfce7;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

.download-limit-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 4px;
}

.download-limit-footer__label {
  font-size: 15px;
  color: #2f2f2f;
  line-height: 1.5;
  font-weight: 600;
  font-family: Lexend, system-ui, sans-serif;
}

.download-limit-policy-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  border-radius: 19px;
  background: #2f2f2f;
  color: #fff !important;
  text-decoration: none !important;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.12px;
  font-family: Lexend, system-ui, sans-serif;
}

.download-limit-policy-pill:hover {
  filter: brightness(1.08);
}

.download-success-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 10000;
  animation: fadeIn 0.3s ease;
}

.download-success-overlay.active {
  display: flex;
  justify-content: center;
  align-items: center;
}

.download-success-modal {
  position: relative;
  border: 1px solid #e2f4ff;
  padding: 30px 30px 26px;
  max-width: 600px;
  width: 90%;
  text-align: center;
  animation: downloadSuccessIn 0.28s ease;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.65);
  box-shadow: 0 -4px 4px 0 rgba(255, 255, 255, 0.25) inset, 0 8px 16px 0 #FFF inset, 0 4px 4px 0 rgba(74, 183, 255, 0.35);
  backdrop-filter: blur(4px);
}

@keyframes downloadSuccessIn {
  from {
    opacity: 0;
    transform: translateY(-18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.download-success-title {
  margin: 0 0 10px;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.64px;
  text-transform: capitalize;
  background: linear-gradient(90deg, #316dd3 0%, #1eb8ff 141.2%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.download-success-body {
  margin: 0 0 16px;
  font-size: 15px;
  line-height: 1.5;
  color: #2f2f2f;
  font-weight: 500;
  font-family: Lexend, system-ui, sans-serif;
}

.download-success-body strong {
  font-weight: 700;
}

#download-success-close.limit-popup-x {
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid #d9e8fb;
  background: rgba(255, 255, 255, 0.92);
  color: #9aa9bc;
}

#download-success-close.limit-popup-x:hover {
  background: #fff;
  color: #475569;
}

.download-success-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex-wrap: wrap;
}

.download-success-footer__label {
  font-size: 15px;
  line-height: 1.5;
  font-weight: 600;
  color: #2f2f2f;
  font-family: Lexend, system-ui, sans-serif;
}

.download-success-policy-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  border-radius: 19px;
  background: #2f2f2f;
  color: #fff !important;
  text-decoration: none !important;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.12px;
  font-family: Lexend, system-ui, sans-serif;
}

.download-success-policy-pill:hover {
  filter: brightness(1.08);
}

@media (max-width: 767px) {
  .download-success-modal {
    max-width: 92vw;
    padding: 24px 18px 20px;
  }

  .download-success-title {
    font-size: 38px;
  }
}

@media (min-width: 992px) {
  .container-lg > .row {
    display: flex;
    align-items: flex-start;
  }

  .col-lg-8,
  .col-lg-4,
  .main-content-card,
  .document-overview-section,
  .document-sidebar,
  .sidebar-section:first-child {
    display: flex;
    flex-direction: column;
    flex: 1;
  }

  .document-sidebar {
    align-items: stretch;
  }
}

@media (max-width: 991px) {
  .share-popup {
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    transform: translate(-50%, -50%);
    animation: slideUp 0.3s ease;
  }
}

@media (max-width: 576px) {
  .share-options {
    flex-wrap: wrap;
    gap: 10px;
  }

  .share-popup {
    padding: 20px;
  }

  .share-copy-input-group {
    flex-direction: column;
  }

  .limit-popup {
    padding: 30px 20px;
  }

  .limit-popup-title {
    font-size: 20px;
  }

  .limit-popup-message {
    font-size: 14px;
  }

  .download-limit-share-row {
    flex-direction: column;
  }

  .download-limit-copy-btn {
    width: 100%;
    justify-content: center;
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 24px));
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% - 24px));
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3) translateY(-50px);
  }
  50% { transform: scale(1.05); }
  70% { transform: scale(0.9); }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.library-related-documents-inner {
  max-width: 100%;
}

.library-related-documents-title {
  margin: 0 0 12px;
  font-family: Lexend, system-ui, sans-serif;
  font-weight: 800;
  font-size: clamp(1.125rem, 2.2vw, 1.65rem);
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #2563eb;
}

.library-related-documents-subtitle {
  margin: 0;
  max-width: 52rem;
  font-family: Lexend, system-ui, sans-serif;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.55;
  color: #0f172a;
}

.library-related-documents-empty {
  margin: 12px 0 0;
  font-size: 14px;
  color: #64748b;
  text-align: center;
}

@media (max-width: 576px) {
  .library-related-documents-section {
    padding: 28px 0 4px;
  }
}

/* ===== Rating & review (đồng bộ Figma / review-form-card) ===== */
.review-section { background: transparent; position: relative; }

.rating-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 28px 50px;
  padding: 20px 0 8px;
  margin-bottom: 36px;
}

.rating-overview {
  flex: 0 0 242px;
  text-align: center;
  font-family: Lexend, system-ui, sans-serif;
}

.rating-score {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 2px;
  font-size: clamp(2.8rem, 6vw, 3.5rem);
  font-weight: 800;
  line-height: 1;
  margin: 0 0 10px;
  letter-spacing: -0.01em;
  color: #ff9900;
}

.rating-stars-large {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 12px;
}

.rating-stars-large .star {
  font-size: 42px;
  line-height: 1;
  color: #316dd3;
}

.rating-stars-large .star.empty {
  color: #cbd5e1;
}

.rating-count {
  font-size: 30px;
  transform: scale(.48);
  transform-origin: center top;
  margin-top: -2px;
  font-weight: 500;
  color: #2f2f2f;
  white-space: nowrap;
}

.rating-breakdown {
  min-width: 0;
  font-family: Lexend, system-ui, sans-serif;
}

.rating-criteria {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 0;
}

.criteria-item {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  padding: 8px 17px;
  background: #fff;
  border-radius: 43px;
  box-sizing: border-box;
  min-height: 49px;
}

.criteria-label {
  flex: 0 0 146px;
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: #2f2f2f;
}

.criteria-value {
  font-size: 29px;
  transform: scale(.55);
  transform-origin: left center;
  font-weight: 700;
  color: #ff9900;
  min-width: 22px;
  margin-right: -8px;
}

.criteria-value-out-of {
  font-size: 29px;
  transform: scale(.55);
  transform-origin: left center;
  color: #ff9900;
  font-weight: 700;
  margin-right: 4px;
}

.criteria-stars {
  display: flex;
  align-items: center;
  gap: 1px;
  margin-left: auto;
}

.criteria-stars .star {
  font-size: 33px;
  transform: scale(.66);
  transform-origin: center;
  line-height: 1;
  color: #316dd3;
}

.criteria-stars .star.empty {
  color: #bcbcbc;
}

.review-form-section { background: transparent; border: none; padding: 0; margin-bottom: 36px; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 10002; display: flex; flex-direction: column; gap: 12px; pointer-events: none; }
.toast { background: #fff; border-radius: 8px; padding: 16px 20px; min-width: 280px; max-width: 360px; box-shadow: 0 4px 12px rgba(0,0,0,.15); display: flex; align-items: center; gap: 12px; opacity: 0; transform: translateX(400px); transition: all .3s cubic-bezier(.68,-0.55,.265,1.55); pointer-events: auto; }
.toast.show { opacity: 1; transform: translateX(0); }
.toast.success { border-left: 4px solid #10b981; }
.toast.error { border-left: 4px solid #ef4444; }
.toast.warning { border-left: 4px solid #f59e0b; }
.toast.info { border-left: 4px solid #3b82f6; }
.toast-icon { width: 24px; height: 24px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.toast.success .toast-icon { color: #10b981; }
.toast.error .toast-icon { color: #ef4444; }
.toast.warning .toast-icon { color: #f59e0b; }
.toast.info .toast-icon { color: #3b82f6; }
.toast-content { flex: 1; font-size: 14px; color: #111827; }
.toast-close { background: transparent; border: none; font-size: 16px; cursor: pointer; color: #9ca3af; padding: 0; }
.toast-close:hover { color: #4b5563; }
.review-section-hero-title {
  font-family: Lexend, system-ui, sans-serif;
  font-weight: 800;
  font-size: clamp(1.125rem, 2.5vw, 2rem);
  line-height: 1.2;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  margin: 0 auto 36px;
  max-width: 900px;
  background: linear-gradient(90deg, #2864c8 0%, #008cff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 2px rgba(255, 255, 255, 0.35));
}
.review-form-card {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 32px 48px;
  width: 100%;
  padding: 35px;
  border-radius: 30px;
  border: 3px solid #e2f4ff;
  background: linear-gradient(180deg, #ffffff 0%, #ceecff 100%);
  box-sizing: border-box;
}
.review-form-card-form { flex: 1 1 0; min-width: 0; }
.review-form-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px 48px;
  align-items: start;
}
.review-form-block-title {
  font-family: Lexend, system-ui, sans-serif;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: #2c58a0;
  margin: 0 0 8px;
}
.review-form-block-title--for-input { display: block; cursor: pointer; }
.rating-input--figma { display: flex; flex-direction: column; gap: 16px; flex-wrap: nowrap; }
.rating-row-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 8px 17px;
  background: #fff;
  border-radius: 43px;
  box-sizing: border-box;
}
.rating-row-pill-label {
  font-family: Lexend, system-ui, sans-serif;
  font-weight: 500;
  font-size: 14px;
  letter-spacing: -0.01em;
  color: #2f2f2f;
  flex: 0 1 180px;
  min-width: 0;
}
.star-rating-input--compact { flex-shrink: 0; gap: 2px; }
.star-rating-input--compact label { font-size: 22px; line-height: 1; }
.review-form-col--share { min-width: 0; }
.review-form-share-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  min-height: 220px;
}
.form-textarea--figma {
  flex: 1 1 auto;
  min-height: 140px;
  padding: 20px;
  border: none;
  border-radius: 22px;
  font-size: 14px;
  font-family: Lexend, system-ui, sans-serif;
  letter-spacing: -0.01em;
  color: #2f2f2f;
  background: #fff;
  resize: vertical;
  box-shadow: inset 0 0 0 1px rgba(226, 244, 255, 0.9);
}
.form-textarea--figma::placeholder { color: #6b7280; }
.form-textarea--figma:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px #316dd3;
}
.btn-submit-review--figma {
  position: relative;
  width: 100%;
  margin-top: 8px;
  padding: 14px 30px;
  border-radius: 30px;
  border: 2px solid #fff;
  font-family: Lexend, system-ui, sans-serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: #fff;
  cursor: pointer;
  overflow: hidden;
  background: transparent;
  box-shadow: 0 4px 4px rgba(74, 183, 255, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn-submit-review--figma::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #316dd3 0%, #1eb8ff 100%);
  z-index: 0;
}
.btn-submit-review--figma::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 -4px 4px rgba(255, 255, 255, 0.25), inset 0 8px 16px rgba(255, 255, 255, 0.53);
  z-index: 1;
}
.btn-submit-review-label { position: relative; z-index: 2; }
.btn-submit-review--figma:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(74, 183, 255, 0.45);
}
.btn-submit-review--figma:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}
.review-form-aside {
  flex: 0 0 202px;
  max-width: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  align-self: center;
}
.review-form-mascot-img {
  position: relative;
  z-index: 1;
  display: block;
  width: min(160px, 42vw);
  height: auto;
  max-height: 200px;
  object-fit: contain;
}
.review-form-speech {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 202px;
  margin-top: -45px;
  padding: 16px 12px;
  border-radius: 30px;
  border: 2px solid #2c58a0;
  background: linear-gradient(90deg, #316dd3 0%, #1eb8ff 100%);
  box-shadow: 1px 3px 0 0 #2c58a0;
  box-sizing: border-box;
}
.review-form-speech-text {
  margin: 0;
  font-family: Lexend, system-ui, sans-serif;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.35;
  letter-spacing: -0.01em;
  text-align: center;
  color: #fff;
}
.star-rating-input { display: flex; gap: 5px; }
.star-rating-input input[type="radio"] { display: none; }
.star-rating-input label { cursor: pointer; transition: color 0.15s ease; color: #d1d5db; margin-bottom: 0; }
.star-rating-input label:hover,
.star-rating-input label.active { color: #316dd3; }
.review-card {
  position: relative;
  padding: 14px 40px;
  border-radius: 28px;
  border: none;
  margin-bottom: 0;
  background: transparent;
  box-shadow: 0 4px 4px rgba(74, 183, 255, 0.35);
  overflow: hidden;
}
.review-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
  z-index: 0;
}
.review-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 -4px 4px rgba(255, 255, 255, 0.25), inset 0 8px 16px #fff;
  z-index: 1;
}
.review-card-inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
  justify-content: center;
}
.review-card-main { flex: 1 1 0; min-width: 200px; max-width: 100%; display: flex; flex-direction: column; gap: 18px; }
.review-card-side {
  flex: 0 0 210px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 17px;
}
.review-card-user-row { display: flex; gap: 22px; align-items: center; }
.review-card-avatar-wrap {
  width: 60px;
  height: 60px;
  border-radius: 100px;
  border: 2px solid #fff;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(49, 146, 211, 0.2);
}
.review-card-avatar-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.review-card-user-text { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.review-card-user-name {
  font-family: Lexend, system-ui, sans-serif;
  font-weight: 700;
  font-size: 17px;
  color: #373737;
  margin: 0;
}
.review-card-user-date {
  font-family: Lexend, system-ui, sans-serif;
  font-weight: 500;
  font-size: 14px;
  color: #5a5a5a;
  margin: 0;
}
.review-card .review-content {
  margin: 0;
  font-family: Lexend, system-ui, sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  color: #2f2f2f;
}
.review-stars-block { display: flex; justify-content: center; gap: 8px; }
.review-stars-block .star { font-size: 24px; line-height: 1; color: #316dd3; }
.review-stars-block .star.empty { color: #d1d5db; }
.review-criteria-pills { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.review-criteria-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 20px;
  background: #fff;
  border-radius: 49px;
  font-family: Lexend, system-ui, sans-serif;
  font-weight: 500;
  font-size: 13.5px;
  letter-spacing: -0.01em;
  box-sizing: border-box;
}
.review-criteria-pill-label { flex: 1; color: #43474e; }
.review-criteria-pill-value { flex-shrink: 0; color: #316dd3; white-space: nowrap; }
.btn-helpful {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 18px;
  border: 2px solid #2c58a0;
  border-radius: 30px;
  font-family: Lexend, system-ui, sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: #2c58a0;
  background: #fff;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}
.btn-helpful:hover:not(:disabled):not(.active) {
  background: #eef6ff;
  color: #244a88;
  border-color: #244a88;
}
.btn-helpful.active {
  color: #fff;
  background: #2c58a0;
  border-color: #2c58a0;
}
.btn-helpful.active:hover:not(:disabled) {
  background: #244a88;
  border-color: #244a88;
}
.btn-helpful:disabled { opacity: 0.65; cursor: not-allowed; }
.btn-helpful svg { width: 13px; height: 12px; flex-shrink: 0; color: inherit; }
.btn-helpful-count { font-weight: 600; opacity: 0.95; }
.review-card-actions { display: flex; flex-wrap: wrap; gap: 12px; }
@media (max-width: 991px) {
  .review-form-card { flex-direction: column; align-items: stretch; }
  .review-form-card-grid { grid-template-columns: 1fr; gap: 28px; }
  .review-form-aside {
    flex: none;
    max-width: none;
    width: 100%;
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
    padding-top: 8px;
  }
  .review-form-speech { max-width: 280px; }
}
.form-group { margin-bottom: 25px; }
.form-label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 10px; color: var(--text-primary); }
.rating-input { display: flex; gap: 30px; flex-wrap: wrap; }
.rating-item { flex: 1; min-width: 200px; }
.rating-item-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.form-textarea { width: 100%; min-height: 120px; padding: 12px 15px; border: 1px solid var(--glass-border); border-radius: 12px; font-size: 14px; font-family: inherit; resize: vertical; transition: border-color 0.2s; background: white; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: var(--text-primary); }
.form-textarea::placeholder { color: var(--text-tertiary); }
.form-textarea:focus { outline: none; border-color: var(--primary); background: var(--bg-card-hover); }
.btn-submit-review:not(.btn-submit-review--figma) { background: var(--primary-gradient); color: var(--text-primary); border: none; padding: 12px 40px; border-radius: 12px; font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.3s; box-shadow: 0 4px 16px rgba(50,159,255,.3); }
.btn-submit-review:not(.btn-submit-review--figma):hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(50,159,255,.4); }
.btn-submit-review:not(.btn-submit-review--figma):disabled { background: var(--text-tertiary); cursor: not-allowed; transform: none; }
.reviews-list-section { margin-top: 40px; }
.reviews-list-section #reviews-list { display: flex; flex-direction: column; gap: 24px; }
.reviews-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.reviews-title { font-size: 24px; font-weight: 700; color: var(--text-primary); }
.reviews-title.reviews-title--figma {
  font-family: Lexend, system-ui, sans-serif;
  font-weight: 700;
  font-size: 22px;
  color: #2c58a0;
  letter-spacing: -0.02em;
}
.review-stars { display: flex; gap: 3px; }
.review-stars .star { font-size: 16px; color: #ffa500; }
.load-more-btn { display: block; margin: 30px auto; padding: 12px 40px; background: var(--glass-bg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 2px solid var(--primary); color: var(--primary-light); border-radius: 12px; font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.3s; box-shadow: 0 4px 16px rgba(50,159,255,.1); }
.load-more-btn:hover { background: var(--primary-gradient); color: var(--text-primary); box-shadow: 0 8px 24px rgba(50,159,255,.3); }
.related-section { margin-top: 60px; padding: 40px 0; background: transparent; position: relative; }
.related-title { font-size: 28px; font-weight: 700; text-align: center; margin-bottom: 40px; color: var(--text-primary); }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 25px; }
.related-card { background: var(--glass-bg); backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%); border: 1px solid var(--glass-border); border-radius: 16px; overflow: hidden; box-shadow: 0 8px 32px var(--glass-shadow); transition: all .3s; cursor: pointer; }
.related-card:hover { transform: translateY(-5px); box-shadow: 0 12px 40px rgba(50,159,255,.2); border-color: var(--primary); background: var(--bg-card-hover); }
.related-card-image { width: 100%; height: 200px; overflow: hidden; }
.related-card-image img { width: 100%; height: 100%; object-fit: cover; }
.related-card-body { padding: 20px; }
.related-card-title { font-size: 16px; font-weight: 600; margin-bottom: 10px; color: var(--text-primary); display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.related-card-meta { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--text-secondary); }
.related-card-rating, .related-card-views { display: flex; align-items: center; gap: 5px; }
.star { color: #ffa500; }
.star.empty { color: #ddd; }
.alert { padding: 15px 20px; border-radius: 12px; margin-bottom: 20px; font-size: 14px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--glass-border); }
.alert-success { background: rgba(16,185,129,.2); color: var(--accent-green); border-color: var(--accent-green); }
.alert-error { background: rgba(236,72,153,.2); color: var(--accent-pink); border-color: var(--accent-pink); }
.alert-info { background: rgba(50,159,255,.2); color: var(--primary-light); border-color: var(--primary-light); }

/* ===== Thư viện PDF: popup ghi chú + sidebar danh sách — nền đục (tránh var glass/broken theme trên nền PDF) ===== */
#main-content #note-popup-overlay.note-popup-overlay {
  background: rgba(15, 23, 42, 0.48) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

#main-content #note-popup.note-popup {
  background: #ffffff !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.2) !important;
  color: #1f2937 !important;
}

#main-content #note-popup .note-popup-title {
  color: #0f172a !important;
}

#main-content #note-popup .note-popup-close {
  background: #f1f5f9 !important;
  color: #334155 !important;
}

#main-content #note-popup .note-popup-close:hover {
  background: #e2e8f0 !important;
}

#main-content #note-popup .note-textarea {
  background: #f8fafc !important;
  color: #111827 !important;
  border: 1px solid #cbd5e1 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

#main-content #note-popup .note-textarea::placeholder {
  color: #64748b !important;
}

#main-content #note-popup .note-btn-cancel {
  background: #ffffff !important;
  color: #475569 !important;
  border: 1px solid #cbd5e1 !important;
}

#main-content #note-popup .note-btn-cancel:hover {
  background: #f1f5f9 !important;
}

#main-content #note-popup .note-btn-save {
  color: #ffffff !important;
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%) !important;
  border: none !important;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.35);
}

#main-content #note-popup .note-btn-save:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%) !important;
  color: #ffffff !important;
}

#main-content #annotation-sidebar.annotation-sidebar {
  background: #f8fafc !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-left: 1px solid #e2e8f0 !important;
  box-shadow: -8px 0 32px rgba(15, 23, 42, 0.12) !important;
}

#main-content #annotation-sidebar .annotation-sidebar-header {
  background: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

#main-content #annotation-sidebar .annotation-sidebar-title {
  color: #0f172a !important;
}

#main-content #annotation-sidebar .annotation-sidebar-close {
  background: #f1f5f9 !important;
  color: #334155 !important;
}

#main-content #annotation-sidebar .annotation-sidebar-close:hover {
  background: #e2e8f0 !important;
}

#main-content #annotation-sidebar .annotation-item {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

#main-content #annotation-sidebar .annotation-item:hover {
  background: #f1f5f9 !important;
}

#main-content #annotation-sidebar .annotation-item-text {
  color: #334155 !important;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
  line-height: 1.45;
}

#main-content #annotation-sidebar .annotation-item-page {
  color: #2563eb !important;
}

/* Popover xóa highlight (click vùng tô trên PDF — không dùng sidebar) */
.lib-highlight-action-popover {
  position: fixed;
  z-index: 10055;
  display: none;
  padding: 6px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.2);
  box-sizing: border-box;
}

.lib-highlight-action-popover.is-visible {
  display: block;
}

.lib-highlight-action-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  font-family: Lexend, system-ui, sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  cursor: pointer;
  background: linear-gradient(135deg, #b91c1c 0%, #ef4444 100%);
  white-space: nowrap;
}

.lib-highlight-action-delete:hover {
  filter: brightness(1.06);
}

@media (max-width: 768px) {
  .rating-summary {
    flex-direction: column;
    gap: 20px;
    padding: 6px 0 4px;
  }
  .rating-overview {
    flex: none;
    width: 100%;
    max-width: 100%;
  }
  .rating-input { flex-direction: column; }
  .related-grid { grid-template-columns: 1fr; }
}

@media (max-width: 767px) {
  .reviews-list-section { margin-top: 24px; }
  .reviews-header { margin-bottom: 20px; }
  .reviews-title { font-size: 18px; }
  .reviews-title.reviews-title--figma { font-size: 18px; }
  .review-card { padding: 14px 20px; border-radius: 22px; }
  .review-card-inner { flex-direction: column; align-items: stretch; }
  .review-card-side {
    flex: 1 1 auto;
    width: 100%;
    max-width: none;
    align-items: stretch;
  }
  .review-stars-block { justify-content: flex-start; }
  .review-form-card { padding: 22px 18px; }
  .rating-breakdown {
    flex: none;
    width: 100%;
    max-width: 100%;
  }
  .criteria-item {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 6px 10px;
    min-height: 0;
    border-radius: 15px !important;
  }
  .criteria-label {
    flex: 1 1 100%;
  }
  .criteria-stars {
    margin-left: 0;
  }
  .btn-helpful { padding: 8px 14px; font-size: 13px; }
  .load-more-btn { margin: 24px auto calc(64px + 16px); padding: 10px 24px; font-size: 14px; }
  .review-form-section { padding-bottom: 24px; }
}
