/* Image-cover settings are visible only when the edited note has image candidates. */
.funify-notes-page .notes-panel-actions:has(.notes-cover-setting:not([hidden])) {
  display: grid;
  grid-template-columns: repeat(6, auto);
  justify-content: end;
  align-items: center;
}

.notes-cover-setting {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding-top: 3px;
  color: var(--color-muted);
  font-size: 12px;
}

.notes-cover-setting[hidden],
.notes-cover-dialog [hidden] {
  display: none;
}

.notes-cover-default {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  cursor: pointer;
}

.notes-cover-default input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--color-primary);
}

.funify-notes-page .notes-cover-adjust {
  min-height: 28px;
  padding: 3px 7px;
  font-size: 11px;
}

.notes-cover-dialog {
  width: min(820px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--color-border, #dfe5fa);
  border-radius: 20px;
  background: var(--color-surface, #fff);
  color: var(--color-text, #0c123e);
  box-shadow: 0 18px 70px rgb(16 35 80 / 25%);
}

.notes-cover-dialog::backdrop {
  background: rgb(13 25 52 / 55%);
}

.notes-cover-dialog h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.notes-cover-help {
  margin: 0 0 16px;
  color: var(--color-muted, #485c91);
  font-size: 13px;
  line-height: 1.6;
}

.notes-cover-choices {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 3px 2px 12px;
}

.notes-cover-choices .notes-btn {
  display: flex;
  flex: 0 0 110px;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  overflow: hidden;
  padding: 5px;
  border-radius: 10px;
  font-size: 11px;
  text-overflow: ellipsis;
}

.notes-cover-choices .notes-btn[aria-pressed='true'] {
  border-color: var(--color-primary, #006bff);
  outline: 2px solid var(--color-primary, #006bff);
  outline-offset: 0;
}

.notes-cover-choices img {
  display: block;
  width: 100%;
  height: 52px;
  border-radius: 6px;
  object-fit: cover;
}

.notes-cover-viewport {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  overflow: hidden;
  padding: 12px;
  border: 1px solid var(--color-border, #dfe5fa);
  border-radius: 12px;
  background: #182137;
}

.notes-cover-stage {
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
  user-select: none;
  background: #fff;
}

.notes-cover-source {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.notes-cover-frame {
  position: absolute;
  box-sizing: border-box;
  border: 2px dashed #fff;
  outline: 1px dashed #006bff;
  outline-offset: -4px;
  box-shadow: 0 0 0 2000px rgb(0 0 0 / 45%);
  cursor: move;
  touch-action: none;
}

.notes-cover-frame:focus-visible {
  border-color: #98c8ff;
  outline: 2px dashed #006bff;
}

.notes-cover-frame span {
  position: absolute;
  top: 5px;
  left: 6px;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgb(0 0 0 / 55%);
  color: #fff;
  font-size: 10px;
  pointer-events: none;
}

.notes-cover-zoom {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 15px;
  color: var(--color-muted, #485c91);
  font-size: 12px;
}

.notes-cover-zoom input {
  flex: 1;
  min-width: 0;
  accent-color: var(--color-primary, #006bff);
}

.notes-cover-error {
  margin: 14px 0 0;
  color: #b84035;
  font-size: 13px;
  line-height: 1.6;
}

.notes-cover-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 20px;
}

.notes-cover-actions .notes-btn {
  min-width: 75px;
  min-height: 36px;
}

.notes-workspace-card-cover[data-custom-cover='true'] {
  height: auto;
  aspect-ratio: 64 / 17;
  background: none;
}

.notes-workspace-custom-cover {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media screen and (max-width: 767px) {
  .funify-notes-page .notes-mobile-toolbar:has(.notes-cover-setting:not([hidden])) {
    flex-wrap: wrap;
    height: auto;
  }

  .notes-mobile-toolbar > .notes-cover-setting {
    flex: 1 0 100%;
    justify-content: flex-end;
    padding-top: 0;
  }

  .notes-cover-dialog {
    padding: 16px;
  }

  .notes-cover-dialog h2 {
    font-size: 20px;
  }

  .notes-cover-viewport {
    padding: 6px;
  }
}

@media print {
  .notes-cover-setting,
  .notes-cover-dialog {
    display: none !important;
  }
}
