 .thumbnail {
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin: 0 auto 1rem;
}

::ng-deep .metapicker .thumbnail {
  img {
    border-radius: 0.5rem;
    max-height: 14rem;
    max-width: 10em;
  }

  @media (max-width: 768px) {
    margin-bottom: 0;
  }
}

.metapicker div.thumbnail {
  background-color: var(--p-inputtext-disabled-background);
  color: var(--p-inputtext-disabled-color);
  width: 9rem;
  height: 14rem;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

::ng-deep .metaeditor img.thumbnail {
  border-radius: 0.5rem;
  max-width: 100%;
  max-height: 100%;
  height: auto;
  width: auto;

  @media (max-width: 768px) {
    max-height: 14em;
  }
}

.metaeditor .arrow-button {
  padding: 0;
}

.thumbnail.changed,
input.changed,
textarea.changed,
::ng-deep p-datepicker.changed input,
::ng-deep p-autocomplete.changed ul.p-autocomplete-input-multiple {
  border: 1px solid var(--p-button-outlined-warn-border-color) !important;
}

::ng-deep .p-inputchips {
  width: 100% !important;
}

::ng-deep .p-autocomplete .p-chip .p-chip-label {
  font-size: 12px;
}

::ng-deep .p-autocomplete-input-chip {
  width: 2rem;
}

.metapicker, .metaeditor {
  box-sizing: border-box;
  display: flex;
  width: 100%;
}

.metapicker {
  flex-direction: column;
}

.form-scroll {
  flex-grow: 1;
  overflow: auto;
}

.field-label {
  font-size: 0.875rem;

  @media (min-width: 768px) {
    width: 8rem;
  }
}

.field-label--fixed {
  width: 8rem;
}

.column-headers {
  display: flex;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px dotted var(--border-color);

  @media (min-width: 768px) {
    &::before {
      content: '';
      min-width: 8rem;
      flex-shrink: 0;
    }
  }

  .column-label {
    display: flex;
    align-items: center;
    flex: 1;
    color: var(--text-color-secondary);
    font-size: 0.875rem;

    &.current {
      justify-content: flex-end;
      padding-right: 1rem;
    }

    &.fetched {
      justify-content: flex-start;
      padding-left: 1rem;
    }
  }

  .column-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-shrink: 0;
  }
}

.thumbnail-row {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
}

.thumbnail-column {
  display: flex;
  width: 50%;
}

.no-cover-text {
  font-size: 0.875rem;
}

.full-width {
  width: 100%;
}

.metabody {
  display: flex;
  flex-direction: column;
  padding: 1rem;

  @media (min-width: 768px) {
    flex-direction: row;
  }
}

.editor-thumbnail-wrapper {
  display: flex;
  align-items: flex-start;
  justify-content: center;

  @media (min-width: 768px) {
    width: 20%;
    height: 100%;
  }
}

.editor-thumbnail-inner {
  width: 100%;

  @media (min-width: 768px) {
    height: 100%;
  }
}

.editor-thumbnail-img {
  width: 100%;
  object-fit: contain;

  @media (min-width: 768px) {
    height: 100%;
  }
}

.editor-metacontent {
  @media (min-width: 768px) {
    width: 80%;
  }
}

.field-input-row {
  display: flex;
  width: 100%;
}

.metapicker label,
.metaeditor label,
.missingmd {
  color: var(--text-color-secondary);
}

::ng-deep .metapicker {
  .dest, .src {
    width: calc(50% - 2rem);
  }

  .arrow-button {
    margin: auto 1rem;
  }

  @media (min-width: 768px) {
    .arrow-button.nosrc button[disabled] {
      display: none;
    }
  }

  input.diff,
  textarea.diff,
  .p-autocomplete.diff .p-chip-label {
    color: var(--p-primary-color) !important;
  }

  .src .p-chip.p-disabled {
    color: var(--p-inputtext-disabled-color) !important;
    opacity: 1;
  }

  .src .p-chip-remove-icon {
    display: none;
  }

  .src li.p-autocomplete-input-chip {
    width: 1px;
  }
}


.metaheader {
  display: flex;
  align-items: center;
  border-bottom: 1px dotted var(--border-color);
  padding: 1rem;
  justify-content: space-between;
}

.metacontent {
  padding: 1rem;
}

.metaeditor .metacontent {
  padding: 0 0 0 1rem;

  @media (max-width: 768px) {
    padding: 0;
  }

  ::ng-deep button {
    border-left-width: 0;
    border-radius: 0 6px 6px 0;

    &:disabled {
      opacity: 1;
      border-color: var(--p-inputtext-border-color) !important;

      span {
        opacity: 0.6;
      }
    }
  }

  ::ng-deep input,
  ::ng-deep ul,
  textarea {
    border-radius: 6px 0 0 6px;
  }

  .field-authors,
  .field-categories,
  .field-moods,
  .field-tags {
    ::ng-deep button {
      line-height: 2em;
    }
  }
}

.metadata-status {
  &.copied {
    color: rgb(34, 197, 94);
  }

  &.no-metadata {
    color: rgb(59, 130, 246);
  }

  &.not-applied {
    color: rgb(239, 68, 68);
  }
}

@media (min-width: 768px) {
  .metapicker .metacontent,
  .metaeditor .metabody {
    padding-left: 3.25rem;
  }
}

.meta-row {
  display: flex;
  align-items: center;
  margin-bottom: 0.5em;

  label {
    margin: auto 0;
  }
}

.meta-fields {
  display: flex;
  align-items: center;
  width: 100%;

}

.field-description .meta-fields {
  align-items: stretch;

  .src {
    resize: none;
  }
}

@media (max-width: 768px) {
  .meta-row {
    flex-wrap: wrap;
    margin-bottom: 1em;

    label {
      width: 100%;
    }
  }

  .metapicker {
    .field-thumbnail label {
      display: none;
    }

    .field-title,
    .field-subtitle,
    .field-publisher,
    .field-authors,
    .field-categories,
    .field-moods,
    .field-tags,
    .field-description,
    .field-seriesName {
      .meta-fields {
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: flex-start;
      }

      .dest {
        flex: 1 !important;
        width: auto !important;
        margin: 0 0 2px 0;

        &:not(:only-child) {
          border-radius: 6px 0 0 6px;

          ::ng-deep ul {
            border-radius: 6px 0 0 6px;
          }
        }
      }

      .arrow-button {
        margin: 0;
        padding: 0;
      }

      ::ng-deep button {
        border-left-width: 0;
        border-radius: 0 6px 6px 0;
      }

      .src {
        width: 100% !important;
        margin: 0;
      }
    }

    .field-authors,
    .field-categories,
    .field-moods,
    .field-tags {
      ::ng-deep button {
        line-height: 2em;
      }
    }
  }
}

.author-chips-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem;
  min-height: 2.25rem;
  border: 1px solid var(--p-inputtext-border-color);
  border-radius: 6px;
  background: var(--p-inputtext-background);
}

.author-add-input {
  flex: 1 1 6rem;
  min-width: 6rem;

  ::ng-deep input {
    border: none !important;
    background: transparent !important;
    padding: 0.25rem;
    box-shadow: none !important;
    outline: none !important;
  }
}

.author-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: 1rem;
  background: var(--p-chip-background);
  color: var(--p-chip-color);
  font-size: 0.875rem;
  cursor: grab;
  user-select: none;
}

.main-author-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--p-primary-color);
  color: var(--p-primary-contrast-color);
  font-size: 0.6rem;
  font-weight: 700;
  flex-shrink: 0;
}

.author-chip-remove {
  font-size: 0.65rem;
  cursor: pointer;
  opacity: 0.6;
  padding: 0.15rem;
  &:hover { opacity: 1; }
}

.cdk-drag-preview {
  box-sizing: border-box;
  border-radius: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.cdk-drag-placeholder {
  opacity: 0.4;
}

.cdk-drag-animating {
  transition: transform 200ms ease;
}
