/**
 * MediaListView — card-grid list view for the Media collection.
 */

.header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: 0.125rem;
  padding-bottom: 0.125rem;
}

.heading {
  margin: 0;
  padding-bottom: 0.125rem;
}

.create-link {
  margin-left: auto;
}

.stats {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 1.75rem;
  min-width: 1.75rem;
  padding: 0.3125rem 0.375rem;
  margin-bottom: -0.25rem;
  white-space: nowrap;
  font-size: var(--font-size-sm);
  line-height: 0;
  background-color: var(--gray-25);
  border: var(--border-width-thin) var(--border-style-solid) var(--gray-200);
  border-radius: var(--border-radius-sm);
}

:is([data-theme="dark"], :global(.dark)) .stats {
  background-color: var(--canvas-700);
}

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-start;
  margin-top: 0.75rem;
  margin-bottom: 1rem;
}

@media (min-width: 40rem) {
  .toolbar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
}

.search {
  width: 100%;
  max-width: 21.875rem;
}

.order-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

@media (min-width: 40rem) {
  .order-group {
    margin-left: auto;
  }
}

.order-label {
  font-size: var(--font-size-sm);
  white-space: nowrap;
  color: var(--gray-500);
}

:is([data-theme="dark"], :global(.dark)) .order-label {
  color: var(--gray-400);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 5rem;
  padding-bottom: 5rem;
  color: var(--gray-500);
}

:is([data-theme="dark"], :global(.dark)) .empty-state {
  color: var(--gray-400);
}

.empty-loader {
  margin-bottom: 1rem;
  opacity: 0;
}

.empty-text {
  font-size: var(--font-size-sm);
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 40rem) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 48rem) {
  .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 77rem) {
  .grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: var(--border-width-thin) var(--border-style-solid) var(--gray-200);
  border-radius: var(--border-radius-sm);
  background-color: white;
  text-decoration: none;
  transition: border-color 0.15s ease;
}

.card:hover {
  border-color: var(--color-indigo-400);
}

:is([data-theme="dark"], :global(.dark)) .card {
  border-color: var(--gray-700);
  background-color: var(--canvas-800);
}

:is([data-theme="dark"], :global(.dark)) .card:hover {
  border-color: var(--color-indigo-500);
}

.thumb-wrap {
  position: relative;
  aspect-ratio: 5 / 4;
  overflow: hidden;
  background-color: var(--gray-100);
}

:is([data-theme="dark"], :global(.dark)) .thumb-wrap {
  background-color: var(--canvas-700);
}

.thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.card:hover .thumb-img {
  transform: scale(1.05);
}

.thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: var(--font-size-xs);
  color: var(--gray-400);
}

:is([data-theme="dark"], :global(.dark)) .thumb-placeholder {
  color: var(--gray-600);
}

.card-meta {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 0.5rem;
  min-width: 0;
  background-color: white;
}

:is([data-theme="dark"], :global(.dark)) .card-meta {
  background-color: var(--canvas-800);
}

.card-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  line-height: 1.375;
}

.card-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
}

.updated-at {
  margin-left: auto;
  font-size: var(--font-size-xs);
  color: var(--gray-500);
}

:is([data-theme="dark"], :global(.dark)) .updated-at {
  color: var(--gray-400);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: var(--border-radius-full);
  padding: 0.125rem 0.5rem;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
}

.status-published {
  color: var(--color-emerald-400);
  background-color: color-mix(in oklab, var(--color-emerald-500) 15%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--color-emerald-500) 30%, transparent);
}

.status-archived {
  color: var(--color-gray-400);
  background-color: color-mix(in oklab, var(--color-gray-500) 15%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--color-gray-500) 30%, transparent);
}

.status-default {
  color: var(--color-amber-400);
  background-color: color-mix(in oklab, var(--color-amber-500) 15%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--color-amber-500) 30%, transparent);
}

.bottom-pager {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1.25rem;
}
