/* EasyFiveM Community — clean 4-column gallery */

.cg-page {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 90% 50% at 50% -10%, rgba(251, 191, 36, 0.05), transparent 55%),
    #050508;
  color: #ececf1;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.cg-shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: calc(var(--site-header-h, 88px) + 24px) 20px 72px;
}

/* Hero */
.cg-hero {
  margin-bottom: 32px;
}

.cg-hero-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 14px;
  margin-bottom: 6px;
}

.cg-title {
  margin: 0;
  font-size: clamp(1.5rem, 2.5vw, 1.875rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: #fff;
}

.cg-count {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.38);
}

.cg-sub {
  margin: 0 0 18px;
  max-width: 520px;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.45);
}

.cg-search {
  display: flex;
  gap: 8px;
  max-width: 400px;
}

.cg-search-input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
  font-size: 13px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.cg-search-input::placeholder {
  color: rgba(255, 255, 255, 0.28);
}

.cg-search-input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
}

.cg-search-btn {
  flex-shrink: 0;
  padding: 10px 18px;
  border: 0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: #0a0a0c;
  background: #f5f5f7;
  transition: background 0.15s;
}

.cg-search-btn:hover {
  background: #fff;
}

/* Status */
.cg-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 16px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
}

.cg-status[hidden],
.cg-grid[hidden],
.cg-empty[hidden],
.cg-more-wrap[hidden],
.cg-skeleton[hidden] {
  display: none !important;
}

.cg-spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-top-color: rgba(255, 255, 255, 0.55);
  animation: cg-spin 0.65s linear infinite;
}

@keyframes cg-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Skeleton */
.cg-skeleton {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.cg-skel-card {
  border-radius: 12px;
  overflow: hidden;
  background: #0c0c10;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.cg-skel-thumb {
  aspect-ratio: 1;
  background: linear-gradient(
    110deg,
    rgba(255, 255, 255, 0.03) 8%,
    rgba(255, 255, 255, 0.07) 18%,
    rgba(255, 255, 255, 0.03) 33%
  );
  background-size: 200% 100%;
  animation: cg-shimmer 1.2s ease-in-out infinite;
}

.cg-skel-foot {
  height: 52px;
  margin: 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  animation: cg-shimmer 1.2s ease-in-out infinite;
}

@keyframes cg-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Grid */
.cg-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

@media (max-width: 1100px) {
  .cg-grid,
  .cg-skeleton {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .cg-grid,
  .cg-skeleton {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .cg-shell {
    padding-left: 14px;
    padding-right: 14px;
  }
}

@media (max-width: 420px) {
  .cg-grid,
  .cg-skeleton {
    grid-template-columns: 1fr;
  }
}

/* Card */
.cg-card {
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, #12121a 0%, #0a0a0f 100%);
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
  transition: border-color 0.22s ease, box-shadow 0.22s ease, transform 0.22s ease;
}

.cg-card:hover {
  border-color: rgba(251, 191, 36, 0.22);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.38), 0 0 0 1px rgba(251, 191, 36, 0.06);
  transform: translateY(-2px);
}

/* Thumbnail */
#community-root .community-prop-thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  cursor: pointer;
  overflow: hidden;
  background: #09090d !important;
  transition: none;
}

#community-root .community-prop-thumb::before,
#community-root .community-prop-thumb::after {
  display: none !important;
}

#community-root .community-prop-thumb:hover {
  filter: none;
}

.cg-thumb-inner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 80% 55% at 50% 100%, rgba(251, 191, 36, 0.06), transparent 62%),
    linear-gradient(180deg, #14141c 0%, #09090d 100%);
}

.cg-thumb-inner.is-missing .cg-thumb-placeholder {
  display: none;
}

.cg-thumb-fallback {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.14);
  pointer-events: none;
}

.cg-thumb-fallback svg {
  width: 42px;
  height: 42px;
}

.cg-thumb-inner.is-missing .cg-thumb-fallback {
  display: flex;
}

.cg-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.35s ease;
}

#community-root .cg-thumb-img.community-thumb-img {
  object-fit: cover;
  object-position: center;
}

.cg-thumb-img.is-loaded {
  opacity: 1;
}

.cg-thumb-img.is-error {
  display: none;
}

.cg-card:hover .cg-thumb-img.is-loaded {
  transform: scale(1.03);
}

.cg-thumb-placeholder {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    110deg,
    rgba(255, 255, 255, 0.02) 8%,
    rgba(255, 255, 255, 0.05) 18%,
    rgba(255, 255, 255, 0.02) 33%
  );
  background-size: 200% 100%;
  animation: cg-shimmer 1.2s ease-in-out infinite;
  pointer-events: none;
}

.cg-thumb-inner.has-image .cg-thumb-placeholder,
.cg-thumb-inner.is-missing .cg-thumb-placeholder {
  display: none;
}

.cg-3d-pill {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fde68a;
  background: rgba(8, 8, 12, 0.72);
  border: 1px solid rgba(251, 191, 36, 0.28);
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.cg-view-hint {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #fff;
  background: rgba(0, 0, 0, 0.42);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.cg-card:hover .cg-view-hint {
  opacity: 1;
}

/* Card body */
.cg-card-body {
  padding: 12px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cg-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.cg-card-head .cg-prop-name {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.cg-prop-name {
  margin: 0;
  min-width: 0;
  font-size: 13px;
  font-weight: 650;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

/* Likes & favorites — compact row beside title on cards */
#community-root .cg-reactions--head {
  flex-shrink: 0;
  padding: 0;
  margin: 0;
  align-self: center;
  background: transparent;
  border: 0;
  gap: 2px;
}

#community-root .cg-reactions--head .cg-react {
  padding: 2px 5px;
  gap: 3px;
  font-size: 10px;
}

#community-root .cg-reactions--head .cg-react-icon {
  width: 12px;
  height: 12px;
}

/* Likes & favorites — modal / standalone row */
#community-root .cg-reactions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
}

#community-root .cg-reactions--inline {
  padding: 4px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  align-self: center;
  margin-inline: auto;
}

.cg-react {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.cg-react:hover {
  color: rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.06);
}

.cg-react:disabled {
  opacity: 0.5;
  cursor: wait;
}

.cg-react-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.cg-react-like.is-active {
  color: #fb7185;
  background: rgba(251, 113, 133, 0.1);
}

.cg-react-like.is-active .cg-react-icon path {
  fill: rgba(251, 113, 133, 0.22);
  stroke: #fb7185;
}

.cg-react-fav.is-active {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.1);
}

.cg-react-fav.is-active .cg-react-icon path {
  fill: rgba(251, 191, 36, 0.22);
  stroke: #fbbf24;
}

.cg-react-count {
  min-width: 1ch;
  line-height: 1;
}

.community-3d-modal-reactions {
  margin-top: 10px;
}

.community-3d-modal-reactions .cg-reactions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  width: fit-content;
}

.community-3d-modal-reactions .cg-reactions--inline {
  padding: 4px 8px;
  border-radius: 10px;
}

.cg-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.cg-meta-lines {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.cg-meta-author {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.78);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.cg-meta-sub {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.34);
  line-height: 1.3;
}

.cg-avatar {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.cg-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.5);
}

.cg-import {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  color: #fde68a !important;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.22);
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
  white-space: nowrap;
}

.cg-import:hover {
  background: rgba(251, 191, 36, 0.14);
  border-color: rgba(251, 191, 36, 0.38);
  transform: translateY(-1px);
}

.cg-import:focus-visible {
  outline: 2px solid rgba(251, 191, 36, 0.45);
  outline-offset: 2px;
}

.cg-admin-bar {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}

.cg-admin-btn {
  flex: 1;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.72);
  font-size: 10px;
  font-weight: 650;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.cg-admin-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.cg-admin-delete {
  border-color: rgba(248, 113, 113, 0.35);
  color: #fca5a5;
}

.cg-admin-delete:hover {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.5);
  color: #fecaca;
}

/* Empty */
.cg-empty {
  text-align: center;
  padding: 48px 20px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.4);
  font-size: 14px;
}

.cg-empty a {
  color: #f4f4f5;
  font-weight: 600;
  text-decoration: none;
}

.cg-empty a:hover {
  text-decoration: underline;
}

/* Load more */
.cg-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 32px;
}

.cg-more-btn {
  padding: 10px 24px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.cg-more-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.cg-more-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.community-gallery:not(#community-root) {
  display: none !important;
}
