.gallery-layout {
  width: 100%;
  max-width: 1920px;
  margin: auto;
  display: flex;
  padding-left: 5%;
}
.gallery-sidebar-overlay{visibility: hidden;transition: all ease 0.5s}
.gallery-view-inmobile{display: none;}
.gallery-sidebar {
  width: 14%;
  border-right: 1px solid #ccc;
  padding-right: 20px;
}
.gallery-title {
  padding-left: 2rem;
}
.gallery-content {
  width: 86%;
  padding-left: 14px;
}
.gallery-sidebar ul {
  list-style: none;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 30px;
  z-index: 1;
  position: relative;
}

.gallery-tree {
  list-style: none;
  padding-left: 0px;
  margin-left: 0;
}

.tree-row {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  justify-content: space-between;
}

.toggle {
  min-width: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  user-select: none;
  font-weight: 500;
}

.spacer {
  width: 18px;
}

.tree-item ul {
  margin-left: 18px;
  display: none; /* default collapse */
}

.tree-item.open > ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 0;
}

.post-list {
  list-style: none;
  padding-left: 18px;
}

.post-list li {
  font-size: 13px;
}
.gallery-tree.level-2 .post-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.gallery-sidebar .gallery-tree .tree-item .tree-row > a {
  color: #000;
  font-size: 18px;
  font-weight: 500;
}
.gallery-tree.level-1 a {
  text-transform: uppercase;
  letter-spacing: 1.2px;
}
.gallery-tree.level-1 .tree-item > .tree-row > a {
  font-size: 14px;
}
.gallery-sidebar .gallery-tree .tree-item .tree-row > a,
.gallery-tree.level-1 .tree-item > .tree-row > a,
.gallery-tree.level-1 .tree-item > .tree-row > a:focus {
  outline: none;
}

.gallery-tree.level-2 .post-list a {
  font-size: 11px;
}

.post-list li a {
  color: #666;
}

.tree-item.has-child {
  position: relative;
}
.tree-item.has-child.open .gallery-tree {
  position: relative;
}
.tree-item.has-child.open .gallery-tree:after {
  content: "";
  position: absolute;
  top: 15px;
  left: -18px;
  height: calc(100% - 30px);
  border-left: 1px solid #ccc;
}

/* loading spinner */
#contain-gallery {
  position: relative;
  min-height: 300px;
}

.gallery-loading-state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.6);
  z-index: 5;
}

.spinner {
  width: 42px;
  height: 42px;
  border: 3px solid #ddd;
  border-top-color: #333;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* loading skeleton */
.skeleton-grid .gallery-item {
  margin-bottom: 10px;
}

.skeleton-box {
  width: 100%;
  //border-radius: 8px;
  background: linear-gradient(90deg, #eee 25%, #f5f5f5 37%, #eee 63%);
  background-size: 400% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}

@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: 0 0;
  }
}

/* grid order */
.gallery-grid {
  position: relative;
  width: 100%;
}

.gallery-loading {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.gallery-grid.is-loading .gallery-loading {
  opacity: 1;
}

/* item masonry */
.gallery-item {
  width: calc(25% - 10px); /* 4 cột desktop */
  margin-bottom: 10px;
  overflow: hidden;
  box-sizing: border-box;
  cursor: pointer;
}

/* ảnh */
.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.3s ease;
}

.gallery-item:hover img {
  transform: scale(1.03);
}

.gallery-sidebar-close{display: none;}

@media (max-width: 1200px) {
  .gallery-item {
    width: calc(100% / 3 - 7px); /* 3 cột */
  }
}

@media (max-width: 1024px) {
  .detailpage-container{position: relative;}
  .gallery-sidebar-overlay{position: absolute;top:0;left:0;width: 100%;height: 100%;background: rgba(0,0,0,0.3);opacity: 0;}
  .gallery-sidebar-overlay.active{z-index: 1;visibility: visible;opacity: 1}
  .gallery-sidebar-close{block;color:#141414;display: block; position: relative; z-index: 1; margin-bottom: 2rem; text-align: right;}
  .gallery-title {
    padding-left: 0rem;
  }
  .archive-title {
    font-size: 32px;
  }
  .gallery-layout {
    padding-left: 0;
  }
  .gallery-content {
    width: 100%;
    padding-left: 0;
    padding: 0 5%;
  }
  .gallery-sidebar {
    position: absolute;
    background: #fff;
    height: 100vh;
    z-index: 1;
    border-right: 0;
    width: 300px;
    padding: 20px;
    left: -320px;
    transition: all ease 0.5s;
  }
  .gallery-sidebar.active{left: 0;}
  .gallery-sidebar:after {
    content: "";
    position: absolute;
    top: -200%;
    left: 0;
    background: #fff;
    width: 100%;
    height: 500%;
    box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.3);
  }
}

@media (max-width: 768px) {
  .gallery-item {
    width: calc(50% - 5px); /* 2 cột */
  }
}

@media (max-width: 480px) {
  .gallery-item {
    width: 100%; /* 1 cột */
  }
}
