/* =========================================================
   BACKGROUND 4K - GALLERY
========================================================= */


/* =========================================================
   GALLERY GRID
========================================================= */

.gallery-grid {
  display: grid;
  grid-template-columns:
    repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}

.gallery-card {
  position: relative;
  min-width: 0;
  overflow: hidden;

  background: rgba(16, 29, 50, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px;

  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.22);

  transition:
    transform 0.22s ease,
    border-color 0.22s ease,
    box-shadow 0.22s ease;
}

.gallery-card:hover {
  transform: translateY(-4px);

  border-color:
    rgba(255, 255, 255, 0.17);

  box-shadow:
    0 20px 42px rgba(0, 0, 0, 0.3);
}


/* =========================================================
   IMAGE AREA
========================================================= */

.gallery-image-area {
  position: relative;
  aspect-ratio: 16 / 9;

  overflow: hidden;

  background: #050b15;
  cursor: pointer;
}

.gallery-image {
  width: 100%;
  height: 100%;

  object-fit: cover;

  transition:
    transform 0.28s ease,
    filter 0.25s ease,
    opacity 0.25s ease;
}

.gallery-card:hover .gallery-image {
  transform: scale(1.035);
}


/* =========================================================
   CATEGORY HOVER - ADMIN / MANAGER
========================================================= */

.gallery-category-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;

  display: flex;
  justify-content: center;
  align-items: center;
  align-content: center;
  flex-wrap: wrap;
  gap: 7px;

  padding: 20px;

  opacity: 0;
  pointer-events: none;

  background: rgba(4, 9, 17, 0.44);

  transition: opacity 0.25s ease;
}

.gallery-card.can-view-categories
.gallery-image-area:hover
.gallery-category-overlay {
  opacity: 1;
}

.gallery-card.can-view-categories
.gallery-image-area:hover
.gallery-image {
  filter:
    brightness(0.55)
    blur(1.5px);
}

.category-tag {
  display: inline-flex;
  align-items: center;

  min-height: 27px;
  padding: 4px 9px;

  border:
    1px solid rgba(255, 255, 255, 0.18);

  border-radius: 999px;

  background: rgba(9, 18, 32, 0.88);
  color: #f7f9ff;

  font-size: 12px;
  font-weight: 700;

  backdrop-filter: blur(8px);
}


/* =========================================================
   CATEGORY CHECK ON
========================================================= */

.gallery-card.show-categories
.gallery-category-overlay {
  position: static;

  opacity: 1;
  pointer-events: auto;

  min-height: 46px;
  padding: 9px 11px;

  justify-content: flex-start;

  background: rgba(8, 17, 31, 0.94);
}

.gallery-card.show-categories
.gallery-image {
  filter: none !important;
}

.gallery-card.show-categories
.gallery-image-area:hover
.gallery-image {
  filter: none !important;
}


/* =========================================================
   CARD INFORMATION
========================================================= */

.gallery-card-body {
  padding: 14px 15px 16px;
}

.gallery-card-title {
  min-width: 0;
  margin: 0 0 11px;

  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;

  color: #fff;

  font-size: 16px;
  font-weight: 700;
}

.gallery-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.gallery-score {
  display: flex;
  align-items: center;
  gap: 13px;

  color: #b7c2d4;
  font-size: 13px;
}

.gallery-score-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.gallery-download-button {
  width: 37px;
  height: 37px;

  display: grid;
  place-items: center;

  flex: 0 0 auto;

  border-radius: 9px;

  background: rgba(255, 255, 255, 0.07);
  color: #fff;

  font-size: 17px;
}

.gallery-download-button:hover {
  background: rgba(124, 140, 255, 0.22);
}


/* =========================================================
   RANK BADGE
========================================================= */

.rank-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 5;

  min-width: 38px;
  height: 32px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 0 9px;

  border-radius: 999px;

  background: rgba(4, 9, 17, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.17);

  color: #fff;

  font-size: 13px;
  font-weight: 800;

  backdrop-filter: blur(8px);
}


/* =========================================================
   TOP 1
========================================================= */

.gallery-card.rank-1 {
  border-color: rgba(255, 213, 92, 0.72);

  box-shadow:
    0 0 0 1px rgba(255, 213, 92, 0.14),
    0 18px 50px rgba(207, 153, 28, 0.2);
}

.gallery-card.rank-1::before,
.gallery-card.rank-1::after {
  content: "❦";

  position: absolute;
  z-index: 6;

  color: #f2cc62;

  font-size: 29px;

  pointer-events: none;
}

.gallery-card.rank-1::before {
  top: 4px;
  right: 9px;
}

.gallery-card.rank-1::after {
  bottom: 5px;
  left: 9px;

  transform: rotate(180deg);
}

.gallery-card.rank-1 .rank-badge {
  background:
    linear-gradient(
      135deg,
      #7c5711,
      #d8a92f
    );

  border-color: #f7da7c;
}

.rank-title {
  margin-top: 9px;

  text-align: center;

  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.gallery-card.rank-1 .rank-title {
  color: #f5d87d;
}


/* =========================================================
   TOP 2
========================================================= */

.gallery-card.rank-2 {
  border-color: rgba(183, 213, 242, 0.62);

  box-shadow:
    0 0 0 1px rgba(183, 213, 242, 0.1),
    0 18px 45px rgba(121, 168, 211, 0.14);
}

.gallery-card.rank-2::before {
  content: "❧";

  position: absolute;
  top: 5px;
  right: 10px;
  z-index: 6;

  color: #c7def3;

  font-size: 26px;
}

.gallery-card.rank-2 .rank-badge {
  background:
    linear-gradient(
      135deg,
      #53697f,
      #9dbbd4
    );

  border-color: #d5e8f7;
}

.gallery-card.rank-2 .rank-title {
  color: #c8dff2;
}


/* =========================================================
   TOP 3
========================================================= */

.gallery-card.rank-3 {
  border-color: rgba(219, 143, 80, 0.6);

  box-shadow:
    0 0 0 1px rgba(219, 143, 80, 0.1),
    0 18px 45px rgba(177, 99, 47, 0.14);
}

.gallery-card.rank-3::before {
  content: "❧";

  position: absolute;
  top: 5px;
  right: 10px;
  z-index: 6;

  color: #dc955d;

  font-size: 25px;
}

.gallery-card.rank-3 .rank-badge {
  background:
    linear-gradient(
      135deg,
      #704328,
      #bd7545
    );

  border-color: #e2a071;
}

.gallery-card.rank-3 .rank-title {
  color: #e4a173;
}


/* =========================================================
   RANK 4 - 10
========================================================= */

.gallery-card.rank-top-10 {
  border-color: rgba(132, 158, 126, 0.34);
}

.gallery-card.rank-top-10::after {
  content: "❧";

  position: absolute;
  right: 8px;
  bottom: 6px;
  z-index: 2;

  color: rgba(171, 203, 158, 0.48);

  font-size: 21px;

  pointer-events: none;
}


/* =========================================================
   SMART CHOICE BANNER
========================================================= */

.smart-choice-banner {
  grid-column: 1 / -1;

  margin: 12px 0 0;
  padding: 14px 20px;

  border:
    1px solid rgba(137, 207, 157, 0.35);

  border-radius: 13px;

  background:
    linear-gradient(
      90deg,
      rgba(78, 138, 91, 0.17),
      rgba(102, 168, 118, 0.08)
    );

  color: #b8e4c2;

  text-align: center;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.25px;
}


/* =========================================================
   GUEST GALLERY
========================================================= */

.guest-gallery .gallery-card {
  border-color: rgba(255, 255, 255, 0.08);
}

.guest-gallery .gallery-card::before,
.guest-gallery .gallery-card::after,
.guest-gallery .rank-badge,
.guest-gallery .rank-title,
.guest-gallery .gallery-score,
.guest-gallery .gallery-download-button,
.guest-gallery .gallery-category-overlay {
  display: none !important;
}

.guest-gallery .gallery-card-body {
  padding: 13px 14px;
}

.guest-gallery .gallery-card-title {
  margin: 0;
}


/* =========================================================
   CATEGORIES GRID
========================================================= */

.categories-grid {
  display: grid;

  grid-template-columns:
    repeat(auto-fill, minmax(250px, 1fr));

  gap: 22px;
}

.category-card {
  position: relative;

  min-height: 180px;

  overflow: hidden;

  border:
    1px solid rgba(255, 255, 255, 0.1);

  border-radius: 17px;

  background: #101d32;

  cursor: pointer;

  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.22);

  transition:
    transform 0.22s ease,
    border-color 0.22s ease;
}

.category-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.2);
}

.category-card-image {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;

  object-fit: cover;

  transition: transform 0.3s ease;
}

.category-card:hover .category-card-image {
  transform: scale(1.045);
}

.category-card-overlay {
  position: absolute;
  inset: 0;

  display: flex;
  flex-direction: column;
  justify-content: flex-end;

  padding: 19px;

  background:
    linear-gradient(
      180deg,
      rgba(5, 11, 21, 0.05),
      rgba(5, 11, 21, 0.9)
    );
}

.category-card-title {
  margin: 0;

  font-size: 21px;
  font-weight: 800;
}

.category-card-count {
  margin-top: 4px;

  color: #c0cad9;
  font-size: 13px;
}


/* =========================================================
   EMPTY / ERROR STATE
========================================================= */

.gallery-empty,
.gallery-error {
  grid-column: 1 / -1;

  padding: 55px 20px;

  border:
    1px dashed rgba(255, 255, 255, 0.14);

  border-radius: 16px;

  text-align: center;
}

.gallery-empty {
  color: #8f9cb0;
}

.gallery-error {
  color: #ff939b;
}


/* =========================================================
   SKELETON
========================================================= */

.gallery-skeleton {
  overflow: hidden;

  border-radius: 16px;

  background: #101d32;
}

.gallery-skeleton-image {
  aspect-ratio: 16 / 9;

  background:
    linear-gradient(
      90deg,
      #101d32,
      #192a45,
      #101d32
    );

  background-size: 200% 100%;

  animation:
    gallery-skeleton-loading
    1.3s linear infinite;
}

.gallery-skeleton-body {
  height: 70px;
}

@keyframes gallery-skeleton-loading {
  from {
    background-position: 200% 0;
  }

  to {
    background-position: -200% 0;
  }
}


/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 900px) {
  .gallery-grid {
    grid-template-columns:
      repeat(auto-fill, minmax(220px, 1fr));

    gap: 17px;
  }

  .categories-grid {
    grid-template-columns:
      repeat(auto-fill, minmax(210px, 1fr));

    gap: 17px;
  }
}


@media (max-width: 560px) {
  .gallery-grid {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));

    gap: 10px;
  }

  .gallery-card {
    border-radius: 11px;
  }

  .gallery-card-body {
    padding: 10px;
  }

  .gallery-card-title {
    margin-bottom: 7px;

    font-size: 13px;
  }

  .gallery-score {
    gap: 7px;
    font-size: 11px;
  }

  .gallery-download-button {
    width: 31px;
    height: 31px;

    font-size: 14px;
  }

  .rank-badge {
    top: 6px;
    left: 6px;

    min-width: 31px;
    height: 27px;

    padding: 0 7px;

    font-size: 11px;
  }

  .rank-title {
    font-size: 10px;
  }

  .category-tag {
    min-height: 23px;

    padding: 3px 7px;

    font-size: 10px;
  }

  .gallery-category-overlay {
    gap: 5px;
    padding: 10px;
  }

  .categories-grid {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));

    gap: 10px;
  }

  .category-card {
    min-height: 130px;
    border-radius: 12px;
  }

  .category-card-overlay {
    padding: 12px;
  }

  .category-card-title {
    font-size: 16px;
  }

  .category-card-count {
    font-size: 11px;
  }

  .smart-choice-banner {
    padding: 11px 14px;
    font-size: 13px;
  }
}
