/* The UGC reports website's layout, on top of the shared Discord theme (/discord.css): a title bar, the categories down
   the side like a server's channels, and the items in a grid */

.app {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 48px;
  padding: 0 12px 0 16px;
  min-width: 0;
  flex: none;
}

.spacer {
  flex: 1;
}

.live {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--background-mod-strong);
  flex: none;
}

.live.on .dot {
  background: var(--status-online);
}

.live.down .dot {
  background: var(--status-warning);
}

/* the two panels, inset into the frame like Discord's */
.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  border-top: 1px solid var(--app-frame-border);
  border-left: 1px solid var(--app-frame-border);
  border-top-left-radius: var(--radius-sm);
  overflow: hidden;
}

/* the categories, like a server's channel list */
.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--background-base-lower);
  border-right: 1px solid var(--border-subtle);
}

.sidebar-head {
  padding: 16px 16px 6px;
}

.category-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.channel,
.channel:hover:not(:disabled),
.channel:active:not(:disabled) {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--channels-default);
  font-size: 16px;
  font-weight: 500;
  text-align: left;
}

.channel:hover:not(:disabled) {
  background: var(--interactive-background-hover);
  color: var(--interactive-text-hover);
}

.channel.selected,
.channel.selected:hover:not(:disabled) {
  background: var(--interactive-background-selected);
  color: var(--interactive-text-active);
}

.channel .icon {
  width: 20px;
  height: 20px;
  color: var(--channels-default);
}

.channel.selected .icon {
  color: var(--interactive-text-active);
}

.channel-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel .count {
  flex: none;
}

.channel.muted-row {
  color: var(--text-muted);
  opacity: .6;
}

.cat-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin: 0 5px;
  border-radius: 50%;
  flex: none;
  background: var(--cat-colour, var(--text-muted));
}

/* (each category's colour, in a fixed order, from a palette checked for colour blindness and contrast on this
   background. The name is always shown beside it) */
.c0 {
  --cat-colour: #3987e5;
}

.c1 {
  --cat-colour: #d95926;
}

.c2 {
  --cat-colour: #199e70;
}

.c3 {
  --cat-colour: #d55181;
}

.c4 {
  --cat-colour: #9085e9;
}

.c5 {
  --cat-colour: #c98500;
}

.c6 {
  --cat-colour: #008300;
}

.c7 {
  --cat-colour: #e66767;
}

.sidebar-foot {
  padding: 12px 16px 14px;
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
  line-height: 16px;
  color: var(--text-muted);
}

.sidebar-foot p {
  margin: 0 0 6px;
}

.scrim {
  display: none;
}

/* the main panel, with a header like a channel's */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--background-base-lower);
}

.channel-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  min-height: 48px;
  padding: 8px 12px 8px 16px;
  border-bottom: 1px solid var(--border-subtle);
  flex: none;
}

.menu-button {
  display: none;
}

.channel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.channel-title h1 {
  font-size: 16px;
  line-height: 20px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.head-divider {
  width: 1px;
  height: 24px;
  background: var(--border-normal);
  flex: none;
}

/* the status tabs, like Discord's friends list */
.tabs {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tabs button {
  min-width: 0;
  height: 30px;
  padding: 2px 10px;
  border-color: transparent;
  background: transparent;
  color: var(--interactive-text-default);
  font-size: 15px;
  font-weight: 500;
}

.tabs button:hover:not(:disabled) {
  background: var(--interactive-background-hover);
  color: var(--interactive-text-hover);
}

.tabs button[aria-selected="true"],
.tabs button[aria-selected="true"]:hover:not(:disabled) {
  background: var(--interactive-background-selected);
  color: var(--interactive-text-active);
}

.search-box {
  position: relative;
  width: 220px;
  flex: 0 1 220px;
  min-width: 140px;
  transition: flex-basis .2s ease;
}

.search-box:focus-within {
  flex-basis: 280px;
}

.search-box input {
  height: 32px;
  padding: 0 32px 0 10px;
  font-size: 14px;
  font-weight: 500;
}

.search-box input::-webkit-search-cancel-button {
  display: none;
}

.search-icon {
  position: absolute;
  right: 8px;
  top: 7px;
  color: var(--text-muted);
  pointer-events: none;
}

.sort-slot {
  width: 168px;
  flex: none;
}

/* the scrolling area */
.content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 24px 40px;
}

.topic {
  max-width: 820px;
  margin: 0 0 16px;
  color: var(--text-subtle);
  font-size: 15px;
  line-height: 20px;
}

/* the counts: Discord-style cards with one number each */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat {
  padding: 12px 16px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--background-base-low);
}

.stat .label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat .label .icon {
  width: 14px;
  height: 14px;
}

.stat-value {
  margin-top: 6px;
  font-size: 26px;
  line-height: 32px;
  font-weight: 700;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}

.stat-note {
  margin-top: 2px;
  font-size: 13px;
  color: var(--text-muted);
}

.stat .skeleton {
  height: 26px;
  width: 60%;
  margin-top: 8px;
}

.icon.good {
  color: var(--feedback-positive-text);
}

.icon.bad {
  color: var(--feedback-critical-text);
}

.icon.warn {
  color: var(--feedback-warning-text);
}

.section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
}

/* the items */
.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 12px;
}

.item-card,
.item-card:hover:not(:disabled),
.item-card:active:not(:disabled) {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  min-width: 0;
  height: auto;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--background-base-low);
  color: var(--text-default);
  font-weight: 400;
  line-height: 1.375;
  text-align: left;
  white-space: normal;
  overflow: hidden;
  transition: transform .15s ease-out, box-shadow .15s ease-out, border-color .15s ease-out, background-color .15s ease-out;
}

.item-card:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--border-normal);
  background: var(--background-surface-high);
  box-shadow: var(--shadow-high);
}

.item-card:active:not(:disabled) {
  transform: translateY(0);
}

/* a thumbnail: shimmers while it loads, and shows a picture icon if there isn't one */
.thumb {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  background: var(--background-base-lowest);
  overflow: hidden;
}

.thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity .25s ease-out;
}

.thumb.loaded img {
  opacity: 1;
}

/* (a gentle pulse while a thumbnail loads. It only changes opacity, which the browser can animate without repainting
   every card) */
.thumb.loading::before,
.skeleton-card .thumb::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--background-mod-subtle);
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: .35;
  }
}

.thumb .no-image {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

.thumb .no-image .icon {
  width: 32px;
  height: 32px;
  opacity: .6;
}

.thumb.empty .no-image {
  display: flex;
}

.thumb.empty img {
  display: none;
}

/* the status, over the top of the thumbnail */
.status-chip {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px 0 6px;
  border-radius: 11px;
  background: #1e1f22e6;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-chip .icon {
  width: 13px;
  height: 13px;
}

.status-Moderated {
  color: var(--feedback-positive-text);
  box-shadow: inset 0 0 0 1px #7ecb9440;
}

.status-Available {
  color: var(--feedback-critical-text);
  box-shadow: inset 0 0 0 1px #ffa39c40;
}

.status-Appealed {
  color: var(--feedback-warning-text);
  box-shadow: inset 0 0 0 1px #fbb32f40;
}

.item-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px 12px;
  min-width: 0;
}

.item-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 40px;
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
  color: var(--text-strong);
  overflow-wrap: anywhere;
}

.item-creator {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--text-muted);
}

.item-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  min-width: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-subtle);
}

.item-meta>span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  white-space: nowrap;
}

.item-meta .cat {
  overflow: hidden;
}

.item-meta .cat span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-meta .cat-dot {
  width: 8px;
  height: 8px;
  margin: 0;
}

.item-meta .icon {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.skeleton-card {
  pointer-events: none;
}

.skeleton-card .skeleton:first-child {
  width: 85%;
}

.skeleton-card .skeleton:nth-child(2) {
  width: 55%;
}

.skeleton-card .skeleton:nth-child(3) {
  width: 35%;
  height: 10px;
}

.list-end {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  min-height: 72px;
  color: var(--text-muted);
  font-size: 13px;
}

.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 56px 16px;
  color: var(--text-muted);
  text-align: center;
}

.empty-state .icon {
  width: 48px;
  height: 48px;
  margin-bottom: 4px;
  color: var(--text-muted);
  opacity: .7;
}

.empty-state b {
  color: var(--text-strong);
  font-size: 16px;
}

/* an item, opened */
dialog.item-modal {
  width: min(700px, calc(100vw - 32px));
}

.item-detail {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.item-detail .thumb {
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.facts {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 16px;
  margin: 14px 0 0;
}

.facts dt {
  color: var(--text-muted);
}

.facts dd {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.facts .cat-dot {
  margin: 0 2px 0 0;
}

.copy-id,
.copy-id:hover:not(:disabled) {
  height: 22px;
  min-width: 0;
  padding: 0 6px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
}

.copy-id:hover:not(:disabled) {
  background: var(--background-mod-normal);
  color: var(--text-strong);
}

.copy-id .icon {
  width: 14px;
  height: 14px;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.status-line .status-chip {
  position: static;
  background: var(--background-mod-subtle);
}

.status-note {
  margin: 8px 0 0;
  color: var(--text-subtle);
}

.description {
  margin-top: 20px;
}

.description .label {
  margin-bottom: 8px;
}

.quote {
  margin: 0;
  padding: 2px 0 2px 12px;
  border-left: 4px solid var(--border-strong);
  border-radius: 2px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text-default);
  font-size: 15px;
  line-height: 22px;
}

.form-message {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--text-muted);
}

.form-message.ok {
  color: var(--feedback-positive-text);
}

.form-message.bad {
  color: var(--feedback-critical-text);
}

.access-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* narrower screens: the categories slide out from the side */
@media (max-width: 960px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 60;
    width: min(300px, 86vw);
    border-right: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-high);
    transform: translateX(-100%);
    transition: transform .2s ease-out;
    visibility: hidden;
  }

  .sidebar.open {
    transform: none;
    visibility: visible;
  }

  .scrim:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(0, 0, 0, .6);
    animation: fade-in .2s ease-out;
  }

  .menu-button {
    display: inline-flex;
    margin-left: -6px;
  }
}

@media (max-width: 760px) {
  .topbar {
    padding: 0 8px 0 12px;
    gap: 10px;
  }

  .live #live-text {
    display: none;
  }

  .layout {
    border-left: 0;
    border-top-left-radius: 0;
  }

  .channel-head {
    padding: 8px 12px;
  }

  .head-divider,
  .channel-head>.spacer {
    display: none;
  }

  .channel-title {
    flex: 1;
  }

  .tabs {
    order: 3;
    width: 100%;
  }

  .tabs button {
    flex: 1;
    font-size: 14px;
  }

  .search-box,
  .search-box:focus-within {
    order: 4;
    flex: 1 1 auto;
    width: auto;
  }

  .sort-slot {
    order: 5;
    width: 140px;
  }

  .content {
    padding: 14px 12px 32px;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 18px;
  }

  .stat {
    padding: 10px 12px;
  }

  .stat-value {
    font-size: 22px;
    line-height: 28px;
  }

  .item-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
  }

  .item-body {
    padding: 8px 10px 10px;
  }

  .item-name {
    font-size: 14px;
    line-height: 18px;
    min-height: 36px;
  }

  .item-detail {
    grid-template-columns: minmax(0, 1fr);
  }

  .item-detail .thumb {
    width: min(220px, 100%);
    margin: 0 auto;
  }

  .modal-head {
    padding: 16px 12px 8px 16px;
  }

  .modal-body {
    padding: 4px 16px 16px;
  }

  .modal-foot {
    padding: 12px 16px;
  }
}
