/*
 * Uploading a theme piece (specs/006 US4, contracts/ui-profile-themes.md §5): the upload
 * form (members on /account, admins on the admin page) with its sample card, and the
 * member's rows under "Your uploads". Tokens only.
 */

.theme-upload-form {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.theme-upload-form__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.theme-upload-form__preview {
  width: 100%;
  max-width: 320px;
  margin: 0 auto var(--space-4);
}

/* Only the layer for the chosen place shows (the pieces' own rules set a display). */
.theme-upload-form__preview[hidden],
.theme-upload-form__preview [hidden] {
  display: none;
}

.theme-upload-form__place {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin: var(--space-4) 0 0;
  font-size: var(--text-md);
}

.theme-upload-form__file {
  padding: var(--space-2);
}

.theme-upload-form__placement {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
  margin: var(--space-4) 0 0;
  padding: var(--space-3) 0 0;
  border: 0;
  border-top: 1px solid var(--color-border-subtle);
}

.theme-upload-form__placement legend {
  float: left;
  width: 100%;
  margin-bottom: var(--space-1);
  padding: 0;
}

/* Doubled class: shared/forms.css (.field + .field) loads after this file. */
.field.theme-upload-form__placement-field {
  margin-top: 0;
}

.theme-upload-form__placement-field[hidden] {
  display: none;
}

.theme-upload-form__slider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.theme-upload-form__range {
  flex: 1;
  min-width: 0;
  accent-color: var(--color-purple);
}

.theme-upload-form__number {
  flex: 0 0 96px;
  width: 96px;
}

.theme-upload-form__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

.theme-upload-form__actions .btn {
  width: auto;
}

/* Delete sits apart from Cancel and Save. */
.theme-upload-form__actions .theme-upload-form__delete {
  margin-right: auto;
}

.theme-upload-form__delete-form {
  display: none;
}

/* Without JavaScript the form has a page of its own. */
.theme-upload-page {
  max-width: 560px;
  padding: 0;
}

/* ---- The member's uploads, in each group of the Profile theme section */

.profile-theme-form__uploads {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
}

.profile-theme-form__uploads-title {
  margin: var(--space-1) 0 0;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-comment);
}

.profile-theme-form__upload {
  width: auto;
}

.theme-upload-rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.theme-upload-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  padding: var(--space-2);
  background-color: var(--color-card);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-standard);
}

.theme-upload-row .theme-thumbnail,
.theme-upload-row__preparing {
  width: 40px;
  height: 40px;
}

.theme-upload-row__preparing {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  color: var(--color-red);
  background-color: var(--color-card-raised);
  border-radius: var(--radius-standard);
}

.theme-upload-row__spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-purple);
  border-radius: 50%;
  animation: theme-upload-spin 800ms linear infinite;
}

@keyframes theme-upload-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .theme-upload-row__spinner {
    animation: none;
  }
}

.theme-upload-row__text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.theme-upload-row__name {
  overflow: hidden;
  font-weight: var(--weight-semibold);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-upload-row__status {
  font-size: var(--text-sm);
  color: var(--color-comment);
}

.theme-upload-row--refused .theme-upload-row__status {
  color: var(--color-red);
}

.theme-upload-row .btn {
  width: auto;
}
