/* ==========================================================================
   ERASIGHT ACADEMY — RESOURCE PAGES
   Dùng chung cho: san-pham-hoc-vien.html & tai-lieu-ai.html
   Phụ thuộc biến màu trong style.css (--p, --pd, --orange, --ink, --slate...)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. PAGE HERO (dùng chung)
   -------------------------------------------------------------------------- */
.res-hero {
  position: relative;
  padding: 64px 0 72px;
  background:
    radial-gradient(900px 380px at 88% -10%, rgba(13, 160, 150, 0.14), transparent 70%),
    radial-gradient(700px 320px at -5% 110%, rgba(232, 93, 4, 0.08), transparent 70%),
    var(--cloud);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.res-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(12, 42, 58, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(12, 42, 58, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent 85%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent 85%);
  pointer-events: none;
}

/* Hero riêng cho Tài liệu AI & Sản phẩm học viên: dùng ảnh nền BC1.png trên web / desktop, giữ nguyên trên mobile */
@media (min-width: 769px) {
  .res-hero--doc,
  .res-hero--showcase {
    background-color: #f5f8f9;
    background-image: url('../images/BC1.png');
    background-repeat: no-repeat;
    background-position: center right;
    background-size: cover;
  }
  .res-hero--doc::before,
  .res-hero--showcase::before {
    display: none;
  }
}

.res-hero .wrap {
  position: relative;
  z-index: 1;
}

.res-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate);
  margin-bottom: 28px;
}

.res-breadcrumb a {
  color: var(--slate);
  transition: color 0.2s ease;
}

.res-breadcrumb a:hover {
  color: var(--pd);
}

.res-breadcrumb .sep {
  opacity: 0.5;
}

.res-breadcrumb .current {
  color: var(--ink);
}

.res-motif {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 22px;
}

.res-motif span {
  width: 36px;
  height: 6px;
  border-radius: 999px;
  background: var(--p);
}

.res-motif span:nth-child(2) {
  background: var(--orange);
}

.res-hero h1 {
  font-size: clamp(34px, 5vw, 58px);
  font-weight: 800;
  max-width: 820px;
  margin: 14px 0 18px;
  text-wrap: balance;
}

.res-hero h1 .hl {
  color: var(--orange);
}

.res-hero .lead {
  font-size: 18px;
  color: var(--slate);
  max-width: 680px;
  line-height: 1.65;
}

.res-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 40px;
  max-width: 920px;
}

.res-stat {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px 20px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.res-stat:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(12, 42, 58, 0.07);
}

.res-stat .k {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--td);
}

.res-stat .v {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.1;
  margin: 6px 0 4px;
}

.res-stat .v small {
  font-size: 15px;
  color: var(--slate);
  font-weight: 700;
}

.res-stat .d {
  font-size: 13px;
  color: var(--slate);
  line-height: 1.45;
}

@media (max-width: 860px) {
  .res-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* --------------------------------------------------------------------------
   2. FILTER PILLS (dùng chung)
   -------------------------------------------------------------------------- */
.res-filter {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(12, 42, 58, 0.04);
}

.res-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--slate);
  transition: background 0.2s ease, color 0.2s ease;
}

.res-filter-btn:hover {
  color: var(--ink);
  background: var(--cloud);
}

.res-filter-btn.is-active {
  background: var(--ink);
  color: #fff;
}

.res-filter-btn .count {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(12, 42, 58, 0.07);
}

.res-filter-btn.is-active .count {
  background: rgba(255, 255, 255, 0.18);
}

.res-toolbar-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 8px;
}

.res-toolbar-head .sec-head {
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   3. SẢN PHẨM HỌC VIÊN — SHOWCASE CARD MỞ RỘNG
   -------------------------------------------------------------------------- */
.showcase-grid {
  margin-top: 36px;
}

.asset-card.is-hidden {
  display: none;
}

.asset-card {
  animation: resFadeUp 0.4s ease both;
}

@keyframes resFadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.asset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.asset-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--pd);
  background: var(--pl);
  padding: 3px 8px;
  border-radius: 6px;
}

.asset-chip.is-blue {
  color: var(--blue);
  background: var(--blue-light);
}

/* Trích nhận xét học viên ngay trong card */
.asset-quote {
  position: relative;
  margin: 0 0 16px;
  padding: 14px 16px 14px 18px;
  background: var(--cloud);
  border-radius: 10px;
  border-left: 3px solid var(--orange);
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink);
  font-style: italic;
}

.asset-quote.is-blue {
  border-left-color: var(--blue);
}

.asset-quote cite {
  display: block;
  margin-top: 6px;
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
  color: var(--slate);
}

.asset-foot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.asset-author {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--p), var(--pd));
}

img.avatar {
  object-fit: cover;
  display: block;
  border: 1.5px solid var(--line);
  background: #fff;
}

.avatar.is-orange {
  background: linear-gradient(135deg, #F48C3A, var(--orange));
}

.avatar.is-blue {
  background: linear-gradient(135deg, #4C9BE3, var(--blue));
}

.avatar.lg {
  width: 52px;
  height: 52px;
  font-size: 18px;
}

.asset-author .name {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}

.asset-author .role {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--slate);
}

/* Card "Sắp cập nhật" giữ chỗ cho đồ án mới */
.asset-card--soon {
  border-style: dashed;
  background: repeating-linear-gradient(135deg, #fff, #fff 12px, var(--cloud) 12px, var(--cloud) 24px);
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 28px;
  min-height: 320px;
}

.asset-card--soon:hover {
  transform: none;
  box-shadow: none;
}

.asset-card--soon .soon-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--p);
  margin: 0 auto 16px;
}

.asset-card--soon h3 {
  font-size: 18px;
  margin-bottom: 8px;
}

.asset-card--soon p {
  font-size: 14px;
  color: var(--slate);
  max-width: 260px;
  margin: 0 auto;
}

/* --------------------------------------------------------------------------
   4. NHẬN XÉT HỌC VIÊN (TESTIMONIALS)
   -------------------------------------------------------------------------- */
.tm-layout {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 24px;
  align-items: stretch;
}

@media (max-width: 960px) {
  .tm-layout {
    grid-template-columns: 1fr;
  }
}

.tm-feature {
  position: relative;
  background:
    radial-gradient(520px 260px at 100% 0%, rgba(13, 160, 150, 0.35), transparent 70%),
    var(--dark);
  color: #fff;
  border-radius: 20px;
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  min-height: 380px;
}

.tm-feature::after {
  content: '\201C';
  position: absolute;
  top: -40px;
  right: 24px;
  font-family: var(--font-display);
  font-size: 260px;
  line-height: 1;
  color: rgba(127, 224, 216, 0.12);
  pointer-events: none;
}

.tm-feature .eyebrow {
  margin-bottom: 18px;
}

.tm-feature blockquote {
  position: relative;
  z-index: 1;
  font-family: var(--font-display);
  font-size: clamp(20px, 2.3vw, 26px);
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: -0.01em;
  color: #fff;
}

.tm-feature blockquote .hl {
  color: #7FE0D8;
}

.tm-feature .tm-author {
  margin-top: 32px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.tm-feature .tm-author .name {
  color: #fff;
}

.tm-feature .tm-author .role {
  color: #A3BDC7;
}

.tm-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.tm-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 24px;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.tm-card:hover {
  transform: translateY(-3px);
  border-color: rgba(13, 160, 150, 0.4);
  box-shadow: 0 14px 30px rgba(12, 42, 58, 0.07);
}

.tm-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.tm-stars {
  display: inline-flex;
  gap: 2px;
  color: #F5A524;
  font-size: 14px;
  letter-spacing: 1px;
}

.tm-course {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--orange-light);
  color: var(--orange);
}

.tm-course.is-blue {
  background: var(--blue-light);
  color: var(--blue);
}

.tm-card p {
  font-size: 14.5px;
  color: var(--ink);
  line-height: 1.65;
  margin-bottom: 16px;
}

.tm-author {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tm-author .name {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.tm-author .role {
  display: block;
  font-size: 12.5px;
  color: var(--slate);
}

.tm-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 16px;
}

@media (max-width: 960px) {
  .tm-grid-3 {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   5. CTA BAND (dùng chung)
   -------------------------------------------------------------------------- */
.res-cta {
  position: relative;
  background:
    radial-gradient(600px 300px at 0% 100%, rgba(232, 93, 4, 0.22), transparent 70%),
    radial-gradient(600px 300px at 100% 0%, rgba(13, 160, 150, 0.3), transparent 70%),
    var(--dark);
  border-radius: 24px;
  padding: 56px 48px;
  display: grid;
  grid-template-columns: 1.4fr auto;
  align-items: center;
  gap: 32px;
  overflow: hidden;
}

.res-cta h2 {
  color: #fff;
  font-size: clamp(26px, 3.2vw, 36px);
  font-weight: 800;
  margin: 12px 0 10px;
}

.res-cta p {
  color: #B9CBD2;
  font-size: 16px;
  max-width: 560px;
}

.res-cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.res-cta .btn-ghost {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.res-cta .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border-color: rgba(127, 224, 216, 0.6);
}

@media (max-width: 860px) {
  .res-cta {
    grid-template-columns: 1fr;
    padding: 40px 26px;
  }
}

/* ==========================================================================
   6. TÀI LIỆU AI — LIBRARY
   ========================================================================== */
.lib-search {
  margin-top: 32px;
  max-width: 720px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 8px 8px 8px 18px;
  box-shadow: 0 12px 34px rgba(12, 42, 58, 0.08);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.lib-search:focus-within {
  border-color: var(--p);
  box-shadow: 0 12px 34px rgba(13, 160, 150, 0.16);
}

.lib-search svg {
  flex-shrink: 0;
  color: var(--slate);
}

.lib-search input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 16px;
  color: var(--ink);
  background: transparent;
  padding: 10px 4px;
}

.lib-search input::placeholder {
  color: #8AA1AB;
}

.lib-search kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--slate);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 3px 7px;
  background: var(--cloud);
}

.lib-search .btn {
  padding: 12px 22px;
}

@media (max-width: 560px) {
  .lib-search kbd {
    display: none;
  }
  .lib-search .btn {
    padding: 12px 16px;
  }
}

.lib-popular {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--slate);
  font-weight: 600;
}

.lib-tag {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  transition: all 0.2s ease;
}

.lib-tag:hover,
.lib-tag.is-active {
  border-color: var(--p);
  color: var(--pd);
  background: var(--pl);
}

/* Layout 2 cột: sidebar + nội dung */
.lib-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 36px;
  align-items: start;
}

@media (max-width: 960px) {
  .lib-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

.lib-sidebar {
  position: sticky;
  top: 100px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

@media (max-width: 960px) {
  .lib-sidebar {
    position: static;
  }
}

.lib-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
}

.lib-panel h4 {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--slate);
  margin-bottom: 12px;
}

.lib-cats {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

@media (max-width: 960px) {
  .lib-cats {
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 4px;
  }
}

.lib-cat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  transition: background 0.18s ease, color 0.18s ease;
  white-space: nowrap;
}

.lib-cat .ico {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.lib-cat .ico i {
  font-style: normal;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  background: var(--cloud);
}

.lib-cat .n {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--slate);
}

.lib-cat:hover {
  background: var(--cloud);
}

.lib-cat.is-active {
  background: var(--pl);
  color: var(--pd);
}

.lib-cat.is-active .ico i {
  background: #fff;
}

.lib-cat.is-active .n {
  color: var(--pd);
}

.lib-types {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lib-type-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--slate);
  background: #fff;
  cursor: pointer;
  user-select: none;
  transition: all 0.18s ease;
}

.lib-type-chip input {
  display: none;
}

.lib-type-chip .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.lib-type-chip:has(input:checked) {
  border-color: var(--ink);
  color: var(--ink);
  background: var(--cloud);
}

.lib-access {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.lib-access label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.lib-access input {
  accent-color: var(--p);
  width: 16px;
  height: 16px;
}

.lib-note {
  background: linear-gradient(160deg, var(--pl), #fff 80%);
  border: 1px dashed rgba(13, 160, 150, 0.45);
  border-radius: 16px;
  padding: 18px;
  font-size: 13px;
  color: var(--slate);
  line-height: 1.55;
}

.lib-note strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  margin-bottom: 4px;
}

/* Toolbar */
.lib-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.lib-result {
  font-size: 14px;
  color: var(--slate);
}

.lib-result b {
  color: var(--ink);
}

.lib-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lib-select {
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%234A6572' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 34px 9px 12px;
  cursor: pointer;
}

.lib-view {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.lib-view button {
  width: 34px;
  height: 32px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--slate);
  transition: all 0.18s ease;
}

.lib-view button.is-active {
  background: var(--ink);
  color: #fff;
}

/* Tài liệu nổi bật */
.lib-featured {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  margin-bottom: 28px;
  transition: box-shadow 0.25s ease;
}

.lib-featured:hover {
  box-shadow: 0 18px 40px rgba(12, 42, 58, 0.08);
}

.lib-featured .doc-cover {
  height: 100%;
  min-height: 220px;
  border-radius: 0;
}

.lib-featured-body {
  padding: 28px 30px;
  display: flex;
  flex-direction: column;
}

.lib-featured-body h3 {
  font-size: 24px;
  margin: 10px 0 10px;
}

.lib-featured-body p {
  color: var(--slate);
  font-size: 15px;
  margin-bottom: 18px;
  flex-grow: 1;
}

.pin-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--orange);
}

@media (max-width: 700px) {
  .lib-featured {
    grid-template-columns: 1fr;
  }
  .lib-featured .doc-cover {
    min-height: 160px;
  }
}

/* Grid tài liệu */
.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}

.doc-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  animation: resFadeUp 0.35s ease both;
}

.doc-card:hover {
  transform: translateY(-4px);
  border-color: rgba(13, 160, 150, 0.35);
  box-shadow: 0 18px 36px rgba(12, 42, 58, 0.08);
}

/* Bìa tài liệu tự sinh theo định dạng file */
.doc-cover {
  --c1: #0DA096;
  --c2: #07736C;
  position: relative;
  height: 150px;
  background:
    radial-gradient(180px 120px at 85% 15%, rgba(255, 255, 255, 0.22), transparent 70%),
    linear-gradient(135deg, var(--c1), var(--c2));
  color: #fff;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 16px;
}

.doc-cover::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 22px 22px;
}

.doc-cover .ext {
  position: relative;
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  opacity: 0.95;
}

.doc-cover .sheet {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 54px;
  height: 68px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
  transform: rotate(6deg);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.doc-cover .sheet::before,
.doc-cover .sheet::after {
  content: '';
  position: absolute;
  left: 9px;
  right: 9px;
  height: 4px;
  border-radius: 2px;
  background: var(--c1);
  opacity: 0.55;
}

.doc-cover .sheet::before { top: 14px; }
.doc-cover .sheet::after { top: 24px; right: 20px; }

.doc-card:hover .doc-cover .sheet,
.lib-featured:hover .doc-cover .sheet {
  transform: rotate(-4deg) translateY(-4px);
}

.doc-cover .lock {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(12, 42, 58, 0.55);
  backdrop-filter: blur(4px);
}

.doc-cover .free {
  background: rgba(255, 255, 255, 0.92);
  color: var(--pd);
}

.doc-type--pdf  { --c1: #E85D04; --c2: #B8410A; }
.doc-type--docx { --c1: #2176C7; --c2: #164E8A; }
.doc-type--xlsx { --c1: #1F9D5C; --c2: #116B3D; }
.doc-type--xls  { --c1: #1F9D5C; --c2: #116B3D; }
.doc-type--csv  { --c1: #107C41; --c2: #0B532B; }
.doc-type--pptx { --c1: #D9480F; --c2: #8F2D0A; }
.doc-type--zip  { --c1: #4A6572; --c2: #0C2A3A; }
.doc-type--link { --c1: #0DA096; --c2: #07736C; }
.doc-type--md   { --c1: #6D4BC3; --c2: #43288A; }

.doc-body {
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.doc-cat {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--td);
  margin-bottom: 6px;
}

.doc-body h3 {
  font-size: 16.5px;
  line-height: 1.3;
  margin-bottom: 8px;
}

.doc-body p {
  font-size: 13.5px;
  color: var(--slate);
  line-height: 1.55;
  margin-bottom: 12px;
  flex-grow: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.doc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 14px;
}

.doc-tags span {
  font-size: 11px;
  font-weight: 600;
  color: var(--slate);
  background: var(--cloud);
  border: 1px solid var(--line);
  padding: 2px 8px;
  border-radius: 999px;
}

.doc-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--slate);
  font-weight: 600;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.doc-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.doc-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.doc-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 10px;
  transition: all 0.2s ease;
}

.doc-btn--ghost {
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
}

.doc-btn--ghost:hover {
  border-color: var(--p);
  color: var(--pd);
  background: var(--pl);
}

.doc-btn--primary {
  background: var(--ink);
  color: #fff;
}

.doc-btn--primary:hover {
  background: var(--orange);
}

.doc-btn--locked {
  background: var(--orange-light);
  color: var(--orange);
}

.doc-btn--locked:hover {
  background: var(--orange);
  color: #fff;
}

/* Chế độ xem danh sách */
.lib-grid.is-list {
  grid-template-columns: 1fr;
  gap: 12px;
}

.lib-grid.is-list .doc-card {
  flex-direction: row;
  align-items: stretch;
}

.lib-grid.is-list .doc-cover {
  width: 150px;
  height: auto;
  min-height: 130px;
  flex-shrink: 0;
}

.lib-grid.is-list .doc-cover .ext {
  font-size: 30px;
}

.lib-grid.is-list .doc-cover .sheet {
  width: 40px;
  height: 50px;
}

.lib-grid.is-list .doc-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  grid-template-areas:
    "cat actions"
    "title actions"
    "desc actions";
  column-gap: 20px;
  align-items: center;
}

.lib-grid.is-list .doc-cat { grid-area: cat; }
.lib-grid.is-list .doc-body h3 { grid-area: title; margin-bottom: 4px; }
.lib-grid.is-list .doc-body p { grid-area: desc; -webkit-line-clamp: 2; margin-bottom: 0; }
.lib-grid.is-list .doc-tags { display: none; }
.lib-grid.is-list .doc-actions { grid-area: actions; flex-direction: column; margin-top: 0; align-self: center; }

@media (max-width: 700px) {
  .lib-grid.is-list .doc-card {
    flex-direction: column;
  }
  .lib-grid.is-list .doc-cover {
    width: 100%;
    min-height: 110px;
  }
  .lib-grid.is-list .doc-body {
    display: flex;
  }
  .lib-grid.is-list .doc-actions {
    flex-direction: row;
    margin-top: 12px;
  }
}

/* Skeleton loading */
.doc-skeleton {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
}

.doc-skeleton .sk {
  background: linear-gradient(90deg, #EEF3F4 0%, #F7FAFA 50%, #EEF3F4 100%);
  background-size: 200% 100%;
  animation: skShine 1.2s linear infinite;
  border-radius: 6px;
}

@keyframes skShine {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* Empty state */
.lib-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 56px 24px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: var(--cloud);
}

.lib-empty .big {
  font-size: 40px;
  margin-bottom: 10px;
}

.lib-empty h3 {
  font-size: 20px;
  margin-bottom: 6px;
}

.lib-empty p {
  color: var(--slate);
  font-size: 14.5px;
  margin-bottom: 18px;
}

.lib-more {
  display: flex;
  justify-content: center;
  margin-top: 32px;
}

/* Modal xem trước tài liệu */
.doc-modal {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(6, 17, 26, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.doc-modal.is-open {
  display: flex;
  animation: modalFadeIn 0.2s ease;
}

.doc-modal-box {
  position: relative;
  background: #fff;
  border-radius: 20px;
  max-width: 760px;
  width: 100%;
  max-height: 92vh;
  overflow: auto;
  display: grid;
  grid-template-columns: 240px 1fr;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.35);
  animation: modalScaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.doc-modal-box .doc-cover {
  height: 100%;
  min-height: 260px;
}

.doc-modal-body {
  padding: 30px 28px 26px;
}

.doc-modal-body h3 {
  font-size: 22px;
  margin: 8px 0 10px;
}

.doc-modal-body p {
  color: var(--slate);
  font-size: 14.5px;
  margin-bottom: 18px;
}

.doc-spec {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.doc-spec div {
  background: var(--cloud);
  border-radius: 10px;
  padding: 10px 12px;
}

.doc-spec dt {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--slate);
}

.doc-spec dd {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-top: 2px;
}

.doc-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--cloud);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: all 0.2s ease;
}

.doc-modal-close:hover {
  background: var(--orange);
  color: #fff;
  transform: rotate(90deg);
}

@media (max-width: 700px) {
  .doc-modal-box {
    grid-template-columns: 1fr;
  }
  .doc-modal-box .doc-cover {
    min-height: 150px;
  }
}

/* Toast thông báo nhỏ */
.res-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: 12px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 3000;
  max-width: calc(100% - 40px);
  text-align: center;
}

.res-toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .asset-card,
  .doc-card {
    animation: none;
  }
}

/* ==========================================================================
   Thư viện tài liệu động: bìa ảnh, lượt xem, popup nhập thông tin tải về
   ========================================================================== */
.doc-card { cursor: pointer; }
.doc-card:focus-visible { outline: 3px solid var(--p); outline-offset: 2px; }

.doc-cover.has-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  padding: 0;
  background: var(--cloud);
  position: relative;
  overflow: hidden;
}
.doc-cover.has-img::before { display: none; }
.doc-cover.has-img .sheet { display: none; }
.doc-cover.has-img img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  transition: transform 0.35s ease;
}
.doc-card:hover .doc-cover.has-img img { transform: scale(1.04); }
.doc-cover.has-img .ext {
  position: absolute;
  left: 12px;
  bottom: 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  line-height: 1;
  padding: 6px 9px;
  border-radius: 7px;
  background: rgba(12, 42, 58, 0.88);
  opacity: 1;
}

.doc-views {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--slate);
}
.doc-views svg { flex-shrink: 0; color: var(--p); }
.doc-views .doc-size { color: #8aa0a8; font-weight: 500; }
.lib-grid.is-list .doc-views { grid-area: cat; margin-top: 0; }
.lib-grid.is-list .doc-cover.has-img {
  width: 130px;
  height: 130px;
  min-height: 130px;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
}

/* Popup điền thông tin (dùng lại nền .doc-modal) */
.dl-box {
  position: relative;
  background: #fff;
  border-radius: 20px;
  width: 100%;
  max-width: 440px;
  max-height: 92vh;
  overflow: auto;
  padding: 30px 28px 24px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.35);
  animation: modalScaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.dl-box h3 {
  font-size: 21px;
  line-height: 1.3;
  color: var(--ink);
  margin: 8px 36px 8px 0;
}
.dl-sub {
  font-size: 13.5px;
  color: var(--slate);
  line-height: 1.6;
  margin-bottom: 20px;
}
.dl-submit { width: 100%; height: 48px; font-size: 15.5px; margin-top: 6px; }
.dl-note { font-size: 12px; color: #8aa0a8; text-align: center; margin-top: 12px; line-height: 1.5; }
.dl-error {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #FDECEC;
  color: #8A1F1F;
  font-size: 13px;
  line-height: 1.5;
}
.dl-error[hidden] { display: none; }

/* Showcase modal (khi đã ghi danh) — format ảnh bìa tỉ lệ 1:1 */
#showcaseModal .doc-modal-box {
  max-width: 900px;
  width: 100%;
  display: grid;
  grid-template-columns: 410px 1fr;
  align-items: stretch;
  border-radius: 24px;
  overflow: hidden;
  background: #fff;
  position: relative;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.3);
}

.sc-cover-col {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(150deg, #f0f6f7 0%, #f7fafb 100%);
  border-right: 1px solid rgba(13, 160, 150, 0.12);
  box-sizing: border-box;
}

#showcaseModal #scCover.doc-cover.has-img {
  width: 100%;
  max-width: 362px;
  aspect-ratio: 1 / 1;
  height: auto;
  min-height: 0;
  padding: 0;
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 12px 30px rgba(12, 42, 58, 0.12), 0 2px 6px rgba(12, 42, 58, 0.05);
  border: 1px solid rgba(12, 42, 58, 0.06);
}

#showcaseModal #scCover.doc-cover.has-img img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  display: block;
}

#showcaseModal #scCover.doc-cover.has-img .ext {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 2;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
}

#showcaseModal .doc-modal-body {
  padding: 28px 30px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.sc-badge-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  padding-right: 44px; /* Tránh nút đóng X ở góc */
}
.sc-badge-row .eyebrow {
  margin-bottom: 0;
}
.sc-status-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(13, 160, 150, 0.12);
  color: var(--p);
  border: 1px solid rgba(13, 160, 150, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.sc-desc {
  color: var(--slate);
  font-size: 14px;
  line-height: 1.65;
  margin-bottom: 18px;
  max-height: 140px;
  overflow-y: auto;
  white-space: pre-line;
}
.sc-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}
.sc-dl-btn {
  flex: 1;
  min-height: 46px;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.sc-note {
  font-size: 12px;
  color: #8aa0a8;
  margin-top: 12px;
  margin-bottom: 0;
  text-align: center;
  line-height: 1.5;
}
@media (max-width: 800px) {
  #showcaseModal .doc-modal-box {
    grid-template-columns: 1fr;
    max-height: 90vh;
    overflow-y: auto;
  }
  .sc-cover-col {
    padding: 20px 20px 0;
    border-right: none;
    background: transparent;
  }
  #showcaseModal #scCover.doc-cover.has-img {
    max-width: 300px;
    margin: 0 auto;
  }
  #showcaseModal .doc-modal-body {
    padding: 20px 22px 24px;
  }
  .sc-actions {
    flex-direction: column;
  }
}

