/* ==========================================================================
   NETPIX - CATEGORY & RESOURCE LISTING PAGE STYLES
   ========================================================================== */

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

/* Main Category Layout Wrapper */
.category-page-wrap {
  padding: 24px 0 64px;
  background-color: var(--bg-body);
  min-height: calc(100vh - 68px - 300px);
}

.category-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  width: 100%;
}

/* ==========================================================================
   LEFT SIDEBAR (BỘ LỌC & DANH MỤC TRUY CẬP NHANH)
   ========================================================================== */
.category-sidebar {
  width: 270px;
  flex-shrink: 0;
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid #e5e7eb;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
  padding: 18px 16px;
  position: sticky;
  top: 86px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  scrollbar-width: thin;
}

.category-sidebar::-webkit-scrollbar {
  width: 5px;
}
.category-sidebar::-webkit-scrollbar-thumb {
  background: #e2e8f0;
  border-radius: 4px;
}

/* Home Link Item */
.sidebar-home-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: #111827;
  font-weight: 700;
  font-size: 0.95rem;
  background: transparent;
  transition: all 0.2s ease;
  text-decoration: none;
}

.sidebar-home-link svg {
  width: 18px;
  height: 18px;
  color: #111827;
  transition: color 0.2s ease;
}

.sidebar-home-link:hover,
.sidebar-home-link.active {
  background: #fef2f2;
  color: var(--color-primary);
}

.sidebar-home-link:hover svg,
.sidebar-home-link.active svg {
  color: var(--color-primary);
}

/* Sidebar Divider */
.sidebar-divider {
  height: 1px;
  background-color: #f1f5f9;
  margin: 14px 4px;
}

/* Sidebar Group */
.sidebar-group {
  margin-bottom: 6px;
}

.sidebar-group-title {
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #0f172a;
  margin: 6px 10px 12px;
}

/* Quick Access Folder Links (Truy Cập Nhanh) */
.quick-access-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.quick-access-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.quick-access-item:hover {
  background: #f1f5f9;
  color: var(--color-primary);
}

.quick-access-item.active {
  background: #fee2e2;
  color: var(--color-primary);
  font-weight: 700;
}

.quick-access-item svg.folder-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  color: #3b82f6;
  fill: #3b82f6;
  transition: transform 0.2s ease;
}

.quick-access-item:hover svg.folder-icon {
  transform: scale(1.1);
}

/* Filter Checkbox Lists (Tìm Kiếm Theo Chủ Đề & Ngành Nghề) */
.filter-checkbox-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.filter-checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease, color 0.15s ease;
  user-select: none;
}

.filter-checkbox-label:hover {
  background: #f8fafc;
  color: #0f172a;
}

.filter-checkbox-label input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid #cbd5e1;
  border-radius: 4px;
  background-color: #ffffff;
  cursor: pointer;
  display: grid;
  place-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.filter-checkbox-label input[type="checkbox"]::before {
  content: "";
  width: 9px;
  height: 9px;
  background-color: #ffffff;
  transform: scale(0);
  transition: transform 0.15s ease;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

.filter-checkbox-label input[type="checkbox"]:checked {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

.filter-checkbox-label input[type="checkbox"]:checked::before {
  transform: scale(1);
}

.filter-checkbox-label input[type="checkbox"]:checked ~ span {
  font-weight: 600;
  color: var(--color-primary);
}

/* ==========================================================================
   RIGHT MAIN CONTENT
   ========================================================================== */
.category-main-content {
  flex: 1;
  min-width: 0; /* Prevents flex overflow */
}

/* Search Box Container */
.category-search-bar {
  margin-bottom: 22px;
}

.category-search-bar .search-box {
  background: #ffffff;
  border: 1.5px solid #d1d5db;
  border-radius: var(--radius-pill);
  height: 52px;
  padding: 4px 8px 4px 18px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
  display: flex;
  align-items: center;
  transition: all 0.25s ease;
}

.category-search-bar .search-box:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(234, 56, 41, 0.1), 0 6px 18px rgba(0, 0, 0, 0.05);
}

/* ==========================================================================
   FILTER TOOLBAR (BỘ LỌC, MEMBER, MIỄN PHÍ, DROPDOWNS)
   ========================================================================== */
.category-filter-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.filter-heading-text {
  font-size: 1rem;
  font-weight: 800;
  color: #111827;
  margin-right: 4px;
}

/* Filter Tag Buttons */
.filter-tag-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  border: 1.5px solid transparent;
}

/* Member Tag (Yellow) */
.filter-tag-member {
  background-color: #facc15;
  color: #854d0e;
  border-color: #eab308;
  box-shadow: 0 2px 8px rgba(234, 179, 8, 0.25);
}

.filter-tag-member:hover,
.filter-tag-member.active {
  background-color: #eab308;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(234, 179, 8, 0.35);
}

.filter-tag-member svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

/* Free Tag (Pink/Gift) */
.filter-tag-free {
  background-color: #ffffff;
  color: #db2777;
  border-color: #fbcfe8;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.filter-tag-free:hover,
.filter-tag-free.active {
  background-color: #fdf2f8;
  border-color: #f472b6;
  color: #be185d;
  transform: translateY(-1px);
}

.filter-tag-free svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

/* Dropdown Filters (Định dạng file, Sắp xếp theo) */
.filter-dropdown-wrap {
  position: relative;
}

.filter-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  background: #f8fafc;
  color: #334155;
  border: 1.5px solid #e2e8f0;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-dropdown-btn:hover,
.filter-dropdown-btn.open {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
}

.filter-dropdown-btn svg.icon-main {
  width: 15px;
  height: 15px;
  color: #64748b;
}

.filter-dropdown-btn svg.chevron-icon {
  width: 12px;
  height: 12px;
  color: #94a3b8;
  transition: transform 0.2s ease;
}

.filter-dropdown-btn.open svg.chevron-icon {
  transform: rotate(180deg);
}

.filter-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 180px;
  background: #ffffff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0, 0, 0, 0.06);
  padding: 6px;
  display: none;
  flex-direction: column;
  z-index: 60;
  animation: dropdownFade 0.2s ease;
}

.filter-dropdown-menu.show {
  display: flex;
}

.filter-dropdown-item {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: #334155;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.15s ease, color 0.15s ease;
}

.filter-dropdown-item:hover {
  background: #fef2f2;
  color: var(--color-primary);
}

.filter-dropdown-item.active {
  background: #fee2e2;
  color: var(--color-primary);
  font-weight: 700;
}

/* ==========================================================================
   RESOURCE CARDS GRID (5 COLUMNS x 4 ROWS = 20 CARDS)
   ========================================================================== */
.resource-items-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}

/* Single Resource Card */
.res-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.3s ease, border-color 0.3s ease;
  cursor: pointer;
  aspect-ratio: 1 / 1.05;
}

.res-card:hover,
.res-card.active-card {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
  border-color: #cbd5e1;
}

/* Card Preview Stage (Checkered Transparency Grid) */
.res-card-preview {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f8fafc;
  background-image: 
    linear-gradient(45deg, #eef2f6 25%, transparent 25%), 
    linear-gradient(-45deg, #eef2f6 25%, transparent 25%), 
    linear-gradient(45deg, transparent 75%, #eef2f6 75%), 
    linear-gradient(-45deg, transparent 75%, #eef2f6 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
  padding: 18px 14px;
}

/* Main Lotus Graphic */
.res-card-img {
  width: 90%;
  height: 90%;
  object-fit: contain;
  display: block;
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.08));
}

.res-card:hover .res-card-img {
  transform: scale(1.08);
}

/* Top Badge: Free (Miễn phí) */
.res-badge-free {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #475569;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(226, 232, 240, 0.8);
  pointer-events: none;
  z-index: 5;
}

/* Top Badge: Crown Member (👑 Vàng) */
.res-badge-crown {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  background: #facc15;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(234, 179, 8, 0.4);
  pointer-events: none;
  z-index: 5;
}

.res-badge-crown svg {
  width: 14px;
  height: 14px;
  fill: #854d0e;
}

/* Bottom Action Bar */
.res-card-actions {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  z-index: 10;
}

/* Download Button ("Tải File") */
.res-btn-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-btn-orange);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.35);
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  border: none;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  flex: 1;
}

.res-btn-download:hover {
  background: #ea580c;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(234, 88, 12, 0.5);
}

/* For active card (like card 1 in mockup), download button is always visible */
.res-card.active-card .res-btn-download,
.res-card:hover .res-btn-download {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Bookmark Save Button (Pink Ribbon) */
.res-btn-bookmark {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  border: 1px solid #fbcfe8;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ec4899;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
}

.res-btn-bookmark:hover {
  background: #fdf2f8;
  color: #db2777;
  transform: scale(1.1);
  border-color: #f472b6;
}

.res-btn-bookmark.saved {
  background: #ec4899;
  color: #ffffff;
  border-color: #db2777;
}

.res-btn-bookmark svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  transition: fill 0.2s ease;
}

.res-btn-bookmark.saved svg {
  fill: currentColor;
}

/* ==========================================================================
   LOAD MORE ACTION BUTTON ("XEM THÊM")
   ========================================================================== */
.category-loadmore-wrap {
  text-align: center;
  margin-top: 36px;
  margin-bottom: 24px;
}

.btn-loadmore-gradient {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 48px;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, #ea3829 0%, #f97316 60%, #f59e0b 100%);
  color: #ffffff;
  font-size: 0.92rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  box-shadow: 0 6px 20px rgba(234, 56, 41, 0.35);
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  border: none;
  cursor: pointer;
}

.btn-loadmore-gradient:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 10px 28px rgba(234, 56, 41, 0.5);
}

/* ==========================================================================
   RESPONSIVE DESIGN FOR CATEGORY PAGE
   ========================================================================== */
@media (max-width: 1360px) {
  .resource-items-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 1180px) {
  .category-layout {
    gap: 20px;
    align-items: flex-start;
  }

  .category-sidebar {
    width: 235px;
    padding: 14px 12px;
  }

  .resource-items-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }
}

@media (max-width: 900px) {
  .category-layout {
    flex-direction: column;
    gap: 20px;
  }

  .category-sidebar {
    width: 100%;
    position: static;
    max-height: none;
    overflow-y: visible;
  }

  .quick-access-list {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .filter-checkbox-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .resource-items-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 860px) {
  .resource-items-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }

  .category-filter-toolbar {
    gap: 8px;
  }

  .filter-tag-btn, .filter-dropdown-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
  }
}

@media (max-width: 600px) {
  .resource-items-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .category-search-bar .search-box {
    height: 46px;
  }

  .btn-loadmore-gradient {
    width: 100%;
    padding: 12px 24px;
  }
}
