.jinya-checkbox {
  visibility: hidden;
}

.jinya-checkbox + label {
  position: relative;
  margin-left: 0.25rem;
}

.jinya-checkbox + label::before {
  content: '';
  left: -2rem;
  position: absolute;
  background: var(--form-item-background);
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 4px;
}

.jinya-checkbox:checked + label::after {
  content: '';
  position: absolute;
  left: -1.5rem;
  top: 0.25rem;
  height: 0.75rem;
  width: 0.25rem;
  border-left: 0.125rem solid var(--article-background);
  border-top: 0.125rem solid var(--article-background);
  transform: rotate(220deg);
}

.jinya-checkbox:checked + label::before {
  background: var(--primary-color);
}

.jinya-checkbox:invalid + label::before {
  background: var(--error-color);
}

@media screen and (width <= 480px) {
  .jinya-checkbox + label::before {
    width: 1.25rem;
    height: 1.25rem;
    left: -1.75rem;
  }

  .jinya-checkbox:checked + label::after {
    left: -1.35rem;
    top: 0.15rem;
    height: 0.75rem;
    width: 0.25rem;
    border-left: 0.125rem solid var(--article-background);
    border-top: 0.125rem solid var(--article-background);
    transform: rotate(220deg);
  }
}

.jinya-form {
  display: grid;
  grid-auto-rows: auto;
}

.jinya-input,
.jinya-select,
.jinya-textarea {
  border-radius: 0.75rem;
  background: var(--form-item-background);
  margin-bottom: 1rem;
  padding: 0.5rem 1rem;
  color: var(--text-color);
  border: 0.125rem solid var(--article-shadow-color);
  box-sizing: border-box;
  font-family: 'Albert Sans', sans-serif;
  font-size: 1.25rem;
}

.jinya-input:invalid,
.jinya-select:invalid,
.jinya-textarea:invalid {
  border: 0.125rem solid var(--error-color);
}

.jinya-input:focus,
.jinya-select:focus,
.jinya-textarea:focus {
  border: 0.125rem solid var(--primary-color);
  box-shadow: none;
  outline: none;
  box-sizing: border-box;
}

.jinya-button {
  text-decoration: none;
  color: var(--primary-button-text-color);
  background: var(--primary-color);
  padding: 0.5rem 1rem;
  border-radius: 0.75rem;
  transition:
    0.3s color,
    0.3s background;
  box-sizing: border-box;
  border: 0.125rem solid var(--primary-color);
  place-self: end end;
  cursor: pointer;

  &:disabled {
    cursor: not-allowed;
    background: var(--disabled-color);
    color: var(--text-color-white);
    border-color: var(--disabled-color);
  }

  &:hover {
    background: var(--text-color-white);
    color: var(--primary-color);

    &:disabled {
      background: var(--disabled-color);
      color: var(--text-color-white);
    }
  }

  &.is--full-width {
    width: 100%;
  }

  &.is--negative {
    background: var(--error-color);
    border-color: var(--error-color);
    color: var(--white);

    &:hover {
      background: var(--text-color-white);
      color: var(--error-color);
    }

    &:disabled {
      background: var(--disabled-color);
    }
  }

  &.is--toolbar {
    padding: 0.25rem 0.5rem;
    border-radius: 0;

    &:first-of-type {
      border-bottom-left-radius: 0.75rem;
      border-top-left-radius: 0.75rem;
    }

    &:last-of-type {
      border-bottom-right-radius: 0.75rem;
      border-top-right-radius: 0.75rem;
    }
  }
}

.jinya-toolbar {
  display: flex;
}

.jinya-buttons {
  display: flex;
  justify-content: end;
  gap: 1rem;
}

.jinya-message {
  border-radius: 0.75rem;
  padding: 1rem 2rem;
  margin-bottom: 1rem;
  margin-top: 1rem;
  box-sizing: border-box;

  &.is--positive {
    background: var(--success-background-color);
    color: var(--success-color);

    a {
      color: var(--success-color);
    }
  }

  &.is--negative {
    background: var(--error-background-color);
    color: var(--error-color);

    a {
      color: var(--error-color);
    }
  }

  &.is--information {
    background: var(--information-background-color);
    color: var(--information-color);

    a {
      color: var(--information-color);
    }
  }
}

.jinya-input__error {
  margin-top: -1rem;
  margin-bottom: 1rem;
  color: var(--error-color);
}

.jinya-outlined__button {
  border: 0.125rem solid var(--primary-button-color);
  background: none;
  border-radius: 2rem;
  text-decoration: none;
  padding: 0.5rem 1rem;
  transition:
    background 0.3s,
    color 0.3s;
  display: inline-flex;
  gap: 0.25rem;
  align-items: center;
  cursor: pointer;
  color: var(--primary-button-color);
  justify-self: end;

  &:disabled {
    background: none;
    border-color: var(--disabled-color);
    color: var(--disabled-color);
    cursor: not-allowed;
  }

  &:hover {
    background: var(--primary-color);
    color: var(--text-color-white);

    @media (prefers-color-scheme: dark) {
      background: var(--text-color);
      color: var(--primary-color);
    }

    &:disabled {
      background: none;
      border-color: var(--disabled-color);
      color: var(--disabled-color);
      cursor: not-allowed;
    }
  }

  .lucide {
    fill: none;
    stroke: currentcolor;
    stroke-width: 0.125rem;
    stroke-linecap: round;
    stroke-linejoin: round;
    height: 1.25rem;
    width: 1.25rem;
  }

  &.is--table {
    font-size: 1rem;
    padding: 0.25rem 0.75rem;
  }

  &.is--negative {
    color: var(--error-color);
    border-color: var(--error-color);

    &:disabled {
      background: none;
      border-color: var(--disabled-color);
      color: var(--disabled-color);
      cursor: not-allowed;
    }

    &:hover {
      background: var(--error-color);
      color: var(--white);

      &:disabled {
        background: none;
        border-color: var(--disabled-color);
        color: var(--disabled-color);
        cursor: not-allowed;
      }
    }
  }

  &.is--toolbar {
    padding: 0.25rem 0.5rem;
    border-radius: 0;

    &:first-of-type {
      border-bottom-left-radius: 0.75rem;
      border-top-left-radius: 0.75rem;
      border-right: none;
    }

    &:last-of-type {
      border-bottom-right-radius: 0.75rem;
      border-top-right-radius: 0.75rem;
      border-left: none;
    }
  }
}

.jinya-or-bar {
  width: 100%;
  display: flex;
  margin-top: 1rem;
  margin-bottom: 1rem;
  align-items: center;
  gap: 1rem;
  text-transform: uppercase;

  &::after,
  &::before {
    content: '';
    width: 100%;
    height: 0.125rem;
    background: var(--primary-color);
  }
}

.jinya-checkboxes {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  margin-left: -0.5rem;
}
