input[type="text"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="date"],
select {
  background: var(--bg-100);
  color: var(--text-100);
  font-size: 14px;
  padding-inline: 4px;
  border: 1px solid var(--bg-40);
  border-radius: 4px;
  height: 28px;
  width: 300px;
  max-width: 100%;
}

/* checkboxes in the theme's colors, with a drawn checkmark (or a dash when partly checked) */
input[type="checkbox"] {
  appearance: none;
  flex-shrink: 0;
  display: inline-grid;
  place-content: center;
  width: 16px;
  height: 16px;
  margin: 0;
  border: 1.5px solid var(--bg-20);
  border-radius: 4px;
  background-color: var(--bg-100);
  vertical-align: middle;
  cursor: pointer;
  transition:
    background-color 100ms ease-in-out,
    border-color 100ms ease-in-out;
}

input[type="checkbox"]::before {
  content: "";
  width: 10px;
  height: 10px;
  background-color: var(--text-accent, #fff);
  clip-path: polygon(14% 44%, 0 59%, 39% 96%, 100% 22%, 85% 8%, 38% 66%);
  transform: scale(0);
  transition: transform 100ms ease-in-out;
}

input[type="checkbox"]:hover:not(:disabled) {
  border-color: var(--accent);
}

input[type="checkbox"]:is(:checked, :indeterminate) {
  border-color: var(--accent);
  background-color: var(--accent);
}

input[type="checkbox"]:is(:checked, :indeterminate)::before {
  transform: scale(1);
}

input[type="checkbox"]:indeterminate::before {
  height: 2px;
  clip-path: none;
}

input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--accent-light, var(--accent));
  outline-offset: 2px;
}

input[type="checkbox"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.edit-form input[type="text"],
.edit-form input[type="date"],
.edit-form textarea {
  width: 100%;
}

input:invalid:not(:placeholder-shown) {
  border-color: var(--invalid-color);
}

textarea {
  background: var(--bg-100);
  color: var(--text-100);
  font-size: 14px;
  padding: 4px;
  border: 1px solid var(--bg-40);
  border-radius: 4px;
}

.edit-form textarea {
  resize: vertical;
}

/* only .button: other buttons (icon buttons, tabs, the editor's remove buttons) style themselves */
.button {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  height: 28px;
  white-space: nowrap;
  padding-inline: 8px;
  border-radius: 4px;
}

.button.lg {
  height: 36px;
  font-size: 14px;
}

.button svg,
.button img,
.button svg:last-child {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  margin: 0;
}

h2 {
  font-size: 20px;
  margin: 0;
  line-height: 1.3;
}

h3 {
  font-size: 16px;
  margin: 0;
  line-height: 1.3;
}

h4 {
  font-size: 14px;
  margin: 0;
  line-height: 1.3;
}

/* a column like the site's navigation sidebar (.sidebar-nav), with its sections (.navigation-section in main.css) */
.sidebar {
  position: fixed;
  width: 240px;
  top: 60px;
  bottom: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  background-color: var(--bg-100);
  border-inline-end: 1px solid var(--bg-60);
  color: var(--text-100);
}

.sidebar-home {
  font-weight: bold;
}

.sidebar .navigation-section > a.selected {
  background-color: var(--bg-60);
  font-weight: bold;
}

/* the number of pending kits or proposed updates */
.navigation-section span.sidebar-badge {
  flex-grow: 0;
  margin-inline-start: auto;
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 999px;
  background-color: var(--accent);
  color: var(--text-accent);
  font-size: 12px;
  font-weight: bold;
  line-height: 1.2;
  text-align: center;
}

:is([data-theme="dark"], [data-theme="blackout"], [data-theme="custom-light"]) .navigation-section span.sidebar-badge {
  background-color: var(--secondary-accent);
  color: var(--text-secondary-accent);
}

.sidebar-content {
  --page-padding-x: 16px;
  --page-padding-y: 16px;
  margin-left: 240px;
  padding: var(--page-padding-y) var(--page-padding-x);
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* root of the admin pages' Vue views: a column whose gap does the spacing, so its headings and texts
   don't add their own margins */
.admin-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-view > :is(h1, p) {
  margin: 0;
}

/* the centered content column of the regular pages (.content-c) */
.sidebar-content > * {
  width: 100%;
  max-width: 1040px;
  margin-inline: auto;
}

/* the kit editor uses the homepage's wider column (.container-main) */
.sidebar-content:has(> .kit-editor) > * {
  max-width: 1500px;
}

/* modal */

#modal .main-header {
  margin-bottom: 0;
}

.top-container {
  background-color: var(--bg-100);
  padding: 20px;
  margin: 0;
  max-width: initial;
}

#modal-container {
  display: none;
  position: fixed;
  align-items: start;
  justify-content: center;
  width: 100%;
  height: 100%;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 5;
  padding-top: 40px;
  overflow-y: auto;
}

div#modal {
  display: flex;
  justify-content: center;
  flex-direction: column;
  background-color: var(--bg-100);
  box-shadow: var(--box-shadow);
}

.kit.editable > .kit-image-container {
  cursor: pointer;
}

/* autocomplete */

.autocomplete {
  position: relative;
  display: inline-block;
}

.autocomplete-items {
  position: absolute;
  border: 1px solid #d4d4d4;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 2;
}

.autocomplete-items div {
  padding: 10px;
  cursor: pointer;
  background-color: #fff;
  background: var(--bg-100);
  border-bottom: 1px solid #d4d4d4;
}

.autocomplete-items div:hover {
  /*when hovering an item:*/
  background-color: #e9e9e9;
  background-color: var(--bg-60);
}

.autocomplete-items div.autocomplete-active {
  /*when navigating through the items using the arrow keys:*/
  background-color: #e9e9e9;
  background-color: var(--bg-60);
  /* color: #fff; */
}

textarea {
  max-width: 100%;
}

.edit-form {
  display: flex;
  flex-direction: column;
  grid-row-gap: 16px;
}

.edit-form__section {
  display: flex;
  gap: 16px;
  max-width: 800px;
}

.edit-form__group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 0 0;
}

.edit-form__group label {
  font-size: 14px;
}

.edit-form__group > div {
  display: flex;
}

/* Keep each SKU on its own line. This editor is a direct child of
   .edit-form__group, whose generic rule above otherwise lays out every row
   horizontally and squeezes the SKU inputs out of view. */
.kit-sku-editor {
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  width: 100%;
}

.kit-sku-row {
  min-width: 0;
  width: 100%;
}

#kit-sku-editor,
#kit-sku-app {
  min-width: 0;
  width: 100%;
}

.image-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  align-items: center;
  justify-items: center;
  /* justify-content: center; */
  gap: 16px;
}

.edit-image-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.edit-image-source {
  width: 100%;
  resize: vertical;
}

.edit-image-container.placeholder {
  border: 2px solid red;
  width: 100px;
  height: 100px;
}

/* the remove buttons on the corner of an image or video */
:is(button.edit-image-remove, button.edit-video-remove) {
  position: absolute;
  right: 0;
  top: 0;
  border: none;
  margin: 0;
  padding: 0;
  display: flex;
  background-color: rgba(0, 0, 0, 0.8);
  transition: background-color 100ms ease-in-out;
}

:is(button.edit-image-remove, button.edit-video-remove) > svg {
  fill: #fff;
}

:is(button.edit-image-remove, button.edit-video-remove):hover {
  background-color: rgba(0, 0, 0);
}

.edit-image {
  max-width: 200px;
  max-height: 200px;
  cursor: pointer;
  margin-bottom: 10px;
  border: 1px solid var(--text-100);
}

.video-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  align-items: center;
  justify-items: center;
  gap: 16px;
  margin: 0;
}

.edit-video-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.edit-video-source {
  width: 100%;
  resize: vertical;
}

.edit-video-container.placeholder {
  border: 2px solid red;
  width: 100px;
  height: 100px;
}

.edit-video {
  max-width: 400px;
  max-height: 400px;
  cursor: pointer;
  margin-bottom: 10px;
  border: 1px solid var(--text-100);
}

.drop-zone {
  padding: 16px;
  border-radius: 8px;
  border: 2px dashed #d0d0d0;
  transition: border-color 150ms ease-in-out;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.drop-zone > h4 {
  margin-top: 0;
}

/* no images yet where they're required: red like an empty required input */
.drop-zone--invalid {
  border-color: var(--invalid-color);
}

.drop-zone.active {
  background-color: #ebe7ee;
  border-color: #692e99;
}

.kit-image-preview {
  width: 150px;
  height: 150px;
  background: #f0f0f0;
}

.edit-logo-container-dark img {
  background-color: #411466;
}

.edit-logo-container.player > img,
.edit-logo-container.player > canvas,
.type-block.player > img {
  border-radius: 100%;
}

.edit-form-affiliate input[type="text"],
.edit-form-affiliate textarea {
  width: 100%;
}

.pagination {
  margin-top: 32px;
}

.kit > .button-set {
  margin-top: 12px;
}

.header-ads {
  margin-top: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.header-ad {
  border: 1px solid #ccc;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.content-blocks-admin {
  padding-block: 16px;
  gap: 12px;
  display: flex;
  flex-direction: column;
}

.content-block-admin {
  background: var(--bg-100);
  border: 1px solid var(--bg-60);
  border-radius: 4px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-card {
  background: var(--bg-100);
  border: 1px solid var(--bg-60);
  border-radius: 4px;
  padding: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group > label {
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  display: flex;
}

.monospace {
  font-family: monospace;
}

/* The kit editor with its controls (the kit's name, "Show on site" and Submit): a sticky column next to the
   form on wide screens, a bar over the bottom of the page on smaller ones (the media queries below) */
.edit-kit-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  align-items: flex-start;
}

.edit-kit-form__controls-wrap {
  position: sticky;
}

.edit-kit-form__controls {
  display: flex;
}

/* the kit's name (or "New kit") next to its "Show on site" link */
.edit-kit-form__kit {
  display: flex;
  align-items: center;
  gap: 8px 12px;
  min-width: 0;
}

.edit-kit-form__kit-name {
  font-size: 13px;
}

/* Submit with the reason it's disabled before it */
.edit-kit-form__submit {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-inline-start: auto;
}

.edit-kit-form__missing {
  color: var(--text-80);
  font-size: 12px;
  white-space: nowrap;
}

@media (min-width: 1440px) {
  .edit-kit-form {
    grid-template-columns: 1fr auto;
  }

  .edit-kit-form__controls-wrap {
    top: 76px;
    min-width: 320px;
    max-width: 400px;
  }

  .edit-kit-form__controls {
    flex-direction: column;
    gap: 16px;
    background-color: var(--bg-80);
    border: 1px solid var(--bg-60);
    padding: 16px;
    border-radius: 8px;
  }

  .edit-kit-form__kit {
    flex-wrap: wrap;
  }

  .edit-kit-form__kit-name {
    overflow-wrap: anywhere;
  }
}

.edit-kit-form__delete {
  display: flex;
  margin-top: 32px;
}

.kit-preview-container {
  display: flex;
}

.validation-error {
  background-color: oklch(93.6% 0.032 17.717);
  color: #000;
  padding: 8px;
  border-radius: 4px;
  font-size: 14px;
}

.dd-overlay {
  background-color: rgba(0, 0, 0, 0.75);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transition: background-color 100ms ease-in-out;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
  font-size: 25px;
  align-items: center;
  padding: 12px;
  z-index: 99999999;
}

.dd-overlay.hidden {
  display: none;
}

.message {
  border-radius: 8px;
  margin: 0;
  padding: 12px;
  font-size: 14px;
}

.submission-rules {
  max-width: 800px;
  line-height: 1.5;
}

.submission-rules h3 {
  margin: 24px 0 8px;
}

.submission-rules ins {
  text-decoration: none;
  background-color: rgb(34 197 94 / 0.25);
  border-radius: 2px;
}

.submission-rules del {
  color: rgb(220 38 38);
  text-decoration: line-through;
  opacity: 0.8;
}

.submission-rules__updated {
  margin-top: 0;
  opacity: 0.7;
  font-size: 14px;
}

.submission-rules__editor {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 48px;
}

.submission-rules__editor h3,
.submission-rules__editor p {
  margin: 0;
}

.submission-rules__editor textarea {
  width: 100%;
  font-family: monospace;
  font-size: 14px;
}

.submission-rules ul {
  margin: 0;
  padding-inline-start: 20px;
}

.submission-rules li + li {
  margin-top: 4px;
}

.submission-rules .note {
  margin: 24px 0 16px;
}

.submission-rules__accept {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
}

.submission-rules__accept .checkbox-label {
  gap: 8px;
}

.submission-rules-info {
  padding: 12px;
  font-size: 14px;
  line-height: 1.5;
  background-color: color-mix(in srgb, currentColor, transparent 95%);
  border-inline-start: 12px solid color-mix(in srgb, currentColor, transparent 35%);
}

@media (max-width: 1439px) {
  /* the editor takes the full width; its controls are a full-width bar out to the edges of the page's
     padding, floating over the bottom of the viewport while scrolling and settling below the form at its end */
  .edit-kit-form__controls-wrap {
    margin: 0 calc(-1 * var(--page-padding-x)) calc(-1 * var(--page-padding-y));
    padding: 12px var(--page-padding-x);
    bottom: 0;
    z-index: 3;
    border-top: 1px solid var(--bg-60);
    background-color: var(--bg-100);
  }

  /* the kit's name and "Show on site" on the left, Submit on the right */
  .edit-kit-form__controls {
    align-items: center;
    gap: 8px 16px;
  }

  /* a long name is cut off rather than pushing the buttons out of the bar */
  .edit-kit-form__kit-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* "Show on site" as just its icon, leaving room for the status next to Submit; the link keeps its name for
     screen readers */
  .edit-kit-form__site-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

@media (max-width: 1023px) {
  /* like the site's navigation on mobile: a full-width menu over the page, opened with the hamburger button */
  .sidebar {
    display: none;
    width: 100%;
    border-inline-end: none;
    z-index: 5000;
  }

  .mobile-menu-open .sidebar {
    display: block;
  }

  .sidebar-content {
    --page-padding-x: 20px;
    margin: 0;
  }

  input[type="text"],
  input[type="password"] {
    width: 100%;
  }
}

@media (max-width: 767px) {
  .edit-kit-form {
    gap: 16px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .sidebar-content {
    --page-padding-x: 12px;
    --page-padding-y: 12px;
  }

  .edit-form__section {
    display: grid;
    gap: 8px;
  }

  textarea {
    width: 100%;
  }

  .autocomplete {
    display: block;
  }

  .image-container {
    grid-template-columns: 1fr 1fr;
  }
}
