/*
 * The Themes shop (specs/006 US3, contracts/ui-profile-themes.md §6): ready-made themes and
 * pieces in a grid of cards, at least 240px wide and as many as fit (like Apps), each
 * shown still on a sample card. An item's own page shows it animated.
 */

.themes-shop {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.themes-shop__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.themes-shop__title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.themes-shop__search {
  display: flex;
  flex: 1 1 280px;
  gap: var(--space-2);
  max-width: 480px;
}

.themes-shop__search .input {
  flex: 1;
  min-width: 0;
}

.themes-shop__search .btn {
  width: auto;
}

.themes-shop__tabs,
.themes-shop__places {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.themes-shop__tab {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-comment);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

.themes-shop__tab[aria-current="page"] {
  color: var(--color-foreground);
  border-bottom-color: var(--color-purple);
}

.themes-shop__place {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-comment);
  text-decoration: none;
  background-color: var(--color-card);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-pill);
}

.themes-shop__place[aria-current="true"] {
  color: var(--color-foreground);
  border-color: var(--color-purple);
}

.themes-shop__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
  gap: var(--space-4);
}

.themes-shop__grid + turbo-frame {
  display: block;
  margin-top: var(--space-4);
}

.themes-shop__loading,
.themes-shop__nothing {
  color: var(--color-comment);
}

.themes-shop__nothing {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.themes-shop__nothing p {
  margin: 0;
}

/* ---- A card */

.theme-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background-color: var(--color-card);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-comfortable);
}

.theme-card__preview {
  display: block;
  padding: var(--space-3);
  background-color: var(--color-deep-night);
}

.theme-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
}

.theme-card__name {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
}

.theme-card__name a {
  color: var(--color-foreground);
  text-decoration: none;
}

.theme-card__places {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-comment);
}

/* ---- The preview's sample card, ID and Add (shared by the grid and an item's page) */

.theme-preview {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.profile-card--sample {
  padding-bottom: var(--space-3);
  background-color: var(--color-deep-night);
  border-radius: var(--radius-comfortable);
}

.profile-card--sample .profile-card__banner {
  border-radius: var(--radius-comfortable) var(--radius-comfortable) 0 0;
}

.theme-sample__line {
  display: block;
  width: 70%;
  height: 10px;
  background-color: var(--color-card-raised);
  border-radius: var(--radius-pill);
}

.theme-sample__line--name {
  width: 45%;
  height: 14px;
  margin-top: var(--space-2);
}

.theme-sample__line--short {
  width: 40%;
}

.theme-id {
  display: flex;
  gap: var(--space-1);
}

.theme-id__value {
  flex: 1;
  min-width: 0;
  font-size: var(--text-sm);
}

.theme-id .theme-id__copy {
  width: auto;
}

.theme-collection {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.theme-collection__form {
  margin: 0;
}

.theme-collection .btn {
  width: auto;
}

.theme-collection__added {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--color-green);
}

/* ---- An item's own page */

.themes-shop-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.themes-shop-item__back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-md);
}

.themes-shop-item__layout {
  display: grid;
  gap: var(--space-6);
}

@media (min-width: 1024px) {
  .themes-shop-item__layout {
    grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
    align-items: start;
  }
}

.themes-shop-item__preview {
  max-width: 380px;
}

.themes-shop-item__details {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

.themes-shop-item__places,
.themes-shop-item__note {
  margin: 0;
  color: var(--color-comment);
}

.themes-shop-item__pieces {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.themes-shop-item__piece {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--color-foreground);
  text-decoration: none;
}

.themes-shop-item__piece-name {
  display: block;
  font-weight: var(--weight-semibold);
}

.themes-shop-item__piece-place {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-comment);
}
